@pisell/private-materials 6.3.32 → 6.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +151 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +23 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -8
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -2
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/components/walletList/index.d.ts +0 -25
- package/es/components/walletList/index.js +98 -66
- package/es/components/walletList/serve.d.ts +4 -0
- package/es/components/walletList/serve.js +46 -13
- package/es/components/walletList/types/index.d.ts +12 -12
- package/es/components/walletList/types/index.js +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
- package/es/plus/productSelect/CategoryTabs/index.js +6 -3
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
- package/es/plus/productSelect/utils.js +0 -1
- package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
- package/es/plus/walletEditor/WalletEditor.js +316 -0
- package/es/plus/walletEditor/WalletEditor.less +129 -0
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
- package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
- package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
- package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
- package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
- package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
- package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
- package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
- package/es/plus/walletEditor/index.d.ts +3 -0
- package/es/plus/walletEditor/index.js +3 -0
- package/es/plus/walletEditor/locales.d.ts +126 -0
- package/es/plus/walletEditor/locales.js +143 -0
- package/es/plus/walletEditor/types.d.ts +52 -0
- package/es/plus/walletEditor/types.js +1 -0
- package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
- package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
- package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
- package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
- package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
- package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
- package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
- package/es/plus/walletPassGallery/components/passList/index.js +115 -0
- package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
- package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
- package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
- package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
- package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
- package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
- package/es/plus/walletPassGallery/index.d.ts +6 -0
- package/es/plus/walletPassGallery/index.js +602 -0
- package/es/plus/walletPassGallery/index.less +115 -0
- package/es/plus/walletPassGallery/locales.d.ts +270 -0
- package/es/plus/walletPassGallery/locales.js +279 -0
- package/es/plus/walletPassGallery/serve.d.ts +218 -0
- package/es/plus/walletPassGallery/serve.js +289 -0
- package/es/pro/Login2.0/AuthModal.js +14 -8
- package/es/pro/Login2.0/Login2.js +52 -28
- package/es/pro/Login2.0/Register2.js +1 -1
- package/es/pro/Login2.0/components/phoneValidation.js +1 -1
- package/es/pro/Login2.0/index.less +11 -2
- package/es/pro/Login2.0/locales.js +112 -112
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/index.d.ts +1 -2
- package/lib/components/index.js +0 -3
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/components/walletList/index.d.ts +0 -25
- package/lib/components/walletList/index.js +90 -51
- package/lib/components/walletList/serve.d.ts +4 -0
- package/lib/components/walletList/serve.js +12 -0
- package/lib/components/walletList/types/index.d.ts +12 -12
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
- package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
- package/lib/plus/productSelect/utils.js +0 -1
- package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
- package/lib/plus/walletEditor/WalletEditor.js +354 -0
- package/lib/plus/walletEditor/WalletEditor.less +129 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
- package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
- package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
- package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
- package/lib/plus/walletEditor/index.d.ts +3 -0
- package/lib/plus/walletEditor/index.js +42 -0
- package/lib/plus/walletEditor/locales.d.ts +126 -0
- package/lib/plus/walletEditor/locales.js +167 -0
- package/lib/plus/walletEditor/types.d.ts +52 -0
- package/lib/plus/walletEditor/types.js +17 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
- package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
- package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
- package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
- package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
- package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
- package/lib/plus/walletPassGallery/index.d.ts +6 -0
- package/lib/plus/walletPassGallery/index.js +498 -0
- package/lib/plus/walletPassGallery/index.less +115 -0
- package/lib/plus/walletPassGallery/locales.d.ts +270 -0
- package/lib/plus/walletPassGallery/locales.js +299 -0
- package/lib/plus/walletPassGallery/serve.d.ts +218 -0
- package/lib/plus/walletPassGallery/serve.js +98 -0
- package/lib/pro/Login2.0/AuthModal.js +16 -11
- package/lib/pro/Login2.0/Login2.js +14 -4
- package/lib/pro/Login2.0/Register2.js +1 -1
- package/lib/pro/Login2.0/components/phoneValidation.js +1 -1
- package/lib/pro/Login2.0/index.less +11 -2
- package/lib/pro/Login2.0/locales.js +112 -112
- package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
- package/lowcode/wallet-editor/meta.ts +57 -0
- package/lowcode/wallet-editor/snippets.ts +13 -0
- package/lowcode/wallet-pass-gallery/meta.ts +35 -0
- package/package.json +4 -4
- package/lowcode/wallet/meta.ts +0 -79
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.wallet-editor {
|
|
2
|
+
.ant-form {
|
|
3
|
+
.ant-form-item {
|
|
4
|
+
margin-bottom: 24px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ant-form-item-label {
|
|
8
|
+
> label {
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
color: #262626;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.display-settings {
|
|
16
|
+
border: 1px solid #d9d9d9;
|
|
17
|
+
border-radius: 6px;
|
|
18
|
+
padding: 16px;
|
|
19
|
+
margin-bottom: 24px;
|
|
20
|
+
|
|
21
|
+
&-header {
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
align-items: center;
|
|
25
|
+
margin-bottom: 16px;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
color: #262626;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-items {
|
|
31
|
+
.display-item {
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
align-items: center;
|
|
35
|
+
padding: 8px 0;
|
|
36
|
+
border-bottom: 1px solid #f0f0f0;
|
|
37
|
+
|
|
38
|
+
&:last-child {
|
|
39
|
+
border-bottom: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.display-toggle {
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
color: #1890ff;
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
color: #40a9ff;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.upload-area {
|
|
56
|
+
border: 2px dashed #d9d9d9;
|
|
57
|
+
border-radius: 6px;
|
|
58
|
+
padding: 32px;
|
|
59
|
+
text-align: center;
|
|
60
|
+
background-color: #fafafa;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
transition: border-color 0.3s;
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
border-color: #1890ff;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.upload-placeholder {
|
|
69
|
+
color: #999;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
line-height: 1.4;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ant-select {
|
|
76
|
+
width: 100%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ant-radio-group {
|
|
80
|
+
display: flex;
|
|
81
|
+
gap: 16px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ant-input,
|
|
85
|
+
.ant-select-selector,
|
|
86
|
+
.ant-picker {
|
|
87
|
+
border-radius: 6px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ant-form-item-required {
|
|
91
|
+
&::before {
|
|
92
|
+
color: #ff4d4f !important;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 响应式设计
|
|
98
|
+
@media (max-width: 768px) {
|
|
99
|
+
.wallet-editor {
|
|
100
|
+
.display-settings {
|
|
101
|
+
padding: 12px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.upload-area {
|
|
105
|
+
padding: 24px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ant-radio-group {
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
gap: 8px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.pisell-wallet-editor_preview-modal {
|
|
116
|
+
|
|
117
|
+
.pisell-lowcode-modal-content {
|
|
118
|
+
background-color: transparent !important;
|
|
119
|
+
box-shadow: none !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.pisell-lowcode-modal-body {
|
|
123
|
+
padding: 0 !important;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.pisell-lowcode-modal-close {
|
|
127
|
+
display: none;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ImageUploadProps {
|
|
3
|
+
value?: string;
|
|
4
|
+
onChange?: (val: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const getBaseTime: (size: number) => 1000 | 2000 | 4000 | 8000;
|
|
7
|
+
declare const ImageUpload: React.FC<ImageUploadProps>;
|
|
8
|
+
export default ImageUpload;
|
|
@@ -0,0 +1,223 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
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
|
+
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import React, { useEffect, useState } from 'react';
|
|
17
|
+
import { Upload, Image } from 'antd';
|
|
18
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
19
|
+
import { PisellUpload } from '@pisell/materials';
|
|
20
|
+
import { locales } from '@pisell/utils';
|
|
21
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
22
|
+
import { uploadFile } from '@pisell/materials/src/components/dataSourceComponents/fields/Upload/shopUploadServe';
|
|
23
|
+
import { request } from '@pisell/materials/src/components/table/utils';
|
|
24
|
+
// 根据文件大小计算上传时间基数(单位:ms)
|
|
25
|
+
export var getBaseTime = function getBaseTime(size) {
|
|
26
|
+
var KB = 1024;
|
|
27
|
+
var MB = KB * 1024;
|
|
28
|
+
if (size < MB) return 1000; // 1MB以下文件基准时间1秒
|
|
29
|
+
if (size < 5 * MB) return 2000; // 1-5MB文件基准时间2秒
|
|
30
|
+
if (size < 20 * MB) return 4000; // 5-20MB文件基准时间4秒
|
|
31
|
+
return 8000; // 大文件基准时间8秒
|
|
32
|
+
};
|
|
33
|
+
var ImageUpload = function ImageUpload(_ref) {
|
|
34
|
+
var _context$appHelper;
|
|
35
|
+
var value = _ref.value,
|
|
36
|
+
onChange = _ref.onChange;
|
|
37
|
+
var context = useEngineContext();
|
|
38
|
+
request.setRequest((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.request);
|
|
39
|
+
var _useState = useState(false),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
uploading = _useState2[0],
|
|
42
|
+
setUploading = _useState2[1];
|
|
43
|
+
var _useState3 = useState([]),
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
fileList = _useState4[0],
|
|
46
|
+
setFileList = _useState4[1];
|
|
47
|
+
var _useState5 = useState(''),
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
previewImage = _useState6[0],
|
|
50
|
+
setPreviewImage = _useState6[1];
|
|
51
|
+
var _useState7 = useState(false),
|
|
52
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
53
|
+
previewOpen = _useState8[0],
|
|
54
|
+
setPreviewOpen = _useState8[1];
|
|
55
|
+
|
|
56
|
+
// 同步外部 value 到内部 fileList,用于展示
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
if (value) {
|
|
59
|
+
setFileList([{
|
|
60
|
+
uid: 'image-0',
|
|
61
|
+
name: 'image',
|
|
62
|
+
status: 'done',
|
|
63
|
+
url: value
|
|
64
|
+
}]);
|
|
65
|
+
} else {
|
|
66
|
+
setFileList([]);
|
|
67
|
+
}
|
|
68
|
+
}, [value]);
|
|
69
|
+
var beforeUpload = /*#__PURE__*/function () {
|
|
70
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
71
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72
|
+
while (1) switch (_context.prev = _context.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
if (file.type.startsWith('image/')) {
|
|
75
|
+
_context.next = 2;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
return _context.abrupt("return", Upload.LIST_IGNORE);
|
|
79
|
+
case 2:
|
|
80
|
+
return _context.abrupt("return", file);
|
|
81
|
+
case 3:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
84
|
+
}
|
|
85
|
+
}, _callee);
|
|
86
|
+
}));
|
|
87
|
+
return function beforeUpload(_x) {
|
|
88
|
+
return _ref2.apply(this, arguments);
|
|
89
|
+
};
|
|
90
|
+
}();
|
|
91
|
+
var handleUpload = function handleUpload(options) {
|
|
92
|
+
var onSuccess = options.onSuccess,
|
|
93
|
+
onError = options.onError,
|
|
94
|
+
onProgress = options.onProgress,
|
|
95
|
+
file = options.file;
|
|
96
|
+
var fileSize = file.size;
|
|
97
|
+
var baseTime = getBaseTime(fileSize);
|
|
98
|
+
var progress = 0;
|
|
99
|
+
|
|
100
|
+
// 模拟初始连接延迟
|
|
101
|
+
setTimeout(function () {
|
|
102
|
+
onProgress === null || onProgress === void 0 || onProgress({
|
|
103
|
+
percent: 1
|
|
104
|
+
});
|
|
105
|
+
}, 200);
|
|
106
|
+
var timer = setInterval(function () {
|
|
107
|
+
// 非线性进度增长
|
|
108
|
+
if (progress < 30) {
|
|
109
|
+
progress += 5; // 前30%快速增长
|
|
110
|
+
} else if (progress < 60) {
|
|
111
|
+
progress += 3; // 30-60%中速增长
|
|
112
|
+
} else if (progress < 80) {
|
|
113
|
+
progress += 2; // 60-80%减缓
|
|
114
|
+
} else if (progress < 90) {
|
|
115
|
+
progress += 0.5; // 80-90%更慢
|
|
116
|
+
}
|
|
117
|
+
if (progress >= 90) {
|
|
118
|
+
clearInterval(timer);
|
|
119
|
+
}
|
|
120
|
+
onProgress === null || onProgress === void 0 || onProgress({
|
|
121
|
+
percent: Math.min(90, progress)
|
|
122
|
+
});
|
|
123
|
+
}, baseTime / 30); // 将总时间分成约30个进度点
|
|
124
|
+
|
|
125
|
+
uploadFile(file).then(function (res) {
|
|
126
|
+
clearInterval(timer);
|
|
127
|
+
// 快速完成最后10%
|
|
128
|
+
onProgress === null || onProgress === void 0 || onProgress({
|
|
129
|
+
percent: 95
|
|
130
|
+
});
|
|
131
|
+
setTimeout(function () {
|
|
132
|
+
onProgress === null || onProgress === void 0 || onProgress({
|
|
133
|
+
percent: 100
|
|
134
|
+
});
|
|
135
|
+
onSuccess === null || onSuccess === void 0 || onSuccess(res);
|
|
136
|
+
}, 200);
|
|
137
|
+
}).catch(function (err) {
|
|
138
|
+
clearInterval(timer);
|
|
139
|
+
onError === null || onError === void 0 || onError(err);
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
var onRemove = function onRemove() {
|
|
143
|
+
setFileList([]);
|
|
144
|
+
onChange === null || onChange === void 0 || onChange('');
|
|
145
|
+
setPreviewImage('');
|
|
146
|
+
setPreviewOpen(false);
|
|
147
|
+
};
|
|
148
|
+
var handlePreview = function handlePreview(file) {
|
|
149
|
+
var url = file.url || file.thumbUrl || '';
|
|
150
|
+
if (!url) return;
|
|
151
|
+
setPreviewImage(url);
|
|
152
|
+
setPreviewOpen(true);
|
|
153
|
+
};
|
|
154
|
+
var handleChange = function handleChange(info) {
|
|
155
|
+
var _file$response$status, _file$response, _file$response3;
|
|
156
|
+
var file = info.file,
|
|
157
|
+
newFileList = info.fileList;
|
|
158
|
+
var updated = newFileList.map(function (item) {
|
|
159
|
+
var _item$response;
|
|
160
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
161
|
+
status: item.status === 'done' && item.response && !((_item$response = item.response) !== null && _item$response !== void 0 && _item$response.status) ? 'error' : item.status
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
setFileList(updated);
|
|
165
|
+
if (file.status === 'uploading') {
|
|
166
|
+
setUploading(true);
|
|
167
|
+
}
|
|
168
|
+
if (file.status === 'done' && ((_file$response$status = (_file$response = file.response) === null || _file$response === void 0 ? void 0 : _file$response.status) !== null && _file$response$status !== void 0 ? _file$response$status : true)) {
|
|
169
|
+
var _file$response2;
|
|
170
|
+
setUploading(false);
|
|
171
|
+
var url = ((_file$response2 = file.response) === null || _file$response2 === void 0 || (_file$response2 = _file$response2.data) === null || _file$response2 === void 0 ? void 0 : _file$response2.url) || file.url || '';
|
|
172
|
+
onChange === null || onChange === void 0 || onChange(url);
|
|
173
|
+
}
|
|
174
|
+
if (file.status === 'error' || file.response && ((_file$response3 = file.response) === null || _file$response3 === void 0 ? void 0 : _file$response3.status) === false) {
|
|
175
|
+
setUploading(false);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(PisellUpload, {
|
|
179
|
+
uploadType: "custom",
|
|
180
|
+
listType: "picture-card",
|
|
181
|
+
multiple: false,
|
|
182
|
+
maxCount: 1,
|
|
183
|
+
accept: "image/*",
|
|
184
|
+
beforeUpload: beforeUpload,
|
|
185
|
+
onChange: handleChange,
|
|
186
|
+
showUploadList: {
|
|
187
|
+
showRemoveIcon: true,
|
|
188
|
+
showPreviewIcon: true,
|
|
189
|
+
showDownloadIcon: false
|
|
190
|
+
},
|
|
191
|
+
fileList: fileList,
|
|
192
|
+
onRemove: onRemove,
|
|
193
|
+
onPreview: handlePreview,
|
|
194
|
+
customRequest: handleUpload
|
|
195
|
+
}, fileList.length >= 1 || uploading ? null : /*#__PURE__*/React.createElement("button", {
|
|
196
|
+
style: {
|
|
197
|
+
color: 'inherit',
|
|
198
|
+
cursor: 'inherit',
|
|
199
|
+
border: 0,
|
|
200
|
+
background: 'none'
|
|
201
|
+
},
|
|
202
|
+
type: "button"
|
|
203
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
style: {
|
|
205
|
+
marginTop: 8
|
|
206
|
+
}
|
|
207
|
+
}, locales.getText('upload')))), previewImage && /*#__PURE__*/React.createElement(Image, {
|
|
208
|
+
wrapperStyle: {
|
|
209
|
+
display: 'none'
|
|
210
|
+
},
|
|
211
|
+
preview: {
|
|
212
|
+
visible: previewOpen,
|
|
213
|
+
onVisibleChange: function onVisibleChange(visible) {
|
|
214
|
+
return setPreviewOpen(visible);
|
|
215
|
+
},
|
|
216
|
+
afterOpenChange: function afterOpenChange(visible) {
|
|
217
|
+
return !visible && setPreviewImage('');
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
src: previewImage
|
|
221
|
+
}));
|
|
222
|
+
};
|
|
223
|
+
export default ImageUpload;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface JsonEditorProps {
|
|
3
|
+
value?: any;
|
|
4
|
+
onChange?: (value: any) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
rows?: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
declare const JsonEditor: React.FC<JsonEditorProps>;
|
|
11
|
+
export default JsonEditor;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState, useEffect } from 'react';
|
|
8
|
+
import { Input } from 'antd';
|
|
9
|
+
var JsonEditor = function JsonEditor(_ref) {
|
|
10
|
+
var value = _ref.value,
|
|
11
|
+
onChange = _ref.onChange,
|
|
12
|
+
_ref$disabled = _ref.disabled,
|
|
13
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
14
|
+
_ref$rows = _ref.rows,
|
|
15
|
+
rows = _ref$rows === void 0 ? 4 : _ref$rows,
|
|
16
|
+
style = _ref.style;
|
|
17
|
+
var _useState = useState(''),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
textValue = _useState2[0],
|
|
20
|
+
setTextValue = _useState2[1];
|
|
21
|
+
var _useState3 = useState(false),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
hasError = _useState4[0],
|
|
24
|
+
setHasError = _useState4[1];
|
|
25
|
+
|
|
26
|
+
// 初始化和同步外部value到内部文本
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (value !== undefined) {
|
|
29
|
+
try {
|
|
30
|
+
setTextValue(JSON.stringify(value, null, 2));
|
|
31
|
+
setHasError(false);
|
|
32
|
+
} catch (_unused) {
|
|
33
|
+
setTextValue('');
|
|
34
|
+
setHasError(false);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
setTextValue('');
|
|
38
|
+
setHasError(false);
|
|
39
|
+
}
|
|
40
|
+
}, [value]);
|
|
41
|
+
var handleTextChange = function handleTextChange(e) {
|
|
42
|
+
var newText = e.target.value;
|
|
43
|
+
setTextValue(newText);
|
|
44
|
+
if (!newText.trim()) {
|
|
45
|
+
setHasError(false);
|
|
46
|
+
onChange === null || onChange === void 0 || onChange(undefined);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
var parsedValue = JSON.parse(newText);
|
|
51
|
+
setHasError(false);
|
|
52
|
+
onChange === null || onChange === void 0 || onChange(parsedValue);
|
|
53
|
+
} catch (_unused2) {
|
|
54
|
+
setHasError(true);
|
|
55
|
+
// 不调用onChange,保持原有值
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
59
|
+
style: style,
|
|
60
|
+
value: textValue,
|
|
61
|
+
onChange: handleTextChange,
|
|
62
|
+
rows: rows,
|
|
63
|
+
disabled: disabled,
|
|
64
|
+
status: hasError ? 'error' : undefined,
|
|
65
|
+
allowClear: true
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
export default JsonEditor;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type ValidityPeriodValue = {
|
|
3
|
+
type: 'normal';
|
|
4
|
+
unit: string;
|
|
5
|
+
unit_type: 'day' | 'month' | 'year';
|
|
6
|
+
} | {
|
|
7
|
+
type: 'custom';
|
|
8
|
+
custom_date?: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'forever';
|
|
11
|
+
};
|
|
12
|
+
export interface ValidityPeriodSelectorProps {
|
|
13
|
+
value?: ValidityPeriodValue;
|
|
14
|
+
onChange?: (value: ValidityPeriodValue) => void;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
options?: readonly ValidityPeriodValue[];
|
|
18
|
+
}
|
|
19
|
+
declare const ValidityPeriodSelector: React.FC<ValidityPeriodSelectorProps>;
|
|
20
|
+
export default ValidityPeriodSelector;
|