@pisell/materials 1.0.365 → 1.0.366

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 (134) 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 +2 -2
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +22 -22
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +22 -22
  11. package/es/components/iconfont/index.js +1 -1
  12. package/es/components/page/index.js +11 -6
  13. package/es/components/pisell-config-provider/context.d.ts +2 -3
  14. package/es/components/pisell-config-provider/index.d.ts +1 -0
  15. package/es/components/pisell-config-provider/index.js +5 -3
  16. package/es/components/pisellAlert/index.d.ts +12 -0
  17. package/es/components/pisellAlert/index.js +67 -0
  18. package/es/components/pisellAlert/index.less +149 -0
  19. package/es/components/pisellCard/index.d.ts +2 -42
  20. package/es/components/pisellCard/index.js +5 -78
  21. package/es/components/pisellCard/index.less +5 -85
  22. package/es/components/pisellCardList/index.d.ts +7 -4
  23. package/es/components/pisellCardList/index.js +22 -59
  24. package/es/components/pisellCheckboxGroup/index.d.ts +1 -1
  25. package/es/components/pisellCheckboxGroup/index.js +7 -7
  26. package/es/components/pisellInformationEntry/Input/index.d.ts +8 -0
  27. package/es/components/pisellInformationEntry/Input/index.js +47 -0
  28. package/es/components/pisellInformationEntry/Input/index.less +14 -0
  29. package/es/components/pisellInformationEntry/Scan/index.d.ts +8 -0
  30. package/es/components/pisellInformationEntry/Scan/index.js +24 -0
  31. package/es/components/pisellInformationEntry/Scan/index.less +8 -0
  32. package/es/components/pisellInformationEntry/constants.d.ts +3 -0
  33. package/es/components/pisellInformationEntry/constants.js +21 -0
  34. package/es/components/pisellInformationEntry/index.d.ts +31 -0
  35. package/es/components/pisellInformationEntry/index.js +188 -0
  36. package/es/components/pisellInformationEntry/index.less +40 -0
  37. package/es/components/pisellInformationEntry/utils.d.ts +4 -0
  38. package/es/components/pisellInformationEntry/utils.js +38 -0
  39. package/es/components/pisellModal/components/Information/index.js +4 -3
  40. package/es/components/pisellModal/components/Information/index.less +3 -2
  41. package/es/components/pisellModal/components/MobileModal/index.less +1 -0
  42. package/es/components/pisellModal/components/PcModal/index.d.ts +1 -1
  43. package/es/components/pisellModal/components/PcModal/index.less +8 -0
  44. package/es/components/pisellModal/constants.js +1 -1
  45. package/es/components/pisellScan/index.d.ts +14 -0
  46. package/es/components/pisellScan/index.js +73 -0
  47. package/es/components/pisellScan/index.less +12 -0
  48. package/es/components/pisellWalletPassCard/bg.jpeg +0 -0
  49. package/es/components/pisellWalletPassCard/index.d.ts +50 -0
  50. package/es/components/pisellWalletPassCard/index.js +91 -0
  51. package/es/components/pisellWalletPassCard/index.less +100 -0
  52. package/es/index.d.ts +6 -1
  53. package/es/index.js +9 -2
  54. package/es/locales/en-US.d.ts +6 -0
  55. package/es/locales/en-US.js +9 -1
  56. package/es/locales/zh-CN.d.ts +6 -0
  57. package/es/locales/zh-CN.js +9 -1
  58. package/es/locales/zh-TW.d.ts +6 -0
  59. package/es/locales/zh-TW.js +9 -1
  60. package/lib/components/iconfont/index.js +1 -1
  61. package/lib/components/page/index.js +13 -6
  62. package/lib/components/pisell-config-provider/context.d.ts +2 -3
  63. package/lib/components/pisell-config-provider/index.d.ts +1 -0
  64. package/lib/components/pisell-config-provider/index.js +8 -2
  65. package/lib/components/pisellAlert/index.d.ts +12 -0
  66. package/lib/components/pisellAlert/index.js +95 -0
  67. package/lib/components/pisellAlert/index.less +149 -0
  68. package/lib/components/pisellCard/index.d.ts +2 -42
  69. package/lib/components/pisellCard/index.js +5 -54
  70. package/lib/components/pisellCard/index.less +5 -85
  71. package/lib/components/pisellCardList/index.d.ts +7 -4
  72. package/lib/components/pisellCardList/index.js +21 -59
  73. package/lib/components/pisellCheckboxGroup/index.d.ts +1 -1
  74. package/lib/components/pisellCheckboxGroup/index.js +7 -7
  75. package/lib/components/pisellInformationEntry/Input/index.d.ts +8 -0
  76. package/lib/components/pisellInformationEntry/Input/index.js +54 -0
  77. package/lib/components/pisellInformationEntry/Input/index.less +14 -0
  78. package/lib/components/pisellInformationEntry/Scan/index.d.ts +8 -0
  79. package/lib/components/pisellInformationEntry/Scan/index.js +63 -0
  80. package/lib/components/pisellInformationEntry/Scan/index.less +8 -0
  81. package/lib/components/pisellInformationEntry/constants.d.ts +3 -0
  82. package/lib/components/pisellInformationEntry/constants.js +49 -0
  83. package/lib/components/pisellInformationEntry/index.d.ts +31 -0
  84. package/lib/components/pisellInformationEntry/index.js +162 -0
  85. package/lib/components/pisellInformationEntry/index.less +40 -0
  86. package/lib/components/pisellInformationEntry/utils.d.ts +4 -0
  87. package/lib/components/pisellInformationEntry/utils.js +40 -0
  88. package/lib/components/pisellModal/components/Information/index.js +3 -3
  89. package/lib/components/pisellModal/components/Information/index.less +3 -2
  90. package/lib/components/pisellModal/components/MobileModal/index.less +1 -0
  91. package/lib/components/pisellModal/components/PcModal/index.d.ts +1 -1
  92. package/lib/components/pisellModal/components/PcModal/index.less +8 -0
  93. package/lib/components/pisellModal/constants.js +1 -1
  94. package/lib/components/pisellScan/index.d.ts +14 -0
  95. package/lib/components/pisellScan/index.js +103 -0
  96. package/lib/components/pisellScan/index.less +12 -0
  97. package/lib/components/pisellWalletPassCard/bg.jpeg +0 -0
  98. package/lib/components/pisellWalletPassCard/index.d.ts +50 -0
  99. package/lib/components/pisellWalletPassCard/index.js +99 -0
  100. package/lib/components/pisellWalletPassCard/index.less +100 -0
  101. package/lib/index.d.ts +6 -1
  102. package/lib/index.js +20 -3
  103. package/lib/locales/en-US.d.ts +6 -0
  104. package/lib/locales/en-US.js +9 -1
  105. package/lib/locales/zh-CN.d.ts +6 -0
  106. package/lib/locales/zh-CN.js +9 -1
  107. package/lib/locales/zh-TW.d.ts +6 -0
  108. package/lib/locales/zh-TW.js +9 -1
  109. package/lowcode/pisell-alert/meta.ts +117 -0
  110. package/lowcode/pisell-alert/snippets.ts +50 -0
  111. package/lowcode/pisell-card/__screenshots__/card-1.png +0 -0
  112. package/lowcode/pisell-card/meta.ts +76 -165
  113. package/lowcode/pisell-card/snippets.ts +1 -11
  114. package/lowcode/pisell-information-entry/meta.ts +131 -0
  115. package/lowcode/pisell-information-entry/snippets.ts +17 -0
  116. package/lowcode/pisell-modal/meta.ts +31 -31
  117. package/lowcode/pisell-modal.information/meta.ts +7 -0
  118. package/lowcode/pisell-scan/meta.ts +53 -0
  119. package/lowcode/pisell-scan/snippets.ts +13 -0
  120. package/lowcode/pisell-wallet-pass-card/meta.ts +189 -0
  121. package/lowcode/pisell-wallet-pass-card/snippets.ts +20 -0
  122. package/package.json +4 -3
  123. package/build/lowcode/assets/7b1c7af5ce9e37e4b40ea53fea6ccfd9.jpeg +0 -0
  124. package/build/lowcode/render/default/assets/7b1c7af5ce9e37e4b40ea53fea6ccfd9.jpeg +0 -0
  125. package/dist/umd/materials.min.css +0 -1
  126. package/dist/umd/materials.min.js +0 -1
  127. package/dist/umd/static/DotsSix.57d66266.svg +0 -1
  128. package/dist/umd/static/arrow-left.e542294f.svg +0 -1
  129. package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
  130. package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
  131. package/dist/umd/static/help-circle.31c9be40.svg +0 -1
  132. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
  133. package/es/components/pisellCard/bg.jpeg +0 -0
  134. package/lib/components/pisellCard/bg.jpeg +0 -0
@@ -36,51 +36,11 @@ var import_react = __toESM(require("react"));
36
36
  var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
37
37
  var import_antd = require("antd");
38
38
  var import_pisellCheckboxGroup = __toESM(require("../pisellCheckboxGroup"));
39
- var import_pisellCard = __toESM(require("../pisellCard"));
40
- var mockList = [
41
- {
42
- id: 1,
43
- name: "张三",
44
- qrCode: "https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLRpBpr.png",
45
- storeName: "张三的店铺",
46
- balance: 100,
47
- code: "Walletpass code",
48
- validDate: "2022-01-01",
49
- redeem: 1e3,
50
- disabled: false,
51
- disabledReason: "",
52
- cover: ""
53
- },
54
- {
55
- id: 2,
56
- name: "张三",
57
- qrCode: "https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLRpBpr.png",
58
- storeName: "张三的店铺",
59
- balance: 100,
60
- code: "Walletpass code",
61
- validDate: "2022-01-01",
62
- redeem: 1e3,
63
- disabled: true,
64
- disabledReason: "Used maximum amount",
65
- cover: ""
66
- },
67
- {
68
- id: 3,
69
- name: "张三",
70
- qrCode: "https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLRpBpr.png",
71
- storeName: "张三的店铺",
72
- balance: 100,
73
- code: "Walletpass code",
74
- validDate: "2022-01-01",
75
- redeem: 1e3,
76
- disabled: false,
77
- disabledReason: "",
78
- cover: ""
79
- }
80
- ];
39
+ var import_pisellWalletPassCard = __toESM(require("../pisellWalletPassCard"));
40
+ var import_pisellEmpty = __toESM(require("../pisellEmpty"));
81
41
  var PisellCardList = (props) => {
82
42
  const {
83
- data = mockList,
43
+ data,
84
44
  loadMoreData = () => {
85
45
  },
86
46
  endMessage,
@@ -97,7 +57,10 @@ var PisellCardList = (props) => {
97
57
  showRedeem,
98
58
  showQrCode,
99
59
  showStoreName,
100
- showValidDate
60
+ showValidDate,
61
+ empty,
62
+ showEmpty,
63
+ showBalanceSymbol
101
64
  } = props;
102
65
  return /* @__PURE__ */ import_react.default.createElement(
103
66
  import_react_infinite_scroll_component.default,
@@ -109,38 +72,37 @@ var PisellCardList = (props) => {
109
72
  endMessage,
110
73
  scrollableTarget: "scrollableDiv"
111
74
  },
112
- /* @__PURE__ */ import_react.default.createElement(
75
+ data.length ? /* @__PURE__ */ import_react.default.createElement(
113
76
  import_pisellCheckboxGroup.default,
114
77
  {
115
78
  options: data,
116
79
  value,
117
80
  mode,
118
81
  rowKey: "id",
119
- className: "payment-list",
120
82
  gap: 12,
121
83
  onChange,
122
84
  iconPosition: "hide",
123
- optionClassName: "payment-item",
124
85
  renderOption: (item, active) => {
125
86
  return /* @__PURE__ */ import_react.default.createElement(
126
- import_pisellCard.default,
87
+ import_pisellWalletPassCard.default,
127
88
  {
128
89
  ...item,
129
90
  active,
130
- showName,
131
- showBalance,
132
- showCode,
133
- showCover,
134
- showDetail,
135
- showQrCode,
136
- showRedeem,
137
- showStoreName,
138
- showValidDate
91
+ showName: showName || (item == null ? void 0 : item.showName),
92
+ showBalance: showBalance || (item == null ? void 0 : item.showBalance),
93
+ showCode: showCode || (item == null ? void 0 : item.showCode),
94
+ showCover: showCover || (item == null ? void 0 : item.showCover),
95
+ showDetail: showDetail || (item == null ? void 0 : item.showDetail),
96
+ showQrCode: showQrCode || (item == null ? void 0 : item.showQrCode),
97
+ showRedeem: showRedeem || (item == null ? void 0 : item.showRedeem),
98
+ showStoreName: showStoreName || (item == null ? void 0 : item.showStoreName),
99
+ showValidDate: showValidDate || (item == null ? void 0 : item.showValidDate),
100
+ showBalanceSymbol: showBalanceSymbol || (item == null ? void 0 : item.showBalanceSymbol)
139
101
  }
140
102
  );
141
103
  }
142
104
  }
143
- )
105
+ ) : showEmpty && (empty || /* @__PURE__ */ import_react.default.createElement(import_pisellEmpty.default, null))
144
106
  );
145
107
  };
146
- var pisellCardList_default = PisellCardList;
108
+ var pisellCardList_default = (0, import_react.memo)(PisellCardList);
@@ -13,7 +13,7 @@ export interface PisellCheckboxGroupProps extends React.HTMLAttributes<HTMLDivEl
13
13
  gap?: number;
14
14
  padding?: number;
15
15
  options: PisellCheckboxGroupOption[];
16
- onChange?: (value: PisellCheckboxGroupValue) => void;
16
+ onChange?: (value: PisellCheckboxGroupValue, item: PisellCheckboxGroupOption) => void;
17
17
  value?: PisellCheckboxGroupValue;
18
18
  renderOption?: (option: PisellCheckboxGroupOption, active: boolean) => React.ReactNode;
19
19
  rowKey?: string;
@@ -90,15 +90,15 @@ var PisellCheckboxGroup = (props) => {
90
90
  (0, import_react.useEffect)(() => {
91
91
  document.body.id = "body";
92
92
  }, []);
93
- const _onChange = (val) => {
94
- onChange == null ? void 0 : onChange(mode === "single" ? val[0] : val);
93
+ const _onChange = (val, item) => {
94
+ onChange == null ? void 0 : onChange(mode === "single" ? val[0] : val, item);
95
95
  };
96
- const handleSelectItem = (item) => {
97
- let newVal = [item];
96
+ const handleSelectItem = (key, item) => {
97
+ let newVal = [key];
98
98
  if (mode === "multiple") {
99
- newVal = (0, import_utils2.changeArray)(_value, item, "this");
99
+ newVal = (0, import_utils2.changeArray)(_value, key, "this");
100
100
  }
101
- _onChange(newVal);
101
+ _onChange(newVal, item);
102
102
  set_value(newVal);
103
103
  };
104
104
  const CheckBoxItem = mode === "multiple" ? import_antd.Checkbox : import_antd.Radio;
@@ -125,7 +125,7 @@ var PisellCheckboxGroup = (props) => {
125
125
  key: option[rowKey],
126
126
  gap: 10,
127
127
  onClick: () => {
128
- handleSelectItem(option[rowKey]);
128
+ handleSelectItem(option[rowKey], option);
129
129
  },
130
130
  leftContent: iconPosition === "left" && /* @__PURE__ */ import_react.default.createElement(
131
131
  CheckBoxItem,
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface PisellEntryInputProps {
4
+ onChange: (val: string) => void;
5
+ searchDescribe?: React.ReactNode;
6
+ }
7
+ declare const PisellEntryInput: (props: PisellEntryInputProps) => React.JSX.Element;
8
+ export default PisellEntryInput;
@@ -0,0 +1,54 @@
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/Input/index.tsx
30
+ var Input_exports = {};
31
+ __export(Input_exports, {
32
+ default: () => Input_default
33
+ });
34
+ module.exports = __toCommonJS(Input_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_pisellInput = __toESM(require("../../pisellInput"));
37
+ var import_button = __toESM(require("../../button"));
38
+ var import_iconfont = __toESM(require("../../iconfont"));
39
+ var import_index = require("./index.less");
40
+ var import_locales = require("../../../locales");
41
+ var PisellEntryInput = (props) => {
42
+ const { onChange, searchDescribe } = props;
43
+ const [value, setValue] = (0, import_react.useState)("");
44
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-entry-input-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-entry-input-line" }, /* @__PURE__ */ import_react.default.createElement(
45
+ import_pisellInput.default,
46
+ {
47
+ value,
48
+ onChange: (e) => setValue(e.target.value),
49
+ style: { flex: 1 },
50
+ prefix: /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { style: { color: "#667085" }, type: "pisell2-search-lg" })
51
+ }
52
+ ), /* @__PURE__ */ import_react.default.createElement(import_button.default, { size: "large", onClick: () => onChange(value) }, (0, import_locales.getText)("pisell-information-entry-input-search"))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-entry-input-describe" }, searchDescribe));
53
+ };
54
+ var Input_default = PisellEntryInput;
@@ -0,0 +1,14 @@
1
+ .pisell-entry-input-wrap {
2
+ .pisell-entry-input-line {
3
+ display: flex;
4
+ gap: 10px;
5
+ }
6
+ .pisell-entry-input-describe {
7
+ color: var(--Gray-600, #475467);
8
+ font-size: 14px;
9
+ font-style: normal;
10
+ font-weight: 400;
11
+ line-height: 20px; /* 142.857% */
12
+ margin-top: 8px;
13
+ }
14
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface ScanProps {
4
+ onChange: (val: string) => void;
5
+ onCancel: () => void;
6
+ }
7
+ declare const Scan: (props: ScanProps) => React.JSX.Element;
8
+ export default Scan;
@@ -0,0 +1,63 @@
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/Scan/index.tsx
30
+ var Scan_exports = {};
31
+ __export(Scan_exports, {
32
+ default: () => Scan_default
33
+ });
34
+ module.exports = __toCommonJS(Scan_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_pisellScan = __toESM(require("../../pisellScan"));
37
+ var import_index = require("./index.less");
38
+ var import_locales = require("../../../locales");
39
+ var Scan = (props) => {
40
+ const { onChange, onCancel } = props;
41
+ const scanRef = (0, import_react.useRef)(null);
42
+ return /* @__PURE__ */ import_react.default.createElement(
43
+ import_pisellScan.default,
44
+ {
45
+ width: "100%",
46
+ borderRadius: "12px",
47
+ onChange,
48
+ ref: scanRef
49
+ },
50
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-scan-custom-action" }, /* @__PURE__ */ import_react.default.createElement(
51
+ "span",
52
+ {
53
+ onClick: () => {
54
+ var _a, _b;
55
+ (_b = (_a = scanRef.current) == null ? void 0 : _a.codeReader) == null ? void 0 : _b.reset();
56
+ onCancel();
57
+ }
58
+ },
59
+ (0, import_locales.getText)("pisell-information-entry-scan-exit")
60
+ ))
61
+ );
62
+ };
63
+ var Scan_default = Scan;
@@ -0,0 +1,8 @@
1
+ .pisell-scan-custom-action {
2
+ color: #fff;
3
+ padding: 16px;
4
+ text-align: right;
5
+ font-size: 16px;
6
+ font-weight: 600;
7
+ line-height: 24px; /* 150% */
8
+ }
@@ -0,0 +1,3 @@
1
+ import { EntryModeType } from './index';
2
+ export declare const entryModeTextIcon: Record<EntryModeType['type'], any>;
3
+ export declare const passiveModeType: string[];
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/pisellInformationEntry/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ entryModeTextIcon: () => entryModeTextIcon,
23
+ passiveModeType: () => passiveModeType
24
+ });
25
+ module.exports = __toCommonJS(constants_exports);
26
+ var entryModeTextIcon = {
27
+ scanCode: {
28
+ icon: "pisell2-qr-code-02",
29
+ text: "Scan Bar/QR codes"
30
+ },
31
+ input: {
32
+ icon: "pisell2-a-keyboard-011",
33
+ text: "Enter coupon codes"
34
+ },
35
+ scanner: {
36
+ icon: "pisell2-a-Scanner1",
37
+ text: "Scanner ready"
38
+ },
39
+ nfc: {
40
+ icon: "pisell2-a-NFC2",
41
+ text: "NFC ready"
42
+ }
43
+ };
44
+ var passiveModeType = ["scanner", "nfc"];
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ entryModeTextIcon,
48
+ passiveModeType
49
+ });
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { PisellContextType } from '../pisell-config-provider/context';
3
+ import './index.less';
4
+ export declare type EntryModeType = {
5
+ /**
6
+ * 录入模式名称
7
+ * scanCode: 扫码录入
8
+ * input: 手动录入
9
+ * scanner: 扫码枪录入
10
+ * nfc: NFC录入
11
+ */
12
+ type: 'scanCode' | 'input' | 'scanner' | 'nfc';
13
+ /**
14
+ * 录入模式文案 没有使用默认文案
15
+ */
16
+ name?: string;
17
+ };
18
+ export interface PisellInformationEntryProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'onChange'> {
19
+ /** 平台 */
20
+ platform?: PisellContextType['platform'];
21
+ /** 录入模式 */
22
+ entryModes: EntryModeType[];
23
+ /** 标题文案 */
24
+ title?: React.ReactNode;
25
+ /** 搜索框描述文案 */
26
+ searchDescribe?: React.ReactNode;
27
+ /** 录入信息值改变 */
28
+ onChange?: (val: string) => void;
29
+ }
30
+ declare const PisellInformationEntry: (props: PisellInformationEntryProps) => React.JSX.Element;
31
+ export default PisellInformationEntry;
@@ -0,0 +1,162 @@
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/index.tsx
30
+ var pisellInformationEntry_exports = {};
31
+ __export(pisellInformationEntry_exports, {
32
+ default: () => pisellInformationEntry_default
33
+ });
34
+ module.exports = __toCommonJS(pisellInformationEntry_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_classnames = __toESM(require("classnames"));
37
+ var import_usePisellConfig = __toESM(require("../pisell-config-provider/hooks/usePisellConfig"));
38
+ var import_pisellCard = __toESM(require("../pisellCard"));
39
+ var import_iconfont = __toESM(require("../iconfont"));
40
+ var import_constants = require("./constants");
41
+ var import_Scan = __toESM(require("./Scan"));
42
+ var import_button = __toESM(require("../button"));
43
+ var import_Input = __toESM(require("./Input"));
44
+ var import_utils = require("./utils");
45
+ var import_index = require("./index.less");
46
+ var CardButton = (props) => {
47
+ const { icon, children, ...others } = props;
48
+ return /* @__PURE__ */ import_react.default.createElement(import_pisellCard.default, { ...others }, /* @__PURE__ */ import_react.default.createElement("div", null, icon), /* @__PURE__ */ import_react.default.createElement("div", null, children));
49
+ };
50
+ var PisellInformationEntry = (props) => {
51
+ const {
52
+ platform: propsPlatform,
53
+ title,
54
+ entryModes = [],
55
+ searchDescribe,
56
+ onChange
57
+ } = props;
58
+ const config = (0, import_usePisellConfig.default)();
59
+ const { platform } = config;
60
+ const [currentType, setCurrentType] = (0, import_react.useState)(
61
+ null
62
+ );
63
+ const [availableEntryModes, setAvailableEntryModes] = (0, import_react.useState)(entryModes);
64
+ (0, import_react.useEffect)(() => {
65
+ document.body.id = "body";
66
+ }, []);
67
+ (0, import_react.useEffect)(() => {
68
+ const getEntryModes = async () => {
69
+ let available = entryModes;
70
+ if (!await (0, import_utils.hasCamera)()) {
71
+ available = entryModes.filter((item) => item.type !== "scanCode");
72
+ }
73
+ if (available.length === 1) {
74
+ setCurrentType(available[0].type);
75
+ }
76
+ setAvailableEntryModes(available);
77
+ };
78
+ getEntryModes();
79
+ }, [entryModes]);
80
+ const handleChange = (val) => {
81
+ onChange == null ? void 0 : onChange(val);
82
+ };
83
+ const handleEntryClick = (type) => {
84
+ if (import_constants.passiveModeType.includes(type)) {
85
+ return;
86
+ }
87
+ setCurrentType(type);
88
+ };
89
+ const { isHasInput, isHasNfc, isHasScanner, isHasScanCode } = (0, import_react.useMemo)(() => {
90
+ let isHasScanCode2 = false;
91
+ let isHasInput2 = false;
92
+ let isHasScanner2 = false;
93
+ let isHasNfc2 = false;
94
+ availableEntryModes.forEach((item) => {
95
+ if (item.type === "scanCode") {
96
+ isHasScanCode2 = true;
97
+ }
98
+ if (item.type === "input") {
99
+ isHasInput2 = true;
100
+ }
101
+ if (item.type === "scanner") {
102
+ isHasScanner2 = true;
103
+ }
104
+ if (item.type === "nfc") {
105
+ isHasNfc2 = true;
106
+ }
107
+ });
108
+ return {
109
+ isHasScanCode: isHasScanCode2,
110
+ isHasInput: isHasInput2,
111
+ isHasScanner: isHasScanner2,
112
+ isHasNfc: isHasNfc2
113
+ };
114
+ }, [availableEntryModes]);
115
+ const isShowEntryModes = (0, import_react.useMemo)(() => {
116
+ if (!currentType) {
117
+ return true;
118
+ }
119
+ if (availableEntryModes.length === 1 && import_constants.passiveModeType.includes(availableEntryModes[0].type)) {
120
+ return true;
121
+ }
122
+ return false;
123
+ }, [currentType, availableEntryModes]);
124
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-information-entry-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-information-entry-title" }, /* @__PURE__ */ import_react.default.createElement("span", null, title), currentType && isHasScanCode && isHasInput && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-information-entry-title-action-wrap" }, isHasScanCode && /* @__PURE__ */ import_react.default.createElement(
125
+ import_button.default,
126
+ {
127
+ size: "large",
128
+ type: currentType === "scanCode" ? "primary" : "default",
129
+ icon: /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: import_constants.entryModeTextIcon["scanCode"].icon }),
130
+ onClick: () => handleEntryClick("scanCode")
131
+ }
132
+ ), isHasInput && /* @__PURE__ */ import_react.default.createElement(
133
+ import_button.default,
134
+ {
135
+ size: "large",
136
+ type: currentType === "input" ? "primary" : "default",
137
+ icon: /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: import_constants.entryModeTextIcon["input"].icon }),
138
+ onClick: () => handleEntryClick("input")
139
+ }
140
+ ))), isShowEntryModes && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-information-entry-modes" }, availableEntryModes.map((item) => {
141
+ const detail = import_constants.entryModeTextIcon[item.type];
142
+ return /* @__PURE__ */ import_react.default.createElement(
143
+ CardButton,
144
+ {
145
+ bordered: !import_constants.passiveModeType.includes(item.type),
146
+ icon: /* @__PURE__ */ import_react.default.createElement(
147
+ import_iconfont.default,
148
+ {
149
+ type: detail.icon,
150
+ className: "pisell-card-button-icon"
151
+ }
152
+ ),
153
+ className: (0, import_classnames.default)("pisell-information-entry-item", {
154
+ ["pisell-entry-ready"]: import_constants.passiveModeType.includes(item.type)
155
+ }),
156
+ onClick: () => handleEntryClick(item.type)
157
+ },
158
+ item.name || detail.text
159
+ );
160
+ })), /* @__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 })));
161
+ };
162
+ var pisellInformationEntry_default = PisellInformationEntry;
@@ -0,0 +1,40 @@
1
+ .pisell-information-entry-wrap {
2
+ .pisell-information-entry-title {
3
+ color: var(--Gray-900, #101828);
4
+ font-size: 18px;
5
+ font-style: normal;
6
+ font-weight: 600;
7
+ line-height: 28px; /* 155.556% */
8
+ margin-bottom: 10px;
9
+ display: flex;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+ gap: 20px;
13
+ .pisell-information-entry-title-action-wrap {
14
+ display: flex;
15
+ gap: 10px;
16
+ }
17
+ }
18
+ .pisell-information-entry-modes {
19
+ display: flex;
20
+ gap: 10px;
21
+ flex-wrap: wrap;
22
+ .pisell-information-entry-item {
23
+ flex: 1;
24
+ text-align: center;
25
+ cursor: pointer;
26
+ min-width: 165px;
27
+ .pisell-card-button-icon {
28
+ height: 48px;
29
+ font-size: 36px;
30
+ }
31
+ }
32
+ .pisell-entry-ready {
33
+ background: var(--Gray-50, #f9fafb);
34
+ cursor: inherit;
35
+ .pisell-card-button-icon {
36
+ font-size: 60px;
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 判断设备是否包含摄像头
3
+ */
4
+ export declare const hasCamera: () => Promise<boolean>;
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/pisellInformationEntry/utils.ts
20
+ var utils_exports = {};
21
+ __export(utils_exports, {
22
+ hasCamera: () => hasCamera
23
+ });
24
+ module.exports = __toCommonJS(utils_exports);
25
+ var hasCamera = async () => {
26
+ try {
27
+ const devices = await navigator.mediaDevices.enumerateDevices();
28
+ const hasVideoInput = devices.some(
29
+ (device) => device.kind === "videoinput"
30
+ );
31
+ return hasVideoInput;
32
+ } catch (error) {
33
+ console.error("Error accessing media devices:", error);
34
+ return false;
35
+ }
36
+ };
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ hasCamera
40
+ });