@pisell/private-materials 3.4.156 → 3.4.157

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 (157) 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/preview.css +1 -1
  6. package/build/lowcode/preview.js +1 -1
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +12 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +12 -12
  11. package/es/components/appointmentBooking/deposit/index.d.ts +1 -2
  12. package/es/components/appointmentBooking/index.d.ts +1 -2
  13. package/es/components/booking/dashboard/index.d.ts +1 -1
  14. package/es/components/booking/deposit/index.d.ts +1 -3
  15. package/es/components/booking/info/addServiceVariant/index.d.ts +1 -3
  16. package/es/components/booking/info/index.d.ts +1 -2
  17. package/es/components/booking/materiels/contacts/index.d.ts +1 -2
  18. package/es/components/booking/materiels/duration/index.d.ts +1 -2
  19. package/es/components/booking/materiels/startTime/index.d.ts +1 -2
  20. package/es/components/ecocup/cupList/index.d.ts +1 -2
  21. package/es/components/ecocup/cupProject/index.d.ts +2 -2
  22. package/es/components/ecocup/customerList/index.d.ts +2 -2
  23. package/es/components/eftpos/index.d.ts +1 -2
  24. package/es/components/eftposPay/index.d.ts +1 -2
  25. package/es/components/eventBooking/index.d.ts +1 -2
  26. package/es/components/kioskSkuDetail/index.d.ts +1 -1
  27. package/es/components/login/index.d.ts +1 -2
  28. package/es/components/pisellSelectCustomerModal/index.d.ts +1 -2
  29. package/es/components/productExtension/index.d.ts +1 -2
  30. package/es/components/ruleSetting/index.d.ts +1 -2
  31. package/es/components/scanOrder/index.d.ts +2 -2
  32. package/es/components/shoppingCart/index.d.ts +1 -2
  33. package/es/components/subTotal/index.d.ts +1 -1
  34. package/es/components/taxSelect/index.d.ts +1 -2
  35. package/es/components/ticketBooking/index.d.ts +1 -2
  36. package/es/components/venueBooking/index.d.ts +2 -2
  37. package/es/components/walletList/index.d.ts +1 -2
  38. package/es/index.d.ts +5 -1
  39. package/es/index.js +4 -2
  40. package/es/plus/inventory/BindingModal.js +94 -0
  41. package/es/plus/inventory/InventoryItemManagement.d.ts +7 -0
  42. package/es/plus/inventory/InventoryItemManagement.js +204 -0
  43. package/es/plus/inventory/InventoryLocationManagement.d.ts +7 -0
  44. package/es/plus/inventory/InventoryLocationManagement.js +296 -0
  45. package/es/plus/inventory/InventoryUnitManagement.d.ts +7 -0
  46. package/es/plus/inventory/InventoryUnitManagement.js +144 -0
  47. package/es/plus/inventory/ItemDrawer.js +266 -0
  48. package/es/plus/inventory/RecordDialog.js +141 -0
  49. package/es/plus/inventory/StockList.js +132 -0
  50. package/es/plus/inventory/api.js +66 -0
  51. package/es/plus/inventory/components.js +172 -0
  52. package/es/plus/inventory/context.js +118 -0
  53. package/es/plus/inventory/forms.js +46 -0
  54. package/es/plus/inventory/hooks.js +235 -0
  55. package/es/plus/inventory/index.less +559 -0
  56. package/es/plus/inventory/locales.js +277 -0
  57. package/es/plus/inventory/types.d.ts +10 -0
  58. package/es/plus/inventory/utils.js +24 -0
  59. package/es/plus/orderList/index.d.ts +1 -1
  60. package/es/plus/panpacificTask/PanpacificTask.d.ts +2 -2
  61. package/es/plus/pisellAdyenDashboard/index.d.ts +1 -1
  62. package/es/plus/pisellProResourcePickerModal/PisellFloorMapPaletteViewAllModal.d.ts +1 -1
  63. package/es/plus/pisellProResourcePickerModal/PisellProResourcePickerModal.d.ts +2 -2
  64. package/es/plus/pisellReservation/components/SelectFloorMapResourceDialog.d.ts +1 -1
  65. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  66. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  67. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  68. package/es/plus/pisellReservation/floorRoomCard/FloorRoomCardFromData.d.ts +1 -1
  69. package/es/plus/pisellReservation/floorRoomCard/ReservationFloorRoomCard.d.ts +1 -1
  70. package/es/plus/pisellSalesManagement/index.d.ts +1 -1
  71. package/es/plus/pisellTopology/PisellTopology.d.ts +2 -2
  72. package/es/plus/pisellTopology/TopologyDeviceCard.d.ts +1 -1
  73. package/es/plus/saasCreateOrganization/index.d.ts +1 -2
  74. package/es/plus/saleDetail/index.d.ts +2 -2
  75. package/es/plus/skuOptionsSelection/store/createStore.js +2 -2
  76. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +1 -2
  77. package/es/plus/walletPassGallery/index.d.ts +1 -2
  78. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  79. package/es/pro/Login2.0/index.d.ts +1 -2
  80. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  81. package/es/pro/Selector/Item.d.ts +1 -1
  82. package/lib/components/appointmentBooking/deposit/index.d.ts +2 -2
  83. package/lib/components/appointmentBooking/index.d.ts +2 -2
  84. package/lib/components/booking/dashboard/index.d.ts +1 -1
  85. package/lib/components/booking/deposit/index.d.ts +2 -3
  86. package/lib/components/booking/info/addServiceVariant/index.d.ts +2 -3
  87. package/lib/components/booking/info/index.d.ts +2 -2
  88. package/lib/components/booking/materiels/contacts/index.d.ts +2 -2
  89. package/lib/components/booking/materiels/duration/index.d.ts +2 -2
  90. package/lib/components/booking/materiels/resources/index.d.ts +1 -1
  91. package/lib/components/booking/materiels/startTime/index.d.ts +2 -2
  92. package/lib/components/ecocup/cupList/index.d.ts +2 -2
  93. package/lib/components/ecocup/cupProject/index.d.ts +2 -2
  94. package/lib/components/ecocup/customerList/index.d.ts +2 -2
  95. package/lib/components/eftpos/index.d.ts +2 -2
  96. package/lib/components/eftposPay/index.d.ts +2 -2
  97. package/lib/components/eventBooking/index.d.ts +2 -2
  98. package/lib/components/kioskSkuDetail/index.d.ts +1 -1
  99. package/lib/components/login/index.d.ts +2 -2
  100. package/lib/components/pisellCashCounting/types.d.ts +1 -1
  101. package/lib/components/pisellSelectCustomerModal/index.d.ts +2 -2
  102. package/lib/components/productExtension/index.d.ts +2 -2
  103. package/lib/components/ruleSetting/index.d.ts +2 -2
  104. package/lib/components/scanOrder/index.d.ts +2 -2
  105. package/lib/components/shoppingCart/index.d.ts +2 -2
  106. package/lib/components/subTotal/index.d.ts +1 -1
  107. package/lib/components/taxSelect/index.d.ts +2 -2
  108. package/lib/components/ticketBooking/index.d.ts +2 -2
  109. package/lib/components/venueBooking/index.d.ts +2 -2
  110. package/lib/components/walletList/index.d.ts +2 -2
  111. package/lib/index.d.ts +5 -1
  112. package/lib/index.js +6 -0
  113. package/lib/plus/clinetSearch/index.d.ts +1 -1
  114. package/lib/plus/inventory/BindingModal.js +96 -0
  115. package/lib/plus/inventory/InventoryItemManagement.d.ts +7 -0
  116. package/lib/plus/inventory/InventoryItemManagement.js +206 -0
  117. package/lib/plus/inventory/InventoryLocationManagement.d.ts +7 -0
  118. package/lib/plus/inventory/InventoryLocationManagement.js +298 -0
  119. package/lib/plus/inventory/InventoryUnitManagement.d.ts +7 -0
  120. package/lib/plus/inventory/InventoryUnitManagement.js +146 -0
  121. package/lib/plus/inventory/ItemDrawer.js +268 -0
  122. package/lib/plus/inventory/RecordDialog.js +143 -0
  123. package/lib/plus/inventory/StockList.js +134 -0
  124. package/lib/plus/inventory/api.js +66 -0
  125. package/lib/plus/inventory/components.js +181 -0
  126. package/lib/plus/inventory/context.js +121 -0
  127. package/lib/plus/inventory/forms.js +50 -0
  128. package/lib/plus/inventory/hooks.js +240 -0
  129. package/lib/plus/inventory/index.less +559 -0
  130. package/lib/plus/inventory/locales.js +277 -0
  131. package/lib/plus/inventory/types.d.ts +10 -0
  132. package/lib/plus/inventory/utils.js +30 -0
  133. package/lib/plus/orderList/index.d.ts +1 -1
  134. package/lib/plus/panpacificTask/PanpacificTask.d.ts +2 -2
  135. package/lib/plus/pisellAdyenDashboard/index.d.ts +1 -1
  136. package/lib/plus/pisellProResourcePickerModal/PisellFloorMapPaletteViewAllModal.d.ts +1 -1
  137. package/lib/plus/pisellProResourcePickerModal/PisellProResourcePickerModal.d.ts +2 -2
  138. package/lib/plus/pisellReservation/components/SelectFloorMapResourceDialog.d.ts +1 -1
  139. package/lib/plus/pisellReservation/floorRoomCard/FloorRoomCardFromData.d.ts +1 -1
  140. package/lib/plus/pisellReservation/floorRoomCard/ReservationFloorRoomCard.d.ts +1 -1
  141. package/lib/plus/pisellSalesManagement/index.d.ts +1 -1
  142. package/lib/plus/pisellTopology/PisellTopology.d.ts +2 -2
  143. package/lib/plus/pisellTopology/TopologyDeviceCard.d.ts +1 -1
  144. package/lib/plus/saasCreateOrganization/index.d.ts +2 -2
  145. package/lib/plus/saleDetail/index.d.ts +2 -2
  146. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +2 -2
  147. package/lib/plus/walletPassGallery/index.d.ts +2 -2
  148. package/lib/pro/Selector/Item.d.ts +1 -1
  149. package/lowcode/inventory-item-management/meta.ts +20 -0
  150. package/lowcode/inventory-location-management/meta.ts +20 -0
  151. package/lowcode/inventory-unit-management/meta.ts +20 -0
  152. package/package.json +3 -3
  153. package/es/plus/pisellReservation/floorRoomCard/views/RoomCardHeaderView.d.ts +0 -1
  154. package/es/plus/pisellReservation/index.js +0 -17
  155. package/lib/plus/pisellReservation/floorRoomCard/mapFloorRoomCardViewProps.d.ts +0 -1
  156. package/lib/plus/pisellReservation/floorRoomCard/views/RoomCardHeaderView.d.ts +0 -1
  157. /package/es/{plus/pisellReservation/floorRoomCard/mapFloorRoomCardViewProps.d.ts → private-materials/lowcode/authmodal/meta.d.ts} +0 -0
@@ -0,0 +1,298 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.js");
2
+ const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
+ const require_asyncToGenerator = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
4
+ const require_utils = require("./utils.js");
5
+ const require_context = require("./context.js");
6
+ const require_hooks = require("./hooks.js");
7
+ const require_components = require("./components.js");
8
+ const require_RecordDialog = require("./RecordDialog.js");
9
+ let react = require("react");
10
+ react = require_runtime.__toESM(react);
11
+ let antd = require("antd");
12
+ let ahooks = require("ahooks");
13
+ let _ant_design_icons = require("@ant-design/icons");
14
+ //#region src/plus/inventory/InventoryLocationManagement.tsx
15
+ function NavigationLocation({ record, expanded, onToggle, selection, onSelect, revision, selectedShelf }) {
16
+ const { t, name } = require_context.useInventory();
17
+ const shelves = require_hooks.useInventoryOptions("shelf", { location_id: record.id }, expanded, revision);
18
+ const rows = (selectedShelf === null || selectedShelf === void 0 ? void 0 : selectedShelf.location_id) === record.id && !shelves.rows.some((shelf) => shelf.id === selectedShelf.id) ? [selectedShelf, ...shelves.rows] : shelves.rows;
19
+ return /* @__PURE__ */ react.default.createElement("div", { className: "inventory-nav-location" }, /* @__PURE__ */ react.default.createElement("div", { className: `inventory-nav-row ${selection.kind === "location" && selection.id === record.id ? "is-selected" : ""}` }, /* @__PURE__ */ react.default.createElement(antd.Button, {
20
+ type: "text",
21
+ "aria-expanded": expanded,
22
+ "aria-label": t(expanded ? "collapse" : "expand"),
23
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.CaretRightOutlined, {
24
+ rotate: expanded ? 90 : 0,
25
+ style: { fontSize: 12 }
26
+ }),
27
+ onClick: onToggle
28
+ }), /* @__PURE__ */ react.default.createElement("button", {
29
+ type: "button",
30
+ className: "inventory-nav-label",
31
+ onClick: () => onSelect({
32
+ kind: "location",
33
+ id: record.id
34
+ }),
35
+ title: name(record)
36
+ }, name(record), record.status === "inactive" && /* @__PURE__ */ react.default.createElement("span", {
37
+ className: "inventory-inactive-dot",
38
+ title: t("inactive")
39
+ }, " ", "· ", t("inactive")))), expanded && /* @__PURE__ */ react.default.createElement("div", { className: "inventory-nav-shelves" }, /* @__PURE__ */ react.default.createElement(require_components.RequestError, {
40
+ error: shelves.error,
41
+ retry: () => void shelves.reload()
42
+ }), rows.map((shelf) => /* @__PURE__ */ react.default.createElement("button", {
43
+ type: "button",
44
+ key: shelf.id,
45
+ className: `inventory-nav-row inventory-nav-shelf ${selection.kind === "shelf" && selection.id === shelf.id ? "is-selected" : ""}`,
46
+ onClick: () => onSelect({
47
+ kind: "shelf",
48
+ id: shelf.id
49
+ }),
50
+ title: name(shelf)
51
+ }, name(shelf), shelf.status === "inactive" && /* @__PURE__ */ react.default.createElement("span", { className: "inventory-inactive-dot" }, " ", "· ", t("inactive")))), shelves.loading && !shelves.hasMore && /* @__PURE__ */ react.default.createElement(require_components.InventoryNavLoading, null), !shelves.loading && !shelves.error && !rows.length && /* @__PURE__ */ react.default.createElement("span", { className: "inventory-nav-empty" }, t("empty")), shelves.hasMore && /* @__PURE__ */ react.default.createElement(antd.Button, {
52
+ type: "text",
53
+ block: true,
54
+ loading: shelves.loading,
55
+ onClick: () => void shelves.loadMore()
56
+ }, t("loadMore"))));
57
+ }
58
+ function LocationPage({ className, style }) {
59
+ const { api, t, name, confirm, success, report } = require_context.useInventory();
60
+ const [selection, setSelection] = (0, react.useState)({ kind: "root" });
61
+ const [expanded, setExpanded] = (0, react.useState)(() => /* @__PURE__ */ new Set());
62
+ const [navigationRevision, setNavigationRevision] = (0, react.useState)(0);
63
+ const [target, setTarget] = (0, react.useState)();
64
+ const selectionKey = JSON.stringify(selection);
65
+ const [filter, setFilter] = (0, react.useState)({
66
+ key: selectionKey,
67
+ search: ""
68
+ });
69
+ const search = filter.key === selectionKey ? filter.search : "";
70
+ const status = filter.key === selectionKey ? filter.status : void 0;
71
+ const debouncedSearch = (0, ahooks.useDebounce)((0, react.useMemo)(() => ({
72
+ key: selectionKey,
73
+ search
74
+ }), [selectionKey, search]), { wait: 300 });
75
+ const keyword = debouncedSearch.key === selectionKey ? debouncedSearch.search : "";
76
+ const mutation = require_hooks.useInventoryMutation();
77
+ const locations = require_hooks.useInventoryOptions("location", {}, true, navigationRevision);
78
+ const selected = require_hooks.useInventoryQuery(() => selection.kind === "root" ? Promise.resolve(null) : api.detail(selection.kind, selection.id, selection.kind === "shelf" ? ["location"] : void 0), selectionKey, selection.kind !== "root");
79
+ const selectedShelf = selection.kind === "shelf" ? selected.data : void 0;
80
+ const selectedLocation = selection.kind === "location" ? selected.data : selectedShelf === null || selectedShelf === void 0 ? void 0 : selectedShelf.location;
81
+ const resource = selection.kind === "root" ? "location" : selection.kind === "location" ? "shelf" : "space";
82
+ const list = require_hooks.useInventoryList(resource, require_objectSpread2._objectSpread2({
83
+ search: keyword || void 0,
84
+ status
85
+ }, selection.kind === "location" ? { location_id: selection.id } : selection.kind === "shelf" ? { shelf_id: selection.id } : {}), selection.kind === "root" || !!selected.data);
86
+ (0, react.useEffect)(() => {
87
+ if (selection.kind !== "root" && selected.data === null) {
88
+ report(new Error(t("missing")));
89
+ setSelection({ kind: "root" });
90
+ }
91
+ }, [
92
+ selected.data,
93
+ selectionKey,
94
+ report,
95
+ t
96
+ ]);
97
+ (0, react.useEffect)(() => {
98
+ if (selectedShelf === null || selectedShelf === void 0 ? void 0 : selectedShelf.location_id) setExpanded((previous) => new Set([...previous, selectedShelf.location_id]));
99
+ }, [selectedShelf === null || selectedShelf === void 0 ? void 0 : selectedShelf.location_id]);
100
+ const refresh = () => {
101
+ list.reload();
102
+ selected.reload();
103
+ setNavigationRevision((value) => value + 1);
104
+ };
105
+ const open = (mode, kind = resource, id) => {
106
+ setTarget({
107
+ resource: kind,
108
+ mode,
109
+ id,
110
+ location: selectedLocation || void 0,
111
+ shelf: selectedShelf || void 0
112
+ });
113
+ };
114
+ const remove = (kind, record) => void mutation.run(require_asyncToGenerator._asyncToGenerator(function* () {
115
+ if (!(yield confirm("deleteTitle", /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, name(record), /* @__PURE__ */ react.default.createElement("p", null, t("deleteHint")))))) return;
116
+ try {
117
+ yield api.remove(kind, record.id);
118
+ success("deleted");
119
+ if (selection.kind === kind && selection.id === record.id) setSelection({ kind: "root" });
120
+ } finally {
121
+ refresh();
122
+ }
123
+ }));
124
+ const columns = (0, react.useMemo)(() => [
125
+ {
126
+ title: t("name"),
127
+ key: "name",
128
+ dataIndex: "name",
129
+ width: 250,
130
+ render: (_, record) => /* @__PURE__ */ react.default.createElement(antd.Button, {
131
+ type: "link",
132
+ onClick: () => {
133
+ if (resource === "space") open("view", resource, record.id);
134
+ else setSelection({
135
+ kind: resource,
136
+ id: record.id
137
+ });
138
+ }
139
+ }, name(record), resource !== "space" && /* @__PURE__ */ react.default.createElement(_ant_design_icons.RightOutlined, null))
140
+ },
141
+ {
142
+ title: t("status"),
143
+ key: "status",
144
+ dataIndex: "status",
145
+ render: (value) => /* @__PURE__ */ react.default.createElement(require_components.StatusTag, { status: value })
146
+ },
147
+ {
148
+ title: t("sort"),
149
+ key: "sort",
150
+ dataIndex: "sort"
151
+ },
152
+ ...resource === "space" ? [{
153
+ title: t("totalQuantity"),
154
+ key: "stock_quantity",
155
+ dataIndex: "stock_quantity",
156
+ render: require_utils.inventoryQuantity
157
+ }] : [],
158
+ {
159
+ title: t("updated"),
160
+ key: "updated_at",
161
+ dataIndex: "updated_at",
162
+ render: (value) => value || "—"
163
+ },
164
+ {
165
+ title: t("actions"),
166
+ key: "actions",
167
+ dataIndex: "actions",
168
+ width: 210,
169
+ fixed: "right",
170
+ render: (_, record) => /* @__PURE__ */ react.default.createElement(antd.Space, { size: 0 }, /* @__PURE__ */ react.default.createElement(antd.Button, {
171
+ type: "link",
172
+ disabled: mutation.busy,
173
+ onClick: () => open("view", resource, record.id)
174
+ }, t("view")), /* @__PURE__ */ react.default.createElement(antd.Button, {
175
+ type: "link",
176
+ disabled: mutation.busy,
177
+ onClick: () => open("edit", resource, record.id)
178
+ }, t("edit")), /* @__PURE__ */ react.default.createElement(antd.Button, {
179
+ type: "link",
180
+ danger: true,
181
+ disabled: mutation.busy,
182
+ onClick: () => remove(resource, record)
183
+ }, t("remove")))
184
+ }
185
+ ], [
186
+ t,
187
+ name,
188
+ resource,
189
+ mutation.busy,
190
+ selectedLocation,
191
+ selectedShelf,
192
+ selectionKey,
193
+ api,
194
+ confirm
195
+ ]);
196
+ const navigationLocations = selectedLocation && !locations.rows.some((record) => record.id === selectedLocation.id) ? [selectedLocation, ...locations.rows] : locations.rows;
197
+ const breadcrumbs = [{ title: /* @__PURE__ */ react.default.createElement("button", {
198
+ className: "inventory-text-button",
199
+ onClick: () => setSelection({ kind: "root" })
200
+ }, t("allLocations")) }];
201
+ if (selectedLocation) breadcrumbs.push({ title: /* @__PURE__ */ react.default.createElement("button", {
202
+ className: "inventory-text-button",
203
+ onClick: () => setSelection({
204
+ kind: "location",
205
+ id: selectedLocation.id
206
+ })
207
+ }, name(selectedLocation)) });
208
+ if (selectedShelf) breadcrumbs.push({ title: /* @__PURE__ */ react.default.createElement("span", null, name(selectedShelf)) });
209
+ return /* @__PURE__ */ react.default.createElement("div", {
210
+ className: `inventory-page ${className || ""}`,
211
+ style
212
+ }, /* @__PURE__ */ react.default.createElement(require_components.InventoryHeader, {
213
+ title: t("locations"),
214
+ description: t("hierarchyHint")
215
+ }, /* @__PURE__ */ react.default.createElement(antd.Button, {
216
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.ReloadOutlined, null),
217
+ disabled: mutation.busy,
218
+ onClick: refresh
219
+ }, t("refresh"))), /* @__PURE__ */ react.default.createElement("div", { className: "inventory-location-layout" }, /* @__PURE__ */ react.default.createElement("nav", {
220
+ className: "inventory-navigation",
221
+ "aria-label": t("locations")
222
+ }, /* @__PURE__ */ react.default.createElement("button", {
223
+ type: "button",
224
+ className: `inventory-nav-row inventory-nav-root ${selection.kind === "root" ? "is-selected" : ""}`,
225
+ onClick: () => setSelection({ kind: "root" })
226
+ }, t("allLocations")), /* @__PURE__ */ react.default.createElement(require_components.RequestError, {
227
+ error: locations.error,
228
+ retry: () => void locations.reload()
229
+ }), navigationLocations.map((record) => /* @__PURE__ */ react.default.createElement(NavigationLocation, {
230
+ key: record.id,
231
+ record,
232
+ selection,
233
+ selectedShelf,
234
+ expanded: expanded.has(record.id),
235
+ revision: navigationRevision,
236
+ onSelect: setSelection,
237
+ onToggle: () => setExpanded((previous) => {
238
+ const next = new Set(previous);
239
+ if (next.has(record.id)) next.delete(record.id);
240
+ else next.add(record.id);
241
+ return next;
242
+ })
243
+ })), locations.loading && !locations.hasMore && /* @__PURE__ */ react.default.createElement(require_components.InventoryNavLoading, null), !locations.loading && !locations.error && !locations.rows.length && /* @__PURE__ */ react.default.createElement("span", { className: "inventory-nav-empty" }, t("empty")), locations.hasMore && /* @__PURE__ */ react.default.createElement(antd.Button, {
244
+ type: "text",
245
+ block: true,
246
+ loading: locations.loading,
247
+ onClick: () => void locations.loadMore()
248
+ }, t("loadMore"))), /* @__PURE__ */ react.default.createElement("main", { className: "inventory-location-main" }, /* @__PURE__ */ react.default.createElement(antd.Breadcrumb, { items: breadcrumbs }), /* @__PURE__ */ react.default.createElement(require_components.RequestError, {
249
+ error: selected.error,
250
+ retry: selected.reload
251
+ }), selected.data && /* @__PURE__ */ react.default.createElement("div", { className: "inventory-section-heading" }, /* @__PURE__ */ react.default.createElement(antd.Space, null, /* @__PURE__ */ react.default.createElement("h3", null, name(selected.data)), /* @__PURE__ */ react.default.createElement(require_components.StatusTag, { status: selected.data.status })), /* @__PURE__ */ react.default.createElement(antd.Space, null, /* @__PURE__ */ react.default.createElement(antd.Tooltip, { title: t("edit") }, /* @__PURE__ */ react.default.createElement(antd.Button, {
252
+ disabled: mutation.busy,
253
+ onClick: () => selection.kind !== "root" && open("edit", selection.kind, selection.id)
254
+ }, t("edit"))), /* @__PURE__ */ react.default.createElement(antd.Button, {
255
+ danger: true,
256
+ disabled: mutation.busy,
257
+ onClick: () => selection.kind !== "root" && remove(selection.kind, selected.data)
258
+ }, t("remove")))), /* @__PURE__ */ react.default.createElement("div", { className: "inventory-toolbar" }, /* @__PURE__ */ react.default.createElement(require_components.SearchInput, {
259
+ value: search,
260
+ onChange: (value) => setFilter({
261
+ key: selectionKey,
262
+ search: value,
263
+ status
264
+ })
265
+ }), /* @__PURE__ */ react.default.createElement(require_components.StatusSelect, {
266
+ value: status,
267
+ onChange: (value) => setFilter({
268
+ key: selectionKey,
269
+ search,
270
+ status: value
271
+ })
272
+ }), /* @__PURE__ */ react.default.createElement(antd.Button, {
273
+ type: "primary",
274
+ className: "inventory-toolbar-primary",
275
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.PlusOutlined, null),
276
+ disabled: mutation.busy || selected.loading || !!selected.error || selection.kind !== "root" && !selected.data,
277
+ onClick: () => open("create")
278
+ }, t("add"), " ", t(resource))), /* @__PURE__ */ react.default.createElement(require_components.RequestError, {
279
+ error: list.error,
280
+ retry: list.reload
281
+ }), /* @__PURE__ */ react.default.createElement(require_components.InventoryTable, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, list), {}, {
282
+ loading: list.loading || selected.loading || mutation.busy,
283
+ columns,
284
+ tableKey: `locations-${resource}`
285
+ })))), target && /* @__PURE__ */ react.default.createElement(require_RecordDialog.default, {
286
+ target,
287
+ onClose: () => setTarget(void 0),
288
+ onSaved: () => {
289
+ setTarget(void 0);
290
+ refresh();
291
+ }
292
+ }));
293
+ }
294
+ function InventoryLocationManagement(props) {
295
+ return /* @__PURE__ */ react.default.createElement(require_context.InventoryProvider, { id: props.__id }, /* @__PURE__ */ react.default.createElement(LocationPage, props));
296
+ }
297
+ //#endregion
298
+ exports.default = InventoryLocationManagement;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { InventoryPageProps } from "./types.js";
3
+
4
+ //#region src/plus/inventory/InventoryUnitManagement.d.ts
5
+ declare function InventoryUnitManagement(props: InventoryPageProps): JSX.Element;
6
+ //#endregion
7
+ export { InventoryUnitManagement };
@@ -0,0 +1,146 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.js");
2
+ const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
+ const require_asyncToGenerator = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
4
+ const require_context = require("./context.js");
5
+ const require_hooks = require("./hooks.js");
6
+ const require_components = require("./components.js");
7
+ const require_RecordDialog = require("./RecordDialog.js");
8
+ let react = require("react");
9
+ react = require_runtime.__toESM(react);
10
+ let antd = require("antd");
11
+ let ahooks = require("ahooks");
12
+ let _ant_design_icons = require("@ant-design/icons");
13
+ //#region src/plus/inventory/InventoryUnitManagement.tsx
14
+ function UnitPage({ className, style }) {
15
+ const { api, t, name, confirm, success } = require_context.useInventory();
16
+ const [search, setSearch] = (0, react.useState)("");
17
+ const keyword = (0, ahooks.useDebounce)(search, { wait: 300 });
18
+ const [status, setStatus] = (0, react.useState)();
19
+ const [target, setTarget] = (0, react.useState)();
20
+ const mutation = require_hooks.useInventoryMutation();
21
+ const list = require_hooks.useInventoryList("item-unit", {
22
+ search: keyword || void 0,
23
+ status
24
+ });
25
+ const remove = (record) => void mutation.run(require_asyncToGenerator._asyncToGenerator(function* () {
26
+ if (!(yield confirm("deleteTitle", /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, name(record), /* @__PURE__ */ react.default.createElement("p", null, t("deleteHint")))))) return;
27
+ try {
28
+ yield api.remove("item-unit", record.id);
29
+ success("deleted");
30
+ } finally {
31
+ list.reload();
32
+ }
33
+ }));
34
+ const columns = (0, react.useMemo)(() => [
35
+ {
36
+ title: t("name"),
37
+ key: "name",
38
+ dataIndex: "name",
39
+ width: 260,
40
+ render: (_, record) => /* @__PURE__ */ react.default.createElement(antd.Button, {
41
+ type: "link",
42
+ onClick: () => setTarget({
43
+ resource: "item-unit",
44
+ id: record.id,
45
+ mode: "view"
46
+ })
47
+ }, name(record))
48
+ },
49
+ {
50
+ title: t("status"),
51
+ key: "status",
52
+ dataIndex: "status",
53
+ render: (value) => /* @__PURE__ */ react.default.createElement(require_components.StatusTag, { status: value })
54
+ },
55
+ {
56
+ title: t("sort"),
57
+ key: "sort",
58
+ dataIndex: "sort"
59
+ },
60
+ {
61
+ title: t("updated"),
62
+ key: "updated_at",
63
+ dataIndex: "updated_at",
64
+ render: (value) => value || "—"
65
+ },
66
+ {
67
+ title: t("actions"),
68
+ key: "actions",
69
+ dataIndex: "actions",
70
+ fixed: "right",
71
+ width: 220,
72
+ render: (_, record) => /* @__PURE__ */ react.default.createElement(antd.Space, { size: 0 }, /* @__PURE__ */ react.default.createElement(antd.Button, {
73
+ type: "link",
74
+ disabled: mutation.busy,
75
+ onClick: () => setTarget({
76
+ resource: "item-unit",
77
+ id: record.id,
78
+ mode: "view"
79
+ })
80
+ }, t("view")), /* @__PURE__ */ react.default.createElement(antd.Button, {
81
+ type: "link",
82
+ disabled: mutation.busy,
83
+ onClick: () => setTarget({
84
+ resource: "item-unit",
85
+ id: record.id,
86
+ mode: "edit"
87
+ })
88
+ }, t("edit")), /* @__PURE__ */ react.default.createElement(antd.Button, {
89
+ type: "link",
90
+ danger: true,
91
+ disabled: mutation.busy,
92
+ onClick: () => remove(record)
93
+ }, t("remove")))
94
+ }
95
+ ], [
96
+ t,
97
+ name,
98
+ mutation.busy,
99
+ api,
100
+ confirm
101
+ ]);
102
+ return /* @__PURE__ */ react.default.createElement("div", {
103
+ className: `inventory-page ${className || ""}`,
104
+ style
105
+ }, /* @__PURE__ */ react.default.createElement(require_components.InventoryHeader, {
106
+ title: t("units"),
107
+ description: t("unitHint")
108
+ }, /* @__PURE__ */ react.default.createElement(antd.Button, {
109
+ type: "primary",
110
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.PlusOutlined, null),
111
+ disabled: mutation.busy,
112
+ onClick: () => setTarget({
113
+ resource: "item-unit",
114
+ mode: "create"
115
+ })
116
+ }, t("add"), " ", t("unit"))), /* @__PURE__ */ react.default.createElement("div", { className: "inventory-toolbar" }, /* @__PURE__ */ react.default.createElement(require_components.SearchInput, {
117
+ value: search,
118
+ onChange: setSearch
119
+ }), /* @__PURE__ */ react.default.createElement(require_components.StatusSelect, {
120
+ value: status,
121
+ onChange: setStatus
122
+ }), /* @__PURE__ */ react.default.createElement(antd.Button, {
123
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.ReloadOutlined, null),
124
+ onClick: list.reload,
125
+ disabled: mutation.busy
126
+ }, t("refresh"))), /* @__PURE__ */ react.default.createElement(require_components.RequestError, {
127
+ error: list.error,
128
+ retry: list.reload
129
+ }), /* @__PURE__ */ react.default.createElement(require_components.InventoryTable, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, list), {}, {
130
+ loading: list.loading || mutation.busy,
131
+ columns,
132
+ tableKey: "units"
133
+ })), target && /* @__PURE__ */ react.default.createElement(require_RecordDialog.default, {
134
+ target,
135
+ onClose: () => setTarget(void 0),
136
+ onSaved: () => {
137
+ setTarget(void 0);
138
+ list.reload();
139
+ }
140
+ }));
141
+ }
142
+ function InventoryUnitManagement(props) {
143
+ return /* @__PURE__ */ react.default.createElement(require_context.InventoryProvider, { id: props.__id }, /* @__PURE__ */ react.default.createElement(UnitPage, props));
144
+ }
145
+ //#endregion
146
+ exports.default = InventoryUnitManagement;