@pisell/private-materials 6.3.220 → 6.3.222

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 (125) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +13 -13
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +13 -13
  9. package/es/components/kioskSkuDetail/index.js +7 -7
  10. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +53 -26
  11. package/es/components/scanOrder/components/Content/index.js +14 -2
  12. package/es/components/scanOrder/components/ExitConfirmModal/index.js +84 -0
  13. package/es/components/scanOrder/components/ExitConfirmModal/index.less +182 -0
  14. package/es/components/scanOrder/locales.js +20 -0
  15. package/es/index.d.ts +9 -1
  16. package/es/index.js +6 -2
  17. package/es/plus/inventory/BindingModal.js +94 -0
  18. package/es/plus/inventory/InventoryItemManagement.d.ts +7 -0
  19. package/es/plus/inventory/InventoryItemManagement.js +204 -0
  20. package/es/plus/inventory/InventoryLocationManagement.d.ts +7 -0
  21. package/es/plus/inventory/InventoryLocationManagement.js +296 -0
  22. package/es/plus/inventory/InventoryUnitManagement.d.ts +7 -0
  23. package/es/plus/inventory/InventoryUnitManagement.js +144 -0
  24. package/es/plus/inventory/ItemDrawer.js +266 -0
  25. package/es/plus/inventory/RecordDialog.js +141 -0
  26. package/es/plus/inventory/StockList.js +132 -0
  27. package/es/plus/inventory/api.js +66 -0
  28. package/es/plus/inventory/components.js +172 -0
  29. package/es/plus/inventory/context.js +118 -0
  30. package/es/plus/inventory/forms.js +46 -0
  31. package/es/plus/inventory/hooks.js +235 -0
  32. package/es/plus/inventory/index.less +559 -0
  33. package/es/plus/inventory/locales.js +277 -0
  34. package/es/plus/inventory/types.d.ts +10 -0
  35. package/es/plus/inventory/utils.js +24 -0
  36. package/es/plus/panpacificTask/JobCard.js +22 -0
  37. package/es/plus/panpacificTask/JobDrawer.js +366 -0
  38. package/es/plus/panpacificTask/JobForm.js +312 -0
  39. package/es/plus/panpacificTask/JobStatus.js +29 -0
  40. package/es/plus/panpacificTask/PanpacificTask.d.ts +7 -0
  41. package/es/plus/panpacificTask/PanpacificTask.js +552 -0
  42. package/es/plus/panpacificTask/PhotoPreview.js +37 -0
  43. package/es/plus/panpacificTask/README.md +114 -0
  44. package/es/plus/panpacificTask/attachments.js +64 -0
  45. package/es/plus/panpacificTask/index.d.ts +2 -0
  46. package/es/plus/panpacificTask/index.less +539 -0
  47. package/es/plus/panpacificTask/locales.js +586 -0
  48. package/es/plus/panpacificTask/model.js +260 -0
  49. package/es/plus/panpacificTask/saveJob.js +68 -0
  50. package/es/plus/panpacificTask/serve.js +243 -0
  51. package/es/plus/panpacificTask/tenant.js +16 -0
  52. package/es/plus/panpacificTask/types.d.ts +19 -0
  53. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  54. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  55. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  56. package/es/plus/pisellSupersetDashboard/README.md +291 -0
  57. package/es/plus/pisellSupersetDashboard/index.d.ts +15 -0
  58. package/es/plus/pisellSupersetDashboard/index.js +187 -0
  59. package/es/plus/pisellSupersetDashboard/index.less +83 -0
  60. package/es/plus/pisellSupersetDashboard/locales.js +36 -0
  61. package/es/plus/pisellSupersetDashboard/serve.js +51 -0
  62. package/es/plus/pisellSupersetDashboard/types.d.ts +17 -0
  63. package/es/plus/skuOptionsSelection/store/createStore.js +2 -2
  64. package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
  65. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  66. package/es/pro/Login2.0/index.d.ts +1 -2
  67. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  68. package/lib/components/kioskSkuDetail/index.js +7 -7
  69. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +53 -26
  70. package/lib/components/scanOrder/components/Content/index.js +14 -2
  71. package/lib/components/scanOrder/components/ExitConfirmModal/index.js +86 -0
  72. package/lib/components/scanOrder/components/ExitConfirmModal/index.less +182 -0
  73. package/lib/components/scanOrder/locales.js +20 -0
  74. package/lib/index.d.ts +9 -1
  75. package/lib/index.js +136 -126
  76. package/lib/plus/inventory/BindingModal.js +96 -0
  77. package/lib/plus/inventory/InventoryItemManagement.d.ts +7 -0
  78. package/lib/plus/inventory/InventoryItemManagement.js +206 -0
  79. package/lib/plus/inventory/InventoryLocationManagement.d.ts +7 -0
  80. package/lib/plus/inventory/InventoryLocationManagement.js +298 -0
  81. package/lib/plus/inventory/InventoryUnitManagement.d.ts +7 -0
  82. package/lib/plus/inventory/InventoryUnitManagement.js +146 -0
  83. package/lib/plus/inventory/ItemDrawer.js +268 -0
  84. package/lib/plus/inventory/RecordDialog.js +143 -0
  85. package/lib/plus/inventory/StockList.js +134 -0
  86. package/lib/plus/inventory/api.js +66 -0
  87. package/lib/plus/inventory/components.js +181 -0
  88. package/lib/plus/inventory/context.js +121 -0
  89. package/lib/plus/inventory/forms.js +50 -0
  90. package/lib/plus/inventory/hooks.js +240 -0
  91. package/lib/plus/inventory/index.less +559 -0
  92. package/lib/plus/inventory/locales.js +277 -0
  93. package/lib/plus/inventory/types.d.ts +10 -0
  94. package/lib/plus/inventory/utils.js +30 -0
  95. package/lib/plus/panpacificTask/JobCard.js +24 -0
  96. package/lib/plus/panpacificTask/JobDrawer.js +368 -0
  97. package/lib/plus/panpacificTask/JobForm.js +314 -0
  98. package/lib/plus/panpacificTask/JobStatus.js +33 -0
  99. package/lib/plus/panpacificTask/PanpacificTask.d.ts +7 -0
  100. package/lib/plus/panpacificTask/PanpacificTask.js +555 -0
  101. package/lib/plus/panpacificTask/PhotoPreview.js +39 -0
  102. package/lib/plus/panpacificTask/README.md +114 -0
  103. package/lib/plus/panpacificTask/attachments.js +66 -0
  104. package/lib/plus/panpacificTask/index.d.ts +2 -0
  105. package/lib/plus/panpacificTask/index.less +539 -0
  106. package/lib/plus/panpacificTask/locales.js +586 -0
  107. package/lib/plus/panpacificTask/model.js +289 -0
  108. package/lib/plus/panpacificTask/saveJob.js +68 -0
  109. package/lib/plus/panpacificTask/serve.js +260 -0
  110. package/lib/plus/panpacificTask/tenant.js +17 -0
  111. package/lib/plus/panpacificTask/types.d.ts +19 -0
  112. package/lib/plus/pisellSupersetDashboard/README.md +291 -0
  113. package/lib/plus/pisellSupersetDashboard/index.d.ts +15 -0
  114. package/lib/plus/pisellSupersetDashboard/index.js +189 -0
  115. package/lib/plus/pisellSupersetDashboard/index.less +83 -0
  116. package/lib/plus/pisellSupersetDashboard/locales.js +36 -0
  117. package/lib/plus/pisellSupersetDashboard/serve.js +52 -0
  118. package/lib/plus/pisellSupersetDashboard/types.d.ts +17 -0
  119. package/lowcode/inventory-item-management/meta.ts +20 -0
  120. package/lowcode/inventory-location-management/meta.ts +20 -0
  121. package/lowcode/inventory-unit-management/meta.ts +20 -0
  122. package/lowcode/panpacific-task/meta.ts +51 -0
  123. package/lowcode/pisell-superset-dashboard/meta.ts +75 -0
  124. package/package.json +4 -2
  125. package/es/plus/pisellReservation/index.js +0 -17
@@ -0,0 +1,235 @@
1
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
+ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
3
+ import { mergeInventoryRecords } from "./utils.js";
4
+ import { useInventory } from "./context.js";
5
+ import { useCallback, useEffect, useRef, useState } from "react";
6
+ //#region src/plus/inventory/hooks.ts
7
+ function useInventoryQuery(load, queryKey, enabled = true) {
8
+ const { api } = useInventory();
9
+ const loadRef = useRef(load);
10
+ loadRef.current = load;
11
+ const [revision, setRevision] = useState(0);
12
+ const key = `${queryKey}:${revision}`;
13
+ const [result, setResult] = useState({
14
+ key: "",
15
+ loading: false
16
+ });
17
+ useEffect(() => {
18
+ if (!enabled) return;
19
+ let current = true;
20
+ setResult({
21
+ key,
22
+ api,
23
+ loading: true
24
+ });
25
+ Promise.resolve().then(() => loadRef.current()).then((data) => {
26
+ if (current) setResult({
27
+ key,
28
+ api,
29
+ data,
30
+ loading: false
31
+ });
32
+ }, (error) => {
33
+ if (current) setResult({
34
+ key,
35
+ api,
36
+ error,
37
+ loading: false
38
+ });
39
+ });
40
+ return () => {
41
+ current = false;
42
+ };
43
+ }, [
44
+ key,
45
+ enabled,
46
+ api
47
+ ]);
48
+ const reload = useCallback(() => setRevision((value) => value + 1), []);
49
+ const valid = enabled && result.key === key && result.api === api;
50
+ return {
51
+ data: valid ? result.data : void 0,
52
+ error: valid ? result.error : void 0,
53
+ loading: enabled && (!valid || result.loading),
54
+ reload
55
+ };
56
+ }
57
+ function useInventoryList(resource, filters = {}, enabled = true) {
58
+ var _query$data$count, _query$data, _query$data$list, _query$data2;
59
+ const { api } = useInventory();
60
+ const filterKey = JSON.stringify([resource, filters]);
61
+ const [pager, setPager] = useState({
62
+ key: filterKey,
63
+ page: 1,
64
+ size: 20
65
+ });
66
+ const page = pager.key === filterKey ? pager.page : 1;
67
+ const { size } = pager;
68
+ const local = resource === "item-unit";
69
+ const query = useInventoryQuery(_asyncToGenerator(function* () {
70
+ if (local) {
71
+ const units = yield api.units(filters);
72
+ return {
73
+ list: units,
74
+ count: units.length,
75
+ page: 1,
76
+ size: units.length
77
+ };
78
+ }
79
+ return api.list(resource, _objectSpread2(_objectSpread2({}, filters), {}, {
80
+ page,
81
+ size
82
+ }));
83
+ }), JSON.stringify([
84
+ filterKey,
85
+ local ? null : page,
86
+ local ? null : size
87
+ ]), enabled);
88
+ const count = (_query$data$count = (_query$data = query.data) === null || _query$data === void 0 ? void 0 : _query$data.count) !== null && _query$data$count !== void 0 ? _query$data$count : 0;
89
+ useEffect(() => {
90
+ if (!query.data) return;
91
+ const lastPage = Math.max(1, Math.ceil(query.data.count / size));
92
+ if (page > lastPage) setPager({
93
+ key: filterKey,
94
+ page: lastPage,
95
+ size
96
+ });
97
+ }, [
98
+ query.data,
99
+ page,
100
+ size,
101
+ filterKey
102
+ ]);
103
+ const rows = (_query$data$list = (_query$data2 = query.data) === null || _query$data2 === void 0 ? void 0 : _query$data2.list) !== null && _query$data$list !== void 0 ? _query$data$list : [];
104
+ return _objectSpread2(_objectSpread2({}, query), {}, {
105
+ count,
106
+ page,
107
+ size,
108
+ rows: local ? rows.slice((page - 1) * size, page * size) : rows,
109
+ onPageChange: (nextPage, nextSize) => setPager({
110
+ key: filterKey,
111
+ page: nextSize === size ? nextPage : 1,
112
+ size: nextSize
113
+ })
114
+ });
115
+ }
116
+ function useInventoryOptions(resource, filters = {}, enabled = true, revision = 0) {
117
+ const { api } = useInventory();
118
+ const key = JSON.stringify([
119
+ resource,
120
+ filters,
121
+ revision
122
+ ]);
123
+ const generation = useRef(0);
124
+ const busy = useRef(false);
125
+ const [result, setResult] = useState({
126
+ key: "",
127
+ rows: [],
128
+ count: 0,
129
+ page: 0,
130
+ loading: false
131
+ });
132
+ const valid = enabled && result.key === key;
133
+ const fetchPage = useCallback(function() {
134
+ var _ref = _asyncToGenerator(function* (page) {
135
+ if (!enabled || page > 1 && busy.current) return;
136
+ const requestId = ++generation.current;
137
+ busy.current = true;
138
+ setResult((previous) => ({
139
+ key,
140
+ rows: page === 1 ? [] : previous.rows,
141
+ count: page === 1 ? 0 : previous.count,
142
+ page: page === 1 ? 0 : previous.page,
143
+ loading: true
144
+ }));
145
+ try {
146
+ const data = yield api.list(resource, _objectSpread2(_objectSpread2({}, JSON.parse(key)[1]), {}, {
147
+ page,
148
+ size: 20
149
+ }));
150
+ if (generation.current !== requestId) return;
151
+ setResult((previous) => ({
152
+ key,
153
+ rows: page === 1 ? data.list : mergeInventoryRecords(previous.rows, data.list),
154
+ count: data.count,
155
+ page,
156
+ loading: false
157
+ }));
158
+ } catch (error) {
159
+ if (generation.current === requestId) setResult((previous) => _objectSpread2(_objectSpread2({}, previous), {}, {
160
+ loading: false,
161
+ error
162
+ }));
163
+ } finally {
164
+ if (generation.current === requestId) busy.current = false;
165
+ }
166
+ });
167
+ return function(_x) {
168
+ return _ref.apply(this, arguments);
169
+ };
170
+ }(), [
171
+ api,
172
+ resource,
173
+ key,
174
+ enabled
175
+ ]);
176
+ useEffect(() => {
177
+ if (enabled) fetchPage(1);
178
+ return () => {
179
+ ++generation.current;
180
+ busy.current = false;
181
+ };
182
+ }, [fetchPage, enabled]);
183
+ return {
184
+ rows: valid ? result.rows : [],
185
+ loading: enabled && (!valid || result.loading),
186
+ error: valid ? result.error : void 0,
187
+ hasMore: valid && result.page * 20 < result.count,
188
+ loadMore: () => fetchPage(result.page + 1),
189
+ reload: () => fetchPage(1)
190
+ };
191
+ }
192
+ function useInventoryMutation() {
193
+ const { report } = useInventory();
194
+ const locked = useRef(false);
195
+ const mounted = useRef(true);
196
+ const [busy, setBusy] = useState(false);
197
+ useEffect(() => {
198
+ mounted.current = true;
199
+ return () => {
200
+ mounted.current = false;
201
+ };
202
+ }, []);
203
+ return {
204
+ busy,
205
+ run: function() {
206
+ var _ref2 = _asyncToGenerator(function* (operation) {
207
+ if (locked.current || !mounted.current) return;
208
+ locked.current = true;
209
+ setBusy(true);
210
+ try {
211
+ yield operation();
212
+ } catch (error) {
213
+ if (mounted.current) report(error);
214
+ } finally {
215
+ locked.current = false;
216
+ if (mounted.current) setBusy(false);
217
+ }
218
+ });
219
+ return function run(_x2) {
220
+ return _ref2.apply(this, arguments);
221
+ };
222
+ }()
223
+ };
224
+ }
225
+ function useUnsavedChanges() {
226
+ const { confirm, t } = useInventory();
227
+ const [dirty, setDirty] = useState(false);
228
+ return {
229
+ dirty,
230
+ setDirty,
231
+ canLeave: () => dirty ? confirm("unsavedTitle", t("unsavedHint"), true) : Promise.resolve(true)
232
+ };
233
+ }
234
+ //#endregion
235
+ export { useInventoryList, useInventoryMutation, useInventoryOptions, useInventoryQuery, useUnsavedChanges };