@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.
- 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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/kioskSkuDetail/index.js +7 -7
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +53 -26
- package/es/components/scanOrder/components/Content/index.js +14 -2
- package/es/components/scanOrder/components/ExitConfirmModal/index.js +84 -0
- package/es/components/scanOrder/components/ExitConfirmModal/index.less +182 -0
- package/es/components/scanOrder/locales.js +20 -0
- package/es/index.d.ts +9 -1
- package/es/index.js +6 -2
- package/es/plus/inventory/BindingModal.js +94 -0
- package/es/plus/inventory/InventoryItemManagement.d.ts +7 -0
- package/es/plus/inventory/InventoryItemManagement.js +204 -0
- package/es/plus/inventory/InventoryLocationManagement.d.ts +7 -0
- package/es/plus/inventory/InventoryLocationManagement.js +296 -0
- package/es/plus/inventory/InventoryUnitManagement.d.ts +7 -0
- package/es/plus/inventory/InventoryUnitManagement.js +144 -0
- package/es/plus/inventory/ItemDrawer.js +266 -0
- package/es/plus/inventory/RecordDialog.js +141 -0
- package/es/plus/inventory/StockList.js +132 -0
- package/es/plus/inventory/api.js +66 -0
- package/es/plus/inventory/components.js +172 -0
- package/es/plus/inventory/context.js +118 -0
- package/es/plus/inventory/forms.js +46 -0
- package/es/plus/inventory/hooks.js +235 -0
- package/es/plus/inventory/index.less +559 -0
- package/es/plus/inventory/locales.js +277 -0
- package/es/plus/inventory/types.d.ts +10 -0
- package/es/plus/inventory/utils.js +24 -0
- package/es/plus/panpacificTask/JobCard.js +22 -0
- package/es/plus/panpacificTask/JobDrawer.js +366 -0
- package/es/plus/panpacificTask/JobForm.js +312 -0
- package/es/plus/panpacificTask/JobStatus.js +29 -0
- package/es/plus/panpacificTask/PanpacificTask.d.ts +7 -0
- package/es/plus/panpacificTask/PanpacificTask.js +552 -0
- package/es/plus/panpacificTask/PhotoPreview.js +37 -0
- package/es/plus/panpacificTask/README.md +114 -0
- package/es/plus/panpacificTask/attachments.js +64 -0
- package/es/plus/panpacificTask/index.d.ts +2 -0
- package/es/plus/panpacificTask/index.less +539 -0
- package/es/plus/panpacificTask/locales.js +586 -0
- package/es/plus/panpacificTask/model.js +260 -0
- package/es/plus/panpacificTask/saveJob.js +68 -0
- package/es/plus/panpacificTask/serve.js +243 -0
- package/es/plus/panpacificTask/tenant.js +16 -0
- package/es/plus/panpacificTask/types.d.ts +19 -0
- package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
- package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
- package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
- package/es/plus/pisellSupersetDashboard/README.md +291 -0
- package/es/plus/pisellSupersetDashboard/index.d.ts +15 -0
- package/es/plus/pisellSupersetDashboard/index.js +187 -0
- package/es/plus/pisellSupersetDashboard/index.less +83 -0
- package/es/plus/pisellSupersetDashboard/locales.js +36 -0
- package/es/plus/pisellSupersetDashboard/serve.js +51 -0
- package/es/plus/pisellSupersetDashboard/types.d.ts +17 -0
- package/es/plus/skuOptionsSelection/store/createStore.js +2 -2
- package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
- package/es/pro/Login2.0/AuthModal.d.ts +1 -1
- package/es/pro/Login2.0/index.d.ts +1 -2
- package/es/pro/Login2.0/shared/types.d.ts +1 -1
- package/lib/components/kioskSkuDetail/index.js +7 -7
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +53 -26
- package/lib/components/scanOrder/components/Content/index.js +14 -2
- package/lib/components/scanOrder/components/ExitConfirmModal/index.js +86 -0
- package/lib/components/scanOrder/components/ExitConfirmModal/index.less +182 -0
- package/lib/components/scanOrder/locales.js +20 -0
- package/lib/index.d.ts +9 -1
- package/lib/index.js +136 -126
- package/lib/plus/inventory/BindingModal.js +96 -0
- package/lib/plus/inventory/InventoryItemManagement.d.ts +7 -0
- package/lib/plus/inventory/InventoryItemManagement.js +206 -0
- package/lib/plus/inventory/InventoryLocationManagement.d.ts +7 -0
- package/lib/plus/inventory/InventoryLocationManagement.js +298 -0
- package/lib/plus/inventory/InventoryUnitManagement.d.ts +7 -0
- package/lib/plus/inventory/InventoryUnitManagement.js +146 -0
- package/lib/plus/inventory/ItemDrawer.js +268 -0
- package/lib/plus/inventory/RecordDialog.js +143 -0
- package/lib/plus/inventory/StockList.js +134 -0
- package/lib/plus/inventory/api.js +66 -0
- package/lib/plus/inventory/components.js +181 -0
- package/lib/plus/inventory/context.js +121 -0
- package/lib/plus/inventory/forms.js +50 -0
- package/lib/plus/inventory/hooks.js +240 -0
- package/lib/plus/inventory/index.less +559 -0
- package/lib/plus/inventory/locales.js +277 -0
- package/lib/plus/inventory/types.d.ts +10 -0
- package/lib/plus/inventory/utils.js +30 -0
- package/lib/plus/panpacificTask/JobCard.js +24 -0
- package/lib/plus/panpacificTask/JobDrawer.js +368 -0
- package/lib/plus/panpacificTask/JobForm.js +314 -0
- package/lib/plus/panpacificTask/JobStatus.js +33 -0
- package/lib/plus/panpacificTask/PanpacificTask.d.ts +7 -0
- package/lib/plus/panpacificTask/PanpacificTask.js +555 -0
- package/lib/plus/panpacificTask/PhotoPreview.js +39 -0
- package/lib/plus/panpacificTask/README.md +114 -0
- package/lib/plus/panpacificTask/attachments.js +66 -0
- package/lib/plus/panpacificTask/index.d.ts +2 -0
- package/lib/plus/panpacificTask/index.less +539 -0
- package/lib/plus/panpacificTask/locales.js +586 -0
- package/lib/plus/panpacificTask/model.js +289 -0
- package/lib/plus/panpacificTask/saveJob.js +68 -0
- package/lib/plus/panpacificTask/serve.js +260 -0
- package/lib/plus/panpacificTask/tenant.js +17 -0
- package/lib/plus/panpacificTask/types.d.ts +19 -0
- package/lib/plus/pisellSupersetDashboard/README.md +291 -0
- package/lib/plus/pisellSupersetDashboard/index.d.ts +15 -0
- package/lib/plus/pisellSupersetDashboard/index.js +189 -0
- package/lib/plus/pisellSupersetDashboard/index.less +83 -0
- package/lib/plus/pisellSupersetDashboard/locales.js +36 -0
- package/lib/plus/pisellSupersetDashboard/serve.js +52 -0
- package/lib/plus/pisellSupersetDashboard/types.d.ts +17 -0
- package/lowcode/inventory-item-management/meta.ts +20 -0
- package/lowcode/inventory-location-management/meta.ts +20 -0
- package/lowcode/inventory-unit-management/meta.ts +20 -0
- package/lowcode/panpacific-task/meta.ts +51 -0
- package/lowcode/pisell-superset-dashboard/meta.ts +75 -0
- package/package.json +4 -2
- 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 };
|