feat(inventory,dashboard,types,core-flows,js-sdk,medusa): Improve inventory UX (#10630)

* feat(dashboard): Add UI for bulk editing inventory stock (#10556)

* progress

* cleanup types

* add changeset

* fix 0 values

* format schema

* add delete event and allow copy/pasting enabled for some fields

* add response types

* add tests

* work on fixing setValue behaviour

* cleanup toggle logic

* add loading state

* format schema

* add support for bidirectional actions in DataGrid and update Checkbox and RadioGroup

* update lock

* lint

* fix 404

* address feedback

* update cursor on bidirectional select
This commit is contained in:
Kasper Fabricius Kristensen
2025-01-12 19:07:14 -05:00
committed by GitHub
parent c5915451b8
commit bc22b81cdf
82 changed files with 2720 additions and 289 deletions
@@ -546,11 +546,11 @@ export default class InventoryModuleService
// @ts-ignore
async updateInventoryLevels(
updates: InventoryTypes.BulkUpdateInventoryLevelInput[],
updates: InventoryTypes.UpdateInventoryLevelInput[],
context?: Context
): Promise<InventoryTypes.InventoryLevelDTO[]>
async updateInventoryLevels(
updates: InventoryTypes.BulkUpdateInventoryLevelInput,
updates: InventoryTypes.UpdateInventoryLevelInput,
context?: Context
): Promise<InventoryTypes.InventoryLevelDTO>
@@ -558,8 +558,8 @@ export default class InventoryModuleService
@EmitEvents()
async updateInventoryLevels(
updates:
| InventoryTypes.BulkUpdateInventoryLevelInput[]
| InventoryTypes.BulkUpdateInventoryLevelInput,
| InventoryTypes.UpdateInventoryLevelInput[]
| InventoryTypes.UpdateInventoryLevelInput,
@MedusaContext() context: Context = {}
): Promise<
InventoryTypes.InventoryLevelDTO | InventoryTypes.InventoryLevelDTO[]
@@ -592,7 +592,7 @@ export default class InventoryModuleService
@InjectTransactionManager()
async updateInventoryLevels_(
updates: InventoryTypes.BulkUpdateInventoryLevelInput[],
updates: InventoryTypes.UpdateInventoryLevelInput[],
@MedusaContext() context: Context = {}
) {
const inventoryLevels = await this.ensureInventoryLevels(
@@ -611,16 +611,13 @@ export default class InventoryModuleService
return acc
}, new Map())
return await this.inventoryLevelService_.update(
updates.map((update) => {
const id = levelMap
.get(update.inventory_item_id)
.get(update.location_id)
const updatesWithIds = updates.map((update) => {
const id = levelMap.get(update.inventory_item_id).get(update.location_id)
return { id, ...update }
}),
context
)
return { id, ...update }
})
return await this.inventoryLevelService_.update(updatesWithIds, context)
}
/**