@pisell/materials 1.0.481 → 1.0.482
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 +3 -3
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/dataSourceComponents/dataSourceForm/group/index.js +3 -3
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +3 -1
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.less +4 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +2 -1
- package/es/components/dataSourceComponents/fields/ColorPicker/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +245 -0
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.js +5 -0
- package/es/components/dataSourceComponents/fields/Upload/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Upload/WithMode.js +9 -0
- package/es/components/dataSourceComponents/fields/Upload/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Upload/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Upload/index.less +8 -0
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +25 -0
- package/es/components/dataSourceComponents/fields/Upload/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +14 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.js +33 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +2 -1
- package/es/components/dataSourceComponents/fields/index.js +3 -1
- package/es/components/pisellUpload/index.d.ts +3 -3
- package/es/components/pisellUpload/index.js +4 -4
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locales/en-US.d.ts +4 -0
- package/es/locales/en-US.js +11 -1
- package/es/locales/zh-CN.d.ts +4 -0
- package/es/locales/zh-CN.js +11 -1
- package/es/locales/zh-TW.d.ts +4 -0
- package/es/locales/zh-TW.js +11 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.js +9 -2
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +2 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.less +4 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +2 -1
- package/lib/components/dataSourceComponents/fields/ColorPicker/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +206 -0
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.js +39 -0
- package/lib/components/dataSourceComponents/fields/Upload/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +43 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.less +8 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +25 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +14 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.js +62 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +2 -1
- package/lib/components/dataSourceComponents/fields/index.js +3 -1
- package/lib/components/pisellUpload/index.d.ts +3 -3
- package/lib/components/pisellUpload/index.js +4 -1
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/locales/en-US.d.ts +4 -0
- package/lib/locales/en-US.js +5 -1
- package/lib/locales/zh-CN.d.ts +4 -0
- package/lib/locales/zh-CN.js +5 -1
- package/lib/locales/zh-TW.d.ts +4 -0
- package/lib/locales/zh-TW.js +5 -1
- package/lowcode/data-source-form/constants.ts +1 -0
- package/lowcode/data-source-form/meta.ts +4 -4
- package/lowcode/form-item-upload/meta.ts +419 -0
- package/lowcode/form-item-upload/snippets.ts +11 -0
- package/lowcode/submit-button/meta.ts +5 -1
- package/package.json +2 -2
package/es/locales/zh-CN.js
CHANGED
|
@@ -184,5 +184,15 @@ export default {
|
|
|
184
184
|
'pisell-number-format-billion': '十亿',
|
|
185
185
|
//walletCard 组件
|
|
186
186
|
'walletCard-done': '完成',
|
|
187
|
-
'walletCard-qrcode': '二维码'
|
|
187
|
+
'walletCard-qrcode': '二维码',
|
|
188
|
+
'pisell-upload-button': '上传',
|
|
189
|
+
'pisell-upload-setting-size-error': function pisellUploadSettingSizeError(maxSize) {
|
|
190
|
+
return "\u6BCF\u4E2A\u6587\u4EF6\u7684\u5927\u5C0F\u4E0D\u8D85\u8FC7".concat(maxSize, "MB");
|
|
191
|
+
},
|
|
192
|
+
'pisell-upload-setting-type-error': function pisellUploadSettingTypeError(type) {
|
|
193
|
+
return "\u4E0D\u652F\u6301\u4E0A\u4F20".concat(type, "\u7C7B\u578B\u7684\u6587\u4EF6");
|
|
194
|
+
},
|
|
195
|
+
'pisell-upload-count-error': function pisellUploadCountError(count) {
|
|
196
|
+
return "\u8BF7\u4E0A\u4F20".concat(count, "\u4E2A\u6587\u4EF6");
|
|
197
|
+
}
|
|
188
198
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -147,5 +147,9 @@ declare const _default: {
|
|
|
147
147
|
'pisell-number-format-billion': string;
|
|
148
148
|
'walletCard-done': string;
|
|
149
149
|
'walletCard-qrcode': string;
|
|
150
|
+
'pisell-upload-button': string;
|
|
151
|
+
'pisell-upload-setting-size-error': (maxSize: number) => string;
|
|
152
|
+
'pisell-upload-setting-type-error': (type: string) => string;
|
|
153
|
+
'pisell-upload-count-error': (count: number) => string;
|
|
150
154
|
};
|
|
151
155
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -185,5 +185,15 @@ export default {
|
|
|
185
185
|
'pisell-number-format-billion': '十億',
|
|
186
186
|
//walletCard 组件
|
|
187
187
|
'walletCard-done': '完成',
|
|
188
|
-
'walletCard-qrcode': '二維碼'
|
|
188
|
+
'walletCard-qrcode': '二維碼',
|
|
189
|
+
'pisell-upload-button': '上傳',
|
|
190
|
+
'pisell-upload-setting-size-error': function pisellUploadSettingSizeError(maxSize) {
|
|
191
|
+
return "\u6BCF\u500B\u6587\u4EF6\u7684\u5927\u5C0F\u4E0D\u8D85\u904E".concat(maxSize, "MB");
|
|
192
|
+
},
|
|
193
|
+
'pisell-upload-setting-type-error': function pisellUploadSettingTypeError(type) {
|
|
194
|
+
return "\u4E0D\u652F\u6301\u4E0A\u50B3".concat(type, "\u985E\u578B\u7684\u6587\u4EF6");
|
|
195
|
+
},
|
|
196
|
+
'pisell-upload-count-error': function pisellUploadCountError(count) {
|
|
197
|
+
return "\u8ACB\u4E0A\u50B3".concat(count, "\u500B\u6587\u4EF6");
|
|
198
|
+
}
|
|
189
199
|
};
|
|
@@ -73,8 +73,15 @@ var FormGroup = (props) => {
|
|
|
73
73
|
"pisell-lowcode-data-source-form-group-side": groupInfoPosition === "side"
|
|
74
74
|
})
|
|
75
75
|
},
|
|
76
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-info" }, propsShowTitle && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-title" }, title), propsShowDescription && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-description" }, description)),
|
|
77
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
76
|
+
(propsShowTitle && title || propsShowDescription && description) && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-info" }, propsShowTitle && title && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-title" }, title), propsShowDescription && description && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-data-source-form-group-description" }, description)),
|
|
77
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "pisell-lowcode-data-source-form-group-content",
|
|
81
|
+
style: contentStyle
|
|
82
|
+
},
|
|
83
|
+
children
|
|
84
|
+
)
|
|
78
85
|
);
|
|
79
86
|
};
|
|
80
87
|
var group_default = FormGroup;
|
|
@@ -40,6 +40,7 @@ var import_Input = __toESM(require("../../fields/Input"));
|
|
|
40
40
|
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
41
41
|
var import_FilterButton = __toESM(require("../../../filter/components/FilterButton"));
|
|
42
42
|
var import_utils = require("./utils");
|
|
43
|
+
var import_index = require("./index.less");
|
|
43
44
|
var defaultArr = [];
|
|
44
45
|
var Filter = (props) => {
|
|
45
46
|
const {
|
|
@@ -145,7 +146,7 @@ var Filter = (props) => {
|
|
|
145
146
|
placeholder: search.placeholder,
|
|
146
147
|
renderMode: "edit",
|
|
147
148
|
prefix: /* @__PURE__ */ import_react.default.createElement(import_icons.SearchOutlined, null),
|
|
148
|
-
style: { width: 200 }
|
|
149
|
+
style: { width: 200, margin: 0 }
|
|
149
150
|
}
|
|
150
151
|
) : null;
|
|
151
152
|
}, [search]);
|
|
@@ -69,7 +69,8 @@ var getCptProps = (field, cptType, item) => {
|
|
|
69
69
|
let props = ((_a = field == null ? void 0 : field.uiSchema) == null ? void 0 : _a["x-component-props"]) || {};
|
|
70
70
|
props.style = {
|
|
71
71
|
...(props == null ? void 0 : props.style) || {},
|
|
72
|
-
width: "200px"
|
|
72
|
+
width: "200px",
|
|
73
|
+
margin: 0
|
|
73
74
|
};
|
|
74
75
|
props.placeholder = item.label;
|
|
75
76
|
props.allowClear = true;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const ColorPicker: React.FC<import("
|
|
2
|
+
declare const ColorPicker: React.FC<import("./type").ColorPickerProps & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps>;
|
|
3
3
|
export default ColorPicker;
|
|
@@ -0,0 +1,206 @@
|
|
|
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/dataSourceComponents/fields/Upload/BaseUpload.tsx
|
|
30
|
+
var BaseUpload_exports = {};
|
|
31
|
+
__export(BaseUpload_exports, {
|
|
32
|
+
default: () => BaseUpload_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(BaseUpload_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_icons = require("@ant-design/icons");
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_ahooks = require("ahooks");
|
|
39
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
40
|
+
var import_locales = require("../../../../locales");
|
|
41
|
+
var import_pisellUpload = __toESM(require("../../../pisellUpload"));
|
|
42
|
+
var import_utils = require("./utils");
|
|
43
|
+
var import_index = require("./index.less");
|
|
44
|
+
var BaseUpload = (props) => {
|
|
45
|
+
const {
|
|
46
|
+
renderMode,
|
|
47
|
+
maxSize,
|
|
48
|
+
minCount,
|
|
49
|
+
maxCount,
|
|
50
|
+
multiple,
|
|
51
|
+
presetType,
|
|
52
|
+
customType,
|
|
53
|
+
enablePresetType,
|
|
54
|
+
enableCustomType,
|
|
55
|
+
...restProps
|
|
56
|
+
} = props;
|
|
57
|
+
const [fileList, setFileList] = (0, import_react.useState)([]);
|
|
58
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
59
|
+
const { mediaUploadUrl, getHeaders } = appHelper == null ? void 0 : appHelper.constants;
|
|
60
|
+
const calcMaxCount = (0, import_react.useMemo)(() => {
|
|
61
|
+
if (multiple) {
|
|
62
|
+
return maxCount || 9;
|
|
63
|
+
}
|
|
64
|
+
return 1;
|
|
65
|
+
}, [maxCount, minCount, multiple]);
|
|
66
|
+
const getMediaMetadata = async (file) => {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
if (file.type.startsWith("image/")) {
|
|
69
|
+
const img = new Image();
|
|
70
|
+
img.src = URL.createObjectURL(file);
|
|
71
|
+
img.onload = () => {
|
|
72
|
+
URL.revokeObjectURL(img.src);
|
|
73
|
+
resolve({
|
|
74
|
+
width: img.width,
|
|
75
|
+
height: img.height
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
} else if (file.type.startsWith("video/")) {
|
|
79
|
+
const video = document.createElement("video");
|
|
80
|
+
video.preload = "metadata";
|
|
81
|
+
video.src = URL.createObjectURL(file);
|
|
82
|
+
video.onloadedmetadata = () => {
|
|
83
|
+
URL.revokeObjectURL(video.src);
|
|
84
|
+
resolve({
|
|
85
|
+
width: video.videoWidth,
|
|
86
|
+
height: video.videoHeight,
|
|
87
|
+
duration: video.duration,
|
|
88
|
+
bitrate: file.size / video.duration
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
} else if (file.type.startsWith("audio/")) {
|
|
92
|
+
const audio = document.createElement("audio");
|
|
93
|
+
audio.preload = "metadata";
|
|
94
|
+
audio.src = URL.createObjectURL(file);
|
|
95
|
+
audio.onloadedmetadata = () => {
|
|
96
|
+
URL.revokeObjectURL(audio.src);
|
|
97
|
+
resolve({
|
|
98
|
+
duration: audio.duration,
|
|
99
|
+
bitrate: file.size / audio.duration
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
} else {
|
|
103
|
+
resolve({});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const handleChange = async ({ file, fileList: newFileList }) => {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
setFileList(newFileList);
|
|
110
|
+
if (file.status === "uploading") {
|
|
111
|
+
const metadata = await getMediaMetadata(file.originFileObj);
|
|
112
|
+
file.metadata = metadata;
|
|
113
|
+
}
|
|
114
|
+
if (file.status === "done") {
|
|
115
|
+
import_antd.message.success(`${file.name} 上传成功`);
|
|
116
|
+
(_b = props.onChange) == null ? void 0 : _b.call(props, (_a = file.response) == null ? void 0 : _a.url);
|
|
117
|
+
} else if (file.status === "error") {
|
|
118
|
+
import_antd.message.error(`${file.name} 上传失败`);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const countError = (0, import_ahooks.useDebounceFn)(
|
|
122
|
+
(msg) => {
|
|
123
|
+
import_antd.message.error(msg);
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
wait: 500
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
const typeError = (0, import_ahooks.useDebounceFn)(
|
|
130
|
+
(msg) => {
|
|
131
|
+
import_antd.message.error(msg);
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
wait: 500
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
const sizeError = (0, import_ahooks.useDebounceFn)(
|
|
138
|
+
(msg) => {
|
|
139
|
+
import_antd.message.error(msg);
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
wait: 500
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
const uploadButton = /* @__PURE__ */ import_react.default.createElement("button", { className: "pisell-upload-button", type: "button" }, /* @__PURE__ */ import_react.default.createElement(import_icons.PlusOutlined, null), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-upload-text" }, (0, import_locales.getText)("pisell-upload-button")));
|
|
146
|
+
const accept = (0, import_react.useMemo)(() => {
|
|
147
|
+
let types = [];
|
|
148
|
+
if (enablePresetType) {
|
|
149
|
+
types = [...presetType || []];
|
|
150
|
+
}
|
|
151
|
+
if (enableCustomType) {
|
|
152
|
+
types = [...types, ...customType || []];
|
|
153
|
+
}
|
|
154
|
+
return types.join(", ");
|
|
155
|
+
}, [presetType, customType, enableCustomType, enablePresetType]);
|
|
156
|
+
const beforeUpload = async (file, newFileList) => {
|
|
157
|
+
let currentFileCount = 1;
|
|
158
|
+
newFileList.forEach((item, index) => {
|
|
159
|
+
if (item.uid === file.uid) {
|
|
160
|
+
currentFileCount = index + 1;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
if (file.size > calcMaxCount * 1024 * 1024) {
|
|
164
|
+
sizeError.run((0, import_locales.getText)("pisell-upload-setting-size-error")(maxSize));
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
const pointSuffix = (0, import_utils.getPointSuffix)(file.name);
|
|
168
|
+
if (accept !== "" && !(accept || "").includes(pointSuffix)) {
|
|
169
|
+
typeError.run((0, import_locales.getText)("pisell-upload-setting-type-error")(pointSuffix));
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
const { success, message: messageStr } = (0, import_utils.checkFileCount)({
|
|
173
|
+
minCount: minCount || 0,
|
|
174
|
+
maxCount: maxCount || 9,
|
|
175
|
+
valueLength: fileList.length + currentFileCount,
|
|
176
|
+
multiple
|
|
177
|
+
});
|
|
178
|
+
if (!success) {
|
|
179
|
+
countError.run(messageStr);
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
return file;
|
|
183
|
+
};
|
|
184
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
185
|
+
import_pisellUpload.default,
|
|
186
|
+
{
|
|
187
|
+
...restProps,
|
|
188
|
+
uploadType: "custom",
|
|
189
|
+
listType: "picture-card",
|
|
190
|
+
fileList,
|
|
191
|
+
onChange: handleChange,
|
|
192
|
+
action: mediaUploadUrl,
|
|
193
|
+
method: "post",
|
|
194
|
+
accept,
|
|
195
|
+
name: "file",
|
|
196
|
+
data: (file) => ({
|
|
197
|
+
group_id: 0,
|
|
198
|
+
metadata: file.metadata ? JSON.stringify(file.metadata) : void 0
|
|
199
|
+
}),
|
|
200
|
+
headers: getHeaders(),
|
|
201
|
+
beforeUpload
|
|
202
|
+
},
|
|
203
|
+
fileList.length >= calcMaxCount ? null : uploadButton
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
var BaseUpload_default = BaseUpload;
|
|
@@ -0,0 +1,39 @@
|
|
|
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/dataSourceComponents/fields/Upload/ReadPretty.tsx
|
|
30
|
+
var ReadPretty_exports = {};
|
|
31
|
+
__export(ReadPretty_exports, {
|
|
32
|
+
default: () => ReadPretty_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ReadPretty_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var UploadReadPretty = (props) => {
|
|
37
|
+
return /* @__PURE__ */ import_react.default.createElement("div", null, "UploadReadPretty");
|
|
38
|
+
};
|
|
39
|
+
var ReadPretty_default = UploadReadPretty;
|
|
@@ -0,0 +1,43 @@
|
|
|
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/dataSourceComponents/fields/Upload/WithMode.tsx
|
|
30
|
+
var WithMode_exports = {};
|
|
31
|
+
__export(WithMode_exports, {
|
|
32
|
+
default: () => WithMode_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(WithMode_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("../../dataSourceForm/utils");
|
|
37
|
+
var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
38
|
+
var import_BaseUpload = __toESM(require("./BaseUpload"));
|
|
39
|
+
var Upload = (props) => {
|
|
40
|
+
return /* @__PURE__ */ import_react.default.createElement(import_BaseUpload.default, { ...props });
|
|
41
|
+
};
|
|
42
|
+
var UploadWithMode = (0, import_utils.withMode)(Upload, import_ReadPretty.default);
|
|
43
|
+
var WithMode_default = UploadWithMode;
|
|
@@ -0,0 +1,38 @@
|
|
|
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/dataSourceComponents/fields/Upload/index.tsx
|
|
30
|
+
var Upload_exports = {};
|
|
31
|
+
__export(Upload_exports, {
|
|
32
|
+
default: () => Upload_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Upload_exports);
|
|
35
|
+
var import_utils = require("../../dataSourceForm/utils");
|
|
36
|
+
var import_WithMode = __toESM(require("./WithMode"));
|
|
37
|
+
var Upload = (0, import_utils.withFormItem)(import_WithMode.default);
|
|
38
|
+
var Upload_default = Upload;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UploadFile as AntdUploadFile } from 'antd/es/upload/interface';
|
|
2
|
+
import { PisellUploadProps } from '../../../pisellUpload';
|
|
3
|
+
export interface UploadFile extends AntdUploadFile {
|
|
4
|
+
metadata?: {
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
duration?: number;
|
|
8
|
+
bitrate?: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface UploadProps extends PisellUploadProps {
|
|
12
|
+
renderMode?: 'read' | 'edit';
|
|
13
|
+
value?: string;
|
|
14
|
+
allowMediaLibrary?: boolean;
|
|
15
|
+
allowLocalUpload?: boolean;
|
|
16
|
+
allowPreview?: boolean;
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
minCount?: number;
|
|
19
|
+
maxCount?: number;
|
|
20
|
+
enablePresetType?: boolean;
|
|
21
|
+
presetType?: string[];
|
|
22
|
+
enableCustomType?: boolean;
|
|
23
|
+
customType?: string[];
|
|
24
|
+
multiple: boolean;
|
|
25
|
+
}
|
|
@@ -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/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const getSuffix: (name: string) => string | undefined;
|
|
2
|
+
export declare const getPointSuffix: (name: string) => string;
|
|
3
|
+
export declare const checkFileCount: ({ multiple, minCount, maxCount, valueLength, }: {
|
|
4
|
+
multiple: boolean;
|
|
5
|
+
minCount: number;
|
|
6
|
+
maxCount: number;
|
|
7
|
+
valueLength: number;
|
|
8
|
+
}) => {
|
|
9
|
+
success: boolean;
|
|
10
|
+
message: any;
|
|
11
|
+
} | {
|
|
12
|
+
success: boolean;
|
|
13
|
+
message?: undefined;
|
|
14
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
checkFileCount: () => checkFileCount,
|
|
23
|
+
getPointSuffix: () => getPointSuffix,
|
|
24
|
+
getSuffix: () => getSuffix
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var import_locales = require("../../../../locales");
|
|
28
|
+
var getSuffix = (name) => {
|
|
29
|
+
return name.split(".").pop();
|
|
30
|
+
};
|
|
31
|
+
var getPointSuffix = (name) => {
|
|
32
|
+
return `.${getSuffix(name)}`;
|
|
33
|
+
};
|
|
34
|
+
var checkFileCount = ({
|
|
35
|
+
multiple,
|
|
36
|
+
minCount,
|
|
37
|
+
maxCount,
|
|
38
|
+
valueLength
|
|
39
|
+
}) => {
|
|
40
|
+
if (multiple) {
|
|
41
|
+
if (minCount === maxCount && valueLength !== minCount) {
|
|
42
|
+
return {
|
|
43
|
+
success: false,
|
|
44
|
+
message: (0, import_locales.getText)("pisell-upload-count-error")(minCount, maxCount)
|
|
45
|
+
};
|
|
46
|
+
} else if (minCount !== maxCount && (valueLength < minCount || valueLength > maxCount)) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
message: (0, import_locales.getText)("pisell-upload-count-error")(minCount, maxCount)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
success: true
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
checkFileCount,
|
|
60
|
+
getPointSuffix,
|
|
61
|
+
getSuffix
|
|
62
|
+
});
|
|
@@ -37,6 +37,7 @@ declare const formFieldMap: {
|
|
|
37
37
|
'Radio.Group': import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
38
38
|
'Checkbox.Group': import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
39
39
|
DateRangePicker: import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
40
|
+
Upload: import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
40
41
|
};
|
|
41
42
|
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<any> | (import("react").FC<{}> & {
|
|
42
43
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -60,5 +61,5 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
60
61
|
valueField: string;
|
|
61
62
|
} & {
|
|
62
63
|
dataSource?: any;
|
|
63
|
-
}) => import("react").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>;
|
|
64
|
+
}) => import("react").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>;
|
|
64
65
|
export { getFieldComponent, formFieldMap };
|
|
@@ -42,6 +42,7 @@ var import_Select = __toESM(require("./Select"));
|
|
|
42
42
|
var import_InputNumber = __toESM(require("./InputNumber"));
|
|
43
43
|
var import_TimePicker = __toESM(require("./TimePicker"));
|
|
44
44
|
var import_DateRangePicker = __toESM(require("./DateRangePicker"));
|
|
45
|
+
var import_Upload = __toESM(require("./Upload"));
|
|
45
46
|
var formFieldMap = {
|
|
46
47
|
Checkbox: import_Checkbox.default,
|
|
47
48
|
ColorPicker: import_ColorPicker.default,
|
|
@@ -57,7 +58,8 @@ var formFieldMap = {
|
|
|
57
58
|
"Input.Password": import_Input.default.Password,
|
|
58
59
|
"Radio.Group": import_Radio.default.Group,
|
|
59
60
|
"Checkbox.Group": import_Checkbox.default.Group,
|
|
60
|
-
DateRangePicker: import_DateRangePicker.default
|
|
61
|
+
DateRangePicker: import_DateRangePicker.default,
|
|
62
|
+
Upload: import_Upload.default
|
|
61
63
|
};
|
|
62
64
|
var getFieldComponent = (fieldComponent) => {
|
|
63
65
|
return formFieldMap[fieldComponent];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { UploadProps } from 'antd';
|
|
3
3
|
import './index.less';
|
|
4
|
-
interface
|
|
4
|
+
export interface PisellUploadProps extends UploadProps {
|
|
5
5
|
title?: string;
|
|
6
6
|
text1?: string;
|
|
7
7
|
text2?: string;
|
|
8
|
-
uploadType?: 'button' | 'drop';
|
|
8
|
+
uploadType?: 'button' | 'drop' | 'custom';
|
|
9
9
|
}
|
|
10
|
-
declare const PisellUpload: (props:
|
|
10
|
+
declare const PisellUpload: (props: PisellUploadProps) => React.JSX.Element;
|
|
11
11
|
export default PisellUpload;
|