@pisell/materials 6.0.18 → 6.0.20
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 +7 -7
- package/build/lowcode/preview.js +146 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +51 -20
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +51 -20
- package/es/components/badge/index.d.ts +7 -0
- package/es/components/badge/index.js +44 -0
- package/es/components/badge/index.less +2 -0
- package/es/components/buttonGroupEdit/index.d.ts +8 -0
- package/es/components/buttonGroupEdit/index.js +408 -0
- package/es/components/buttonGroupPreview/index.d.ts +19 -0
- package/es/components/buttonGroupPreview/index.js +74 -0
- package/es/components/cardMetricItem/index.d.ts +12 -0
- package/es/components/cardMetricItem/index.js +39 -0
- package/es/components/cardMetricItem/index.less +39 -0
- package/es/components/cardPro/index.d.ts +3 -0
- package/es/components/cardPro/index.js +66 -0
- package/es/components/cardPro/index.less +55 -0
- package/es/components/cropPhoto/index.d.ts +3 -0
- package/es/components/cropPhoto/index.js +72 -0
- package/es/components/cropPhoto/index.less +15 -0
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
- package/es/components/dataSourceComponents/dataSourceMenu/Basic.js +13 -3
- package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
- package/es/components/dataSourceComponents/fields/Input/WithMode.js +24 -1
- package/es/components/dataSourceComponents/fields/Input.Mobile/serve.js +31 -3
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.js +31 -3
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +102 -141
- package/es/components/dataSourceComponents/fields/Upload/WithMode.js +6 -3
- package/es/components/dataSourceComponents/fields/Upload/serve.js +13 -3
- package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
- package/es/components/dataSourceComponents/fields/Upload/shopUploadServe.js +396 -0
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.js +17 -2
- package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
- package/es/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
- package/es/components/dataSourceComponents/hooks/usePlatform.js +12 -0
- package/es/components/login-and-register/index.js +23 -21
- package/es/components/login-and-register/index.less +7 -7
- package/es/components/page/index.js +23 -57
- package/es/components/pisellAnchor/index.d.ts +23 -0
- package/es/components/pisellAnchor/index.js +303 -0
- package/es/components/pisellAnchor/index.less +197 -0
- package/es/components/pisellNavigationMenu/PisellNavigationMenu.js +18 -2
- package/es/components/pisellQrcode/index.d.ts +10 -0
- package/es/components/pisellQrcode/index.js +70 -0
- package/es/components/pisellQrcode/index.less +41 -0
- package/es/components/pisellStatisticList/index.d.ts +3 -0
- package/es/components/pisellStatisticList/index.js +17 -5
- package/es/components/pisellStatisticList/index.less +1 -1
- package/es/components/pisellText/components/Amount/index.d.ts +2 -0
- package/es/components/pisellText/components/Amount/index.js +3 -2
- package/es/components/pisellWalletPassCard/index.d.ts +4 -4
- package/es/components/pisellWalletPassCard/index.js +28 -12
- package/es/components/pisellWalletPassCard/index.less +26 -4
- package/es/components/record-view/index.d.ts +13 -5
- package/es/components/record-view/index.js +81 -30
- package/es/components/record-view/index.less +37 -2
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/tabs/index.d.ts +1 -0
- package/es/components/tabs/index.js +25 -7
- package/es/components/tabs/index.less +5 -5
- package/es/components/walletCard/Guest/index.d.ts +3 -0
- package/es/components/walletCard/Guest/index.js +83 -0
- package/es/components/walletCard/Guest/index.less +71 -0
- package/es/components/walletCard/index.d.ts +65 -0
- package/es/components/walletCard/index.js +402 -0
- package/es/components/walletCard/index.less +267 -0
- package/es/index.d.ts +10 -1
- package/es/index.js +10 -1
- package/es/locales/en-US.d.ts +38 -2
- package/es/locales/en-US.js +55 -10
- package/es/locales/index.js +4 -2
- package/es/locales/zh-CN.d.ts +36 -0
- package/es/locales/zh-CN.js +41 -1
- package/es/locales/zh-TW.d.ts +36 -0
- package/es/locales/zh-TW.js +41 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +3 -0
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/badge/index.d.ts +7 -0
- package/lib/components/badge/index.js +70 -0
- package/lib/components/badge/index.less +2 -0
- package/lib/components/buttonGroupEdit/index.d.ts +8 -0
- package/lib/components/buttonGroupEdit/index.js +317 -0
- package/lib/components/buttonGroupPreview/index.d.ts +19 -0
- package/lib/components/buttonGroupPreview/index.js +79 -0
- package/lib/components/cardMetricItem/index.d.ts +12 -0
- package/lib/components/cardMetricItem/index.js +75 -0
- package/lib/components/cardMetricItem/index.less +39 -0
- package/lib/components/cardPro/index.d.ts +3 -0
- package/lib/components/cardPro/index.js +98 -0
- package/lib/components/cardPro/index.less +55 -0
- package/lib/components/cropPhoto/index.d.ts +3 -0
- package/lib/components/cropPhoto/index.js +70 -0
- package/lib/components/cropPhoto/index.less +15 -0
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.d.ts +8 -2
- package/lib/components/dataSourceComponents/dataSourceMenu/Basic.js +12 -3
- package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +8 -2
- package/lib/components/dataSourceComponents/fields/Input/WithMode.js +21 -0
- package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.js +37 -3
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.js +37 -3
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +2 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +47 -72
- package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +11 -9
- package/lib/components/dataSourceComponents/fields/Upload/serve.js +11 -2
- package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.d.ts +56 -0
- package/lib/components/dataSourceComponents/fields/Upload/shopUploadServe.js +247 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.js +17 -2
- package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
- package/lib/components/dataSourceComponents/hooks/usePlatform.d.ts +3 -0
- package/lib/components/dataSourceComponents/hooks/usePlatform.js +51 -0
- package/lib/components/login-and-register/index.js +23 -21
- package/lib/components/login-and-register/index.less +7 -7
- package/lib/components/page/index.js +37 -65
- package/lib/components/pisellAnchor/index.d.ts +23 -0
- package/lib/components/pisellAnchor/index.js +251 -0
- package/lib/components/pisellAnchor/index.less +197 -0
- package/lib/components/pisellNavigationMenu/PisellNavigationMenu.js +24 -3
- package/lib/components/pisellQrcode/index.d.ts +10 -0
- package/lib/components/pisellQrcode/index.js +82 -0
- package/lib/components/pisellQrcode/index.less +41 -0
- package/lib/components/pisellStatisticList/index.d.ts +3 -0
- package/lib/components/pisellStatisticList/index.js +35 -15
- package/lib/components/pisellStatisticList/index.less +1 -1
- package/lib/components/pisellText/components/Amount/index.d.ts +2 -0
- package/lib/components/pisellText/components/Amount/index.js +2 -1
- package/lib/components/pisellWalletPassCard/index.d.ts +4 -4
- package/lib/components/pisellWalletPassCard/index.js +17 -9
- package/lib/components/pisellWalletPassCard/index.less +26 -4
- package/lib/components/record-view/index.d.ts +13 -5
- package/lib/components/record-view/index.js +63 -11
- package/lib/components/record-view/index.less +37 -2
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/tabs/index.d.ts +1 -0
- package/lib/components/tabs/index.js +12 -1
- package/lib/components/tabs/index.less +5 -5
- package/lib/components/walletCard/Guest/index.d.ts +3 -0
- package/lib/components/walletCard/Guest/index.js +138 -0
- package/lib/components/walletCard/Guest/index.less +71 -0
- package/lib/components/walletCard/index.d.ts +65 -0
- package/lib/components/walletCard/index.js +374 -0
- package/lib/components/walletCard/index.less +267 -0
- package/lib/index.d.ts +10 -1
- package/lib/index.js +26 -1
- package/lib/locales/en-US.d.ts +38 -2
- package/lib/locales/en-US.js +41 -3
- package/lib/locales/index.js +4 -2
- package/lib/locales/zh-CN.d.ts +36 -0
- package/lib/locales/zh-CN.js +41 -1
- package/lib/locales/zh-TW.d.ts +36 -0
- package/lib/locales/zh-TW.js +41 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +6 -1
- package/lib/utils/platform.d.ts +1 -1
- package/lowcode/badge/meta.ts +20 -11
- package/lowcode/badge/snippets.ts +2 -0
- package/lowcode/button/meta.ts +2 -6
- package/lowcode/button-group/meta.ts +198 -0
- package/lowcode/button-group/snippets.ts +68 -0
- package/lowcode/button-group-edit/meta.ts +32 -0
- package/lowcode/button-group-edit/snippets.ts +98 -0
- package/lowcode/button-group-preview/meta.ts +55 -0
- package/lowcode/button-group-preview/snippets.ts +57 -0
- package/lowcode/card/snippets.ts +55 -55
- package/lowcode/card-metric-item/meta.ts +83 -0
- package/lowcode/card-metric-item/snippets.ts +13 -0
- package/lowcode/card-pro/meta.ts +338 -0
- package/lowcode/card-pro/snippe.ts +39 -0
- package/lowcode/crop-photo/meta.ts +77 -0
- package/lowcode/crop-photo/snippe.ts +12 -0
- package/lowcode/form-item-input/snippets.ts +1 -1
- package/lowcode/form-item-upload/meta.ts +11 -0
- package/lowcode/pisell-anchor/meta.ts +118 -0
- package/lowcode/pisell-anchor/snippets.ts +26 -0
- package/lowcode/pisell-card/meta.ts +63 -27
- package/lowcode/pisell-card/snippets.ts +6 -0
- package/lowcode/pisell-modal.information/meta.ts +8 -0
- package/lowcode/pisell-qrcode/__screenshots__/upload-1.png +0 -0
- package/lowcode/pisell-qrcode/meta.ts +46 -0
- package/lowcode/pisell-qrcode/snippets.ts +13 -0
- package/lowcode/pisell-tooltip/meta.ts +1 -1
- package/lowcode/record-view/meta.ts +20 -0
- package/lowcode/section-footers/meta.ts +66 -0
- package/lowcode/section-footers/snippe.ts +21 -0
- package/lowcode/spin/meta.ts +9 -0
- package/lowcode/tag/meta.ts +6 -0
- package/lowcode/timeline/meta.ts +32 -9
- package/lowcode/timeline/snippets.ts +12 -2
- package/lowcode/timeline.item/meta.ts +1 -1
- package/lowcode/wallet-card/meta.ts +283 -0
- package/lowcode/wallet-card/snippets.ts +44 -0
- package/package.json +5 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.pisell-cardPro-wrap {
|
|
2
|
+
border-radius: 12px;
|
|
3
|
+
|
|
4
|
+
&.pisell-cardPro-wrap-with-cover {
|
|
5
|
+
.pisell-lowcode-card-body {
|
|
6
|
+
padding-top: 0;
|
|
7
|
+
padding-left: 0;
|
|
8
|
+
padding-right: 0;
|
|
9
|
+
padding-bottom: 24px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pisell-cardPro-head,
|
|
13
|
+
.pisell-cardPro-content {
|
|
14
|
+
padding: 0 24px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pisell-cardPro-cover {
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
.pisell-cardPro-badge {
|
|
22
|
+
position: absolute;
|
|
23
|
+
right: 0;
|
|
24
|
+
top: 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pisell-cardPro-head {
|
|
29
|
+
padding: 0;
|
|
30
|
+
.pisell-cardPro-head-title {
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: #1a2029;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.pisell-cardPro-head-subtitle {
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
color: #6e8098;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.pisell-cardPro-head-extra {
|
|
42
|
+
width: 150px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pisell-cardPro-content {
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
margin-top: 20px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pisell-cardPro-content {
|
|
52
|
+
overflow-y: auto;
|
|
53
|
+
margin-top: 20px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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/cropPhoto/index.tsx
|
|
30
|
+
var cropPhoto_exports = {};
|
|
31
|
+
__export(cropPhoto_exports, {
|
|
32
|
+
default: () => cropPhoto_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(cropPhoto_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_antd_img_crop = __toESM(require("antd-img-crop"));
|
|
38
|
+
var CropPhoto = (props) => {
|
|
39
|
+
const { cropShape } = props;
|
|
40
|
+
const [fileList, setFileList] = (0, import_react.useState)([]);
|
|
41
|
+
const onChange = ({ fileList: newFileList }) => {
|
|
42
|
+
setFileList(newFileList);
|
|
43
|
+
};
|
|
44
|
+
const onPreview = async (file) => {
|
|
45
|
+
let src = file.url;
|
|
46
|
+
if (!src) {
|
|
47
|
+
src = await new Promise((resolve) => {
|
|
48
|
+
const reader = new FileReader();
|
|
49
|
+
reader.readAsDataURL(file.originFileObj);
|
|
50
|
+
reader.onload = () => resolve(reader.result);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const image = new Image();
|
|
54
|
+
image.src = src;
|
|
55
|
+
const imgWindow = window.open(src);
|
|
56
|
+
imgWindow == null ? void 0 : imgWindow.document.write(image.outerHTML);
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd_img_crop.default, { rotationSlider: true, aspectSlider: true, cropShape }, /* @__PURE__ */ import_react.default.createElement(
|
|
59
|
+
import_antd.Upload,
|
|
60
|
+
{
|
|
61
|
+
action: "https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload",
|
|
62
|
+
listType: "picture-card",
|
|
63
|
+
fileList,
|
|
64
|
+
onChange,
|
|
65
|
+
onPreview
|
|
66
|
+
},
|
|
67
|
+
fileList.length < 5 && "+ Upload"
|
|
68
|
+
));
|
|
69
|
+
};
|
|
70
|
+
var cropPhoto_default = CropPhoto;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellMenuProps } from '../../pisellMenu/types';
|
|
3
|
+
/**
|
|
4
|
+
* @title: 数据源表单组件
|
|
5
|
+
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
6
|
+
*/
|
|
7
|
+
declare const DataSourceMenu: React.ForwardRefExoticComponent<PisellMenuProps & React.RefAttributes<any>>;
|
|
8
|
+
export default DataSourceMenu;
|
|
@@ -37,7 +37,7 @@ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext")
|
|
|
37
37
|
var import_pisellMenu = __toESM(require("../../pisellMenu"));
|
|
38
38
|
var DataSourceMenu = (0, import_react.forwardRef)(
|
|
39
39
|
(props, ref) => {
|
|
40
|
-
var _a, _b, _c, _d;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
41
41
|
const { appHelper } = (0, import_useEngineContext.default)();
|
|
42
42
|
const {
|
|
43
43
|
menuItems,
|
|
@@ -47,6 +47,15 @@ var DataSourceMenu = (0, import_react.forwardRef)(
|
|
|
47
47
|
getShowChildren,
|
|
48
48
|
handleClick
|
|
49
49
|
} = (_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.menuManager) == null ? void 0 : _d.useMenu();
|
|
50
|
+
const translation = ((_h = (_g = (_f = (_e = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _e.getApp) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.locales) == null ? void 0 : _h.translation) || ((str) => {
|
|
51
|
+
if (!str) {
|
|
52
|
+
return "";
|
|
53
|
+
}
|
|
54
|
+
if (typeof str === "string") {
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
57
|
+
return JSON.stringify(str);
|
|
58
|
+
});
|
|
50
59
|
const renderMenuItems = (items) => {
|
|
51
60
|
return items.map((item) => {
|
|
52
61
|
if (item.hide) {
|
|
@@ -58,14 +67,14 @@ var DataSourceMenu = (0, import_react.forwardRef)(
|
|
|
58
67
|
import_pisellMenu.default.SubMenu,
|
|
59
68
|
{
|
|
60
69
|
key: item.key,
|
|
61
|
-
title: item.label,
|
|
70
|
+
title: translation(item.label),
|
|
62
71
|
icon: item.icon,
|
|
63
72
|
router: item.path
|
|
64
73
|
},
|
|
65
74
|
renderMenuItems(_children)
|
|
66
75
|
);
|
|
67
76
|
}
|
|
68
|
-
return /* @__PURE__ */ import_react.default.createElement(import_pisellMenu.default.Item, { key: item.key, icon: item.icon, router: item.path }, item.label);
|
|
77
|
+
return /* @__PURE__ */ import_react.default.createElement(import_pisellMenu.default.Item, { key: item.key, icon: item.icon, router: item.path }, translation(item.label));
|
|
69
78
|
});
|
|
70
79
|
};
|
|
71
80
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PisellMenuProps } from '../../pisellMenu/types';
|
|
3
|
+
/**
|
|
4
|
+
* @title: 数据源表单组件
|
|
5
|
+
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
6
|
+
*/
|
|
7
|
+
declare const DataSourceMenu: (props: PisellMenuProps, ref: React.Ref<any>) => JSX.Element;
|
|
8
|
+
export default DataSourceMenu;
|
|
@@ -47,6 +47,8 @@ var Input = (props) => {
|
|
|
47
47
|
// 明确解构,避免通过restProps传递
|
|
48
48
|
innerRef,
|
|
49
49
|
// 明确解构
|
|
50
|
+
className,
|
|
51
|
+
// 明确解构className
|
|
50
52
|
...restProps
|
|
51
53
|
} = props;
|
|
52
54
|
const [inputValue, setInputValue] = (0, import_react.useState)(propValue || "");
|
|
@@ -103,11 +105,30 @@ var Input = (props) => {
|
|
|
103
105
|
if (renderMode === "view" || renderMode === "tableView") {
|
|
104
106
|
return /* @__PURE__ */ import_react.default.createElement(import_ReadPretty.default, { ...props });
|
|
105
107
|
}
|
|
108
|
+
(0, import_react.useEffect)(() => {
|
|
109
|
+
if (enableQRScanner) {
|
|
110
|
+
const styleEl = document.createElement("style");
|
|
111
|
+
styleEl.id = "pisell-qr-scanner-style";
|
|
112
|
+
styleEl.innerHTML = `
|
|
113
|
+
.pisell-input-with-scanner .pisell-lowcode-input-group .pisell-lowcode-input-group-addon {
|
|
114
|
+
background-color: var(--primary-600, #7F56D9);
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
document.head.appendChild(styleEl);
|
|
118
|
+
return () => {
|
|
119
|
+
const existingStyle = document.getElementById("pisell-qr-scanner-style");
|
|
120
|
+
if (existingStyle) {
|
|
121
|
+
document.head.removeChild(existingStyle);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}, [enableQRScanner]);
|
|
106
126
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
107
127
|
import_antd.Input,
|
|
108
128
|
{
|
|
109
129
|
...restProps,
|
|
110
130
|
ref: innerRef || void 0,
|
|
131
|
+
className: `${className || ""} ${enableQRScanner ? "pisell-input-with-scanner" : ""}`,
|
|
111
132
|
addonAfter: scanSuffix,
|
|
112
133
|
value: inputValue,
|
|
113
134
|
onChange: handleInputChange
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
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
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/dataSourceComponents/fields/Input.Mobile/serve.ts
|
|
@@ -23,8 +33,11 @@ __export(serve_exports, {
|
|
|
23
33
|
useCountries: () => useCountries
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(serve_exports);
|
|
36
|
+
var import_react = require("react");
|
|
26
37
|
var import_ahooks = require("ahooks");
|
|
27
38
|
var import_utils = require("../../../table/utils");
|
|
39
|
+
var import_usePlatform = require("../../hooks/usePlatform");
|
|
40
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
28
41
|
var getCountryDataList = async () => {
|
|
29
42
|
const { data } = await import_utils.request.getRequest().get(`/country:list`, {}, {
|
|
30
43
|
isNocobase: true,
|
|
@@ -39,14 +52,35 @@ var getCountryDataList = async () => {
|
|
|
39
52
|
}));
|
|
40
53
|
};
|
|
41
54
|
var useCountries = () => {
|
|
42
|
-
const
|
|
55
|
+
const isShop = (0, import_usePlatform.useIsShop)();
|
|
56
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
57
|
+
const { data, run } = (0, import_ahooks.useRequest)(getCountryDataList, {
|
|
43
58
|
cacheKey: "phone-countries",
|
|
44
59
|
staleTime: 1e3 * 60 * 5,
|
|
45
60
|
// 5分钟后数据过期
|
|
46
|
-
cacheTime: 1e3 * 60 * 60
|
|
61
|
+
cacheTime: 1e3 * 60 * 60,
|
|
47
62
|
// 1小时后清除缓存
|
|
63
|
+
manual: true
|
|
48
64
|
});
|
|
49
|
-
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
if (!isShop) {
|
|
67
|
+
run();
|
|
68
|
+
}
|
|
69
|
+
}, [isShop]);
|
|
70
|
+
const currentData = (0, import_react.useMemo)(() => {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
72
|
+
if (isShop) {
|
|
73
|
+
const codeList = (_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.store) == null ? void 0 : _b.getState()) == null ? void 0 : _c.global) == null ? void 0 : _d.codeList;
|
|
74
|
+
if (codeList) {
|
|
75
|
+
return codeList.map((item) => ({
|
|
76
|
+
...item,
|
|
77
|
+
prefix: `+${item.calling_code}`
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return data;
|
|
82
|
+
}, [isShop, data]);
|
|
83
|
+
return { data: currentData };
|
|
50
84
|
};
|
|
51
85
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
86
|
0 && (module.exports = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
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
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/dataSourceComponents/fields/Input.Phone/serve.ts
|
|
@@ -23,8 +33,11 @@ __export(serve_exports, {
|
|
|
23
33
|
useCountries: () => useCountries
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(serve_exports);
|
|
36
|
+
var import_react = require("react");
|
|
26
37
|
var import_ahooks = require("ahooks");
|
|
27
38
|
var import_utils = require("../../../table/utils");
|
|
39
|
+
var import_usePlatform = require("../../hooks/usePlatform");
|
|
40
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
28
41
|
var getCountryDataList = async () => {
|
|
29
42
|
const { data } = await import_utils.request.getRequest().get(`/country:list`, {}, {
|
|
30
43
|
isNocobase: true,
|
|
@@ -39,14 +52,35 @@ var getCountryDataList = async () => {
|
|
|
39
52
|
}));
|
|
40
53
|
};
|
|
41
54
|
var useCountries = () => {
|
|
42
|
-
const
|
|
55
|
+
const isShop = (0, import_usePlatform.useIsShop)();
|
|
56
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
57
|
+
const { data, run } = (0, import_ahooks.useRequest)(getCountryDataList, {
|
|
43
58
|
cacheKey: "phone-countries",
|
|
44
59
|
staleTime: 1e3 * 60 * 5,
|
|
45
60
|
// 5分钟后数据过期
|
|
46
|
-
cacheTime: 1e3 * 60 * 60
|
|
61
|
+
cacheTime: 1e3 * 60 * 60,
|
|
47
62
|
// 1小时后清除缓存
|
|
63
|
+
manual: true
|
|
48
64
|
});
|
|
49
|
-
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
if (!isShop) {
|
|
67
|
+
run();
|
|
68
|
+
}
|
|
69
|
+
}, [isShop]);
|
|
70
|
+
const currentData = (0, import_react.useMemo)(() => {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
72
|
+
if (isShop) {
|
|
73
|
+
const codeList = (_d = (_c = (_b = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.store) == null ? void 0 : _b.getState()) == null ? void 0 : _c.global) == null ? void 0 : _d.codeList;
|
|
74
|
+
if (codeList) {
|
|
75
|
+
return codeList.map((item) => ({
|
|
76
|
+
...item,
|
|
77
|
+
prefix: `+${item.calling_code}`
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return data;
|
|
82
|
+
}, [isShop, data]);
|
|
83
|
+
return { data: currentData };
|
|
50
84
|
};
|
|
51
85
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
86
|
0 && (module.exports = {
|
|
@@ -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" | "xzero" | "saas";
|
|
6
6
|
customDomain?: string | undefined;
|
|
7
7
|
value?: string | undefined;
|
|
8
8
|
tenantId: string;
|
|
@@ -44,7 +44,9 @@ var import_pisellUpload = __toESM(require("../../../pisellUpload"));
|
|
|
44
44
|
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
45
45
|
var import_locales = require("../../../../locales");
|
|
46
46
|
var import_constants = require("./constants");
|
|
47
|
+
var import_usePlatform = require("../../hooks/usePlatform");
|
|
47
48
|
var import_utils2 = require("./utils");
|
|
49
|
+
var import_shopUploadServe = require("./shopUploadServe");
|
|
48
50
|
var import_fallback = __toESM(require("./fallback.png"));
|
|
49
51
|
var import_index = require("./index.less");
|
|
50
52
|
var BaseUpload = (props) => {
|
|
@@ -67,58 +69,18 @@ var BaseUpload = (props) => {
|
|
|
67
69
|
getHeaders: propsGetHeaders,
|
|
68
70
|
...restProps
|
|
69
71
|
} = props;
|
|
72
|
+
const isShop = (0, import_usePlatform.useIsShop)();
|
|
70
73
|
const [fileList, setFileList] = (0, import_react.useState)([]);
|
|
71
74
|
const [previewImage, setPreviewImage] = (0, import_react.useState)("");
|
|
72
75
|
const [previewOpen, setPreviewOpen] = (0, import_react.useState)(false);
|
|
73
76
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
74
77
|
const [editMultilingualFile, setEditMultilingualFile] = (0, import_react.useState)(null);
|
|
75
|
-
const [errorImageMap, setErrorImageMap] = (0, import_react.useState)(
|
|
76
|
-
{}
|
|
77
|
-
);
|
|
78
78
|
const fileListRef = (0, import_react.useRef)([]);
|
|
79
79
|
(0, import_react.useEffect)(() => {
|
|
80
80
|
fileListRef.current = fileList;
|
|
81
81
|
}, [fileList]);
|
|
82
82
|
const { appHelper } = (0, import_useEngineContext.default)();
|
|
83
83
|
const { mediaUploadUrl, getHeaders } = (appHelper == null ? void 0 : appHelper.constants) || {};
|
|
84
|
-
const handleImageError = (0, import_react.useCallback)((file) => {
|
|
85
|
-
setErrorImageMap((prev) => ({
|
|
86
|
-
...prev,
|
|
87
|
-
[file.uid]: true
|
|
88
|
-
}));
|
|
89
|
-
}, []);
|
|
90
|
-
const checkImageUrl = (0, import_react.useCallback)((url) => {
|
|
91
|
-
return new Promise((resolve) => {
|
|
92
|
-
const img = document.createElement("img");
|
|
93
|
-
img.onload = () => resolve(true);
|
|
94
|
-
img.onerror = () => resolve(false);
|
|
95
|
-
img.src = url;
|
|
96
|
-
});
|
|
97
|
-
}, []);
|
|
98
|
-
const getItemUrl = (0, import_react.useCallback)(
|
|
99
|
-
async (file) => {
|
|
100
|
-
var _a, _b;
|
|
101
|
-
if (errorImageMap[file.uid]) {
|
|
102
|
-
return import_fallback.default;
|
|
103
|
-
}
|
|
104
|
-
const url = file.url || ((_b = (_a = file.response) == null ? void 0 : _a.data) == null ? void 0 : _b.url) || "";
|
|
105
|
-
if (!url) return "";
|
|
106
|
-
try {
|
|
107
|
-
const isValid = await checkImageUrl(url);
|
|
108
|
-
if (!isValid) {
|
|
109
|
-
setErrorImageMap((prev) => ({
|
|
110
|
-
...prev,
|
|
111
|
-
[file.uid]: true
|
|
112
|
-
}));
|
|
113
|
-
return import_fallback.default;
|
|
114
|
-
}
|
|
115
|
-
return url;
|
|
116
|
-
} catch (error) {
|
|
117
|
-
return import_fallback.default;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
[errorImageMap]
|
|
121
|
-
);
|
|
122
84
|
(0, import_react.useEffect)(() => {
|
|
123
85
|
const currentValue = getValueFromFileList(fileListRef.current);
|
|
124
86
|
if (!fileListRef.current.length || !(0, import_utils2.isValueEqual)(value, currentValue)) {
|
|
@@ -127,7 +89,6 @@ var BaseUpload = (props) => {
|
|
|
127
89
|
multiple: !!multiple
|
|
128
90
|
});
|
|
129
91
|
setFileList(newFileList);
|
|
130
|
-
setErrorImageMap({});
|
|
131
92
|
}
|
|
132
93
|
}, [value, enableMultilingual, multiple]);
|
|
133
94
|
const getValueFromFileList = (fileList2) => {
|
|
@@ -419,36 +380,49 @@ var BaseUpload = (props) => {
|
|
|
419
380
|
),
|
|
420
381
|
[restProps.disabled, handleGlobeIconClick]
|
|
421
382
|
);
|
|
422
|
-
const
|
|
423
|
-
(
|
|
424
|
-
|
|
425
|
-
(0, import_react.useEffect)(() => {
|
|
426
|
-
getItemUrl(file).then(setItemUrl);
|
|
427
|
-
}, [file]);
|
|
428
|
-
const newNode = import_react.default.cloneElement(originNode, {
|
|
429
|
-
children: import_react.default.Children.map(originNode.props.children, (child) => {
|
|
430
|
-
if ((child == null ? void 0 : child.type) === "a") {
|
|
431
|
-
return import_react.default.cloneElement(child, {
|
|
432
|
-
children: import_react.default.Children.map(
|
|
433
|
-
child.props.children,
|
|
434
|
-
(grandChild) => {
|
|
435
|
-
if ((grandChild == null ? void 0 : grandChild.type) === "img") {
|
|
436
|
-
return import_react.default.cloneElement(grandChild, {
|
|
437
|
-
src: itemUrl,
|
|
438
|
-
onError: () => handleImageError(file)
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
return grandChild;
|
|
442
|
-
}
|
|
443
|
-
)
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
return child;
|
|
447
|
-
})
|
|
448
|
-
});
|
|
449
|
-
return newNode;
|
|
383
|
+
const customRequest = (0, import_react.useMemo)(() => {
|
|
384
|
+
if (!isShop) {
|
|
385
|
+
return {};
|
|
450
386
|
}
|
|
451
|
-
|
|
387
|
+
const handleUpload = (options) => {
|
|
388
|
+
const { onSuccess, onError, onProgress, file } = options;
|
|
389
|
+
const fileSize = file.size;
|
|
390
|
+
const baseTime = (0, import_utils2.getBaseTime)(fileSize);
|
|
391
|
+
let progress = 0;
|
|
392
|
+
setTimeout(() => {
|
|
393
|
+
onProgress == null ? void 0 : onProgress({ percent: 1 });
|
|
394
|
+
}, 200);
|
|
395
|
+
const timer = setInterval(() => {
|
|
396
|
+
if (progress < 30) {
|
|
397
|
+
progress += 5;
|
|
398
|
+
} else if (progress < 60) {
|
|
399
|
+
progress += 3;
|
|
400
|
+
} else if (progress < 80) {
|
|
401
|
+
progress += 2;
|
|
402
|
+
} else if (progress < 90) {
|
|
403
|
+
progress += 0.5;
|
|
404
|
+
}
|
|
405
|
+
if (progress >= 90) {
|
|
406
|
+
clearInterval(timer);
|
|
407
|
+
}
|
|
408
|
+
onProgress == null ? void 0 : onProgress({ percent: Math.min(90, progress) });
|
|
409
|
+
}, baseTime / 30);
|
|
410
|
+
(0, import_shopUploadServe.uploadFile)(file).then((res) => {
|
|
411
|
+
clearInterval(timer);
|
|
412
|
+
onProgress == null ? void 0 : onProgress({ percent: 95 });
|
|
413
|
+
setTimeout(() => {
|
|
414
|
+
onProgress == null ? void 0 : onProgress({ percent: 100 });
|
|
415
|
+
onSuccess == null ? void 0 : onSuccess(res);
|
|
416
|
+
}, 200);
|
|
417
|
+
}).catch((err) => {
|
|
418
|
+
clearInterval(timer);
|
|
419
|
+
onError == null ? void 0 : onError(err);
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
return {
|
|
423
|
+
customRequest: handleUpload
|
|
424
|
+
};
|
|
425
|
+
}, [isShop]);
|
|
452
426
|
const uploadProps = {
|
|
453
427
|
...restProps,
|
|
454
428
|
multiple,
|
|
@@ -483,7 +457,8 @@ var BaseUpload = (props) => {
|
|
|
483
457
|
}),
|
|
484
458
|
headers: (propsGetHeaders == null ? void 0 : propsGetHeaders()) || (getHeaders == null ? void 0 : getHeaders()),
|
|
485
459
|
beforeUpload,
|
|
486
|
-
className: "pisell-data-source-upload"
|
|
460
|
+
className: "pisell-data-source-upload",
|
|
461
|
+
...customRequest
|
|
487
462
|
};
|
|
488
463
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_pisellUpload.default, { ...uploadProps, fileList }, fileList.length >= calcMaxCount ? null : renderUploadButton(!!enableMultilingual)), /* @__PURE__ */ import_react.default.createElement(
|
|
489
464
|
import_pisellModal.default,
|
|
@@ -33,33 +33,35 @@ __export(WithMode_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(WithMode_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_utils = require("
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_utils2 = require("../../dataSourceForm/utils");
|
|
37
38
|
var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
38
39
|
var import_BaseUpload = __toESM(require("./BaseUpload"));
|
|
39
40
|
var import_serve = require("./serve");
|
|
40
|
-
var
|
|
41
|
+
var import_usePlatform = require("../../hooks/usePlatform");
|
|
41
42
|
var Upload = (props) => {
|
|
42
|
-
const
|
|
43
|
+
const isShop = (0, import_usePlatform.useIsShop)();
|
|
44
|
+
const { presetType, mediaConfig: propsMediaConfig, presetTypeString: propsPresetTypeString } = props;
|
|
43
45
|
const { getExtensionsByIds, getMaxSizeByIds } = (0, import_serve.useMediaTypes)();
|
|
44
46
|
const { data: mediaConfig } = (0, import_serve.useMediaConfig)(propsMediaConfig);
|
|
45
|
-
const presetTypeString = getExtensionsByIds(presetType || []);
|
|
47
|
+
const presetTypeString = isShop ? propsPresetTypeString : getExtensionsByIds(presetType || []);
|
|
46
48
|
const maxSizeMap = getMaxSizeByIds(presetType || []);
|
|
47
49
|
const maxCount = (0, import_react.useMemo)(() => {
|
|
48
50
|
const minArr = [];
|
|
49
|
-
if ((0,
|
|
51
|
+
if ((0, import_utils.isNumber)(mediaConfig == null ? void 0 : mediaConfig.upload_onetime_limit)) {
|
|
50
52
|
minArr.push(mediaConfig == null ? void 0 : mediaConfig.upload_onetime_limit);
|
|
51
53
|
}
|
|
52
|
-
if ((0,
|
|
54
|
+
if ((0, import_utils.isNumber)(props.maxCount)) {
|
|
53
55
|
minArr.push(props.maxCount);
|
|
54
56
|
}
|
|
55
57
|
return Math.min(...minArr);
|
|
56
58
|
}, [mediaConfig, props.maxCount]);
|
|
57
59
|
const maxSize = (0, import_react.useMemo)(() => {
|
|
58
60
|
const minArr = [];
|
|
59
|
-
if ((0,
|
|
61
|
+
if ((0, import_utils.isNumber)(mediaConfig == null ? void 0 : mediaConfig.upload_maxsize)) {
|
|
60
62
|
minArr.push(mediaConfig == null ? void 0 : mediaConfig.upload_maxsize);
|
|
61
63
|
}
|
|
62
|
-
if ((0,
|
|
64
|
+
if ((0, import_utils.isNumber)(props.maxSize)) {
|
|
63
65
|
minArr.push(props.maxSize);
|
|
64
66
|
}
|
|
65
67
|
return Math.min(...minArr);
|
|
@@ -75,5 +77,5 @@ var Upload = (props) => {
|
|
|
75
77
|
}
|
|
76
78
|
);
|
|
77
79
|
};
|
|
78
|
-
var UploadWithMode = (0,
|
|
80
|
+
var UploadWithMode = (0, import_utils2.withMode)(Upload, import_ReadPretty.default);
|
|
79
81
|
var WithMode_default = UploadWithMode;
|
|
@@ -34,10 +34,12 @@ __export(serve_exports, {
|
|
|
34
34
|
useMediaTypes: () => useMediaTypes
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(serve_exports);
|
|
37
|
+
var import_react = require("react");
|
|
37
38
|
var import_ahooks = require("ahooks");
|
|
38
39
|
var import_utils = require("./utils");
|
|
39
40
|
var import_utils2 = require("../../../table/utils");
|
|
40
41
|
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
42
|
+
var import_usePlatform = require("../../hooks/usePlatform");
|
|
41
43
|
var getMediaTypeList = async () => {
|
|
42
44
|
const { data } = await import_utils2.request.getRequest().get(
|
|
43
45
|
`/media_type:list`,
|
|
@@ -64,13 +66,20 @@ var useMediaConfig = (mediaConfig) => {
|
|
|
64
66
|
};
|
|
65
67
|
};
|
|
66
68
|
var useMediaTypes = () => {
|
|
67
|
-
const
|
|
69
|
+
const isShop = (0, import_usePlatform.useIsShop)();
|
|
70
|
+
const { data, run } = (0, import_ahooks.useRequest)(getMediaTypeList, {
|
|
68
71
|
cacheKey: "media-type",
|
|
69
72
|
staleTime: 1e3 * 60 * 5,
|
|
70
73
|
// 5分钟后数据过期
|
|
71
|
-
cacheTime: 1e3 * 60 * 60
|
|
74
|
+
cacheTime: 1e3 * 60 * 60,
|
|
72
75
|
// 1小时后清除缓存
|
|
76
|
+
manual: true
|
|
73
77
|
});
|
|
78
|
+
(0, import_react.useEffect)(() => {
|
|
79
|
+
if (!isShop) {
|
|
80
|
+
run();
|
|
81
|
+
}
|
|
82
|
+
}, [isShop]);
|
|
74
83
|
const getExtensionsByIds = (ids) => {
|
|
75
84
|
const extensions = [];
|
|
76
85
|
(data || []).forEach((item) => {
|