@acorex/platform 20.3.0-next.22 → 20.3.0-next.23
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/common/index.d.ts +245 -3
- package/fesm2022/acorex-platform-common.mjs +444 -9
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +2 -2
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +1 -0
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +1 -0
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs +52 -0
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/layout/components/index.d.ts +1 -0
- package/layout/widget-core/index.d.ts +1 -0
- package/package.json +9 -9
|
@@ -1296,16 +1296,355 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImpor
|
|
|
1296
1296
|
type: Input
|
|
1297
1297
|
}] } });
|
|
1298
1298
|
|
|
1299
|
+
//#region ---- Menu Context Builder ----
|
|
1300
|
+
/**
|
|
1301
|
+
* Creates a rich context for menu manipulation
|
|
1302
|
+
* Similar to entity modifier context pattern
|
|
1303
|
+
*/
|
|
1304
|
+
function createMenuContext(items) {
|
|
1305
|
+
const context = {
|
|
1306
|
+
get items() {
|
|
1307
|
+
return items;
|
|
1308
|
+
},
|
|
1309
|
+
find(nameOrPattern) {
|
|
1310
|
+
if (typeof nameOrPattern === 'string') {
|
|
1311
|
+
return context.findByName(nameOrPattern);
|
|
1312
|
+
}
|
|
1313
|
+
const found = context.findByPattern(nameOrPattern);
|
|
1314
|
+
return found.length > 0 ? found[0] : createEmptyFinder();
|
|
1315
|
+
},
|
|
1316
|
+
findByName(name) {
|
|
1317
|
+
return createMenuItemFinder(items, name);
|
|
1318
|
+
},
|
|
1319
|
+
findByPattern(pattern) {
|
|
1320
|
+
const regex = typeof pattern === 'string' ? wildcardToRegex(pattern) : pattern;
|
|
1321
|
+
const results = [];
|
|
1322
|
+
const searchRecursive = (itemList) => {
|
|
1323
|
+
for (const item of itemList) {
|
|
1324
|
+
if (item.name && regex.test(item.name)) {
|
|
1325
|
+
results.push(createMenuItemFinder(items, item.name));
|
|
1326
|
+
}
|
|
1327
|
+
if (item.children) {
|
|
1328
|
+
searchRecursive(item.children);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
searchRecursive(items);
|
|
1333
|
+
return results;
|
|
1334
|
+
},
|
|
1335
|
+
add(...newItems) {
|
|
1336
|
+
items.push(...newItems);
|
|
1337
|
+
return context;
|
|
1338
|
+
},
|
|
1339
|
+
remove(predicate) {
|
|
1340
|
+
removeRecursive(items, predicate);
|
|
1341
|
+
return context;
|
|
1342
|
+
},
|
|
1343
|
+
sort() {
|
|
1344
|
+
sortItemsRecursively(items);
|
|
1345
|
+
return context;
|
|
1346
|
+
},
|
|
1347
|
+
toArray() {
|
|
1348
|
+
return items;
|
|
1349
|
+
},
|
|
1350
|
+
};
|
|
1351
|
+
return context;
|
|
1352
|
+
}
|
|
1353
|
+
//#endregion
|
|
1354
|
+
//#region ---- Menu Item Finder Implementation ----
|
|
1355
|
+
/**
|
|
1356
|
+
* Creates a finder for a specific menu item
|
|
1357
|
+
*/
|
|
1358
|
+
function createMenuItemFinder(rootItems, targetName) {
|
|
1359
|
+
const findItemWithParent = (items, name, parent = { items: rootItems }) => {
|
|
1360
|
+
for (const item of items) {
|
|
1361
|
+
if (item.name === name) {
|
|
1362
|
+
return { item, parent };
|
|
1363
|
+
}
|
|
1364
|
+
if (item.children) {
|
|
1365
|
+
const result = findItemWithParent(item.children, name, { items: item.children });
|
|
1366
|
+
if (result.item) {
|
|
1367
|
+
return result;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
return { item: undefined, parent };
|
|
1372
|
+
};
|
|
1373
|
+
const finder = {
|
|
1374
|
+
get() {
|
|
1375
|
+
return findItemWithParent(rootItems, targetName).item;
|
|
1376
|
+
},
|
|
1377
|
+
exists() {
|
|
1378
|
+
return finder.get() !== undefined;
|
|
1379
|
+
},
|
|
1380
|
+
update(updater) {
|
|
1381
|
+
const { item } = findItemWithParent(rootItems, targetName);
|
|
1382
|
+
if (item) {
|
|
1383
|
+
const updates = typeof updater === 'function' ? updater(item) : updater;
|
|
1384
|
+
Object.assign(item, updates);
|
|
1385
|
+
}
|
|
1386
|
+
return finder;
|
|
1387
|
+
},
|
|
1388
|
+
remove() {
|
|
1389
|
+
const { item, parent } = findItemWithParent(rootItems, targetName);
|
|
1390
|
+
if (item) {
|
|
1391
|
+
const index = parent.items.indexOf(item);
|
|
1392
|
+
if (index !== -1) {
|
|
1393
|
+
parent.items.splice(index, 1);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
return finder;
|
|
1397
|
+
},
|
|
1398
|
+
hide() {
|
|
1399
|
+
// Hide by removing the item from menu
|
|
1400
|
+
return finder.remove();
|
|
1401
|
+
},
|
|
1402
|
+
show() {
|
|
1403
|
+
// Show is a no-op since items are visible by default
|
|
1404
|
+
// To truly implement show, we'd need to track removed items and re-add them
|
|
1405
|
+
console.warn('show() is not fully implemented - items are visible by default');
|
|
1406
|
+
return finder;
|
|
1407
|
+
},
|
|
1408
|
+
setPriority(priority) {
|
|
1409
|
+
return finder.update({ priority });
|
|
1410
|
+
},
|
|
1411
|
+
addChildren(...children) {
|
|
1412
|
+
const { item } = findItemWithParent(rootItems, targetName);
|
|
1413
|
+
if (item) {
|
|
1414
|
+
item.children = item.children || [];
|
|
1415
|
+
item.children.push(...children);
|
|
1416
|
+
}
|
|
1417
|
+
return finder;
|
|
1418
|
+
},
|
|
1419
|
+
removeChildren(predicate) {
|
|
1420
|
+
const { item } = findItemWithParent(rootItems, targetName);
|
|
1421
|
+
if (item && item.children) {
|
|
1422
|
+
item.children = item.children.filter((c) => !predicate(c));
|
|
1423
|
+
}
|
|
1424
|
+
return finder;
|
|
1425
|
+
},
|
|
1426
|
+
moveTo(parentName) {
|
|
1427
|
+
const { item, parent: oldParent } = findItemWithParent(rootItems, targetName);
|
|
1428
|
+
if (!item) {
|
|
1429
|
+
return finder;
|
|
1430
|
+
}
|
|
1431
|
+
// Remove from old parent
|
|
1432
|
+
const oldIndex = oldParent.items.indexOf(item);
|
|
1433
|
+
if (oldIndex !== -1) {
|
|
1434
|
+
oldParent.items.splice(oldIndex, 1);
|
|
1435
|
+
}
|
|
1436
|
+
// Add to new parent
|
|
1437
|
+
if (parentName === null) {
|
|
1438
|
+
// Move to root
|
|
1439
|
+
rootItems.push(item);
|
|
1440
|
+
}
|
|
1441
|
+
else {
|
|
1442
|
+
const { item: newParentItem } = findItemWithParent(rootItems, parentName);
|
|
1443
|
+
if (newParentItem) {
|
|
1444
|
+
newParentItem.children = newParentItem.children || [];
|
|
1445
|
+
newParentItem.children.push(item);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
return finder;
|
|
1449
|
+
},
|
|
1450
|
+
insertBefore(...items) {
|
|
1451
|
+
const { item, parent } = findItemWithParent(rootItems, targetName);
|
|
1452
|
+
if (item) {
|
|
1453
|
+
const index = parent.items.indexOf(item);
|
|
1454
|
+
if (index !== -1) {
|
|
1455
|
+
parent.items.splice(index, 0, ...items);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return finder;
|
|
1459
|
+
},
|
|
1460
|
+
insertAfter(...items) {
|
|
1461
|
+
const { item, parent } = findItemWithParent(rootItems, targetName);
|
|
1462
|
+
if (item) {
|
|
1463
|
+
const index = parent.items.indexOf(item);
|
|
1464
|
+
if (index !== -1) {
|
|
1465
|
+
parent.items.splice(index + 1, 0, ...items);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
return finder;
|
|
1469
|
+
},
|
|
1470
|
+
};
|
|
1471
|
+
return finder;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Creates an empty finder for items not found
|
|
1475
|
+
*/
|
|
1476
|
+
function createEmptyFinder() {
|
|
1477
|
+
return {
|
|
1478
|
+
get: () => undefined,
|
|
1479
|
+
exists: () => false,
|
|
1480
|
+
update: () => createEmptyFinder(),
|
|
1481
|
+
remove: () => createEmptyFinder(),
|
|
1482
|
+
hide: () => createEmptyFinder(),
|
|
1483
|
+
show: () => createEmptyFinder(),
|
|
1484
|
+
setPriority: () => createEmptyFinder(),
|
|
1485
|
+
addChildren: () => createEmptyFinder(),
|
|
1486
|
+
removeChildren: () => createEmptyFinder(),
|
|
1487
|
+
moveTo: () => createEmptyFinder(),
|
|
1488
|
+
insertBefore: () => createEmptyFinder(),
|
|
1489
|
+
insertAfter: () => createEmptyFinder(),
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
//#endregion
|
|
1493
|
+
//#region ---- Helper Functions ----
|
|
1494
|
+
/**
|
|
1495
|
+
* Converts wildcard pattern to regex
|
|
1496
|
+
*/
|
|
1497
|
+
function wildcardToRegex(pattern) {
|
|
1498
|
+
const escaped = pattern.replace(/[.+?^${}()|\[\]\\]/g, '\\$&');
|
|
1499
|
+
const regexStr = `^${escaped.replace(/\*/g, '.*')}$`;
|
|
1500
|
+
return new RegExp(regexStr);
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Recursively removes items matching predicate
|
|
1504
|
+
*/
|
|
1505
|
+
function removeRecursive(items, predicate) {
|
|
1506
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
1507
|
+
const item = items[i];
|
|
1508
|
+
if (predicate(item)) {
|
|
1509
|
+
items.splice(i, 1);
|
|
1510
|
+
}
|
|
1511
|
+
else if (item.children) {
|
|
1512
|
+
removeRecursive(item.children, predicate);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Recursively sorts items by priority
|
|
1518
|
+
*/
|
|
1519
|
+
function sortItemsRecursively(items) {
|
|
1520
|
+
items.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
1521
|
+
items.forEach((item) => {
|
|
1522
|
+
if (item.children && item.children.length > 0) {
|
|
1523
|
+
sortItemsRecursively(item.children);
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
//#endregion
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* Injection token for menu middlewares (multi-provider)
|
|
1531
|
+
*/
|
|
1532
|
+
const AXP_MENU_MIDDLEWARE = new InjectionToken('AXP_MENU_MIDDLEWARE');
|
|
1533
|
+
//#endregion
|
|
1534
|
+
|
|
1535
|
+
//#region ---- Menu Middleware Registry ----
|
|
1536
|
+
/**
|
|
1537
|
+
* Central service for managing menu middlewares with priority-based ordering
|
|
1538
|
+
* Similar to token registry pattern used in identifier-management
|
|
1539
|
+
*/
|
|
1540
|
+
class AXPMenuMiddlewareRegistry {
|
|
1541
|
+
constructor() {
|
|
1542
|
+
//#region ---- Fields ----
|
|
1543
|
+
/**
|
|
1544
|
+
* Manually registered middlewares
|
|
1545
|
+
*/
|
|
1546
|
+
this.manualMiddlewares = new Map();
|
|
1547
|
+
/**
|
|
1548
|
+
* Provider-based middlewares (multi-provider injection)
|
|
1549
|
+
*/
|
|
1550
|
+
this.providerMiddlewares = inject(AXP_MENU_MIDDLEWARE, { optional: true }) ?? [];
|
|
1551
|
+
}
|
|
1552
|
+
//#endregion
|
|
1553
|
+
//#region ---- Registration Methods ----
|
|
1554
|
+
/**
|
|
1555
|
+
* Manually register a middleware
|
|
1556
|
+
* @param middleware - The middleware to register
|
|
1557
|
+
*/
|
|
1558
|
+
register(middleware) {
|
|
1559
|
+
const name = middleware.name || `middleware_${Date.now()}_${Math.random()}`;
|
|
1560
|
+
const existing = this.manualMiddlewares.get(name);
|
|
1561
|
+
if (!existing || (middleware.priority ?? 0) > (existing.priority ?? 0)) {
|
|
1562
|
+
this.manualMiddlewares.set(name, middleware);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Unregister a middleware by name
|
|
1567
|
+
* @param name - The name of the middleware to remove
|
|
1568
|
+
*/
|
|
1569
|
+
unregister(name) {
|
|
1570
|
+
this.manualMiddlewares.delete(name);
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Get a specific middleware by name
|
|
1574
|
+
* @param name - The middleware name
|
|
1575
|
+
*/
|
|
1576
|
+
get(name) {
|
|
1577
|
+
// Provider-provided middlewares take precedence
|
|
1578
|
+
const fromProvider = this.providerMiddlewares
|
|
1579
|
+
.filter((m) => m.name === name)
|
|
1580
|
+
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0))[0];
|
|
1581
|
+
if (fromProvider) {
|
|
1582
|
+
return fromProvider;
|
|
1583
|
+
}
|
|
1584
|
+
return this.manualMiddlewares.get(name);
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Get all middlewares sorted by priority (highest first)
|
|
1588
|
+
* Combines provider-based and manually registered middlewares
|
|
1589
|
+
*/
|
|
1590
|
+
list() {
|
|
1591
|
+
const map = new Map();
|
|
1592
|
+
// Helper to add middleware, respecting priority
|
|
1593
|
+
const addMiddleware = (m) => {
|
|
1594
|
+
const name = m.name || `anonymous_${Date.now()}`;
|
|
1595
|
+
const existing = map.get(name);
|
|
1596
|
+
if (!existing || (m.priority ?? 0) > (existing.priority ?? 0)) {
|
|
1597
|
+
map.set(name, m);
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
// Add provider middlewares first (higher precedence)
|
|
1601
|
+
this.providerMiddlewares.forEach(addMiddleware);
|
|
1602
|
+
// Add manual middlewares
|
|
1603
|
+
Array.from(this.manualMiddlewares.values()).forEach(addMiddleware);
|
|
1604
|
+
// Return sorted by priority (highest first)
|
|
1605
|
+
return Array.from(map.values()).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Check if a middleware exists
|
|
1609
|
+
* @param name - The middleware name
|
|
1610
|
+
*/
|
|
1611
|
+
exists(name) {
|
|
1612
|
+
return this.get(name) !== undefined;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Clear all manually registered middlewares
|
|
1616
|
+
* Provider-based middlewares are not affected
|
|
1617
|
+
*/
|
|
1618
|
+
clear() {
|
|
1619
|
+
this.manualMiddlewares.clear();
|
|
1620
|
+
}
|
|
1621
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPMenuMiddlewareRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1622
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPMenuMiddlewareRegistry, providedIn: 'root' }); }
|
|
1623
|
+
}
|
|
1624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPMenuMiddlewareRegistry, decorators: [{
|
|
1625
|
+
type: Injectable,
|
|
1626
|
+
args: [{ providedIn: 'root' }]
|
|
1627
|
+
}] });
|
|
1628
|
+
|
|
1299
1629
|
const AXP_MENU_PROVIDER = new InjectionToken('AXP_MENU_PROVIDER');
|
|
1300
1630
|
class AXPMenuProviderService {
|
|
1301
1631
|
constructor() {
|
|
1632
|
+
//#region ---- Dependencies ----
|
|
1302
1633
|
this.providers = inject(AXP_MENU_PROVIDER, { optional: true });
|
|
1634
|
+
this.middlewareRegistry = inject(AXPMenuMiddlewareRegistry);
|
|
1635
|
+
//#endregion
|
|
1636
|
+
//#region ---- State ----
|
|
1303
1637
|
this.cache = null;
|
|
1304
1638
|
this.pendingInserts = [];
|
|
1305
1639
|
this.pendingRemovals = [];
|
|
1306
1640
|
this.pendingUpdates = [];
|
|
1307
1641
|
this.pendingAdditions = [];
|
|
1308
1642
|
}
|
|
1643
|
+
//#endregion
|
|
1644
|
+
//#region ---- Public API ----
|
|
1645
|
+
/**
|
|
1646
|
+
* Get menu items with middlewares applied (for end-user display)
|
|
1647
|
+
*/
|
|
1309
1648
|
async items() {
|
|
1310
1649
|
// Return cached items if available
|
|
1311
1650
|
if (this.cache) {
|
|
@@ -1322,12 +1661,65 @@ class AXPMenuProviderService {
|
|
|
1322
1661
|
this.applyPendingOperations(items);
|
|
1323
1662
|
// Sort items by priority
|
|
1324
1663
|
items.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
1664
|
+
// Apply middlewares using registry (sorted by priority)
|
|
1665
|
+
await this.applyMiddlewares(items);
|
|
1325
1666
|
// ADD level property to items
|
|
1326
1667
|
setMenuItemMeta(items);
|
|
1327
1668
|
// Cache the computed items
|
|
1328
1669
|
this.cache = items;
|
|
1329
1670
|
return items;
|
|
1330
1671
|
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Get raw menu items WITHOUT middleware applied (for management/editing)
|
|
1674
|
+
* Used by menu management pages to show original items before customization
|
|
1675
|
+
*/
|
|
1676
|
+
async rawItems() {
|
|
1677
|
+
const items = [];
|
|
1678
|
+
const context = this.createMenuProviderContext(items);
|
|
1679
|
+
if (Array.isArray(this.providers)) {
|
|
1680
|
+
for (const provider of this.providers) {
|
|
1681
|
+
await provider.provide(context);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
// Apply pending operations
|
|
1685
|
+
this.applyPendingOperations(items);
|
|
1686
|
+
// Sort items by priority
|
|
1687
|
+
items.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
1688
|
+
// ADD level property to items (but NO middleware)
|
|
1689
|
+
setMenuItemMeta(items);
|
|
1690
|
+
return items;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Clear the cache to force reload of menu items
|
|
1694
|
+
*/
|
|
1695
|
+
clearCache() {
|
|
1696
|
+
this.cache = null;
|
|
1697
|
+
this.pendingInserts = [];
|
|
1698
|
+
this.pendingRemovals = [];
|
|
1699
|
+
this.pendingUpdates = [];
|
|
1700
|
+
this.pendingAdditions = [];
|
|
1701
|
+
}
|
|
1702
|
+
//#endregion
|
|
1703
|
+
//#region ---- Private Methods ----
|
|
1704
|
+
/**
|
|
1705
|
+
* Apply middlewares in priority order using the enhanced context API
|
|
1706
|
+
*/
|
|
1707
|
+
async applyMiddlewares(items) {
|
|
1708
|
+
const middlewares = this.middlewareRegistry.list();
|
|
1709
|
+
for (const middleware of middlewares) {
|
|
1710
|
+
try {
|
|
1711
|
+
const context = createMenuContext(items);
|
|
1712
|
+
await middleware.process(context);
|
|
1713
|
+
// The context mutates the items array, so no need to reassign
|
|
1714
|
+
}
|
|
1715
|
+
catch (error) {
|
|
1716
|
+
console.error(`Error in menu middleware ${middleware.name || 'anonymous'}:`, error);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* Create provider context for menu providers
|
|
1722
|
+
*/
|
|
1331
1723
|
createMenuProviderContext(items) {
|
|
1332
1724
|
return {
|
|
1333
1725
|
addItems: (newItems) => {
|
|
@@ -1424,14 +1816,6 @@ class AXPMenuProviderService {
|
|
|
1424
1816
|
}
|
|
1425
1817
|
return { foundItem: null, parentItems: items };
|
|
1426
1818
|
}
|
|
1427
|
-
// Method to clear the cache, if needed (e.g., when providers change)
|
|
1428
|
-
clearCache() {
|
|
1429
|
-
this.cache = null;
|
|
1430
|
-
this.pendingInserts = [];
|
|
1431
|
-
this.pendingRemovals = [];
|
|
1432
|
-
this.pendingUpdates = [];
|
|
1433
|
-
this.pendingAdditions = [];
|
|
1434
|
-
}
|
|
1435
1819
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPMenuProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1436
1820
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPMenuProviderService, providedIn: 'root' }); }
|
|
1437
1821
|
}
|
|
@@ -1455,6 +1839,57 @@ function setMenuItemMeta(items, parentIndex = '', depth = 0) {
|
|
|
1455
1839
|
});
|
|
1456
1840
|
}
|
|
1457
1841
|
|
|
1842
|
+
//#region ---- Menu Middleware Provider Helper ----
|
|
1843
|
+
/**
|
|
1844
|
+
* Helper function to provide menu middlewares with proper DI setup
|
|
1845
|
+
* Similar to provideCommandMiddleware pattern
|
|
1846
|
+
*
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```typescript
|
|
1849
|
+
* // In app.config.ts or module providers
|
|
1850
|
+
* export const appConfig: ApplicationConfig = {
|
|
1851
|
+
* providers: [
|
|
1852
|
+
* provideMenuMiddleware([
|
|
1853
|
+
* customizationMiddleware,
|
|
1854
|
+
* securityMiddleware,
|
|
1855
|
+
* loggingMiddleware
|
|
1856
|
+
* ])
|
|
1857
|
+
* ]
|
|
1858
|
+
* };
|
|
1859
|
+
* ```
|
|
1860
|
+
*/
|
|
1861
|
+
function provideMenuMiddleware(middlewares) {
|
|
1862
|
+
return makeEnvironmentProviders([
|
|
1863
|
+
...middlewares.map((middleware) => ({
|
|
1864
|
+
provide: AXP_MENU_MIDDLEWARE,
|
|
1865
|
+
useValue: middleware,
|
|
1866
|
+
multi: true,
|
|
1867
|
+
})),
|
|
1868
|
+
]);
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Helper to create a class-based middleware with priority
|
|
1872
|
+
*
|
|
1873
|
+
* @example
|
|
1874
|
+
* ```typescript
|
|
1875
|
+
* const myMiddleware = createMenuMiddleware({
|
|
1876
|
+
* name: 'my-middleware',
|
|
1877
|
+
* priority: 100,
|
|
1878
|
+
* process: async (context) => {
|
|
1879
|
+
* context.find('dashboard').setPriority(1);
|
|
1880
|
+
* }
|
|
1881
|
+
* });
|
|
1882
|
+
* ```
|
|
1883
|
+
*/
|
|
1884
|
+
function createMenuMiddleware(config) {
|
|
1885
|
+
return {
|
|
1886
|
+
name: config.name,
|
|
1887
|
+
priority: config.priority ?? 0,
|
|
1888
|
+
process: config.process,
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
//#endregion
|
|
1892
|
+
|
|
1458
1893
|
const AXPMenuService = signalStore({ providedIn: 'root' },
|
|
1459
1894
|
// Initial State
|
|
1460
1895
|
withState((router = inject(Router)) => {
|
|
@@ -2610,5 +3045,5 @@ class AXPVersioningService {
|
|
|
2610
3045
|
* Generated bundle index. Do not edit.
|
|
2611
3046
|
*/
|
|
2612
3047
|
|
|
2613
|
-
export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPAppVersionService, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCommonSettings, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGlobalVariableDefinitionService, AXPGlobalVariableEvaluatorScopeProvider, AXPHomePageModule, AXPHomePageService, AXPLockService, AXPLogoComponent, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRelationshipCardinality, AXPRelationshipKind, AXPReloadAction, AXPReloadEvent, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValuesAggregatorService, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPToastAction, AXPVersioningService, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_GLOBAL_VARIABLE_DEFINITION_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFAULT_VALUES_PROVIDERS, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, AXVChangeType, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IN_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, createAllQueryView, createQueryView, getEntityInfo, provideDynamicHomePage };
|
|
3048
|
+
export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPAppVersionService, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCommonSettings, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGlobalVariableDefinitionService, AXPGlobalVariableEvaluatorScopeProvider, AXPHomePageModule, AXPHomePageService, AXPLockService, AXPLogoComponent, AXPMenuMiddlewareRegistry, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRelationshipCardinality, AXPRelationshipKind, AXPReloadAction, AXPReloadEvent, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValuesAggregatorService, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPToastAction, AXPVersioningService, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_GLOBAL_VARIABLE_DEFINITION_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_MENU_MIDDLEWARE, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFAULT_VALUES_PROVIDERS, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, AXVChangeType, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IN_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, createAllQueryView, createMenuContext, createMenuMiddleware, createQueryView, getEntityInfo, provideDynamicHomePage, provideMenuMiddleware };
|
|
2614
3049
|
//# sourceMappingURL=acorex-platform-common.mjs.map
|