@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,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withWrap } from "../../utils/hoc";
|
|
3
|
+
import { Card, Flex } from 'antd';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import "./index.less";
|
|
6
|
+
var CardPro = function CardPro(props) {
|
|
7
|
+
var headTitle = props.headTitle,
|
|
8
|
+
headSubTitle = props.headSubTitle,
|
|
9
|
+
_props$isShowFooter = props.isShowFooter,
|
|
10
|
+
isShowFooter = _props$isShowFooter === void 0 ? true : _props$isShowFooter,
|
|
11
|
+
contentHeight = props.contentHeight,
|
|
12
|
+
children = props.children,
|
|
13
|
+
_props$actionButtons = props.actionButtons,
|
|
14
|
+
actionButtons = _props$actionButtons === void 0 ? [] : _props$actionButtons,
|
|
15
|
+
_props$buttonPosition = props.buttonPosition,
|
|
16
|
+
buttonPosition = _props$buttonPosition === void 0 ? 'center' : _props$buttonPosition,
|
|
17
|
+
cover = props.cover,
|
|
18
|
+
extra = props.extra,
|
|
19
|
+
isShowHead = props.isShowHead,
|
|
20
|
+
className = props.className,
|
|
21
|
+
coverHeight = props.coverHeight,
|
|
22
|
+
badge = props.badge;
|
|
23
|
+
return /*#__PURE__*/React.createElement(Card, {
|
|
24
|
+
title: null,
|
|
25
|
+
style: {
|
|
26
|
+
padding: 0
|
|
27
|
+
},
|
|
28
|
+
className: classNames('pisell-cardPro-wrap', className, cover && 'pisell-cardPro-wrap-with-cover')
|
|
29
|
+
}, !!cover && /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: classNames('pisell-cardPro-cover'),
|
|
31
|
+
style: {
|
|
32
|
+
height: coverHeight
|
|
33
|
+
}
|
|
34
|
+
}, cover, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: classNames('pisell-cardPro-badge')
|
|
36
|
+
}, badge)), isShowHead && /*#__PURE__*/React.createElement(Flex, {
|
|
37
|
+
className: classNames('pisell-cardPro-head'),
|
|
38
|
+
justify: "space-between"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
40
|
+
style: {
|
|
41
|
+
flex: 1
|
|
42
|
+
},
|
|
43
|
+
vertical: true,
|
|
44
|
+
gap: "middle"
|
|
45
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: classNames('pisell-cardPro-head-title')
|
|
47
|
+
}, headTitle), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: classNames('pisell-cardPro-head-subTitle')
|
|
49
|
+
}, headSubTitle)), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: classNames('pisell-cardPro-head-extra')
|
|
51
|
+
}, extra)), /*#__PURE__*/React.createElement(Flex, {
|
|
52
|
+
style: {
|
|
53
|
+
height: contentHeight
|
|
54
|
+
},
|
|
55
|
+
className: classNames('pisell-cardPro-content')
|
|
56
|
+
}, children), isShowFooter && /*#__PURE__*/React.createElement(Flex, {
|
|
57
|
+
gap: 20,
|
|
58
|
+
justify: buttonPosition,
|
|
59
|
+
style: {
|
|
60
|
+
marginTop: 20
|
|
61
|
+
}
|
|
62
|
+
}, actionButtons.map(function (item, index) {
|
|
63
|
+
return item.button;
|
|
64
|
+
})));
|
|
65
|
+
};
|
|
66
|
+
export default withWrap(CardPro);
|
|
@@ -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,72 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { Upload } from 'antd';
|
|
13
|
+
import ImgCrop from 'antd-img-crop';
|
|
14
|
+
var CropPhoto = function CropPhoto(props) {
|
|
15
|
+
var cropShape = props.cropShape; // 裁剪形状
|
|
16
|
+
var _useState = useState([]),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
fileList = _useState2[0],
|
|
19
|
+
setFileList = _useState2[1];
|
|
20
|
+
var onChange = function onChange(_ref) {
|
|
21
|
+
var newFileList = _ref.fileList;
|
|
22
|
+
setFileList(newFileList);
|
|
23
|
+
};
|
|
24
|
+
var onPreview = /*#__PURE__*/function () {
|
|
25
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
26
|
+
var src, image, imgWindow;
|
|
27
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
src = file.url;
|
|
31
|
+
if (src) {
|
|
32
|
+
_context.next = 5;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
_context.next = 4;
|
|
36
|
+
return new Promise(function (resolve) {
|
|
37
|
+
var reader = new FileReader();
|
|
38
|
+
reader.readAsDataURL(file.originFileObj);
|
|
39
|
+
reader.onload = function () {
|
|
40
|
+
return resolve(reader.result);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
case 4:
|
|
44
|
+
src = _context.sent;
|
|
45
|
+
case 5:
|
|
46
|
+
image = new Image();
|
|
47
|
+
image.src = src;
|
|
48
|
+
imgWindow = window.open(src);
|
|
49
|
+
imgWindow === null || imgWindow === void 0 || imgWindow.document.write(image.outerHTML);
|
|
50
|
+
case 9:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
}));
|
|
56
|
+
return function onPreview(_x) {
|
|
57
|
+
return _ref2.apply(this, arguments);
|
|
58
|
+
};
|
|
59
|
+
}();
|
|
60
|
+
return /*#__PURE__*/React.createElement(ImgCrop, {
|
|
61
|
+
rotationSlider: true,
|
|
62
|
+
aspectSlider: true,
|
|
63
|
+
cropShape: cropShape
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Upload, {
|
|
65
|
+
action: "https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload",
|
|
66
|
+
listType: "picture-card",
|
|
67
|
+
fileList: fileList,
|
|
68
|
+
onChange: onChange,
|
|
69
|
+
onPreview: onPreview
|
|
70
|
+
}, fileList.length < 5 && '+ Upload'));
|
|
71
|
+
};
|
|
72
|
+
export 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;
|
|
@@ -7,7 +7,7 @@ import BaseMenu from "../../pisellMenu";
|
|
|
7
7
|
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
8
8
|
*/
|
|
9
9
|
var DataSourceMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
10
|
-
var _appHelper$utils, _appHelper$utils$getA2;
|
|
10
|
+
var _appHelper$utils, _appHelper$utils$getA2, _appHelper$utils2, _appHelper$utils2$get;
|
|
11
11
|
var _useEngineContext = useEngineContext(),
|
|
12
12
|
appHelper = _useEngineContext.appHelper;
|
|
13
13
|
var _appHelper$utils$getA = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 || (_appHelper$utils$getA2 = _appHelper$utils.getApp) === null || _appHelper$utils$getA2 === void 0 || (_appHelper$utils$getA2 = _appHelper$utils$getA2.call(_appHelper$utils)) === null || _appHelper$utils$getA2 === void 0 || (_appHelper$utils$getA2 = _appHelper$utils$getA2.menuManager) === null || _appHelper$utils$getA2 === void 0 ? void 0 : _appHelper$utils$getA2.useMenu(),
|
|
@@ -17,6 +17,16 @@ var DataSourceMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
17
17
|
setOpenKeys = _appHelper$utils$getA.setOpenKeys,
|
|
18
18
|
getShowChildren = _appHelper$utils$getA.getShowChildren,
|
|
19
19
|
handleClick = _appHelper$utils$getA.handleClick;
|
|
20
|
+
var translation = (appHelper === null || appHelper === void 0 || (_appHelper$utils2 = appHelper.utils) === null || _appHelper$utils2 === void 0 || (_appHelper$utils2$get = _appHelper$utils2.getApp) === null || _appHelper$utils2$get === void 0 || (_appHelper$utils2$get = _appHelper$utils2$get.call(_appHelper$utils2)) === null || _appHelper$utils2$get === void 0 || (_appHelper$utils2$get = _appHelper$utils2$get.locales) === null || _appHelper$utils2$get === void 0 ? void 0 : _appHelper$utils2$get.translation) || function (str) {
|
|
21
|
+
if (!str) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
if (typeof str === 'string') {
|
|
25
|
+
return str;
|
|
26
|
+
}
|
|
27
|
+
return JSON.stringify(str);
|
|
28
|
+
};
|
|
29
|
+
|
|
20
30
|
// 递归渲染菜单项
|
|
21
31
|
var renderMenuItems = function renderMenuItems(items) {
|
|
22
32
|
return items.map(function (item) {
|
|
@@ -27,7 +37,7 @@ var DataSourceMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
27
37
|
if (_children !== null && _children !== void 0 && _children.length) {
|
|
28
38
|
return /*#__PURE__*/React.createElement(BaseMenu.SubMenu, {
|
|
29
39
|
key: item.key,
|
|
30
|
-
title: item.label,
|
|
40
|
+
title: translation(item.label),
|
|
31
41
|
icon: item.icon,
|
|
32
42
|
router: item.path
|
|
33
43
|
}, renderMenuItems(_children));
|
|
@@ -36,7 +46,7 @@ var DataSourceMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
36
46
|
key: item.key,
|
|
37
47
|
icon: item.icon,
|
|
38
48
|
router: item.path
|
|
39
|
-
}, item.label);
|
|
49
|
+
}, translation(item.label));
|
|
40
50
|
});
|
|
41
51
|
};
|
|
42
52
|
return /*#__PURE__*/React.createElement(BaseMenu, _extends({
|
|
@@ -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["enableQRScanner", "value", "onChange", "renderMode", "innerRef"];
|
|
1
|
+
var _excluded = ["enableQRScanner", "value", "onChange", "renderMode", "innerRef", "className"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -21,6 +21,7 @@ var Input = function Input(props) {
|
|
|
21
21
|
onChange = props.onChange,
|
|
22
22
|
renderMode = props.renderMode,
|
|
23
23
|
innerRef = props.innerRef,
|
|
24
|
+
className = props.className,
|
|
24
25
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
25
26
|
|
|
26
27
|
// 使用内部状态来管理输入值
|
|
@@ -114,8 +115,30 @@ var Input = function Input(props) {
|
|
|
114
115
|
if (renderMode === 'view' || renderMode === 'tableView') {
|
|
115
116
|
return /*#__PURE__*/React.createElement(ReadPretty, props);
|
|
116
117
|
}
|
|
118
|
+
|
|
119
|
+
// 注入自定义样式到文档
|
|
120
|
+
useEffect(function () {
|
|
121
|
+
if (enableQRScanner) {
|
|
122
|
+
// 创建一个样式元素
|
|
123
|
+
var styleEl = document.createElement('style');
|
|
124
|
+
styleEl.id = 'pisell-qr-scanner-style';
|
|
125
|
+
styleEl.innerHTML = "\n .pisell-input-with-scanner .pisell-lowcode-input-group .pisell-lowcode-input-group-addon {\n background-color: var(--primary-600, #7F56D9);\n }\n ";
|
|
126
|
+
|
|
127
|
+
// 添加到文档中
|
|
128
|
+
document.head.appendChild(styleEl);
|
|
129
|
+
|
|
130
|
+
// 清理函数
|
|
131
|
+
return function () {
|
|
132
|
+
var existingStyle = document.getElementById('pisell-qr-scanner-style');
|
|
133
|
+
if (existingStyle) {
|
|
134
|
+
document.head.removeChild(existingStyle);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}, [enableQRScanner]);
|
|
117
139
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AntInput, _extends({}, restProps, {
|
|
118
140
|
ref: innerRef || undefined,
|
|
141
|
+
className: "".concat(className || '', " ").concat(enableQRScanner ? 'pisell-input-with-scanner' : ''),
|
|
119
142
|
addonAfter: scanSuffix,
|
|
120
143
|
value: inputValue,
|
|
121
144
|
onChange: handleInputChange
|
|
@@ -7,8 +7,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
import { useEffect, useMemo } from 'react';
|
|
10
11
|
import { useRequest } from 'ahooks';
|
|
11
12
|
import { request } from "../../../table/utils";
|
|
13
|
+
import { useIsShop } from "../../hooks/usePlatform";
|
|
14
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* 获取nocobase数据列表
|
|
@@ -46,14 +49,39 @@ export var getCountryDataList = /*#__PURE__*/function () {
|
|
|
46
49
|
};
|
|
47
50
|
}();
|
|
48
51
|
export var useCountries = function useCountries() {
|
|
52
|
+
var isShop = useIsShop();
|
|
53
|
+
var _useEngineContext = useEngineContext(),
|
|
54
|
+
appHelper = _useEngineContext.appHelper;
|
|
49
55
|
var _useRequest = useRequest(getCountryDataList, {
|
|
50
56
|
cacheKey: 'phone-countries',
|
|
51
57
|
staleTime: 1000 * 60 * 5,
|
|
52
58
|
// 5分钟后数据过期
|
|
53
|
-
cacheTime: 1000 * 60 * 60
|
|
59
|
+
cacheTime: 1000 * 60 * 60,
|
|
60
|
+
// 1小时后清除缓存
|
|
61
|
+
manual: true
|
|
54
62
|
}),
|
|
55
|
-
data = _useRequest.data
|
|
63
|
+
data = _useRequest.data,
|
|
64
|
+
run = _useRequest.run;
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (!isShop) {
|
|
67
|
+
run();
|
|
68
|
+
}
|
|
69
|
+
}, [isShop]);
|
|
70
|
+
var currentData = useMemo(function () {
|
|
71
|
+
if (isShop) {
|
|
72
|
+
var _appHelper$utils;
|
|
73
|
+
var codeList = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 || (_appHelper$utils = _appHelper$utils.store) === null || _appHelper$utils === void 0 || (_appHelper$utils = _appHelper$utils.getState()) === null || _appHelper$utils === void 0 || (_appHelper$utils = _appHelper$utils.global) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.codeList;
|
|
74
|
+
if (codeList) {
|
|
75
|
+
return codeList.map(function (item) {
|
|
76
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
77
|
+
prefix: "+".concat(item.calling_code)
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return data;
|
|
83
|
+
}, [isShop, data]);
|
|
56
84
|
return {
|
|
57
|
-
data:
|
|
85
|
+
data: currentData
|
|
58
86
|
};
|
|
59
87
|
};
|
|
@@ -7,8 +7,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
import { useEffect, useMemo } from "react";
|
|
10
11
|
import { useRequest } from 'ahooks';
|
|
11
12
|
import { request } from "../../../table/utils";
|
|
13
|
+
import { useIsShop } from "../../hooks/usePlatform";
|
|
14
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* 获取nocobase数据列表
|
|
@@ -46,14 +49,39 @@ export var getCountryDataList = /*#__PURE__*/function () {
|
|
|
46
49
|
};
|
|
47
50
|
}();
|
|
48
51
|
export var useCountries = function useCountries() {
|
|
52
|
+
var isShop = useIsShop();
|
|
53
|
+
var _useEngineContext = useEngineContext(),
|
|
54
|
+
appHelper = _useEngineContext.appHelper;
|
|
49
55
|
var _useRequest = useRequest(getCountryDataList, {
|
|
50
56
|
cacheKey: 'phone-countries',
|
|
51
57
|
staleTime: 1000 * 60 * 5,
|
|
52
58
|
// 5分钟后数据过期
|
|
53
|
-
cacheTime: 1000 * 60 * 60
|
|
59
|
+
cacheTime: 1000 * 60 * 60,
|
|
60
|
+
// 1小时后清除缓存
|
|
61
|
+
manual: true
|
|
54
62
|
}),
|
|
55
|
-
data = _useRequest.data
|
|
63
|
+
data = _useRequest.data,
|
|
64
|
+
run = _useRequest.run;
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (!isShop) {
|
|
67
|
+
run();
|
|
68
|
+
}
|
|
69
|
+
}, [isShop]);
|
|
70
|
+
var currentData = useMemo(function () {
|
|
71
|
+
if (isShop) {
|
|
72
|
+
var _appHelper$utils;
|
|
73
|
+
var codeList = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 || (_appHelper$utils = _appHelper$utils.store) === null || _appHelper$utils === void 0 || (_appHelper$utils = _appHelper$utils.getState()) === null || _appHelper$utils === void 0 || (_appHelper$utils = _appHelper$utils.global) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.codeList;
|
|
74
|
+
if (codeList) {
|
|
75
|
+
return codeList.map(function (item) {
|
|
76
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
77
|
+
prefix: "+".concat(item.calling_code)
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return data;
|
|
83
|
+
}, [isShop, data]);
|
|
56
84
|
return {
|
|
57
|
-
data:
|
|
85
|
+
data: currentData
|
|
58
86
|
};
|
|
59
87
|
};
|
|
@@ -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;
|