@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.
Files changed (52) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +6 -6
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +18 -18
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +17 -17
  11. package/es/components/pisellCardList/index.d.ts +29 -1
  12. package/es/components/pisellCardList/index.js +24 -19
  13. package/es/components/pisellCardList/index.less +75 -75
  14. package/es/components/pisellCheckboxGroup/index.d.ts +3 -1
  15. package/es/components/pisellCheckboxGroup/index.js +32 -8
  16. package/es/components/pisellCheckboxGroup/index.less +1 -0
  17. package/es/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +4 -0
  18. package/es/components/pisellInformationEntry/hooks/useNativeScanner.js +35 -0
  19. package/es/components/pisellInformationEntry/index.d.ts +2 -0
  20. package/es/components/pisellInformationEntry/index.js +16 -2
  21. package/es/components/pisellWalletPassCard/index.d.ts +28 -1
  22. package/es/components/pisellWalletPassCard/index.js +383 -47
  23. package/es/components/pisellWalletPassCard/index.less +154 -28
  24. package/es/locales/en-US.d.ts +8 -1
  25. package/es/locales/en-US.js +8 -1
  26. package/es/locales/zh-CN.d.ts +8 -1
  27. package/es/locales/zh-CN.js +8 -1
  28. package/es/locales/zh-TW.d.ts +8 -1
  29. package/es/locales/zh-TW.js +8 -1
  30. package/lib/components/pisellCardList/index.d.ts +29 -1
  31. package/lib/components/pisellCardList/index.js +44 -43
  32. package/lib/components/pisellCardList/index.less +75 -75
  33. package/lib/components/pisellCheckboxGroup/index.d.ts +3 -1
  34. package/lib/components/pisellCheckboxGroup/index.js +30 -7
  35. package/lib/components/pisellCheckboxGroup/index.less +1 -0
  36. package/lib/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +4 -0
  37. package/lib/components/pisellInformationEntry/hooks/useNativeScanner.js +75 -0
  38. package/lib/components/pisellInformationEntry/index.d.ts +2 -0
  39. package/lib/components/pisellInformationEntry/index.js +14 -9
  40. package/lib/components/pisellWalletPassCard/index.d.ts +28 -1
  41. package/lib/components/pisellWalletPassCard/index.js +369 -23
  42. package/lib/components/pisellWalletPassCard/index.less +154 -28
  43. package/lib/locales/en-US.d.ts +8 -1
  44. package/lib/locales/en-US.js +8 -1
  45. package/lib/locales/zh-CN.d.ts +8 -1
  46. package/lib/locales/zh-CN.js +8 -1
  47. package/lib/locales/zh-TW.d.ts +8 -1
  48. package/lib/locales/zh-TW.js +8 -1
  49. package/lowcode/pisell-card-list/meta.ts +217 -136
  50. package/lowcode/pisell-wallet-pass-card/actionsMeta.ts +217 -0
  51. package/lowcode/pisell-wallet-pass-card/meta.ts +173 -129
  52. package/package.json +1 -1
@@ -1,75 +1,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
- }
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';
@@ -57,6 +57,8 @@ var PisellCheckboxGroup = (props) => {
57
57
  padding = 0,
58
58
  rowKey = "value",
59
59
  mode = "multiple",
60
+ direction,
61
+ fullWidth,
60
62
  iconPosition = "left",
61
63
  optionClassName,
62
64
  optionActiveClassName,
@@ -82,11 +84,31 @@ var PisellCheckboxGroup = (props) => {
82
84
  const paddingVal = (0, import_utils.isNumber)(padding) ? padding + "px" : padding;
83
85
  let obj = {
84
86
  gap: gapVal,
85
- padding: paddingVal,
86
- ...style
87
+ padding: paddingVal
87
88
  };
88
- return obj;
89
- }, [style, gap, padding]);
89
+ if ("horizontal" === direction) {
90
+ obj = {
91
+ ...obj,
92
+ flexDirection: "row",
93
+ overflowX: "auto"
94
+ };
95
+ }
96
+ return { ...obj, ...style };
97
+ }, [style, gap, padding, direction]);
98
+ const rowStyle = (0, import_react.useMemo)(() => {
99
+ if ("horizontal" === direction) {
100
+ if (false === fullWidth) {
101
+ return {
102
+ flexShrink: 0,
103
+ width: "auto"
104
+ };
105
+ }
106
+ return {
107
+ flexShrink: 0
108
+ };
109
+ }
110
+ return {};
111
+ }, [direction, fullWidth]);
90
112
  const _onChange = (val, item) => {
91
113
  onChange == null ? void 0 : onChange(mode === "single" ? val[0] : val, item);
92
114
  };
@@ -106,7 +128,7 @@ var PisellCheckboxGroup = (props) => {
106
128
  className: (0, import_classnames.default)("pisell-checkbox-group", rest.className),
107
129
  style: _style
108
130
  },
109
- options.map((option) => {
131
+ options.map((option, index) => {
110
132
  const active = _value.includes(option[rowKey]);
111
133
  return /* @__PURE__ */ import_react.default.createElement(
112
134
  import_pisellRow.default,
@@ -121,7 +143,8 @@ var PisellCheckboxGroup = (props) => {
121
143
  ),
122
144
  key: option[rowKey],
123
145
  gap: 10,
124
- onClick: () => {
146
+ style: rowStyle,
147
+ onClick: (e) => {
125
148
  if (option.disabled)
126
149
  return;
127
150
  handleSelectItem(option[rowKey], option);
@@ -140,7 +163,7 @@ var PisellCheckboxGroup = (props) => {
140
163
  className: "pisell-checkbox-group-item-checkbox"
141
164
  }
142
165
  ),
143
- centerContent: renderOption == null ? void 0 : renderOption(option, active),
166
+ centerContent: renderOption == null ? void 0 : renderOption(option, active, index),
144
167
  centerContentFill: true
145
168
  }
146
169
  );
@@ -19,6 +19,7 @@
19
19
  border-radius: 12px;
20
20
  border: 1px solid var(--Gray-200, #EAECF0);
21
21
  z-index: 2;
22
+ pointer-events: none;
22
23
  }
23
24
 
24
25
  &.pisell-checkbox-group-item-active {
@@ -0,0 +1,4 @@
1
+ export declare const useNativeScanner: (onChange?: ((val: string) => void) | undefined) => {
2
+ activeNativeScanner: () => void;
3
+ isTerminal: any;
4
+ };
@@ -0,0 +1,75 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/pisellInformationEntry/hooks/useNativeScanner.ts
30
+ var useNativeScanner_exports = {};
31
+ __export(useNativeScanner_exports, {
32
+ useNativeScanner: () => useNativeScanner
33
+ });
34
+ module.exports = __toCommonJS(useNativeScanner_exports);
35
+ var import_react = require("react");
36
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
37
+ var useNativeScanner = (onChange) => {
38
+ var _a;
39
+ const context = (0, import_useEngineContext.default)();
40
+ const { interaction, isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
41
+ (0, import_react.useEffect)(() => {
42
+ var _a2, _b;
43
+ (_b = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.mountFunction) == null ? void 0 : _b.call(
44
+ _a2,
45
+ "global",
46
+ "nativeScannerResult",
47
+ (strVal) => {
48
+ try {
49
+ const val = JSON.parse(strVal);
50
+ onChange == null ? void 0 : onChange(val.value);
51
+ } catch (err) {
52
+ console.error(err);
53
+ }
54
+ }
55
+ );
56
+ }, []);
57
+ const activeNativeScanner = (0, import_react.useCallback)(() => {
58
+ var _a2, _b;
59
+ (_b = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b.call(_a2, {
60
+ module: "global",
61
+ key: "active_native_scanner",
62
+ data: {
63
+ source: "pisellInformationEntry"
64
+ }
65
+ });
66
+ }, []);
67
+ return {
68
+ activeNativeScanner,
69
+ isTerminal: isTerminal && isTerminal()
70
+ };
71
+ };
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ useNativeScanner
75
+ });
@@ -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;
@@ -43,6 +43,7 @@ var import_button = __toESM(require("../button"));
43
43
  var import_Input = __toESM(require("./Input"));
44
44
  var import_utils = require("./utils");
45
45
  var import_useTerminalPeripherals = __toESM(require("./hooks/useTerminalPeripherals"));
46
+ var import_useNativeScanner = require("./hooks/useNativeScanner");
46
47
  var import_index = require("./index.less");
47
48
  var CardButton = (props) => {
48
49
  const { icon, children, ...others } = props;
@@ -54,7 +55,8 @@ var PisellInformationEntry = (props) => {
54
55
  title,
55
56
  entryModes = [],
56
57
  searchDescribe,
57
- onChange
58
+ onChange,
59
+ onChangeType
58
60
  } = props;
59
61
  const config = (0, import_usePisellConfig.default)();
60
62
  const { platform } = config;
@@ -62,6 +64,7 @@ var PisellInformationEntry = (props) => {
62
64
  null
63
65
  );
64
66
  const { peripheralsStatus } = (0, import_useTerminalPeripherals.default)(onChange);
67
+ const { activeNativeScanner, isTerminal } = (0, import_useNativeScanner.useNativeScanner)(onChange);
65
68
  const [availableEntryModes, setAvailableEntryModes] = (0, import_react.useState)(entryModes);
66
69
  (0, import_react.useEffect)(() => {
67
70
  document.body.id = "body";
@@ -95,8 +98,16 @@ var PisellInformationEntry = (props) => {
95
98
  if (import_constants.passiveModeType.includes(type)) {
96
99
  return;
97
100
  }
101
+ if (isTerminal && "scanCode" === type) {
102
+ setCurrentType(null);
103
+ activeNativeScanner();
104
+ return;
105
+ }
98
106
  setCurrentType(type);
99
107
  };
108
+ (0, import_react.useEffect)(() => {
109
+ onChangeType && onChangeType(currentType);
110
+ }, [currentType]);
100
111
  const { isHasInput, isHasNfc, isHasScanner, isHasScanCode } = (0, import_react.useMemo)(() => {
101
112
  let isHasScanCode2 = false;
102
113
  let isHasInput2 = false;
@@ -159,13 +170,7 @@ var PisellInformationEntry = (props) => {
159
170
  CardButton,
160
171
  {
161
172
  bordered: !import_constants.passiveModeType.includes(item.type),
162
- icon: /* @__PURE__ */ import_react.default.createElement(
163
- import_iconfont.default,
164
- {
165
- type: icon,
166
- className: "pisell-card-button-icon"
167
- }
168
- ),
173
+ icon: /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: icon, className: "pisell-card-button-icon" }),
169
174
  className: (0, import_classnames.default)("pisell-information-entry-item", {
170
175
  ["pisell-entry-ready"]: import_constants.passiveModeType.includes(item.type)
171
176
  }),
@@ -173,6 +178,6 @@ var PisellInformationEntry = (props) => {
173
178
  },
174
179
  item.name || detail.text
175
180
  );
176
- })), /* @__PURE__ */ import_react.default.createElement("div", null, currentType === "scanCode" && /* @__PURE__ */ import_react.default.createElement(import_Scan.default, { onChange: handleChange, onCancel: () => setCurrentType(null) }), currentType === "input" && /* @__PURE__ */ import_react.default.createElement(import_Input.default, { onChange: handleChange, searchDescribe })));
181
+ })), /* @__PURE__ */ import_react.default.createElement("div", null, currentType === "scanCode" && !isTerminal && /* @__PURE__ */ import_react.default.createElement(import_Scan.default, { onChange: handleChange, onCancel: () => setCurrentType(null) }), currentType === "input" && /* @__PURE__ */ import_react.default.createElement(import_Input.default, { onChange: handleChange, searchDescribe })));
177
182
  };
178
183
  var pisellInformationEntry_default = PisellInformationEntry;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  export interface PisellWalletPassCardProps {
4
- id?: number;
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;