@acorex/platform 20.9.47 → 20.9.49
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/fesm2022/acorex-platform-layout-builder.mjs +102 -38
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity-contracts.mjs +3 -3
- package/fesm2022/acorex-platform-layout-entity-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +30 -4
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +2 -2
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/acorex-platform-layout-widget-core.d.ts +1 -0
|
@@ -2294,6 +2294,8 @@ var openEntityDetails_command = /*#__PURE__*/Object.freeze({
|
|
|
2294
2294
|
AXPOpenEntityDetailsCommand: AXPOpenEntityDetailsCommand
|
|
2295
2295
|
});
|
|
2296
2296
|
|
|
2297
|
+
/** Footer dropdown item: persist then reopen the create dialog with the same seed data. */
|
|
2298
|
+
const CREATE_AND_NEW_ACTION = 'create-and-new';
|
|
2297
2299
|
/** Matches persisted PK checks used for choose update vs create (strict types only). */
|
|
2298
2300
|
function hasPersistedRootId(context) {
|
|
2299
2301
|
const raw = context?.id ?? context?._id;
|
|
@@ -2331,11 +2333,26 @@ class AXPCreateEntityCommand {
|
|
|
2331
2333
|
};
|
|
2332
2334
|
}
|
|
2333
2335
|
const entityRef = await this.entityService.resolve(moduleName, entityName);
|
|
2336
|
+
const canCreateNewOne = get(options, 'process.canCreateNewOne') === true;
|
|
2334
2337
|
let chain = this.entityForm.entity(`${moduleName}.${entityName}`).create(data);
|
|
2335
2338
|
chain.actions((actions) => {
|
|
2336
|
-
actions
|
|
2337
|
-
|
|
2338
|
-
.
|
|
2339
|
+
actions.cancel('@general:actions.cancel.title');
|
|
2340
|
+
if (canCreateNewOne) {
|
|
2341
|
+
actions.custom({
|
|
2342
|
+
title: '@general:actions.create.title',
|
|
2343
|
+
color: 'primary',
|
|
2344
|
+
command: { name: 'submit', options: { validate: true } },
|
|
2345
|
+
items: [
|
|
2346
|
+
{
|
|
2347
|
+
title: '@general:actions.save-and-new.title',
|
|
2348
|
+
command: { name: CREATE_AND_NEW_ACTION, options: { validate: true } },
|
|
2349
|
+
},
|
|
2350
|
+
],
|
|
2351
|
+
}, { shortcuts: ['Enter', 'ctrl+s'] });
|
|
2352
|
+
}
|
|
2353
|
+
else {
|
|
2354
|
+
actions.submit('@general:actions.create.title', { shortcuts: ['Enter', 'ctrl+s'] });
|
|
2355
|
+
}
|
|
2339
2356
|
});
|
|
2340
2357
|
if (excludeProperties && excludeProperties.length > 0) {
|
|
2341
2358
|
chain = chain.exclude(...excludeProperties);
|
|
@@ -2362,11 +2379,13 @@ class AXPCreateEntityCommand {
|
|
|
2362
2379
|
const { shouldRedirect, shouldHighlight } = await resolveEntityCreateListBehavior(this.settingsService, {
|
|
2363
2380
|
redirect: redirectOption,
|
|
2364
2381
|
});
|
|
2382
|
+
let isCreateAndNew = false;
|
|
2365
2383
|
const result = await chain
|
|
2366
2384
|
.onAction(async (dialogRef) => {
|
|
2367
2385
|
if (dialogRef.action() === 'cancel') {
|
|
2368
2386
|
return { success: false };
|
|
2369
2387
|
}
|
|
2388
|
+
isCreateAndNew = dialogRef.action() === CREATE_AND_NEW_ACTION;
|
|
2370
2389
|
const createFn = entityRef.commands?.create?.execute;
|
|
2371
2390
|
const updateFn = entityRef.commands?.update?.execute;
|
|
2372
2391
|
const context = merge({}, data, dialogRef.context());
|
|
@@ -2398,6 +2417,9 @@ class AXPCreateEntityCommand {
|
|
|
2398
2417
|
message: {
|
|
2399
2418
|
text: await this.translationService.translateAsync('@general:messages.generic.success.description'),
|
|
2400
2419
|
},
|
|
2420
|
+
metadata: {
|
|
2421
|
+
createAndNew: isCreateAndNew,
|
|
2422
|
+
},
|
|
2401
2423
|
};
|
|
2402
2424
|
if (dialogRef.action() === ENTITY_FORM_ACTION_FIRST_STEP_CONTINUE) {
|
|
2403
2425
|
this.dispatchCreateListRefresh(entityFullName, entityRef, commandResult.data, shouldHighlight);
|
|
@@ -2434,6 +2456,10 @@ class AXPCreateEntityCommand {
|
|
|
2434
2456
|
const createdItem = commandResult.data?.item ?? commandResult.data;
|
|
2435
2457
|
const createdId = createdItem?.id ?? createdItem?._id;
|
|
2436
2458
|
this.dispatchCreateListRefresh(entityFullName, entityRef, commandResult.data, shouldHighlight);
|
|
2459
|
+
// Create & New always wins over Redirect to Details After Create.
|
|
2460
|
+
if (isCreateAndNew) {
|
|
2461
|
+
return this.execute(input);
|
|
2462
|
+
}
|
|
2437
2463
|
if (shouldRedirect && createdId != null) {
|
|
2438
2464
|
await this.openEntityDetailsCommand.execute({
|
|
2439
2465
|
entity: entityFullName,
|
|
@@ -2505,7 +2531,7 @@ const axpCreateEntityCommandDefinition = defineCommand({
|
|
|
2505
2531
|
{
|
|
2506
2532
|
name: '__context__',
|
|
2507
2533
|
title: 'Command context',
|
|
2508
|
-
description: 'Required nested object: entity (Module.Entity), entityInfo { name, module, title, parentKey }, data seed, options { excludeProperties, includeProperties, decoration, layout, process { redirect } }. For AI/tool calls, defaults include options.process.redirect = false (see toolInputDefaults) to avoid navigating away after create.',
|
|
2534
|
+
description: 'Required nested object: entity (Module.Entity), entityInfo { name, module, title, parentKey }, data seed, options { excludeProperties, includeProperties, decoration, layout, process { redirect, canCreateNewOne } }. canCreateNewOne defaults to false; when true the Create button is a split dropdown with Save and Create New (reopens the dialog with the same process.data). For AI/tool calls, defaults include options.process.redirect = false (see toolInputDefaults) to avoid navigating away after create.',
|
|
2509
2535
|
interface: { name: 'json' },
|
|
2510
2536
|
validations: [{ rule: 'required' }],
|
|
2511
2537
|
},
|