@pisell/materials 2.2.57 → 2.2.59
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +17 -17
- package/es/components/pisellCardList/index.d.ts +29 -1
- package/es/components/pisellCardList/index.js +24 -19
- package/es/components/pisellCardList/index.less +75 -75
- package/es/components/pisellCheckboxGroup/index.d.ts +3 -1
- package/es/components/pisellCheckboxGroup/index.js +32 -8
- package/es/components/pisellCheckboxGroup/index.less +1 -0
- package/es/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +4 -0
- package/es/components/pisellInformationEntry/hooks/useNativeScanner.js +35 -0
- package/es/components/pisellInformationEntry/index.d.ts +2 -0
- package/es/components/pisellInformationEntry/index.js +16 -2
- package/es/components/pisellWalletPassCard/index.d.ts +28 -1
- package/es/components/pisellWalletPassCard/index.js +383 -47
- package/es/components/pisellWalletPassCard/index.less +154 -28
- package/es/locales/en-US.d.ts +8 -1
- package/es/locales/en-US.js +8 -1
- package/es/locales/zh-CN.d.ts +8 -1
- package/es/locales/zh-CN.js +8 -1
- package/es/locales/zh-TW.d.ts +8 -1
- package/es/locales/zh-TW.js +8 -1
- package/lib/components/pisellCardList/index.d.ts +29 -1
- package/lib/components/pisellCardList/index.js +44 -43
- package/lib/components/pisellCardList/index.less +75 -75
- package/lib/components/pisellCheckboxGroup/index.d.ts +3 -1
- package/lib/components/pisellCheckboxGroup/index.js +30 -7
- package/lib/components/pisellCheckboxGroup/index.less +1 -0
- package/lib/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +4 -0
- package/lib/components/pisellInformationEntry/hooks/useNativeScanner.js +75 -0
- package/lib/components/pisellInformationEntry/index.d.ts +2 -0
- package/lib/components/pisellInformationEntry/index.js +14 -9
- package/lib/components/pisellWalletPassCard/index.d.ts +28 -1
- package/lib/components/pisellWalletPassCard/index.js +369 -23
- package/lib/components/pisellWalletPassCard/index.less +154 -28
- package/lib/locales/en-US.d.ts +8 -1
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +8 -1
- package/lib/locales/zh-CN.js +8 -1
- package/lib/locales/zh-TW.d.ts +8 -1
- package/lib/locales/zh-TW.js +8 -1
- package/lowcode/pisell-card-list/meta.ts +217 -136
- package/lowcode/pisell-wallet-pass-card/actionsMeta.ts +217 -0
- package/lowcode/pisell-wallet-pass-card/meta.ts +173 -129
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { PisellCheckboxGroupProps } from '../pisellCheckboxGroup';
|
|
3
3
|
import { PisellContextType } from '../pisell-config-provider/context';
|
|
4
4
|
import { PisellWalletPassCardProps } from '../pisellWalletPassCard';
|
|
5
|
+
import './index.less';
|
|
5
6
|
export interface PisellCardListProps extends Omit<PisellCheckboxGroupProps, 'options'> {
|
|
6
7
|
platform?: PisellContextType['platform'];
|
|
7
8
|
/** 当用户查看完所有记录时,底部会显示此消息 */
|
|
@@ -38,6 +39,33 @@ export interface PisellCardListProps extends Omit<PisellCheckboxGroupProps, 'opt
|
|
|
38
39
|
showCover?: boolean;
|
|
39
40
|
/** 是否余额货币单位 */
|
|
40
41
|
showBalanceSymbol?: boolean;
|
|
42
|
+
/** 卡片大小 */
|
|
43
|
+
type?: 'default' | 'mini';
|
|
44
|
+
/** 展示操作按钮 */
|
|
45
|
+
showActions?: boolean;
|
|
46
|
+
/** 操作按钮配置 */
|
|
47
|
+
actions?: {
|
|
48
|
+
/** 按钮展示方式 */
|
|
49
|
+
layout: 'expanded' | 'collapsed';
|
|
50
|
+
/** detail 按钮配置 */
|
|
51
|
+
detail?: {
|
|
52
|
+
visible: boolean;
|
|
53
|
+
iconColor: string;
|
|
54
|
+
};
|
|
55
|
+
/** edit按钮配置 */
|
|
56
|
+
edit?: {
|
|
57
|
+
visible: boolean;
|
|
58
|
+
iconColor: string;
|
|
59
|
+
dialogTitle: string;
|
|
60
|
+
enableDialog: boolean;
|
|
61
|
+
fields: {
|
|
62
|
+
name: string;
|
|
63
|
+
label: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/** 编辑弹窗点击提交 */
|
|
68
|
+
onConfirmEdit?: (value: any, index: number) => void;
|
|
41
69
|
}
|
|
42
|
-
declare const _default: React.
|
|
70
|
+
declare const _default: React.NamedExoticComponent<PisellCardListProps>;
|
|
43
71
|
export default _default;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
|
-
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
4
|
-
import { Skeleton } from 'antd';
|
|
3
|
+
// import InfiniteScroll from 'react-infinite-scroll-component';
|
|
4
|
+
// import { Skeleton } from 'antd';
|
|
5
5
|
import PisellCheckboxGroup from "../pisellCheckboxGroup";
|
|
6
6
|
import PisellWalletPassCard from "../pisellWalletPassCard";
|
|
7
7
|
import PisellEmpty from "../pisellEmpty";
|
|
8
|
+
import "./index.less";
|
|
8
9
|
/**
|
|
9
10
|
* 卡列表组件
|
|
10
11
|
* @param props
|
|
11
12
|
* @constructor
|
|
12
13
|
*/
|
|
13
14
|
var PisellCardList = function PisellCardList(props) {
|
|
14
|
-
var data = props.data,
|
|
15
|
+
var _props$data = props.data,
|
|
16
|
+
data = _props$data === void 0 ? [] : _props$data,
|
|
15
17
|
_props$loadMoreData = props.loadMoreData,
|
|
16
18
|
loadMoreData = _props$loadMoreData === void 0 ? function () {} : _props$loadMoreData,
|
|
17
19
|
endMessage = props.endMessage,
|
|
@@ -20,6 +22,9 @@ var PisellCardList = function PisellCardList(props) {
|
|
|
20
22
|
onChange = props.onChange,
|
|
21
23
|
value = props.value,
|
|
22
24
|
mode = props.mode,
|
|
25
|
+
direction = props.direction,
|
|
26
|
+
fullWidth = props.fullWidth,
|
|
27
|
+
type = props.type,
|
|
23
28
|
showName = props.showName,
|
|
24
29
|
showCode = props.showCode,
|
|
25
30
|
showCover = props.showCover,
|
|
@@ -32,27 +37,17 @@ var PisellCardList = function PisellCardList(props) {
|
|
|
32
37
|
empty = props.empty,
|
|
33
38
|
showEmpty = props.showEmpty,
|
|
34
39
|
showBalanceSymbol = props.showBalanceSymbol;
|
|
35
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
-
dataLength: data.length,
|
|
37
|
-
next: loadMoreData,
|
|
38
|
-
hasMore: hasMore,
|
|
39
|
-
loader: loader || /*#__PURE__*/React.createElement(Skeleton, {
|
|
40
|
-
paragraph: {
|
|
41
|
-
rows: 3
|
|
42
|
-
},
|
|
43
|
-
active: true
|
|
44
|
-
}),
|
|
45
|
-
endMessage: endMessage,
|
|
46
|
-
scrollableTarget: "scrollableDiv"
|
|
47
|
-
}, data.length ? /*#__PURE__*/React.createElement(PisellCheckboxGroup, {
|
|
40
|
+
return data.length ? /*#__PURE__*/React.createElement(PisellCheckboxGroup, {
|
|
48
41
|
options: data,
|
|
49
42
|
value: value,
|
|
50
43
|
mode: mode,
|
|
44
|
+
direction: direction,
|
|
51
45
|
rowKey: "id",
|
|
52
46
|
gap: 12,
|
|
53
47
|
onChange: onChange,
|
|
54
48
|
iconPosition: "hide",
|
|
55
|
-
|
|
49
|
+
fullWidth: fullWidth,
|
|
50
|
+
renderOption: function renderOption(item, active, index) {
|
|
56
51
|
return /*#__PURE__*/React.createElement(PisellWalletPassCard, _extends({}, item, {
|
|
57
52
|
active: active,
|
|
58
53
|
showName: showName || (item === null || item === void 0 ? void 0 : item.showName),
|
|
@@ -64,9 +59,19 @@ var PisellCardList = function PisellCardList(props) {
|
|
|
64
59
|
showRedeem: showRedeem || (item === null || item === void 0 ? void 0 : item.showRedeem),
|
|
65
60
|
showStoreName: showStoreName || (item === null || item === void 0 ? void 0 : item.showStoreName),
|
|
66
61
|
showValidDate: showValidDate || (item === null || item === void 0 ? void 0 : item.showValidDate),
|
|
67
|
-
showBalanceSymbol: showBalanceSymbol || (item === null || item === void 0 ? void 0 : item.showBalanceSymbol)
|
|
62
|
+
showBalanceSymbol: showBalanceSymbol || (item === null || item === void 0 ? void 0 : item.showBalanceSymbol),
|
|
63
|
+
showActions: props.showActions || (item === null || item === void 0 ? void 0 : item.showActions),
|
|
64
|
+
actions: props.actions || (item === null || item === void 0 ? void 0 : item.actions),
|
|
65
|
+
onConfirmEdit: function onConfirmEdit(newVal) {
|
|
66
|
+
var _props$onConfirmEdit;
|
|
67
|
+
(_props$onConfirmEdit = props.onConfirmEdit) === null || _props$onConfirmEdit === void 0 ? void 0 : _props$onConfirmEdit.call(props, newVal, index);
|
|
68
|
+
},
|
|
69
|
+
type: type,
|
|
70
|
+
style: direction === 'vertical' || direction === 'horizontal' && fullWidth ? {
|
|
71
|
+
width: '100%'
|
|
72
|
+
} : {}
|
|
68
73
|
}));
|
|
69
74
|
}
|
|
70
|
-
}) : showEmpty && (empty || /*#__PURE__*/React.createElement(PisellEmpty, null))
|
|
75
|
+
}) : showEmpty && (empty || /*#__PURE__*/React.createElement(PisellEmpty, null));
|
|
71
76
|
};
|
|
72
77
|
export default /*#__PURE__*/memo(PisellCardList);
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
.pisell-card {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
.pisell-card-disabled {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
1
|
+
// .pisell-card {
|
|
2
|
+
// padding: 16px;
|
|
3
|
+
// color: var(--Gray-900, #101828);
|
|
4
|
+
// font-size: 14px;
|
|
5
|
+
// font-style: normal;
|
|
6
|
+
// position: relative;
|
|
7
|
+
// overflow: hidden;
|
|
8
|
+
// border-radius: 12px;
|
|
9
|
+
// .pisell-card-name-wrap {
|
|
10
|
+
// display: flex;
|
|
11
|
+
// justify-content: space-between;
|
|
12
|
+
// font-weight: 500;
|
|
13
|
+
// line-height: 20px;
|
|
14
|
+
// }
|
|
15
|
+
// .pisell-card-store-name {
|
|
16
|
+
// height: 20px;
|
|
17
|
+
// font-size: 12px;
|
|
18
|
+
// font-weight: 400;
|
|
19
|
+
// line-height: 18px; /* 150% */
|
|
20
|
+
// }
|
|
21
|
+
// .pisell-card-amount-wrap {
|
|
22
|
+
// display: flex;
|
|
23
|
+
// margin-bottom: 4px;
|
|
24
|
+
// .pisell-card-amount-item {
|
|
25
|
+
// display: flex;
|
|
26
|
+
// flex-direction: column;
|
|
27
|
+
// margin-right: 16px;
|
|
28
|
+
// .pisell-card-amount-item-label {
|
|
29
|
+
// color: var(--Gray-500, #667085);
|
|
30
|
+
// font-weight: 400;
|
|
31
|
+
// line-height: 20px;
|
|
32
|
+
// height: 20px;
|
|
33
|
+
// }
|
|
34
|
+
// .pisell-card-amount-item-value {
|
|
35
|
+
// font-size: 20px;
|
|
36
|
+
// font-weight: 600;
|
|
37
|
+
// line-height: 30px;
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
|
+
// }
|
|
41
|
+
// .pisell-card-code-wrap {
|
|
42
|
+
// display: flex;
|
|
43
|
+
// justify-content: space-between;
|
|
44
|
+
// position: relative;
|
|
45
|
+
// .pisell-card-qr-code {
|
|
46
|
+
// position: absolute;
|
|
47
|
+
// top: -16px;
|
|
48
|
+
// right: 0;
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// .pisell-lowcode-qrcode {
|
|
52
|
+
// padding: 6px;
|
|
53
|
+
// }
|
|
54
|
+
// .pisell-card-warn-message {
|
|
55
|
+
// position: absolute;
|
|
56
|
+
// bottom: 0;
|
|
57
|
+
// width: 100%;
|
|
58
|
+
// left: 0;
|
|
59
|
+
// background: var(--Warning-200, #FEDF89);
|
|
60
|
+
// display: flex;
|
|
61
|
+
// padding: 6px 16px;
|
|
62
|
+
// color: var(--Warning-900, #7A2E0E);
|
|
63
|
+
// font-weight: 400;
|
|
64
|
+
// line-height: 20px;
|
|
65
|
+
// .pisell-card-icon {
|
|
66
|
+
// font-size: 20px;
|
|
67
|
+
// color: #7A2E0E;
|
|
68
|
+
// margin-right: 2px;
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
// .pisell-card-disabled {
|
|
73
|
+
// color: var(--Gray-500, #667085);
|
|
74
|
+
// padding-bottom: 36px;
|
|
75
|
+
// }
|
|
@@ -10,12 +10,14 @@ export interface PisellCheckboxGroupOption {
|
|
|
10
10
|
declare type PisellCheckboxGroupValue = string | string[] | any;
|
|
11
11
|
export interface PisellCheckboxGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
12
|
platform?: PisellContextType['platform'];
|
|
13
|
+
direction?: 'horizontal' | 'vertical';
|
|
14
|
+
fullWidth?: boolean;
|
|
13
15
|
gap?: number;
|
|
14
16
|
padding?: number;
|
|
15
17
|
options: PisellCheckboxGroupOption[];
|
|
16
18
|
onChange?: (value: PisellCheckboxGroupValue, item: PisellCheckboxGroupOption) => void;
|
|
17
19
|
value?: PisellCheckboxGroupValue;
|
|
18
|
-
renderOption?: (option: PisellCheckboxGroupOption, active: boolean) => React.ReactNode;
|
|
20
|
+
renderOption?: (option: PisellCheckboxGroupOption, active: boolean, index: number) => React.ReactNode;
|
|
19
21
|
rowKey?: string;
|
|
20
22
|
mode?: 'multiple' | 'single';
|
|
21
23
|
iconPosition?: 'left' | 'right' | 'hide';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "iconPosition", "optionClassName", "optionActiveClassName"];
|
|
2
|
+
var _excluded = ["platform", "gap", "style", "options", "onChange", "value", "renderOption", "padding", "rowKey", "mode", "direction", "fullWidth", "iconPosition", "optionClassName", "optionActiveClassName"];
|
|
3
3
|
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); }
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -55,6 +55,8 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
|
|
|
55
55
|
rowKey = _props$rowKey === void 0 ? 'value' : _props$rowKey,
|
|
56
56
|
_props$mode = props.mode,
|
|
57
57
|
mode = _props$mode === void 0 ? 'multiple' : _props$mode,
|
|
58
|
+
direction = props.direction,
|
|
59
|
+
fullWidth = props.fullWidth,
|
|
58
60
|
_props$iconPosition = props.iconPosition,
|
|
59
61
|
iconPosition = _props$iconPosition === void 0 ? 'left' : _props$iconPosition,
|
|
60
62
|
optionClassName = props.optionClassName,
|
|
@@ -98,12 +100,33 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
|
|
|
98
100
|
|
|
99
101
|
// 内边距
|
|
100
102
|
var paddingVal = isNumber(padding) ? padding + 'px' : padding;
|
|
101
|
-
var obj =
|
|
103
|
+
var obj = {
|
|
102
104
|
gap: gapVal,
|
|
103
105
|
padding: paddingVal
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
};
|
|
107
|
+
// 方向
|
|
108
|
+
if ('horizontal' === direction) {
|
|
109
|
+
obj = _objectSpread(_objectSpread({}, obj), {}, {
|
|
110
|
+
flexDirection: 'row',
|
|
111
|
+
overflowX: 'auto'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return _objectSpread(_objectSpread({}, obj), style);
|
|
115
|
+
}, [style, gap, padding, direction]);
|
|
116
|
+
var rowStyle = useMemo(function () {
|
|
117
|
+
if ('horizontal' === direction) {
|
|
118
|
+
if (false === fullWidth) {
|
|
119
|
+
return {
|
|
120
|
+
flexShrink: 0,
|
|
121
|
+
width: 'auto'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
flexShrink: 0
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return {};
|
|
129
|
+
}, [direction, fullWidth]);
|
|
107
130
|
|
|
108
131
|
/**
|
|
109
132
|
* @title: 统一外部onChange
|
|
@@ -145,7 +168,7 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
|
|
|
145
168
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
146
169
|
className: classNames('pisell-checkbox-group', rest.className),
|
|
147
170
|
style: _style
|
|
148
|
-
}), options.map(function (option) {
|
|
171
|
+
}), options.map(function (option, index) {
|
|
149
172
|
var active = _value.includes(option[rowKey]);
|
|
150
173
|
return /*#__PURE__*/React.createElement(PisellRow, {
|
|
151
174
|
className: classNames('pisell-checkbox-group-item', optionClassName, _defineProperty({
|
|
@@ -153,7 +176,8 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
|
|
|
153
176
|
}, optionActiveClassName, active)),
|
|
154
177
|
key: option[rowKey],
|
|
155
178
|
gap: 10,
|
|
156
|
-
|
|
179
|
+
style: rowStyle,
|
|
180
|
+
onClick: function onClick(e) {
|
|
157
181
|
if (option.disabled) return;
|
|
158
182
|
handleSelectItem(option[rowKey], option);
|
|
159
183
|
},
|
|
@@ -165,7 +189,7 @@ var PisellCheckboxGroup = function PisellCheckboxGroup(props) {
|
|
|
165
189
|
checked: active,
|
|
166
190
|
className: "pisell-checkbox-group-item-checkbox"
|
|
167
191
|
}),
|
|
168
|
-
centerContent: renderOption === null || renderOption === void 0 ? void 0 : renderOption(option, active),
|
|
192
|
+
centerContent: renderOption === null || renderOption === void 0 ? void 0 : renderOption(option, active, index),
|
|
169
193
|
centerContentFill: true
|
|
170
194
|
});
|
|
171
195
|
}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
|
+
import useEngineContext from "../../../hooks/useEngineContext";
|
|
3
|
+
export var useNativeScanner = function useNativeScanner(onChange) {
|
|
4
|
+
var _context$appHelper;
|
|
5
|
+
var context = useEngineContext();
|
|
6
|
+
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
7
|
+
interaction = _ref.interaction,
|
|
8
|
+
isTerminal = _ref.isTerminal;
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
var _interaction$utils, _interaction$utils$mo;
|
|
11
|
+
// 获取客户端扫描结果
|
|
12
|
+
interaction === null || interaction === void 0 ? void 0 : (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 ? void 0 : (_interaction$utils$mo = _interaction$utils.mountFunction) === null || _interaction$utils$mo === void 0 ? void 0 : _interaction$utils$mo.call(_interaction$utils, 'global', 'nativeScannerResult', function (strVal) {
|
|
13
|
+
try {
|
|
14
|
+
var _val = JSON.parse(strVal);
|
|
15
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_val.value);
|
|
16
|
+
} catch (err) {
|
|
17
|
+
console.error(err);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}, []);
|
|
21
|
+
var activeNativeScanner = useCallback(function () {
|
|
22
|
+
var _interaction$utils2, _interaction$utils2$p;
|
|
23
|
+
interaction === null || interaction === void 0 ? void 0 : (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 ? void 0 : (_interaction$utils2$p = _interaction$utils2.postMessageToApp) === null || _interaction$utils2$p === void 0 ? void 0 : _interaction$utils2$p.call(_interaction$utils2, {
|
|
24
|
+
module: 'global',
|
|
25
|
+
key: 'active_native_scanner',
|
|
26
|
+
data: {
|
|
27
|
+
source: 'pisellInformationEntry'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, []);
|
|
31
|
+
return {
|
|
32
|
+
activeNativeScanner: activeNativeScanner,
|
|
33
|
+
isTerminal: isTerminal && isTerminal()
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -26,6 +26,8 @@ export interface PisellInformationEntryProps extends Omit<React.HTMLAttributes<H
|
|
|
26
26
|
searchDescribe?: React.ReactNode;
|
|
27
27
|
/** 录入信息值改变 */
|
|
28
28
|
onChange?: (val: string) => void;
|
|
29
|
+
/** 录入类型切换时候触发的 */
|
|
30
|
+
onChangeType?: (val: null | EntryModeType['type']) => void;
|
|
29
31
|
}
|
|
30
32
|
declare const PisellInformationEntry: (props: PisellInformationEntryProps) => React.JSX.Element;
|
|
31
33
|
export default PisellInformationEntry;
|
|
@@ -25,6 +25,7 @@ import Button from "../button";
|
|
|
25
25
|
import Input from "./Input";
|
|
26
26
|
import { hasCamera } from "./utils";
|
|
27
27
|
import useTerminalPeripherals from "./hooks/useTerminalPeripherals";
|
|
28
|
+
import { useNativeScanner } from "./hooks/useNativeScanner";
|
|
28
29
|
import "./index.less";
|
|
29
30
|
var CardButton = function CardButton(props) {
|
|
30
31
|
var icon = props.icon,
|
|
@@ -38,7 +39,8 @@ var PisellInformationEntry = function PisellInformationEntry(props) {
|
|
|
38
39
|
_props$entryModes = props.entryModes,
|
|
39
40
|
entryModes = _props$entryModes === void 0 ? [] : _props$entryModes,
|
|
40
41
|
searchDescribe = props.searchDescribe,
|
|
41
|
-
onChange = props.onChange
|
|
42
|
+
onChange = props.onChange,
|
|
43
|
+
onChangeType = props.onChangeType;
|
|
42
44
|
var config = usePisellConfig();
|
|
43
45
|
var platform = config.platform;
|
|
44
46
|
var _useState = useState(null),
|
|
@@ -47,6 +49,9 @@ var PisellInformationEntry = function PisellInformationEntry(props) {
|
|
|
47
49
|
setCurrentType = _useState2[1];
|
|
48
50
|
var _useTerminalPeriphera = useTerminalPeripherals(onChange),
|
|
49
51
|
peripheralsStatus = _useTerminalPeriphera.peripheralsStatus;
|
|
52
|
+
var _useNativeScanner = useNativeScanner(onChange),
|
|
53
|
+
activeNativeScanner = _useNativeScanner.activeNativeScanner,
|
|
54
|
+
isTerminal = _useNativeScanner.isTerminal;
|
|
50
55
|
|
|
51
56
|
// 可用录入模式
|
|
52
57
|
var _useState3 = useState(entryModes),
|
|
@@ -107,8 +112,17 @@ var PisellInformationEntry = function PisellInformationEntry(props) {
|
|
|
107
112
|
if (passiveModeType.includes(type)) {
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
115
|
+
// 客户端调用系统原生扫码功能
|
|
116
|
+
if (isTerminal && 'scanCode' === type) {
|
|
117
|
+
setCurrentType(null);
|
|
118
|
+
activeNativeScanner();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
110
121
|
setCurrentType(type);
|
|
111
122
|
};
|
|
123
|
+
useEffect(function () {
|
|
124
|
+
onChangeType && onChangeType(currentType);
|
|
125
|
+
}, [currentType]);
|
|
112
126
|
var _useMemo = useMemo(function () {
|
|
113
127
|
var isHasScanCode = false;
|
|
114
128
|
var isHasInput = false;
|
|
@@ -192,7 +206,7 @@ var PisellInformationEntry = function PisellInformationEntry(props) {
|
|
|
192
206
|
return handleEntryClick(item.type);
|
|
193
207
|
}
|
|
194
208
|
}, item.name || detail.text);
|
|
195
|
-
})), /*#__PURE__*/React.createElement("div", null, currentType === 'scanCode' && /*#__PURE__*/React.createElement(Scan, {
|
|
209
|
+
})), /*#__PURE__*/React.createElement("div", null, currentType === 'scanCode' && !isTerminal && /*#__PURE__*/React.createElement(Scan, {
|
|
196
210
|
onChange: handleChange,
|
|
197
211
|
onCancel: function onCancel() {
|
|
198
212
|
return setCurrentType(null);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
export interface PisellWalletPassCardProps {
|
|
4
|
-
id
|
|
4
|
+
id: number;
|
|
5
|
+
/** 卡片样式 */
|
|
6
|
+
type: 'default' | 'mini';
|
|
5
7
|
/** 商品名称 */
|
|
6
8
|
name: string;
|
|
7
9
|
/** 二维码 */
|
|
@@ -50,6 +52,31 @@ export interface PisellWalletPassCardProps {
|
|
|
50
52
|
showCover?: boolean;
|
|
51
53
|
/** 是否展示余额货币符号 */
|
|
52
54
|
showBalanceSymbol?: boolean;
|
|
55
|
+
/** 展示操作按钮 */
|
|
56
|
+
showActions?: boolean;
|
|
57
|
+
/** 操作按钮配置 */
|
|
58
|
+
actions?: {
|
|
59
|
+
/** 按钮展示方式 */
|
|
60
|
+
layout: 'expanded' | 'collapsed';
|
|
61
|
+
/** detail 按钮配置 */
|
|
62
|
+
detail?: {
|
|
63
|
+
visible: boolean;
|
|
64
|
+
iconColor: string;
|
|
65
|
+
};
|
|
66
|
+
/** edit按钮配置 */
|
|
67
|
+
edit?: {
|
|
68
|
+
visible: boolean;
|
|
69
|
+
iconColor: string;
|
|
70
|
+
dialogTitle: string;
|
|
71
|
+
enableDialog: boolean;
|
|
72
|
+
fields: {
|
|
73
|
+
name: string;
|
|
74
|
+
label: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** 编辑弹窗点击提交 */
|
|
79
|
+
onConfirmEdit?: (value: any) => void;
|
|
53
80
|
[key: string]: any;
|
|
54
81
|
}
|
|
55
82
|
declare const PisellWalletPassCard: (props: PisellWalletPassCardProps) => React.JSX.Element;
|