@pisell/materials 1.0.663 → 1.0.664
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 +6 -6
- package/build/lowcode/preview.js +5 -5
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +8 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.d.ts +11 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +48 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +98 -0
- package/es/components/dataSourceComponents/fields/Input/WithMode.d.ts +6 -20
- package/es/components/dataSourceComponents/fields/Input/WithMode.js +204 -463
- package/es/components/dataSourceComponents/fields/Input/index.d.ts +22 -0
- package/es/components/dataSourceComponents/fields/Input/index.js +6 -19
- package/es/components/dataSourceComponents/fields/Input/type.d.ts +8 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +10 -9
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +18 -0
- package/es/components/pisellScan/index.js +3 -17
- package/es/components/productCard/hooks/useOpenNote.d.ts +3 -0
- package/es/components/productCard/index.d.ts +5 -0
- package/es/index.d.ts +139 -0
- package/es/locales/en-US.js +1 -1
- package/es/locales/zh-CN.js +2 -2
- package/es/locales/zh-TW.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +8 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.d.ts +11 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +48 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +98 -0
- package/lib/components/dataSourceComponents/fields/Input/WithMode.d.ts +6 -20
- package/lib/components/dataSourceComponents/fields/Input/WithMode.js +101 -317
- package/lib/components/dataSourceComponents/fields/Input/index.d.ts +22 -0
- package/lib/components/dataSourceComponents/fields/Input/index.js +3 -13
- package/lib/components/dataSourceComponents/fields/Input/type.d.ts +8 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +10 -9
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +18 -0
- package/lib/components/pisellScan/index.js +3 -9
- package/lib/components/productCard/hooks/useOpenNote.d.ts +3 -0
- package/lib/components/productCard/index.d.ts +5 -0
- package/lib/index.d.ts +139 -0
- package/lib/locales/en-US.js +1 -9
- package/lib/locales/zh-CN.js +2 -10
- package/lib/locales/zh-TW.js +1 -9
- package/lowcode/form-item-input/meta.ts +5 -97
- package/lowcode/form-item-input/snippets.ts +1 -0
- package/package.json +3 -3
|
@@ -35,339 +35,123 @@ module.exports = __toCommonJS(WithMode_exports);
|
|
|
35
35
|
var import_antd = require("antd");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_icons = require("@ant-design/icons");
|
|
38
|
-
var
|
|
38
|
+
var import_antd2 = require("antd");
|
|
39
39
|
var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
40
40
|
var import_utils = require("../../dataSourceForm/utils");
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
var isMobileOrTablet = () => {
|
|
42
|
+
if (typeof window === "undefined") return false;
|
|
43
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
44
|
+
};
|
|
45
45
|
var Input = (props) => {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (props.value !== void 0) {
|
|
55
|
-
if (isDevelopEnv) {
|
|
56
|
-
console.log("[Input.WithMode] props.value变化:", props.value);
|
|
57
|
-
}
|
|
58
|
-
setDebugValue(props.value);
|
|
59
|
-
}
|
|
60
|
-
}, [props.value]);
|
|
61
|
-
const handleChange = (e) => {
|
|
62
|
-
if (e && e.target) {
|
|
63
|
-
setDebugValue(e.target.value);
|
|
64
|
-
} else if (e === "" || e === null || e === void 0) {
|
|
65
|
-
setDebugValue("");
|
|
66
|
-
}
|
|
67
|
-
if (props.onChange) {
|
|
68
|
-
props.onChange(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const {
|
|
72
|
-
allowScan = false,
|
|
73
|
-
// 默认不允许扫描
|
|
74
|
-
scanCodeType = "all",
|
|
75
|
-
// 默认扫描全部类型
|
|
76
|
-
...restProps
|
|
77
|
-
} = props;
|
|
78
|
-
const formatMap = {
|
|
79
|
-
all: [import_library.BarcodeFormat.QR_CODE, import_library.BarcodeFormat.EAN_8, import_library.BarcodeFormat.EAN_13, import_library.BarcodeFormat.CODE_128, import_library.BarcodeFormat.CODE_39, import_library.BarcodeFormat.CODE_93],
|
|
80
|
-
qrcode: [import_library.BarcodeFormat.QR_CODE],
|
|
81
|
-
barcode: [import_library.BarcodeFormat.EAN_8, import_library.BarcodeFormat.EAN_13, import_library.BarcodeFormat.CODE_128, import_library.BarcodeFormat.CODE_39, import_library.BarcodeFormat.CODE_93]
|
|
82
|
-
};
|
|
83
|
-
const formats = (0, import_react.useMemo)(() => {
|
|
84
|
-
if (scanCodeType === "qrcode") {
|
|
85
|
-
return formatMap.qrcode;
|
|
86
|
-
} else if (scanCodeType === "barcode") {
|
|
87
|
-
return formatMap.barcode;
|
|
88
|
-
} else {
|
|
89
|
-
return formatMap.all;
|
|
90
|
-
}
|
|
91
|
-
}, [scanCodeType]);
|
|
92
|
-
const getScanTypeText = (0, import_react.useMemo)(() => {
|
|
93
|
-
if (isDevelopEnv) {
|
|
94
|
-
console.log("[Input.WithMode] 当前扫码类型:", scanCodeType);
|
|
95
|
-
}
|
|
96
|
-
if (scanCodeType === "qrcode") {
|
|
97
|
-
return (0, import_locales.getText)("scan.qrcode");
|
|
98
|
-
} else if (scanCodeType === "barcode") {
|
|
99
|
-
return (0, import_locales.getText)("scan.barcode");
|
|
100
|
-
} else {
|
|
101
|
-
return (0, import_locales.getText)("scan.all");
|
|
102
|
-
}
|
|
103
|
-
}, [scanCodeType]);
|
|
104
|
-
const getBackText = (0, import_locales.getText)("scan.back");
|
|
105
|
-
const getFromAlbumText = (0, import_locales.getText)("scan.fromAlbum");
|
|
106
|
-
const handleScan = (value, barcodeFormat, isValidType) => {
|
|
107
|
-
var _a, _b, _c, _d;
|
|
108
|
-
if (isDevelopEnv) {
|
|
109
|
-
console.log("[Input.WithMode] 扫码结果:", value, "码类型:", barcodeFormat, "是否有效类型:", isValidType);
|
|
110
|
-
}
|
|
111
|
-
if (!value) {
|
|
112
|
-
console.warn("[Input.WithMode] 扫码结果为空");
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (isValidType === false) {
|
|
116
|
-
setScanVisible(false);
|
|
117
|
-
setFullScreenMode(false);
|
|
118
|
-
(_b = (_a = scanRef.current) == null ? void 0 : _a.codeReader) == null ? void 0 : _b.reset();
|
|
119
|
-
const errorMsg = scanCodeType === "qrcode" ? (0, import_locales.getText)("scan.qrcodeOnlyError") : (0, import_locales.getText)("scan.barcodeOnlyError");
|
|
120
|
-
import_antd.message.error(errorMsg || `不符合当前扫码类型要求,请扫描${getScanTypeText}`);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
setScanVisible(false);
|
|
124
|
-
setFullScreenMode(false);
|
|
125
|
-
(_d = (_c = scanRef.current) == null ? void 0 : _c.codeReader) == null ? void 0 : _d.reset();
|
|
126
|
-
handleChange({ target: { value } });
|
|
127
|
-
};
|
|
128
|
-
const exitFullScreenScan = () => {
|
|
129
|
-
var _a, _b;
|
|
130
|
-
if (document.exitFullscreen) {
|
|
131
|
-
document.exitFullscreen().catch((err) => {
|
|
132
|
-
console.error("退出全屏失败:", err);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
setFullScreenMode(false);
|
|
136
|
-
setScanVisible(false);
|
|
137
|
-
(_b = (_a = scanRef.current) == null ? void 0 : _a.codeReader) == null ? void 0 : _b.reset();
|
|
138
|
-
};
|
|
139
|
-
const handleScanClick = () => {
|
|
140
|
-
if (isDevelopEnv) {
|
|
141
|
-
console.log("[Input.WithMode] 点击扫码按钮,当前扫码类型:", scanCodeType, "标题:", getScanTypeText);
|
|
142
|
-
}
|
|
143
|
-
if (isH5) {
|
|
144
|
-
setScanVisible(true);
|
|
145
|
-
setFullScreenMode(true);
|
|
146
|
-
setTimeout(() => {
|
|
147
|
-
if (scanContainerRef.current && scanContainerRef.current.requestFullscreen) {
|
|
148
|
-
scanContainerRef.current.requestFullscreen().catch((err) => {
|
|
149
|
-
console.error("进入全屏失败:", err);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}, 100);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const handleImageSelect = async (file) => {
|
|
156
|
-
if (isDevelopEnv) {
|
|
157
|
-
console.log("[handleImageSelect] 选择图片:", file);
|
|
158
|
-
}
|
|
159
|
-
if (!file.type.includes("image/")) {
|
|
160
|
-
import_antd.message.error("请选择图片文件");
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
46
|
+
const { enableQRScanner, onChange, suffix, ...restProps } = props;
|
|
47
|
+
const fileInputRef = (0, import_react.useRef)(null);
|
|
48
|
+
const [isProcessing, setIsProcessing] = (0, import_react.useState)(false);
|
|
49
|
+
const showQRScanner = enableQRScanner && isMobileOrTablet();
|
|
50
|
+
const handleFileChange = async (e) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
53
|
+
if (!file || isProcessing) return;
|
|
163
54
|
try {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
const url = URL.createObjectURL(file);
|
|
55
|
+
setIsProcessing(true);
|
|
56
|
+
import_antd2.message.loading("正在识别二维码...", 0);
|
|
57
|
+
const zxingLibrary = await import("@zxing/library");
|
|
58
|
+
const { BinaryBitmap, HybridBinarizer, RGBLuminanceSource, MultiFormatReader, BarcodeFormat, DecodeHintType } = zxingLibrary;
|
|
170
59
|
const img = new Image();
|
|
171
|
-
img.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const ctx = canvas.getContext("2d");
|
|
175
|
-
canvas.width = img.width;
|
|
176
|
-
canvas.height = img.height;
|
|
177
|
-
ctx == null ? void 0 : ctx.drawImage(img, 0, 0, img.width, img.height);
|
|
178
|
-
const hints = /* @__PURE__ */ new Map();
|
|
179
|
-
if (formats && formats.length > 0) {
|
|
180
|
-
hints.set(2, formats);
|
|
181
|
-
}
|
|
182
|
-
const reader = new import_library.BrowserMultiFormatReader(hints);
|
|
183
|
-
try {
|
|
184
|
-
const result = await reader.decodeFromImage(img);
|
|
185
|
-
const barcodeFormat = result.getBarcodeFormat();
|
|
186
|
-
const isValidType = !formats || formats.length === 0 || formats.includes(barcodeFormat);
|
|
187
|
-
if (!isValidType) {
|
|
188
|
-
const errorMsg = scanCodeType === "qrcode" ? (0, import_locales.getText)("scan.qrcodeOnlyError") : (0, import_locales.getText)("scan.barcodeOnlyError");
|
|
189
|
-
import_antd.message.error({
|
|
190
|
-
content: errorMsg || `不符合当前扫码类型要求,请扫描${getScanTypeText}`,
|
|
191
|
-
key: "scanLoading"
|
|
192
|
-
});
|
|
193
|
-
} else {
|
|
194
|
-
import_antd.message.success({
|
|
195
|
-
content: "识别成功",
|
|
196
|
-
key: "scanLoading"
|
|
197
|
-
});
|
|
198
|
-
setScanVisible(false);
|
|
199
|
-
setFullScreenMode(false);
|
|
200
|
-
handleChange({ target: { value: result.getText() } });
|
|
201
|
-
}
|
|
202
|
-
} catch (error) {
|
|
203
|
-
console.error("[handleImageSelect] 扫描图片失败:", error);
|
|
204
|
-
import_antd.message.error({
|
|
205
|
-
content: "未能识别二维码/条形码",
|
|
206
|
-
key: "scanLoading"
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
} catch (error) {
|
|
210
|
-
console.error("[handleImageSelect] 扫描图片失败:", error);
|
|
211
|
-
import_antd.message.error({
|
|
212
|
-
content: "未能识别二维码/条形码",
|
|
213
|
-
key: "scanLoading"
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
URL.revokeObjectURL(url);
|
|
217
|
-
};
|
|
218
|
-
img.onerror = () => {
|
|
219
|
-
URL.revokeObjectURL(url);
|
|
220
|
-
import_antd.message.error({
|
|
221
|
-
content: "图片加载失败",
|
|
222
|
-
key: "scanLoading"
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
img.src = url;
|
|
226
|
-
} catch (error) {
|
|
227
|
-
console.error("[handleImageSelect] 处理图片失败:", error);
|
|
228
|
-
import_antd.message.error({
|
|
229
|
-
content: "处理图片失败",
|
|
230
|
-
key: "scanLoading"
|
|
60
|
+
img.src = URL.createObjectURL(file);
|
|
61
|
+
await new Promise((resolve) => {
|
|
62
|
+
img.onload = resolve;
|
|
231
63
|
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
import_antd.Input,
|
|
237
|
-
{
|
|
238
|
-
...restProps,
|
|
239
|
-
ref: props.innerRef || void 0,
|
|
240
|
-
style: {
|
|
241
|
-
...props.style,
|
|
242
|
-
flex: 1,
|
|
243
|
-
...allowScan && isH5 ? {
|
|
244
|
-
borderTopRightRadius: 0,
|
|
245
|
-
borderBottomRightRadius: 0,
|
|
246
|
-
borderRight: 0
|
|
247
|
-
} : {}
|
|
248
|
-
},
|
|
249
|
-
onChange: handleChange,
|
|
250
|
-
value: debugValue,
|
|
251
|
-
allowClear: props.allowClear !== false
|
|
252
|
-
}
|
|
253
|
-
), allowScan && isH5 && /* @__PURE__ */ import_react.default.createElement(
|
|
254
|
-
import_antd.Button,
|
|
255
|
-
{
|
|
256
|
-
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.ScanOutlined, null),
|
|
257
|
-
onClick: handleScanClick,
|
|
258
|
-
style: {
|
|
259
|
-
borderTopLeftRadius: 0,
|
|
260
|
-
borderBottomLeftRadius: 0,
|
|
261
|
-
height: "auto"
|
|
64
|
+
const canvas = document.createElement("canvas");
|
|
65
|
+
const ctx = canvas.getContext("2d");
|
|
66
|
+
if (!ctx) {
|
|
67
|
+
throw new Error("无法创建canvas上下文");
|
|
262
68
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
69
|
+
canvas.width = img.width;
|
|
70
|
+
canvas.height = img.height;
|
|
71
|
+
ctx.drawImage(img, 0, 0);
|
|
72
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
73
|
+
const luminanceSource = new RGBLuminanceSource(
|
|
74
|
+
imageData.data,
|
|
75
|
+
imageData.width,
|
|
76
|
+
imageData.height
|
|
77
|
+
);
|
|
78
|
+
const binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));
|
|
79
|
+
const hints = /* @__PURE__ */ new Map();
|
|
80
|
+
hints.set(DecodeHintType.POSSIBLE_FORMATS, [BarcodeFormat.QR_CODE]);
|
|
81
|
+
const reader = new MultiFormatReader();
|
|
82
|
+
reader.setHints(hints);
|
|
83
|
+
const result = reader.decode(binaryBitmap);
|
|
84
|
+
const scannedText = result.getText();
|
|
85
|
+
import_antd2.message.destroy();
|
|
86
|
+
if (onChange) {
|
|
87
|
+
onChange({ target: { value: scannedText } });
|
|
88
|
+
import_antd2.message.success("扫码成功");
|
|
279
89
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
console.log("[Input.WithMode] 当前平台: PC");
|
|
289
|
-
window.__DEBUG_INPUT_PROPS__ = props;
|
|
90
|
+
} catch (error) {
|
|
91
|
+
import_antd2.message.destroy();
|
|
92
|
+
console.error("解码失败:", error);
|
|
93
|
+
import_antd2.message.error("无法识别二维码,请重试");
|
|
94
|
+
} finally {
|
|
95
|
+
setIsProcessing(false);
|
|
96
|
+
if (fileInputRef.current) {
|
|
97
|
+
fileInputRef.current.value = "";
|
|
290
98
|
}
|
|
291
99
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}, [platform, allowScan, scanCodeType, formats]);
|
|
297
|
-
(0, import_react.useEffect)(() => {
|
|
298
|
-
const handleFullscreenChange = () => {
|
|
299
|
-
var _a, _b;
|
|
300
|
-
if (!document.fullscreenElement && fullScreenMode) {
|
|
301
|
-
setFullScreenMode(false);
|
|
302
|
-
setScanVisible(false);
|
|
303
|
-
(_b = (_a = scanRef.current) == null ? void 0 : _a.codeReader) == null ? void 0 : _b.reset();
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
|
307
|
-
return () => document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
308
|
-
}, [fullScreenMode]);
|
|
309
|
-
(0, import_react.useEffect)(() => {
|
|
310
|
-
if (isDevelopEnv) {
|
|
311
|
-
console.log("[Input.WithMode] 扫码类型变化:", scanCodeType, "标题文本:", getScanTypeText);
|
|
100
|
+
};
|
|
101
|
+
const triggerScan = () => {
|
|
102
|
+
if (fileInputRef.current) {
|
|
103
|
+
fileInputRef.current.click();
|
|
312
104
|
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
"
|
|
105
|
+
};
|
|
106
|
+
const scanIcon = showQRScanner ? /* @__PURE__ */ import_react.default.createElement(
|
|
107
|
+
"span",
|
|
316
108
|
{
|
|
317
|
-
|
|
109
|
+
onClick: triggerScan,
|
|
318
110
|
style: {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
111
|
+
cursor: "pointer",
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
backgroundColor: "#8c5ddd",
|
|
116
|
+
// 紫色背景
|
|
117
|
+
width: "32px",
|
|
118
|
+
height: "28px",
|
|
119
|
+
borderRadius: "4px",
|
|
120
|
+
marginLeft: "8px"
|
|
328
121
|
}
|
|
329
122
|
},
|
|
330
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
331
|
-
|
|
332
|
-
backgroundColor: "#fff",
|
|
333
|
-
display: "flex",
|
|
334
|
-
justifyContent: "space-between",
|
|
335
|
-
alignItems: "center"
|
|
336
|
-
} }, /* @__PURE__ */ import_react.default.createElement("span", { style: { fontSize: "16px", fontWeight: "bold" } }, getScanTypeText || "Scan QR Code/Barcode"), /* @__PURE__ */ import_react.default.createElement("span", { onClick: exitFullScreenScan, style: { cursor: "pointer", fontSize: "24px" } }, "×")),
|
|
337
|
-
/* @__PURE__ */ import_react.default.createElement("div", { style: { flex: 1, position: "relative" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
338
|
-
import_pisellScan.default,
|
|
123
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
124
|
+
import_icons.QrcodeOutlined,
|
|
339
125
|
{
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
formats
|
|
126
|
+
style: {
|
|
127
|
+
fontSize: "18px",
|
|
128
|
+
color: "white"
|
|
129
|
+
// 白色图标
|
|
130
|
+
}
|
|
346
131
|
}
|
|
347
|
-
)
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
getBackText || "Back"
|
|
370
|
-
))
|
|
132
|
+
)
|
|
133
|
+
) : null;
|
|
134
|
+
const combinedSuffix = showQRScanner ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, suffix, scanIcon) : suffix;
|
|
135
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
136
|
+
import_antd.Input,
|
|
137
|
+
{
|
|
138
|
+
...restProps,
|
|
139
|
+
ref: props.innerRef,
|
|
140
|
+
onChange,
|
|
141
|
+
suffix: combinedSuffix
|
|
142
|
+
}
|
|
143
|
+
), showQRScanner && // @ts-ignore - 忽略TypeScript对input元素的警告
|
|
144
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
145
|
+
"input",
|
|
146
|
+
{
|
|
147
|
+
type: "file",
|
|
148
|
+
accept: "image/*",
|
|
149
|
+
capture: "environment",
|
|
150
|
+
ref: fileInputRef,
|
|
151
|
+
onChange: handleFileChange,
|
|
152
|
+
style: { display: "none" }
|
|
153
|
+
}
|
|
371
154
|
));
|
|
372
155
|
};
|
|
373
|
-
var
|
|
156
|
+
var InputWithMode = (0, import_utils.withMode)(Input, import_ReadPretty.default);
|
|
157
|
+
var WithMode_default = InputWithMode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import JSON from '../Input.Json';
|
|
3
|
+
import Password from '../Input.Password';
|
|
4
|
+
import TextArea from '../Input.TextArea';
|
|
5
|
+
import Url from '../Input.Url';
|
|
6
|
+
import Email from '../Input.Email';
|
|
7
|
+
import Phone from '../Input.Phone';
|
|
8
|
+
import Mobile from '../Input.Mobile';
|
|
9
|
+
import Subdomain from '../Input.Subdomain';
|
|
10
|
+
import { InputProps } from './type';
|
|
11
|
+
declare type InputComponent = React.FC<InputProps> & {
|
|
12
|
+
JSON: typeof JSON;
|
|
13
|
+
Password: typeof Password;
|
|
14
|
+
TextArea: typeof TextArea;
|
|
15
|
+
URL: typeof Url;
|
|
16
|
+
Email: typeof Email;
|
|
17
|
+
Phone: typeof Phone;
|
|
18
|
+
Mobile: typeof Mobile;
|
|
19
|
+
Subdomain: typeof Subdomain;
|
|
20
|
+
};
|
|
21
|
+
declare const Input: InputComponent;
|
|
22
|
+
export default Input;
|
|
@@ -32,9 +32,6 @@ __export(Input_exports, {
|
|
|
32
32
|
default: () => Input_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(Input_exports);
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_utils = require("../../dataSourceForm/utils");
|
|
37
|
-
var import_WithMode = __toESM(require("./WithMode"));
|
|
38
35
|
var import_Input = __toESM(require("../Input.Json"));
|
|
39
36
|
var import_Input2 = __toESM(require("../Input.Password"));
|
|
40
37
|
var import_Input3 = __toESM(require("../Input.TextArea"));
|
|
@@ -43,16 +40,9 @@ var import_Input5 = __toESM(require("../Input.Email"));
|
|
|
43
40
|
var import_Input6 = __toESM(require("../Input.Phone"));
|
|
44
41
|
var import_Input7 = __toESM(require("../Input.Mobile"));
|
|
45
42
|
var import_Input8 = __toESM(require("../Input.Subdomain"));
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
scanCodeType: void 0,
|
|
50
|
-
language: void 0
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
var Input = (props) => {
|
|
54
|
-
return /* @__PURE__ */ import_react.default.createElement(InputWithForm, { ...props });
|
|
55
|
-
};
|
|
43
|
+
var import_WithMode = __toESM(require("./WithMode"));
|
|
44
|
+
var import_utils = require("../../dataSourceForm/utils");
|
|
45
|
+
var Input = (0, import_utils.withFormItem)(import_WithMode.default);
|
|
56
46
|
Input.JSON = import_Input.default;
|
|
57
47
|
Input.Password = import_Input2.default;
|
|
58
48
|
Input.TextArea = import_Input3.default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { InputProps as AntInputProps } from 'antd';
|
|
3
|
+
import { ModeType } from "../../dataSourceForm/type";
|
|
4
|
+
export interface InputProps extends AntInputProps {
|
|
5
|
+
renderMode: ModeType;
|
|
6
|
+
innerRef: Ref<any>;
|
|
7
|
+
enableQRScanner?: boolean;
|
|
8
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
declare const formFieldMap: {
|
|
2
3
|
FormItemCheckbox: import("react").FC<{}> & {
|
|
3
4
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -19,7 +20,7 @@ declare const formFieldMap: {
|
|
|
19
20
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
20
21
|
onChange: (value: string) => void;
|
|
21
22
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
22
|
-
rootDomain: "custom" | "
|
|
23
|
+
rootDomain: "custom" | "xzero" | "saas";
|
|
23
24
|
customDomain?: string | undefined;
|
|
24
25
|
value?: string | undefined;
|
|
25
26
|
tenantId: string;
|
|
@@ -59,11 +60,7 @@ declare const formFieldMap: {
|
|
|
59
60
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
60
61
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
62
|
};
|
|
62
|
-
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("
|
|
63
|
-
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
64
|
-
} & {
|
|
65
|
-
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
66
|
-
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
63
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
67
64
|
onChange: (value: string) => void;
|
|
68
65
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
69
66
|
JSON: import("react").FC<any>;
|
|
@@ -78,14 +75,18 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
78
75
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
79
76
|
onChange: (value: string) => void;
|
|
80
77
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
81
|
-
rootDomain: "custom" | "
|
|
78
|
+
rootDomain: "custom" | "xzero" | "saas";
|
|
82
79
|
customDomain?: string | undefined;
|
|
83
80
|
value?: string | undefined;
|
|
84
81
|
tenantId: string;
|
|
85
82
|
name?: string | undefined;
|
|
86
83
|
fieldKey?: string | undefined;
|
|
87
84
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
88
|
-
}) |
|
|
85
|
+
}) | (import("react").FC<{}> & {
|
|
86
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
87
|
+
} & {
|
|
88
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
89
|
+
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<{}> & {
|
|
89
90
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
90
91
|
} & {
|
|
91
92
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -97,5 +98,5 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
97
98
|
extraParams?: Record<string, any> | undefined;
|
|
98
99
|
} & {
|
|
99
100
|
dataSource?: any;
|
|
100
|
-
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
101
|
+
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
101
102
|
export { getFieldComponent, formFieldMap };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataSourceType } from '../provider/dataSource/DataSourceContext';
|
|
2
|
+
export interface UseActionsParams {
|
|
3
|
+
dataSource?: DataSourceType;
|
|
4
|
+
currentValue?: 'server' | 'local';
|
|
5
|
+
__designMode?: string;
|
|
6
|
+
extraParams?: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, extraParams: propsExtraParams, }?: UseActionsParams) => {
|
|
9
|
+
create: (values: Record<string, any>) => Promise<any>;
|
|
10
|
+
get: () => Promise<any>;
|
|
11
|
+
update: (values: Record<string, any>) => Promise<any>;
|
|
12
|
+
list: (params: {
|
|
13
|
+
page: number;
|
|
14
|
+
pageSize: number;
|
|
15
|
+
}) => Promise<any>;
|
|
16
|
+
destroy: (id: string) => Promise<any>;
|
|
17
|
+
};
|
|
18
|
+
export default useActions;
|
|
@@ -36,7 +36,7 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_library = require("@zxing/library");
|
|
37
37
|
var import_index = require("./index.less");
|
|
38
38
|
var PisellScan = (0, import_react.forwardRef)((props, ref) => {
|
|
39
|
-
const { width, height, borderRadius, style, children, onChange, timeBetweenScansMillis = 500,
|
|
39
|
+
const { width, height, borderRadius, style, children, onChange, timeBetweenScansMillis = 500, ...others } = props;
|
|
40
40
|
const videoRef = (0, import_react.useRef)(null);
|
|
41
41
|
const codeReaderRef = (0, import_react.useRef)(null);
|
|
42
42
|
(0, import_react.useImperativeHandle)(ref, () => {
|
|
@@ -45,11 +45,7 @@ var PisellScan = (0, import_react.forwardRef)((props, ref) => {
|
|
|
45
45
|
};
|
|
46
46
|
});
|
|
47
47
|
(0, import_react.useEffect)(() => {
|
|
48
|
-
const
|
|
49
|
-
if (formats && formats.length > 0) {
|
|
50
|
-
hints.set(2, formats);
|
|
51
|
-
}
|
|
52
|
-
const codeReader = new import_library.BrowserMultiFormatReader(hints, timeBetweenScansMillis);
|
|
48
|
+
const codeReader = new import_library.BrowserMultiFormatReader(void 0, timeBetweenScansMillis);
|
|
53
49
|
codeReaderRef.current = codeReader;
|
|
54
50
|
let selectedDeviceId;
|
|
55
51
|
codeReaderRef.current.listVideoInputDevices().then((videoInputDevices) => {
|
|
@@ -59,9 +55,7 @@ var PisellScan = (0, import_react.forwardRef)((props, ref) => {
|
|
|
59
55
|
videoRef.current,
|
|
60
56
|
(result, err) => {
|
|
61
57
|
if (result) {
|
|
62
|
-
|
|
63
|
-
const isValidType = !formats || formats.length === 0 || formats.includes(barcodeFormat);
|
|
64
|
-
onChange == null ? void 0 : onChange(result.getText(), barcodeFormat, isValidType);
|
|
58
|
+
onChange == null ? void 0 : onChange(result.getText());
|
|
65
59
|
}
|
|
66
60
|
if (err && !(err instanceof import_library.NotFoundException)) {
|
|
67
61
|
console.error(err);
|