@pisell/private-materials 6.6.59 → 6.6.61
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 +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +11 -11
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/components/footer/utils.js +79 -75
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/es/components/pisellCashCounting/PisellCashCounting.js +121 -0
- package/es/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.js +250 -0
- package/es/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/es/components/pisellCashCounting/hooks.d.ts +21 -0
- package/es/components/pisellCashCounting/hooks.js +193 -0
- package/es/components/pisellCashCounting/index.d.ts +2 -0
- package/es/components/pisellCashCounting/index.js +1 -0
- package/es/components/pisellCashCounting/locales.d.ts +118 -0
- package/es/components/pisellCashCounting/locales.js +117 -0
- package/es/components/pisellCashCounting/types.d.ts +85 -0
- package/es/components/pisellCashCounting/types.js +1 -0
- package/es/components/pisellCashCounting/utils.d.ts +10 -0
- package/es/components/pisellCashCounting/utils.js +40 -0
- package/es/hooks/useResponsive.d.ts +8 -0
- package/es/hooks/useResponsive.js +43 -0
- package/es/hooks/useThemeTokens.d.ts +7 -0
- package/es/hooks/useThemeTokens.js +20 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/pro/NumericStepper/index.d.ts +75 -0
- package/es/pro/NumericStepper/index.js +301 -0
- package/es/pro/NumericStepper/index.less +364 -0
- package/es/pro/keyboards/index.d.ts +2 -0
- package/es/pro/keyboards/index.js +1 -0
- package/es/pro/keyboards/locales.d.ts +38 -0
- package/es/pro/keyboards/locales.js +57 -0
- package/es/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/es/pro/keyboards/numberKeyboard/index.js +523 -0
- package/es/pro/keyboards/numberKeyboard/index.less +59 -0
- package/es/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/es/pro/keyboards/numberKeyboard/types.js +1 -0
- package/es/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/es/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lib/components/booking/components/footer/utils.js +6 -3
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.d.ts +5 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.js +168 -0
- package/lib/components/pisellCashCounting/PisellCashCounting.less +263 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.d.ts +20 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.js +171 -0
- package/lib/components/pisellCashCounting/components/CashCountingModal/index.less +279 -0
- package/lib/components/pisellCashCounting/hooks.d.ts +21 -0
- package/lib/components/pisellCashCounting/hooks.js +189 -0
- package/lib/components/pisellCashCounting/index.d.ts +2 -0
- package/lib/components/pisellCashCounting/index.js +35 -0
- package/lib/components/pisellCashCounting/locales.d.ts +118 -0
- package/lib/components/pisellCashCounting/locales.js +141 -0
- package/lib/components/pisellCashCounting/types.d.ts +85 -0
- package/lib/components/pisellCashCounting/types.js +17 -0
- package/lib/components/pisellCashCounting/utils.d.ts +10 -0
- package/lib/components/pisellCashCounting/utils.js +59 -0
- package/lib/hooks/useResponsive.d.ts +8 -0
- package/lib/hooks/useResponsive.js +48 -0
- package/lib/hooks/useThemeTokens.d.ts +7 -0
- package/lib/hooks/useThemeTokens.js +40 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/pro/NumericStepper/index.d.ts +75 -0
- package/lib/pro/NumericStepper/index.js +338 -0
- package/lib/pro/NumericStepper/index.less +364 -0
- package/lib/pro/keyboards/index.d.ts +2 -0
- package/lib/pro/keyboards/index.js +39 -0
- package/lib/pro/keyboards/locales.d.ts +38 -0
- package/lib/pro/keyboards/locales.js +61 -0
- package/lib/pro/keyboards/numberKeyboard/index.d.ts +16 -0
- package/lib/pro/keyboards/numberKeyboard/index.js +400 -0
- package/lib/pro/keyboards/numberKeyboard/index.less +59 -0
- package/lib/pro/keyboards/numberKeyboard/types.d.ts +63 -0
- package/lib/pro/keyboards/numberKeyboard/types.js +17 -0
- package/lib/pro/pisellPriceKeyboardModal/PisellPriceKeyboardModal.js +3 -1
- package/lib/pro/pisellPriceKeyboardModal/types.d.ts +2 -0
- package/lowcode/pisell-cash-counting/meta.ts +167 -0
- package/lowcode/pisell-cash-counting/snippets.ts +13 -0
- package/package.json +4 -4
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
.pisell-private-cash-counting-modal {
|
|
2
|
+
&__modal-wrap {
|
|
3
|
+
.pisell-lowcode-modal-footer {
|
|
4
|
+
background: rgb(249, 250, 251);
|
|
5
|
+
padding: 12px 16px !important;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&__modal {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__modal-header {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
|
|
19
|
+
&__modal-header-icon {
|
|
20
|
+
font-size: 20px;
|
|
21
|
+
color: #667085;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__modal-intro {
|
|
26
|
+
padding: 10px 16px;
|
|
27
|
+
background: #FFF2C2;
|
|
28
|
+
color: #995522;
|
|
29
|
+
border-radius: 6px;
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__subtitle {
|
|
37
|
+
color: #667085;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
line-height: 20px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__currency {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
min-height: 28px;
|
|
46
|
+
margin-top: 12px;
|
|
47
|
+
padding: 4px 10px;
|
|
48
|
+
border-radius: 999px;
|
|
49
|
+
background: #f2f4f7;
|
|
50
|
+
color: #344054;
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__scroll {
|
|
56
|
+
flex: 1;
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
gap: 16px;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__empty {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
min-height: 220px;
|
|
69
|
+
color: #98a2b3;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__section {
|
|
74
|
+
padding: 16px;
|
|
75
|
+
flex: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&__section+&__section {
|
|
79
|
+
|
|
80
|
+
border-top: none;
|
|
81
|
+
padding-bottom: 16px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__section-header {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
gap: 16px;
|
|
89
|
+
margin-bottom: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__section-title {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 8px;
|
|
96
|
+
color: #667085;
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
font-weight: 700;
|
|
99
|
+
letter-spacing: 0.04em;
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__dot {
|
|
104
|
+
width: 8px;
|
|
105
|
+
height: 8px;
|
|
106
|
+
border-radius: 50%;
|
|
107
|
+
background: #635bff;
|
|
108
|
+
|
|
109
|
+
&--coin {
|
|
110
|
+
background: #f59e0b;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__section-subtotal {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 10px;
|
|
118
|
+
color: #667085;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
|
|
121
|
+
strong {
|
|
122
|
+
color: #101828;
|
|
123
|
+
font-size: 15px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&__denomination-list {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__denomination-row {
|
|
134
|
+
// display: grid;
|
|
135
|
+
// grid-template-columns: 94px minmax(220px, 1fr) minmax(94px, 1fr);
|
|
136
|
+
align-items: center;
|
|
137
|
+
gap: 16px;
|
|
138
|
+
display: flex;
|
|
139
|
+
justify-content: space-between;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&__denomination-label {
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
min-width: 94px;
|
|
147
|
+
height: 32px;
|
|
148
|
+
padding: 0 12px;
|
|
149
|
+
border-radius: 6px;
|
|
150
|
+
background: #dbeafe;
|
|
151
|
+
color: #175cd3;
|
|
152
|
+
font-size: 14px;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
|
|
155
|
+
&--coin {
|
|
156
|
+
background: #fef3c7;
|
|
157
|
+
color: #92400e;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__denomination-left {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 16px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__stepper {
|
|
168
|
+
&.numeric-stepper {
|
|
169
|
+
gap: 8px;
|
|
170
|
+
grid-template-columns: auto auto auto;
|
|
171
|
+
justify-content: flex-start;
|
|
172
|
+
width: auto;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.numeric-stepper-button {
|
|
176
|
+
width: 40px;
|
|
177
|
+
height: 32px;
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.numeric-stepper-display {
|
|
182
|
+
width: 70px;
|
|
183
|
+
height: 32px;
|
|
184
|
+
max-width: 70px;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__row-amount {
|
|
189
|
+
justify-self: end;
|
|
190
|
+
color: #98a2b3;
|
|
191
|
+
font-size: 15px;
|
|
192
|
+
font-weight: 700;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&__footer {
|
|
196
|
+
width: 100%;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__summary {
|
|
200
|
+
padding-bottom: 4px;
|
|
201
|
+
border-bottom: 1px dashed #d0d5dd;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&__summary-row,
|
|
205
|
+
&__total-row {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
gap: 16px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&__summary-row {
|
|
213
|
+
color: #667085;
|
|
214
|
+
font-size: 15px;
|
|
215
|
+
|
|
216
|
+
+.pisell-private-cash-counting__summary-row {
|
|
217
|
+
margin-top: 10px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
strong {
|
|
221
|
+
color: #101828;
|
|
222
|
+
font-size: 16px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&__total-row {
|
|
227
|
+
margin-top: 4px;
|
|
228
|
+
color: #101828;
|
|
229
|
+
font-size: 18px;
|
|
230
|
+
font-weight: 700;
|
|
231
|
+
|
|
232
|
+
strong {
|
|
233
|
+
font-size: 34px;
|
|
234
|
+
line-height: 40px;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&__actions {
|
|
239
|
+
display: grid;
|
|
240
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
241
|
+
gap: 12px;
|
|
242
|
+
margin-top: 12px;
|
|
243
|
+
|
|
244
|
+
.pisell-lowcode-btn {
|
|
245
|
+
margin: 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
&__scroll-column {
|
|
250
|
+
padding: 0 0 10px;
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
gap: 0;
|
|
253
|
+
|
|
254
|
+
.numeric-stepper-button {
|
|
255
|
+
width: 66px!important;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.numeric-stepper-display {
|
|
259
|
+
width: 100px!important;
|
|
260
|
+
max-width: 100px!important;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&__scroll-mobile {
|
|
265
|
+
.numeric-stepper-button {
|
|
266
|
+
width: 32px!important;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.numeric-stepper-display {
|
|
270
|
+
width: 60px!important;
|
|
271
|
+
max-width: 60px!important;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&__scroll-column &__section+&__section {
|
|
276
|
+
border-top: 1px solid #f2f4f7;
|
|
277
|
+
padding-bottom: 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CashCountingConfirmPayload, PisellCashCountingProps } from './types';
|
|
2
|
+
import type { PisellCashCountingModalRef } from './components/CashCountingModal/index';
|
|
3
|
+
export declare function usePisellCashCounting({ value, defaultValue, currencyCode, currencySymbol, amountPrecision, denominations, disabled, countDisabled, onChange, onCountConfirm, onCountCancel, }: PisellCashCountingProps): {
|
|
4
|
+
modalRef: import("react").RefObject<PisellCashCountingModalRef>;
|
|
5
|
+
triggerRef: import("react").RefObject<HTMLDivElement>;
|
|
6
|
+
keyboardOpen: boolean;
|
|
7
|
+
setKeyboardOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
currencyDenominations: import("./types").CurrencyDenominationConfig[];
|
|
9
|
+
decimalPlaces: number;
|
|
10
|
+
symbol: any;
|
|
11
|
+
currencyCode: any;
|
|
12
|
+
currentValue: string;
|
|
13
|
+
handleAmountChange: (nextValue: string | number) => void;
|
|
14
|
+
handleKeyboardClose: () => void;
|
|
15
|
+
openCountModal: () => void;
|
|
16
|
+
handleCountCancel: () => void;
|
|
17
|
+
handleCountConfirm: (payload: CashCountingConfirmPayload) => void;
|
|
18
|
+
manualCountMismatchOpen: boolean;
|
|
19
|
+
confirmUseCountedTotal: () => void;
|
|
20
|
+
confirmKeepManualAmount: () => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { message } from 'antd';
|
|
15
|
+
import { locales } from '@pisell/utils';
|
|
16
|
+
import { buildEmptyQuantities, getEffectiveDenominationsForCurrency } from "./utils";
|
|
17
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
18
|
+
export function usePisellCashCounting(_ref) {
|
|
19
|
+
var _context$appHelper, _store$getState2, _currencyDenomination3;
|
|
20
|
+
var value = _ref.value,
|
|
21
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
22
|
+
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
23
|
+
currencyCode = _ref.currencyCode,
|
|
24
|
+
currencySymbol = _ref.currencySymbol,
|
|
25
|
+
amountPrecision = _ref.amountPrecision,
|
|
26
|
+
_ref$denominations = _ref.denominations,
|
|
27
|
+
denominations = _ref$denominations === void 0 ? [] : _ref$denominations,
|
|
28
|
+
_ref$disabled = _ref.disabled,
|
|
29
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
30
|
+
_ref$countDisabled = _ref.countDisabled,
|
|
31
|
+
countDisabled = _ref$countDisabled === void 0 ? false : _ref$countDisabled,
|
|
32
|
+
onChange = _ref.onChange,
|
|
33
|
+
onCountConfirm = _ref.onCountConfirm,
|
|
34
|
+
onCountCancel = _ref.onCountCancel;
|
|
35
|
+
var context = useEngineContext();
|
|
36
|
+
var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
37
|
+
store = _ref2.store;
|
|
38
|
+
var modalRef = useRef(null);
|
|
39
|
+
var triggerRef = useRef(null);
|
|
40
|
+
var _useState = useState(false),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
+
keyboardOpen = _useState2[0],
|
|
43
|
+
setKeyboardOpen = _useState2[1];
|
|
44
|
+
var _useState3 = useState(defaultValue),
|
|
45
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
46
|
+
internalValue = _useState4[0],
|
|
47
|
+
setInternalValue = _useState4[1];
|
|
48
|
+
var _useState5 = useState({}),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
confirmedQuantities = _useState6[0],
|
|
51
|
+
setConfirmedQuantities = _useState6[1];
|
|
52
|
+
// 数钱结果
|
|
53
|
+
var countedResultRef = useRef(null);
|
|
54
|
+
// 手动输入金额
|
|
55
|
+
var manualInputValueRef = useRef(null);
|
|
56
|
+
// 手动输入金额与数钱总额不一致时弹窗
|
|
57
|
+
var _useState7 = useState(false),
|
|
58
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
59
|
+
manualCountMismatchOpen = _useState8[0],
|
|
60
|
+
setManualCountMismatchOpen = _useState8[1];
|
|
61
|
+
var globalConfig = useMemo(function () {
|
|
62
|
+
var _store$getState;
|
|
63
|
+
var global = (store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 || (_store$getState = _store$getState.call(store)) === null || _store$getState === void 0 ? void 0 : _store$getState.global) || {};
|
|
64
|
+
return {
|
|
65
|
+
symbol: (global === null || global === void 0 ? void 0 : global.symbol) || '$',
|
|
66
|
+
currency_code: (global === null || global === void 0 ? void 0 : global.currency_code) || 'AUD'
|
|
67
|
+
};
|
|
68
|
+
}, [store === null || store === void 0 || (_store$getState2 = store.getState) === null || _store$getState2 === void 0 || (_store$getState2 = _store$getState2.call(store)) === null || _store$getState2 === void 0 ? void 0 : _store$getState2.global]);
|
|
69
|
+
var _currencyCode = useMemo(function () {
|
|
70
|
+
return currencyCode || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.currency_code);
|
|
71
|
+
}, [currencyCode, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.currency_code]);
|
|
72
|
+
var currencyDenominations = useMemo(function () {
|
|
73
|
+
return getEffectiveDenominationsForCurrency(denominations, _currencyCode);
|
|
74
|
+
}, [_currencyCode, denominations]);
|
|
75
|
+
var decimalPlaces = useMemo(function () {
|
|
76
|
+
var _currencyDenomination, _currencyDenomination2;
|
|
77
|
+
if (typeof amountPrecision === 'number') {
|
|
78
|
+
return amountPrecision;
|
|
79
|
+
}
|
|
80
|
+
return (_currencyDenomination = (_currencyDenomination2 = currencyDenominations[0]) === null || _currencyDenomination2 === void 0 ? void 0 : _currencyDenomination2.decimal_places) !== null && _currencyDenomination !== void 0 ? _currencyDenomination : 2;
|
|
81
|
+
}, [amountPrecision, (_currencyDenomination3 = currencyDenominations[0]) === null || _currencyDenomination3 === void 0 ? void 0 : _currencyDenomination3.decimal_places]);
|
|
82
|
+
var symbolValue = useMemo(function () {
|
|
83
|
+
if (currencySymbol) {
|
|
84
|
+
return currencySymbol;
|
|
85
|
+
}
|
|
86
|
+
return globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.symbol;
|
|
87
|
+
}, [currencySymbol, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.symbol]);
|
|
88
|
+
var currentValue = useMemo(function () {
|
|
89
|
+
return String(value !== null && value !== void 0 ? value : internalValue);
|
|
90
|
+
}, [value, internalValue]);
|
|
91
|
+
var updateAmount = useCallback(function (nextValue, source) {
|
|
92
|
+
if (value === undefined) {
|
|
93
|
+
setInternalValue(nextValue);
|
|
94
|
+
}
|
|
95
|
+
if (typeof onChange === 'function') {
|
|
96
|
+
onChange(nextValue, {
|
|
97
|
+
source: source
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [decimalPlaces, onChange, value]);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @description: 价格键盘输入
|
|
104
|
+
* @return {*}
|
|
105
|
+
*/
|
|
106
|
+
var handleAmountChange = useCallback(function (nextValue) {
|
|
107
|
+
manualInputValueRef.current = nextValue;
|
|
108
|
+
updateAmount(String(nextValue), 'manual');
|
|
109
|
+
}, [updateAmount]);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @description: 价格键盘关闭
|
|
113
|
+
* @return {*}
|
|
114
|
+
*/
|
|
115
|
+
var handleKeyboardClose = useCallback(function () {
|
|
116
|
+
var _countedResultRef$cur;
|
|
117
|
+
setKeyboardOpen(false);
|
|
118
|
+
// 手动输入金额与数钱总额不一致时弹窗
|
|
119
|
+
if ((_countedResultRef$cur = countedResultRef.current) !== null && _countedResultRef$cur !== void 0 && _countedResultRef$cur.amount && Number(countedResultRef.current.amount) !== Number(manualInputValueRef.current)) {
|
|
120
|
+
setManualCountMismatchOpen(true);
|
|
121
|
+
}
|
|
122
|
+
}, [setManualCountMismatchOpen]);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @description: 使用数钱金额
|
|
126
|
+
* @param {*} useCallback
|
|
127
|
+
* @return {*}
|
|
128
|
+
*/
|
|
129
|
+
var confirmUseCountedTotal = useCallback(function () {
|
|
130
|
+
var _countedResultRef$cur2, _countedResultRef$cur3;
|
|
131
|
+
updateAmount((_countedResultRef$cur2 = (_countedResultRef$cur3 = countedResultRef.current) === null || _countedResultRef$cur3 === void 0 ? void 0 : _countedResultRef$cur3.amount) !== null && _countedResultRef$cur2 !== void 0 ? _countedResultRef$cur2 : '', 'count');
|
|
132
|
+
setManualCountMismatchOpen(false);
|
|
133
|
+
}, [updateAmount]);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @description: 保留手动金额
|
|
137
|
+
* @param {*} useCallback
|
|
138
|
+
* @return {*}
|
|
139
|
+
*/
|
|
140
|
+
var confirmKeepManualAmount = useCallback(function () {
|
|
141
|
+
var _manualInputValueRef$;
|
|
142
|
+
// 保留手动金额时清空数钱结果与面额数量,避免再次打开数钱仍带回旧数据
|
|
143
|
+
countedResultRef.current = null;
|
|
144
|
+
setConfirmedQuantities({});
|
|
145
|
+
updateAmount((_manualInputValueRef$ = manualInputValueRef.current) !== null && _manualInputValueRef$ !== void 0 ? _manualInputValueRef$ : '', 'manual');
|
|
146
|
+
setManualCountMismatchOpen(false);
|
|
147
|
+
}, [updateAmount]);
|
|
148
|
+
var openCountModal = useCallback(function () {
|
|
149
|
+
var _modalRef$current;
|
|
150
|
+
if (disabled || countDisabled) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (currencyDenominations.length === 0) {
|
|
154
|
+
message.warning(locales.getText('pisell-cash-counting.no-country-config'));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
var initialQuantities = _objectSpread(_objectSpread({}, buildEmptyQuantities(currencyDenominations)), confirmedQuantities);
|
|
158
|
+
setKeyboardOpen(false);
|
|
159
|
+
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 || _modalRef$current.open({
|
|
160
|
+
initialQuantities: initialQuantities
|
|
161
|
+
});
|
|
162
|
+
}, [confirmedQuantities, countDisabled, currencyDenominations, disabled]);
|
|
163
|
+
var handleCountCancel = useCallback(function () {
|
|
164
|
+
onCountCancel === null || onCountCancel === void 0 || onCountCancel();
|
|
165
|
+
}, [onCountCancel]);
|
|
166
|
+
var handleCountConfirm = useCallback(function (payload) {
|
|
167
|
+
countedResultRef.current = payload;
|
|
168
|
+
setConfirmedQuantities(payload.quantities);
|
|
169
|
+
updateAmount(payload.amount, 'count');
|
|
170
|
+
if (typeof onCountConfirm === 'function') {
|
|
171
|
+
onCountConfirm(payload);
|
|
172
|
+
}
|
|
173
|
+
}, [onCountConfirm, updateAmount]);
|
|
174
|
+
return {
|
|
175
|
+
modalRef: modalRef,
|
|
176
|
+
triggerRef: triggerRef,
|
|
177
|
+
keyboardOpen: keyboardOpen,
|
|
178
|
+
setKeyboardOpen: setKeyboardOpen,
|
|
179
|
+
currencyDenominations: currencyDenominations,
|
|
180
|
+
decimalPlaces: decimalPlaces,
|
|
181
|
+
symbol: symbolValue,
|
|
182
|
+
currencyCode: _currencyCode,
|
|
183
|
+
currentValue: currentValue,
|
|
184
|
+
handleAmountChange: handleAmountChange,
|
|
185
|
+
handleKeyboardClose: handleKeyboardClose,
|
|
186
|
+
openCountModal: openCountModal,
|
|
187
|
+
handleCountCancel: handleCountCancel,
|
|
188
|
+
handleCountConfirm: handleCountConfirm,
|
|
189
|
+
manualCountMismatchOpen: manualCountMismatchOpen,
|
|
190
|
+
confirmUseCountedTotal: confirmUseCountedTotal,
|
|
191
|
+
confirmKeepManualAmount: confirmKeepManualAmount
|
|
192
|
+
};
|
|
193
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./PisellCashCounting";
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
en: {
|
|
3
|
+
'pisell-cash-counting.countCash': string;
|
|
4
|
+
'pisell-cash-counting.subtitle': string;
|
|
5
|
+
'pisell-cash-counting.currency': string;
|
|
6
|
+
'pisell-cash-counting.bills': string;
|
|
7
|
+
'pisell-cash-counting.coins': string;
|
|
8
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
9
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
10
|
+
'pisell-cash-counting.subtotal': string;
|
|
11
|
+
'pisell-cash-counting.total': string;
|
|
12
|
+
'pisell-cash-counting.clearAll': string;
|
|
13
|
+
'pisell-cash-counting.cancel': string;
|
|
14
|
+
'pisell-cash-counting.confirm': string;
|
|
15
|
+
'pisell-cash-counting.placeholder': string;
|
|
16
|
+
'pisell-cash-counting.empty': string;
|
|
17
|
+
'pisell-cash-counting.no-country-config': string;
|
|
18
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
19
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
20
|
+
'pisell-cash-counting.use-count-total': string;
|
|
21
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
22
|
+
'pisell2.customise-item.save': string;
|
|
23
|
+
'pisell2.booking.info.text.clear': string;
|
|
24
|
+
};
|
|
25
|
+
'zh-CN': {
|
|
26
|
+
'pisell-cash-counting.countCash': string;
|
|
27
|
+
'pisell-cash-counting.subtitle': string;
|
|
28
|
+
'pisell-cash-counting.currency': string;
|
|
29
|
+
'pisell-cash-counting.bills': string;
|
|
30
|
+
'pisell-cash-counting.coins': string;
|
|
31
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
32
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
33
|
+
'pisell-cash-counting.subtotal': string;
|
|
34
|
+
'pisell-cash-counting.total': string;
|
|
35
|
+
'pisell-cash-counting.clearAll': string;
|
|
36
|
+
'pisell-cash-counting.cancel': string;
|
|
37
|
+
'pisell-cash-counting.confirm': string;
|
|
38
|
+
'pisell-cash-counting.placeholder': string;
|
|
39
|
+
'pisell-cash-counting.empty': string;
|
|
40
|
+
'pisell-cash-counting.no-country-config': string;
|
|
41
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
42
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
43
|
+
'pisell-cash-counting.use-count-total': string;
|
|
44
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
45
|
+
'pisell2.customise-item.save': string;
|
|
46
|
+
'pisell2.booking.info.text.clear': string;
|
|
47
|
+
};
|
|
48
|
+
'zh-HK': {
|
|
49
|
+
'pisell-cash-counting.countCash': string;
|
|
50
|
+
'pisell-cash-counting.subtitle': string;
|
|
51
|
+
'pisell-cash-counting.currency': string;
|
|
52
|
+
'pisell-cash-counting.bills': string;
|
|
53
|
+
'pisell-cash-counting.coins': string;
|
|
54
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
55
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
56
|
+
'pisell-cash-counting.subtotal': string;
|
|
57
|
+
'pisell-cash-counting.total': string;
|
|
58
|
+
'pisell-cash-counting.clearAll': string;
|
|
59
|
+
'pisell-cash-counting.cancel': string;
|
|
60
|
+
'pisell-cash-counting.confirm': string;
|
|
61
|
+
'pisell-cash-counting.placeholder': string;
|
|
62
|
+
'pisell-cash-counting.empty': string;
|
|
63
|
+
'pisell-cash-counting.no-country-config': string;
|
|
64
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
65
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
66
|
+
'pisell-cash-counting.use-count-total': string;
|
|
67
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
68
|
+
'pisell2.customise-item.save': string;
|
|
69
|
+
'pisell2.booking.info.text.clear': string;
|
|
70
|
+
};
|
|
71
|
+
ja: {
|
|
72
|
+
'pisell-cash-counting.countCash': string;
|
|
73
|
+
'pisell-cash-counting.subtitle': string;
|
|
74
|
+
'pisell-cash-counting.currency': string;
|
|
75
|
+
'pisell-cash-counting.bills': string;
|
|
76
|
+
'pisell-cash-counting.coins': string;
|
|
77
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
78
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
79
|
+
'pisell-cash-counting.subtotal': string;
|
|
80
|
+
'pisell-cash-counting.total': string;
|
|
81
|
+
'pisell-cash-counting.clearAll': string;
|
|
82
|
+
'pisell-cash-counting.cancel': string;
|
|
83
|
+
'pisell-cash-counting.confirm': string;
|
|
84
|
+
'pisell-cash-counting.placeholder': string;
|
|
85
|
+
'pisell-cash-counting.empty': string;
|
|
86
|
+
'pisell-cash-counting.no-country-config': string;
|
|
87
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
88
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
89
|
+
'pisell-cash-counting.use-count-total': string;
|
|
90
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
91
|
+
'pisell2.customise-item.save': string;
|
|
92
|
+
'pisell2.booking.info.text.clear': string;
|
|
93
|
+
};
|
|
94
|
+
pt: {
|
|
95
|
+
'pisell-cash-counting.countCash': string;
|
|
96
|
+
'pisell-cash-counting.subtitle': string;
|
|
97
|
+
'pisell-cash-counting.currency': string;
|
|
98
|
+
'pisell-cash-counting.bills': string;
|
|
99
|
+
'pisell-cash-counting.coins': string;
|
|
100
|
+
'pisell-cash-counting.billsSubtotal': string;
|
|
101
|
+
'pisell-cash-counting.coinsSubtotal': string;
|
|
102
|
+
'pisell-cash-counting.subtotal': string;
|
|
103
|
+
'pisell-cash-counting.total': string;
|
|
104
|
+
'pisell-cash-counting.clearAll': string;
|
|
105
|
+
'pisell-cash-counting.cancel': string;
|
|
106
|
+
'pisell-cash-counting.confirm': string;
|
|
107
|
+
'pisell-cash-counting.placeholder': string;
|
|
108
|
+
'pisell-cash-counting.empty': string;
|
|
109
|
+
'pisell-cash-counting.no-country-config': string;
|
|
110
|
+
'pisell-cash-counting.manual-vs-count-message-title': string;
|
|
111
|
+
'pisell-cash-counting.manual-vs-count-message': string;
|
|
112
|
+
'pisell-cash-counting.use-count-total': string;
|
|
113
|
+
'pisell-cash-counting.keep-manual-amount': string;
|
|
114
|
+
'pisell2.customise-item.save': string;
|
|
115
|
+
'pisell2.booking.info.text.clear': string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export default _default;
|