@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,206 @@
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_ItemDrawer = require("./ItemDrawer.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/InventoryItemManagement.tsx
15
+ function ItemPage({ className, style }) {
16
+ const { api, t, name, confirm, success } = require_context.useInventory();
17
+ const [search, setSearch] = (0, react.useState)("");
18
+ const keyword = (0, ahooks.useDebounce)(search, { wait: 300 });
19
+ const [status, setStatus] = (0, react.useState)();
20
+ const [unit, setUnit] = (0, react.useState)();
21
+ const [stockMode, setStockMode] = (0, react.useState)();
22
+ const [target, setTarget] = (0, react.useState)();
23
+ const mutation = require_hooks.useInventoryMutation();
24
+ const units = require_hooks.useInventoryQuery(() => api.units(), "item-filter-units");
25
+ const list = require_hooks.useInventoryList("item", {
26
+ search: keyword || void 0,
27
+ status,
28
+ unit_id: unit,
29
+ stock_mode: stockMode,
30
+ with: ["unit"]
31
+ });
32
+ const remove = (record) => void mutation.run(require_asyncToGenerator._asyncToGenerator(function* () {
33
+ if (!(yield confirm("deleteTitle", /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, name(record), /* @__PURE__ */ react.default.createElement("p", null, t("deleteHint")))))) return;
34
+ try {
35
+ yield api.remove("item", record.id);
36
+ success("deleted");
37
+ } finally {
38
+ list.reload();
39
+ }
40
+ }));
41
+ const columns = (0, react.useMemo)(() => [
42
+ {
43
+ title: t("item"),
44
+ key: "name",
45
+ dataIndex: "name",
46
+ width: 250,
47
+ render: (_, record) => /* @__PURE__ */ react.default.createElement("button", {
48
+ type: "button",
49
+ className: "inventory-item-link",
50
+ onClick: () => setTarget({
51
+ id: record.id,
52
+ mode: "view"
53
+ })
54
+ }, record.cover && /* @__PURE__ */ react.default.createElement("img", {
55
+ className: "inventory-cover inventory-cover-small",
56
+ src: record.cover,
57
+ alt: ""
58
+ }), /* @__PURE__ */ react.default.createElement("span", null, name(record)))
59
+ },
60
+ {
61
+ title: t("sku"),
62
+ key: "sku",
63
+ dataIndex: "sku",
64
+ render: (value) => value || "—"
65
+ },
66
+ {
67
+ title: t("barcode"),
68
+ key: "barcode",
69
+ dataIndex: "barcode",
70
+ render: (value) => value || "—"
71
+ },
72
+ {
73
+ title: t("unit"),
74
+ key: "unit",
75
+ dataIndex: "unit",
76
+ render: (_, record) => record.unit ? name(record.unit) : "—"
77
+ },
78
+ {
79
+ title: t("stockMode"),
80
+ key: "stock_mode",
81
+ dataIndex: "stock_mode",
82
+ render: (value) => t(value)
83
+ },
84
+ {
85
+ title: t("quantity"),
86
+ key: "stock_quantity",
87
+ dataIndex: "stock_quantity",
88
+ align: "right",
89
+ render: require_utils.inventoryQuantity
90
+ },
91
+ {
92
+ title: t("available"),
93
+ key: "stock_available_quantity",
94
+ dataIndex: "stock_available_quantity",
95
+ align: "right",
96
+ render: require_utils.inventoryQuantity
97
+ },
98
+ {
99
+ title: t("status"),
100
+ key: "status",
101
+ dataIndex: "status",
102
+ render: (value) => /* @__PURE__ */ react.default.createElement(require_components.StatusTag, { status: value })
103
+ },
104
+ {
105
+ title: t("actions"),
106
+ key: "actions",
107
+ dataIndex: "actions",
108
+ fixed: "right",
109
+ width: 210,
110
+ render: (_, record) => /* @__PURE__ */ react.default.createElement(antd.Space, { size: 0 }, /* @__PURE__ */ react.default.createElement(antd.Button, {
111
+ type: "link",
112
+ disabled: mutation.busy,
113
+ onClick: () => setTarget({
114
+ id: record.id,
115
+ mode: "view"
116
+ })
117
+ }, t("view")), /* @__PURE__ */ react.default.createElement(antd.Button, {
118
+ type: "link",
119
+ disabled: mutation.busy,
120
+ onClick: () => setTarget({
121
+ id: record.id,
122
+ mode: "edit"
123
+ })
124
+ }, t("edit")), /* @__PURE__ */ react.default.createElement(antd.Button, {
125
+ type: "link",
126
+ danger: true,
127
+ disabled: mutation.busy,
128
+ onClick: () => remove(record)
129
+ }, t("remove")))
130
+ }
131
+ ], [
132
+ t,
133
+ name,
134
+ mutation.busy,
135
+ confirm,
136
+ api
137
+ ]);
138
+ return /* @__PURE__ */ react.default.createElement("div", {
139
+ className: `inventory-page ${className || ""}`,
140
+ style
141
+ }, /* @__PURE__ */ react.default.createElement(require_components.InventoryHeader, {
142
+ title: t("items"),
143
+ description: t("itemHint")
144
+ }, /* @__PURE__ */ react.default.createElement(antd.Button, {
145
+ type: "primary",
146
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.PlusOutlined, null),
147
+ disabled: mutation.busy,
148
+ onClick: () => setTarget({ mode: "create" })
149
+ }, t("add"), " ", t("item"))), /* @__PURE__ */ react.default.createElement("div", { className: "inventory-toolbar" }, /* @__PURE__ */ react.default.createElement(antd.Tooltip, { title: t("searchHint") }, /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement(require_components.SearchInput, {
150
+ items: true,
151
+ value: search,
152
+ onChange: setSearch
153
+ }))), /* @__PURE__ */ react.default.createElement(antd.Select, {
154
+ className: "inventory-filter",
155
+ showSearch: true,
156
+ allowClear: true,
157
+ optionFilterProp: "label",
158
+ placeholder: t("allUnits"),
159
+ loading: units.loading,
160
+ value: unit,
161
+ onChange: setUnit,
162
+ options: (units.data || []).map((record) => ({
163
+ value: record.id,
164
+ label: `${name(record)}${record.status === "inactive" ? ` (${t("inactive")})` : ""}`
165
+ }))
166
+ }), /* @__PURE__ */ react.default.createElement(antd.Select, {
167
+ className: "inventory-filter",
168
+ allowClear: true,
169
+ placeholder: t("allStockModes"),
170
+ value: stockMode,
171
+ onChange: setStockMode,
172
+ options: ["tracked", "unlimited"].map((value) => ({
173
+ value,
174
+ label: t(value)
175
+ }))
176
+ }), /* @__PURE__ */ react.default.createElement(require_components.StatusSelect, {
177
+ value: status,
178
+ onChange: setStatus
179
+ }), /* @__PURE__ */ react.default.createElement(antd.Button, {
180
+ icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.ReloadOutlined, null),
181
+ disabled: mutation.busy,
182
+ onClick: () => {
183
+ list.reload();
184
+ units.reload();
185
+ }
186
+ }, t("refresh"))), /* @__PURE__ */ react.default.createElement(require_components.RequestError, {
187
+ error: list.error || units.error,
188
+ retry: () => {
189
+ list.reload();
190
+ units.reload();
191
+ }
192
+ }), /* @__PURE__ */ react.default.createElement(require_components.InventoryTable, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, list), {}, {
193
+ loading: list.loading || mutation.busy,
194
+ columns,
195
+ tableKey: "items"
196
+ })), target && /* @__PURE__ */ react.default.createElement(require_ItemDrawer.default, {
197
+ target,
198
+ onClose: () => setTarget(void 0),
199
+ onChanged: list.reload
200
+ }));
201
+ }
202
+ function InventoryItemManagement(props) {
203
+ return /* @__PURE__ */ react.default.createElement(require_context.InventoryProvider, { id: props.__id }, /* @__PURE__ */ react.default.createElement(ItemPage, props));
204
+ }
205
+ //#endregion
206
+ exports.default = InventoryItemManagement;
@@ -0,0 +1,7 @@
1
+ import { InventoryPageProps } from "./types.js";
2
+ import React from "react";
3
+
4
+ //#region src/plus/inventory/InventoryLocationManagement.d.ts
5
+ declare function InventoryLocationManagement(props: InventoryPageProps): React.JSX.Element;
6
+ //#endregion
7
+ export { InventoryLocationManagement };
@@ -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
+ import { InventoryPageProps } from "./types.js";
2
+ import React from "react";
3
+
4
+ //#region src/plus/inventory/InventoryUnitManagement.d.ts
5
+ declare function InventoryUnitManagement(props: InventoryPageProps): React.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;