@acorex/platform 19.3.0-next.2 → 19.3.0-next.3
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/auth/lib/application/application.types.d.ts +1 -1
- package/auth/lib/tenant/tenant.types.d.ts +1 -1
- package/common/index.d.ts +1 -0
- package/common/lib/app/application.types.d.ts +1 -1
- package/common/lib/app/index.d.ts +1 -0
- package/common/lib/configs/app.config.d.ts +1 -1
- package/common/lib/home-page/home-page-settings.key.d.ts +3 -0
- package/common/lib/home-page/home-page-settings.provider.d.ts +12 -0
- package/common/lib/home-page/home-page.module.d.ts +6 -0
- package/common/lib/home-page/home-page.routes.d.ts +2 -0
- package/common/lib/home-page/home-page.service.d.ts +24 -0
- package/common/lib/home-page/home-page.types.d.ts +9 -0
- package/common/lib/home-page/index.d.ts +4 -0
- package/common/lib/layout/logo/index.d.ts +0 -1
- package/common/lib/settings/setting.builder.d.ts +1 -1
- package/core/lib/data/data-generator.d.ts +2 -1
- package/core/lib/types/index.d.ts +4 -3
- package/core/lib/utils/object-util.d.ts +1 -0
- package/fesm2022/acorex-platform-auth.mjs +0 -1
- package/fesm2022/acorex-platform-auth.mjs.map +1 -1
- package/fesm2022/acorex-platform-common.mjs +1556 -1393
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +173 -113
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +2 -0
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +25 -37
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-BqMlSX6b.mjs → acorex-platform-themes-default-entity-master-list-view.component-CuyWAi6X.mjs} +31 -20
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CuyWAi6X.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +95 -47
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-shared-setting.provider-CXiRmniv.mjs → acorex-platform-themes-shared-settings.provider-CXiRmniv.mjs} +1 -1
- package/fesm2022/acorex-platform-themes-shared-settings.provider-CXiRmniv.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared.mjs +2 -2
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/acorex-platform-widgets.mjs +571 -41
- package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
- package/layout/builder/lib/builder/widget-map.d.ts +2 -0
- package/layout/builder/lib/builder/widget.types.d.ts +2 -2
- package/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.d.ts +2 -1
- package/package.json +1 -1
- package/themes/default/lib/layouts/base/base-page.component.d.ts +9 -4
- package/themes/default/lib/layouts/base/base-page.types.d.ts +3 -2
- package/themes/default/lib/layouts/base/page-layout/page-layout.component.d.ts +9 -2
- package/themes/default/lib/layouts/entity-layouts/entity-category/entity-category.component.d.ts +2 -1
- package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +1 -0
- package/themes/default/lib/layouts/entity-layouts/entity-master-toolbar-view/entity-master-toolbar-view.component.d.ts +62 -0
- package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +3 -3
- package/themes/default/lib/layouts/root-layout/horizontal/horizontal-layout.component.d.ts +3 -3
- package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +4 -1
- package/themes/default/lib/layouts/root-layout/vertical/vertical-layout.component.d.ts +3 -3
- package/themes/default/lib/layouts/view-layouts/layout-detail-view/layout-detail-view.component.d.ts +1 -1
- package/themes/shared/index.d.ts +1 -1
- package/widgets/lib/widgets/charts/notification/index.d.ts +3 -0
- package/widgets/lib/widgets/charts/notification/notification-widget.component.d.ts +54 -0
- package/widgets/lib/widgets/charts/notification/notification-widget.config.d.ts +10 -0
- package/widgets/lib/widgets/charts/notification/notification.type.d.ts +47 -0
- package/widgets/lib/widgets/charts/sticky-note/sticky-note-widget.component.d.ts +3 -3
- package/widgets/lib/widgets/charts/tasklist/index.d.ts +3 -0
- package/widgets/lib/widgets/charts/tasklist/tasklist-widget.component.d.ts +34 -0
- package/widgets/lib/widgets/charts/tasklist/tasklist-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/charts/tasklist/tasklist.type.d.ts +36 -0
- package/widgets/lib/widgets/index.d.ts +3 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-BqMlSX6b.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-shared-setting.provider-CXiRmniv.mjs.map +0 -1
- /package/{common/lib/layout/logo → core/lib/types}/logo.types.d.ts +0 -0
- /package/themes/shared/lib/{setting.keys.d.ts → settings.keys.d.ts} +0 -0
- /package/themes/shared/lib/{setting.provider.d.ts → settings.provider.d.ts} +0 -0
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, provideAppInitializer, inject, InjectionToken, Injector, ErrorHandler, Input, Directive, EventEmitter, Output, runInInjectionContext, Optional, Inject,
|
|
3
|
-
import { kebabCase,
|
|
2
|
+
import { Injectable, provideAppInitializer, inject, InjectionToken, Injector, makeEnvironmentProviders, NgModule, ErrorHandler, Input, Directive, EventEmitter, Output, runInInjectionContext, Optional, Inject, Component, computed, ViewEncapsulation, signal, model, linkedSignal, afterNextRender } from '@angular/core';
|
|
3
|
+
import { kebabCase, merge, cloneDeep, get, sortBy, omit } from 'lodash-es';
|
|
4
|
+
import { ROUTES, Router, RouterModule } from '@angular/router';
|
|
5
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
6
|
+
import { Subject, merge as merge$1 } from 'rxjs';
|
|
7
|
+
import { AXPPlatformScope, AXPBroadcastEventService, objectKeyValueTransforms, AXPComponentLogoConfig, AXPFontIconLogoConfig, AXPImageUrlLogoConfig, AXPTextLogoConfig } from '@acorex/platform/core';
|
|
8
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
9
|
+
import { AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
|
|
4
10
|
import { AXPopupModule, AXPopupService } from '@acorex/components/popup';
|
|
5
11
|
import { AXToastService, AXToastModule } from '@acorex/components/toast';
|
|
6
12
|
import { AXDateTimeModule } from '@acorex/core/date-time';
|
|
7
13
|
import * as i3 from '@acorex/platform/workflow';
|
|
8
14
|
import { AXPWorkflowService, createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowError, AXPWorkflowModule } from '@acorex/platform/workflow';
|
|
9
|
-
import { Router, RouterModule } from '@angular/router';
|
|
10
15
|
import * as i4 from '@acorex/components/decorators';
|
|
11
16
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
12
17
|
import * as i2 from '@acorex/components/image';
|
|
@@ -14,10 +19,7 @@ import { AXImageModule } from '@acorex/components/image';
|
|
|
14
19
|
import * as i1 from '@angular/common';
|
|
15
20
|
import { CommonModule } from '@angular/common';
|
|
16
21
|
import { signalStore, withState, withMethods, patchState, withHooks } from '@ngrx/signals';
|
|
17
|
-
import { AXTranslationService } from '@acorex/core/translation';
|
|
18
22
|
import { AXFormatService } from '@acorex/core/format';
|
|
19
|
-
import { AXPPlatformScope, AXPBroadcastEventService } from '@acorex/platform/core';
|
|
20
|
-
import { Subject } from 'rxjs';
|
|
21
23
|
import { AXDialogService } from '@acorex/components/dialog';
|
|
22
24
|
import * as i5 from '@acorex/components/button';
|
|
23
25
|
import { AXButtonModule } from '@acorex/components/button';
|
|
@@ -238,1591 +240,1752 @@ const ALL_DEFAULT_OPERATORS = [
|
|
|
238
240
|
BETWEEN_OPER,
|
|
239
241
|
];
|
|
240
242
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
class AXPCustomOperatorServiceImpl extends AXPCustomOperatorService {
|
|
247
|
-
getCustomOperators() {
|
|
248
|
-
return {};
|
|
249
|
-
}
|
|
250
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCustomOperatorServiceImpl, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
251
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCustomOperatorServiceImpl }); }
|
|
252
|
-
}
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCustomOperatorServiceImpl, decorators: [{
|
|
254
|
-
type: Injectable
|
|
255
|
-
}] });
|
|
243
|
+
const AXP_HOME_PAGES = new InjectionToken('AXP_HOME_PAGES');
|
|
244
|
+
const AXP_HOME_PAGE_DEFAULT_KEY = new InjectionToken('AXP_HOME_PAGE_DEFAULT_KEY', {
|
|
245
|
+
factory: () => 'home'
|
|
246
|
+
});
|
|
256
247
|
|
|
257
|
-
class
|
|
258
|
-
}
|
|
259
|
-
class AXPFilterOperatorMiddlewareServiceImpl extends AXPFilterOperatorMiddlewareService {
|
|
248
|
+
class AXPSettingDefinitionProviderContext {
|
|
260
249
|
constructor() {
|
|
261
|
-
|
|
262
|
-
this.
|
|
263
|
-
this.operators = {
|
|
264
|
-
...this.getDefaultOperators(),
|
|
265
|
-
...this.customOperatorService.getCustomOperators(),
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
transformFilters(filters) {
|
|
269
|
-
return filters.map((filter) => this.transformFilter(filter));
|
|
250
|
+
this.rootGroups = [];
|
|
251
|
+
this.groupMap = new Map();
|
|
270
252
|
}
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
253
|
+
addGroup(name, title, description, icon) {
|
|
254
|
+
const newGroup = {
|
|
255
|
+
name,
|
|
256
|
+
title,
|
|
257
|
+
description,
|
|
258
|
+
icon,
|
|
259
|
+
groups: [],
|
|
260
|
+
sections: [],
|
|
279
261
|
};
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
262
|
+
this.rootGroups.push(newGroup);
|
|
263
|
+
this.groupMap.set(name, newGroup); // Index by name
|
|
264
|
+
return new AXPSettingDefinitionGroupBuilder(this, newGroup);
|
|
265
|
+
}
|
|
266
|
+
group(name) {
|
|
267
|
+
const foundGroup = this.groupMap.get(name);
|
|
268
|
+
if (!foundGroup) {
|
|
269
|
+
console.error(`Group with name "${name}" not found.`);
|
|
270
|
+
return null;
|
|
283
271
|
}
|
|
284
|
-
return
|
|
272
|
+
return new AXPSettingDefinitionGroupBuilder(this, foundGroup);
|
|
285
273
|
}
|
|
286
|
-
|
|
287
|
-
return this.
|
|
274
|
+
getGroups() {
|
|
275
|
+
return this.rootGroups;
|
|
288
276
|
}
|
|
289
|
-
//
|
|
290
|
-
|
|
291
|
-
return
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return acc;
|
|
296
|
-
}, {});
|
|
277
|
+
// Expose groupMap for controlled access
|
|
278
|
+
hasGroup(name) {
|
|
279
|
+
return this.groupMap.has(name);
|
|
280
|
+
}
|
|
281
|
+
getGroup(name) {
|
|
282
|
+
return this.groupMap.get(name);
|
|
297
283
|
}
|
|
298
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFilterOperatorMiddlewareServiceImpl, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
299
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFilterOperatorMiddlewareServiceImpl }); }
|
|
300
284
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
class AXPErrorHandlerRegistryService {
|
|
306
|
-
constructor(injector) {
|
|
307
|
-
this.injector = injector;
|
|
308
|
-
this.errorHandlers = [];
|
|
285
|
+
class AXPSettingDefinitionGroupBuilder {
|
|
286
|
+
constructor(context, group) {
|
|
287
|
+
this.context = context;
|
|
288
|
+
this.group = group;
|
|
309
289
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
290
|
+
addSection(name, title, description) {
|
|
291
|
+
const newSection = {
|
|
292
|
+
name,
|
|
293
|
+
title,
|
|
294
|
+
description: description,
|
|
295
|
+
settings: [],
|
|
296
|
+
};
|
|
297
|
+
this.group.sections.push(newSection);
|
|
298
|
+
return new AXPSettingDefinitionSectionBuilder(this, newSection);
|
|
318
299
|
}
|
|
319
|
-
|
|
320
|
-
|
|
300
|
+
section(name) {
|
|
301
|
+
const foundSection = this.group.sections.find((section) => section.name === name);
|
|
302
|
+
if (!foundSection) {
|
|
303
|
+
throw new Error(`Section with name "${name}" not found in group "${this.group.name}".`);
|
|
304
|
+
}
|
|
305
|
+
return new AXPSettingDefinitionSectionBuilder(this, foundSection);
|
|
306
|
+
}
|
|
307
|
+
addGroup(name, title, description, icon) {
|
|
308
|
+
const newGroup = {
|
|
309
|
+
name,
|
|
310
|
+
title,
|
|
311
|
+
description: description,
|
|
312
|
+
icon,
|
|
313
|
+
groups: [],
|
|
314
|
+
sections: [],
|
|
315
|
+
};
|
|
316
|
+
this.group.groups.push(newGroup);
|
|
317
|
+
if (this.context.hasGroup(name)) {
|
|
318
|
+
throw new Error(`Group with name "${name}" already exists.`);
|
|
319
|
+
}
|
|
320
|
+
this.context['groupMap'].set(name, newGroup);
|
|
321
|
+
return new AXPSettingDefinitionGroupBuilder(this.context, newGroup);
|
|
322
|
+
}
|
|
323
|
+
endGroup() {
|
|
324
|
+
return this.context;
|
|
321
325
|
}
|
|
322
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPErrorHandlerRegistryService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
323
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPErrorHandlerRegistryService, providedIn: 'root' }); }
|
|
324
326
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}]
|
|
330
|
-
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
331
|
-
|
|
332
|
-
class AXPGlobalErrorHandler extends ErrorHandler {
|
|
333
|
-
constructor(injector, registry) {
|
|
334
|
-
super();
|
|
335
|
-
this.injector = injector;
|
|
336
|
-
this.registry = registry;
|
|
327
|
+
class AXPSettingDefinitionSectionBuilder {
|
|
328
|
+
constructor(groupBuilder, section) {
|
|
329
|
+
this.groupBuilder = groupBuilder;
|
|
330
|
+
this.section = section;
|
|
337
331
|
}
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
332
|
+
addSetting(setting) {
|
|
333
|
+
const newSetting = {
|
|
334
|
+
name: setting.key,
|
|
335
|
+
title: setting.title,
|
|
336
|
+
description: setting.description,
|
|
337
|
+
isRequired: setting.isRequired ?? false,
|
|
338
|
+
isInherited: setting.isInherited ?? false,
|
|
339
|
+
isEncrypted: setting.isEncrypted ?? false,
|
|
340
|
+
defaultValue: setting.defaultValue,
|
|
341
|
+
scope: setting.scope ?? 'G',
|
|
342
|
+
layout: setting.widget.layout,
|
|
343
|
+
widget: {
|
|
344
|
+
type: setting.widget.type,
|
|
345
|
+
name: setting.key,
|
|
346
|
+
path: setting.key,
|
|
347
|
+
defaultValue: setting.defaultValue,
|
|
348
|
+
options: merge(setting.widget.options ?? {}, {
|
|
349
|
+
label: Object.keys(setting.widget.options ?? {}).includes('label') ? setting.widget.options?.['label'] : setting.title,
|
|
350
|
+
validationRules: setting.validationRules ?? [],
|
|
351
|
+
}),
|
|
352
|
+
valueTransforms: setting.valueTransforms,
|
|
353
|
+
triggers: setting.widget.triggers,
|
|
354
|
+
},
|
|
349
355
|
};
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
this.section.settings.push(newSetting);
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
endSection() {
|
|
360
|
+
return this.groupBuilder;
|
|
355
361
|
}
|
|
356
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGlobalErrorHandler, deps: [{ token: i0.Injector }, { token: AXPErrorHandlerRegistryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
357
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGlobalErrorHandler, providedIn: 'root' }); }
|
|
358
362
|
}
|
|
359
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGlobalErrorHandler, decorators: [{
|
|
360
|
-
type: Injectable,
|
|
361
|
-
args: [{ providedIn: 'root' }]
|
|
362
|
-
}], ctorParameters: () => [{ type: i0.Injector }, { type: AXPErrorHandlerRegistryService }] });
|
|
363
363
|
|
|
364
|
-
//
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
this.
|
|
364
|
+
// Injection token for setting providers
|
|
365
|
+
const AXP_SETTING_DEFINITION_PROVIDER = new InjectionToken('AXP_SETTING_DEFINITION_PROVIDER');
|
|
366
|
+
class AXPSettingDefinitionProviderService {
|
|
367
|
+
constructor() {
|
|
368
|
+
this.providers = inject(AXP_SETTING_DEFINITION_PROVIDER, { optional: true });
|
|
369
|
+
this.cache = null;
|
|
369
370
|
}
|
|
370
|
-
|
|
371
|
-
if (
|
|
372
|
-
|
|
371
|
+
async load() {
|
|
372
|
+
if (this.cache) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const context = new AXPSettingDefinitionProviderContext();
|
|
376
|
+
if (Array.isArray(this.providers)) {
|
|
377
|
+
for (const provider of this.providers) {
|
|
378
|
+
if (provider instanceof Promise) {
|
|
379
|
+
// If provider is a promise, resolve it
|
|
380
|
+
const resolvedProvider = await provider;
|
|
381
|
+
await resolvedProvider.provide(context);
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
// If provider is a direct instance, use it directly
|
|
385
|
+
await provider.provide(context);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
373
388
|
}
|
|
389
|
+
this.cache = context.getGroups();
|
|
374
390
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
// Clear existing grid classes
|
|
379
|
-
this.clearClasses();
|
|
380
|
-
// Apply new grid classes based on the input options
|
|
381
|
-
this.setClasses(this.options.positions?.default, '');
|
|
382
|
-
this.setClasses(this.options.positions?.md, 'md:');
|
|
383
|
-
this.setClasses(this.options.positions?.lg, 'lg:');
|
|
384
|
-
this.setClasses(this.options.positions?.xl, 'xl:');
|
|
385
|
-
this.setClasses(this.options.positions?.xxl, '2xl:');
|
|
391
|
+
async reload() {
|
|
392
|
+
this.cache = null;
|
|
393
|
+
await this.load();
|
|
386
394
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const colStart = positions.colStart ? `${prefix}ax-col-start-${positions.colStart}` : '';
|
|
391
|
-
const colEnd = positions.colEnd ? `${prefix}ax-col-end-${positions.colEnd}` : '';
|
|
392
|
-
const colSpan = positions.colSpan ? `${prefix}ax-col-span-${positions.colSpan}` : '';
|
|
393
|
-
const rowStart = positions.rowStart ? `${prefix}ax-row-start-${positions.rowStart}` : '';
|
|
394
|
-
const rowEnd = positions.rowEnd ? `${prefix}ax-row-end-${positions.rowEnd}` : '';
|
|
395
|
-
const rowSpan = positions.rowSpan ? `${prefix}ax-row-span-${positions.rowSpan}` : '';
|
|
396
|
-
const order = positions.order ? `${prefix}ax-order-${positions.order}` : ''; // Handling order
|
|
397
|
-
[colStart, colEnd, colSpan, rowStart, rowEnd, rowSpan, order].forEach(cls => {
|
|
398
|
-
if (cls) {
|
|
399
|
-
this.renderer.addClass(this.el.nativeElement, cls);
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
clearClasses() {
|
|
404
|
-
const currentClasses = this.el.nativeElement.className.split(' ');
|
|
405
|
-
currentClasses.forEach((className) => {
|
|
406
|
-
if (className.startsWith('ax-col-') || className.startsWith('ax-row-') || className.startsWith('ax-order-')) {
|
|
407
|
-
this.renderer.removeClass(this.el.nativeElement, className);
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGridLayoutDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
412
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXPGridLayoutDirective, isStandalone: true, selector: "[gridLayout]", inputs: { options: ["gridLayout", "options"] }, usesOnChanges: true, ngImport: i0 }); }
|
|
413
|
-
}
|
|
414
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGridLayoutDirective, decorators: [{
|
|
415
|
-
type: Directive,
|
|
416
|
-
args: [{
|
|
417
|
-
selector: '[gridLayout]',
|
|
418
|
-
standalone: true,
|
|
419
|
-
}]
|
|
420
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { options: [{
|
|
421
|
-
type: Input,
|
|
422
|
-
args: ['gridLayout']
|
|
423
|
-
}] } });
|
|
424
|
-
|
|
425
|
-
class AXPStickyDirective {
|
|
426
|
-
get isSticky() {
|
|
427
|
-
return this._isSticky;
|
|
395
|
+
async getListAsync(scope) {
|
|
396
|
+
await this.load();
|
|
397
|
+
return this.getList(scope);
|
|
428
398
|
}
|
|
429
|
-
|
|
430
|
-
if (this.
|
|
431
|
-
|
|
432
|
-
this.isStickyChange.emit(value);
|
|
399
|
+
getList(scope) {
|
|
400
|
+
if (!this.cache) {
|
|
401
|
+
return [];
|
|
433
402
|
}
|
|
403
|
+
const scopeOrder = ['C', 'G', 'T', 'U']; // Scopes hierarchy in ascending order
|
|
404
|
+
const filterByScope = (groups, currentScope) => {
|
|
405
|
+
const currentScopeIndex = scopeOrder.indexOf(currentScope);
|
|
406
|
+
return groups
|
|
407
|
+
.map((group) => ({
|
|
408
|
+
...group,
|
|
409
|
+
sections: group.sections.map((section) => ({
|
|
410
|
+
...section,
|
|
411
|
+
settings: section.settings.filter((setting) => {
|
|
412
|
+
const settingScopeIndex = scopeOrder.indexOf(setting.scope);
|
|
413
|
+
// Include settings where:
|
|
414
|
+
// 1. The scope matches the requested scope.
|
|
415
|
+
if (setting.scope === currentScope)
|
|
416
|
+
return true;
|
|
417
|
+
// 2. The setting scope is higher (closer to 'U') and is inherited.
|
|
418
|
+
if (setting.isInherited &&
|
|
419
|
+
settingScopeIndex > currentScopeIndex // Higher scope
|
|
420
|
+
) {
|
|
421
|
+
return true;
|
|
422
|
+
}
|
|
423
|
+
// 3. Exclude settings with a lower or irrelevant scope.
|
|
424
|
+
return false;
|
|
425
|
+
}),
|
|
426
|
+
})).filter((section) => section.settings.length > 0), // Keep only sections with settings
|
|
427
|
+
groups: filterByScope(group.groups, currentScope), // Recursively filter nested groups
|
|
428
|
+
}))
|
|
429
|
+
.filter((group) => group.sections.length > 0 || group.groups.length > 0); // Keep groups with valid sections or nested groups
|
|
430
|
+
};
|
|
431
|
+
return filterByScope(this.cache, scope);
|
|
434
432
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
this.zone.runOutsideAngular(() => {
|
|
445
|
-
const scrollTop = this.parentElement === window
|
|
446
|
-
? window.scrollY
|
|
447
|
-
: this.parentElement.scrollTop;
|
|
448
|
-
const shouldStick = scrollTop + this.stickyOffset >= this.topOffset;
|
|
449
|
-
if (shouldStick !== this.isSticky) {
|
|
450
|
-
this.zone.run(() => {
|
|
451
|
-
this.isSticky = shouldStick;
|
|
452
|
-
this.toggleStickyClasses(shouldStick);
|
|
453
|
-
this.cdr.markForCheck();
|
|
433
|
+
async defaultValues() {
|
|
434
|
+
const defaults = {};
|
|
435
|
+
const collectDefaults = (groups) => {
|
|
436
|
+
groups.forEach((group) => {
|
|
437
|
+
group.sections.forEach((section) => {
|
|
438
|
+
section.settings.forEach((setting) => {
|
|
439
|
+
if (setting.defaultValue !== undefined) {
|
|
440
|
+
defaults[setting.name] = setting.defaultValue;
|
|
441
|
+
}
|
|
454
442
|
});
|
|
455
|
-
}
|
|
443
|
+
});
|
|
444
|
+
collectDefaults(group.groups);
|
|
456
445
|
});
|
|
457
446
|
};
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
this.initSticky();
|
|
461
|
-
// Add mutation observer for dynamic content
|
|
462
|
-
this.mutationObserver = new MutationObserver(() => {
|
|
463
|
-
this.updateTopOffset();
|
|
464
|
-
});
|
|
465
|
-
this.mutationObserver.observe(this.element.nativeElement, {
|
|
466
|
-
childList: true,
|
|
467
|
-
subtree: true,
|
|
468
|
-
});
|
|
469
|
-
// Add resize event listener
|
|
470
|
-
window.addEventListener('resize', this.updateTopOffset.bind(this));
|
|
471
|
-
}
|
|
472
|
-
initSticky() {
|
|
473
|
-
if (this.stickyParent instanceof HTMLElement) {
|
|
474
|
-
this.parentElement = this.stickyParent;
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
this.parentElement =
|
|
478
|
-
document.querySelector(this.stickyParent) || window;
|
|
447
|
+
if (!this.cache) {
|
|
448
|
+
await this.load();
|
|
479
449
|
}
|
|
480
|
-
this.
|
|
481
|
-
|
|
482
|
-
this.element.nativeElement;
|
|
483
|
-
this.updateTopOffset();
|
|
484
|
-
this.parentElement.addEventListener('scroll', this.onParentScroll);
|
|
450
|
+
collectDefaults(this.cache);
|
|
451
|
+
return defaults;
|
|
485
452
|
}
|
|
486
|
-
|
|
487
|
-
this.
|
|
488
|
-
const rect = this.targetElement.getBoundingClientRect();
|
|
489
|
-
this.topOffset = rect.top + (window.scrollY || 0);
|
|
490
|
-
});
|
|
453
|
+
findGroup(scope, groupName) {
|
|
454
|
+
return this.searchRecursive(this.getList(scope), groupName, []); // Initialize with an empty breadcrumb
|
|
491
455
|
}
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
456
|
+
searchRecursive(groups, groupName, breadcrumb) {
|
|
457
|
+
for (const group of groups) {
|
|
458
|
+
const currentBreadcrumb = [...breadcrumb, { name: group.name, title: group.title, description: group.description }];
|
|
459
|
+
// If the group name matches, return its details
|
|
460
|
+
if (group.name === groupName) {
|
|
461
|
+
return {
|
|
462
|
+
breadcrumb: currentBreadcrumb,
|
|
463
|
+
sections: group.sections.length > 0 ? group.sections : null,
|
|
464
|
+
groups: group.groups.length > 0 ? group.groups : null,
|
|
465
|
+
};
|
|
497
466
|
}
|
|
498
|
-
|
|
499
|
-
|
|
467
|
+
// Recursively search in nested groups
|
|
468
|
+
const nestedResult = this.searchRecursive(group.groups, groupName, currentBreadcrumb);
|
|
469
|
+
if (nestedResult.breadcrumb.length > 0) {
|
|
470
|
+
return nestedResult;
|
|
500
471
|
}
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
ngOnDestroy() {
|
|
504
|
-
this.parentElement.removeEventListener('scroll', this.onParentScroll);
|
|
505
|
-
window.removeEventListener('resize', this.updateTopOffset.bind(this));
|
|
506
|
-
if (this.mutationObserver) {
|
|
507
|
-
this.mutationObserver.disconnect();
|
|
508
472
|
}
|
|
473
|
+
// If no matching group is found
|
|
474
|
+
return {
|
|
475
|
+
breadcrumb: [],
|
|
476
|
+
groups: [],
|
|
477
|
+
sections: []
|
|
478
|
+
};
|
|
509
479
|
}
|
|
510
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
511
|
-
static { this.ɵ
|
|
480
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
481
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, providedIn: 'root' }); }
|
|
512
482
|
}
|
|
513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
514
|
-
type:
|
|
515
|
-
args: [{
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
standalone: true,
|
|
519
|
-
}]
|
|
520
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }], propDecorators: { stickyClass: [{
|
|
521
|
-
type: Input,
|
|
522
|
-
args: ['axpSticky']
|
|
523
|
-
}], stickyOffset: [{
|
|
524
|
-
type: Input,
|
|
525
|
-
args: ['stickyOffset']
|
|
526
|
-
}], isStickyChange: [{
|
|
527
|
-
type: Output
|
|
528
|
-
}], stickyParent: [{
|
|
529
|
-
type: Input
|
|
530
|
-
}], stickyTarget: [{
|
|
531
|
-
type: Input
|
|
532
|
-
}] } });
|
|
533
|
-
|
|
534
|
-
class AXPComponentSlotRegistryService {
|
|
483
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, decorators: [{
|
|
484
|
+
type: Injectable,
|
|
485
|
+
args: [{ providedIn: 'root' }]
|
|
486
|
+
}] });
|
|
487
|
+
class AXPSettingDefaultValueProvider {
|
|
535
488
|
constructor() {
|
|
536
|
-
this.
|
|
489
|
+
this.definitionProvider = inject(AXPSettingDefinitionProviderService);
|
|
537
490
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
// Check if the component is already registered in this slot
|
|
541
|
-
const isDuplicate = configs.some(existingConfig => existingConfig.name === config.name);
|
|
542
|
-
if (!isDuplicate) {
|
|
543
|
-
configs = [...configs, config]; // Add the new configuration
|
|
544
|
-
this.registry.set(slotName, configs);
|
|
545
|
-
}
|
|
491
|
+
get scope() {
|
|
492
|
+
return AXPPlatformScope.Global;
|
|
546
493
|
}
|
|
547
|
-
|
|
548
|
-
return this.
|
|
494
|
+
async load() {
|
|
495
|
+
return Object.entries(await this.definitionProvider.defaultValues()).map(c => ({ key: c[0], value: c[1] }));
|
|
496
|
+
}
|
|
497
|
+
set(key, value) {
|
|
498
|
+
throw new Error('Method not implemented.');
|
|
549
499
|
}
|
|
550
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
551
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotRegistryService, providedIn: 'root' }); }
|
|
552
500
|
}
|
|
553
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotRegistryService, decorators: [{
|
|
554
|
-
type: Injectable,
|
|
555
|
-
args: [{
|
|
556
|
-
providedIn: 'root'
|
|
557
|
-
}]
|
|
558
|
-
}] });
|
|
559
501
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
502
|
+
const AXP_SETTING_VALUE_PROVIDER = new InjectionToken('AXP_SETTING_VALUE_PROVIDER', {
|
|
503
|
+
providedIn: 'root',
|
|
504
|
+
factory: () => {
|
|
505
|
+
return [
|
|
506
|
+
new AXPSettingValueProviderDefault(AXPPlatformScope.Tenant),
|
|
507
|
+
new AXPSettingValueProviderDefault(AXPPlatformScope.User)
|
|
508
|
+
];
|
|
564
509
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
//
|
|
583
|
-
if (typeof config.options === 'function') {
|
|
584
|
-
// If options is a function
|
|
585
|
-
runInInjectionContext(this.injector, () => {
|
|
586
|
-
const fun = config.options;
|
|
587
|
-
options = fun();
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
else if (config.options) {
|
|
591
|
-
// If options is a object
|
|
592
|
-
options = config.options;
|
|
593
|
-
}
|
|
594
|
-
//
|
|
595
|
-
if (component != null) {
|
|
596
|
-
const componentRef = viewContainerRef.createComponent(component);
|
|
597
|
-
Object.assign(componentRef.instance, options);
|
|
598
|
-
}
|
|
510
|
+
});
|
|
511
|
+
class AXPSettingValueProviderDefault {
|
|
512
|
+
get scope() {
|
|
513
|
+
return this._scope;
|
|
514
|
+
}
|
|
515
|
+
constructor(_scope) {
|
|
516
|
+
this._scope = _scope;
|
|
517
|
+
this.cache = new Map();
|
|
518
|
+
this.localStorageKey = `AXP_SETTINGS_SCOPE(${this.scope})`;
|
|
519
|
+
}
|
|
520
|
+
async load() {
|
|
521
|
+
// Load settings from localStorage as a single key
|
|
522
|
+
const storedSettings = localStorage.getItem(this.localStorageKey);
|
|
523
|
+
if (storedSettings) {
|
|
524
|
+
const parsedSettings = JSON.parse(storedSettings);
|
|
525
|
+
Object.entries(parsedSettings).forEach(([key, value]) => {
|
|
526
|
+
this.cache.set(key, value);
|
|
599
527
|
});
|
|
528
|
+
return Promise.resolve(Array.from(this.cache.entries()).map(c => ({ key: c[0], value: c[1] })));
|
|
600
529
|
}
|
|
530
|
+
return Promise.resolve([]);
|
|
601
531
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
this.dynamicLoaderService = dynamicLoaderService;
|
|
615
|
-
this.viewContainerRef = viewContainerRef;
|
|
532
|
+
async set(keyOrValues, value) {
|
|
533
|
+
if (typeof keyOrValues === 'string') {
|
|
534
|
+
// Single value update
|
|
535
|
+
this.cache.set(keyOrValues, value);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
// Bulk update
|
|
539
|
+
for (const [key, val] of Object.entries(keyOrValues)) {
|
|
540
|
+
this.cache.set(key, val);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
await this.saveToLocalStorage();
|
|
616
544
|
}
|
|
617
|
-
|
|
618
|
-
|
|
545
|
+
async saveToLocalStorage() {
|
|
546
|
+
const settingsObject = {};
|
|
547
|
+
this.cache.forEach((value, key) => {
|
|
548
|
+
settingsObject[key] = value;
|
|
549
|
+
});
|
|
550
|
+
localStorage.setItem(this.localStorageKey, JSON.stringify(settingsObject));
|
|
619
551
|
}
|
|
620
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotDirective, deps: [{ token: AXPComponentSlotLoaderService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
621
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXPComponentSlotDirective, isStandalone: false, selector: "axp-component-slot", inputs: { name: "name" }, ngImport: i0 }); }
|
|
622
552
|
}
|
|
623
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotDirective, decorators: [{
|
|
624
|
-
type: Directive,
|
|
625
|
-
args: [{
|
|
626
|
-
selector: 'axp-component-slot',
|
|
627
|
-
standalone: false
|
|
628
|
-
}]
|
|
629
|
-
}], ctorParameters: () => [{ type: AXPComponentSlotLoaderService }, { type: i0.ViewContainerRef }], propDecorators: { name: [{
|
|
630
|
-
type: Input
|
|
631
|
-
}] } });
|
|
632
553
|
|
|
633
|
-
class
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
554
|
+
class AXPSettingService {
|
|
555
|
+
constructor() {
|
|
556
|
+
this.providers = inject(AXP_SETTING_VALUE_PROVIDER);
|
|
557
|
+
//private readonly definitionService = inject(AXPSettingDefinitionProviderService);
|
|
558
|
+
this.injector = inject(Injector);
|
|
559
|
+
this.eventService = inject(AXPBroadcastEventService);
|
|
560
|
+
this.scopedSettingsCache = new Map();
|
|
561
|
+
this.onChanged = new Subject();
|
|
562
|
+
// Initialize scoped caches for dynamic scopes
|
|
563
|
+
const staticScopes = [
|
|
564
|
+
AXPPlatformScope.Environment,
|
|
565
|
+
AXPPlatformScope.Global,
|
|
566
|
+
AXPPlatformScope.Tenant,
|
|
567
|
+
AXPPlatformScope.User,
|
|
568
|
+
];
|
|
569
|
+
staticScopes.forEach((scope) => {
|
|
570
|
+
if (!this.scopedSettingsCache.has(scope)) {
|
|
571
|
+
this.scopedSettingsCache.set(scope, new Map());
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
// Listen for setting changes from other tabs
|
|
575
|
+
this.eventService.listen('AXPSettingChangedEvent').subscribe((event) => {
|
|
576
|
+
const data = event.data;
|
|
577
|
+
data.keys.forEach((key) => {
|
|
578
|
+
this.scopedSettingsCache.get(data.scope)?.set(key, data.values[key]);
|
|
579
|
+
});
|
|
580
|
+
this.onChanged.next(data); // Notify subscribers in the current tab
|
|
581
|
+
});
|
|
654
582
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
providers
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
583
|
+
async load() {
|
|
584
|
+
try {
|
|
585
|
+
const settingsList = [];
|
|
586
|
+
for (const provider of this.providers) {
|
|
587
|
+
const scopeCache = this.scopedSettingsCache.get(provider.scope);
|
|
588
|
+
const providerSettings = await provider.load();
|
|
589
|
+
providerSettings.forEach((setting) => {
|
|
590
|
+
scopeCache.set(setting.key, setting.value);
|
|
591
|
+
});
|
|
592
|
+
settingsList.push(...providerSettings);
|
|
593
|
+
}
|
|
594
|
+
return settingsList;
|
|
595
|
+
}
|
|
596
|
+
catch (error) {
|
|
597
|
+
console.error('Error loading settings', error);
|
|
598
|
+
throw error;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
async get(key) {
|
|
602
|
+
if (this.scopedSettingsCache.size === 0) {
|
|
603
|
+
await this.load();
|
|
604
|
+
}
|
|
605
|
+
const scopeOrder = [
|
|
606
|
+
AXPPlatformScope.User,
|
|
607
|
+
AXPPlatformScope.Tenant,
|
|
608
|
+
AXPPlatformScope.Global,
|
|
609
|
+
AXPPlatformScope.Environment,
|
|
610
|
+
];
|
|
611
|
+
for (const scope of scopeOrder) {
|
|
612
|
+
const scopeCache = this.scopedSettingsCache.get(scope);
|
|
613
|
+
if (scopeCache && scopeCache.has(key)) {
|
|
614
|
+
const value = scopeCache.get(key);
|
|
615
|
+
if (value !== undefined && value !== null) {
|
|
616
|
+
return cloneDeep(value);
|
|
672
617
|
}
|
|
673
|
-
|
|
674
|
-
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const definitionService = this.injector.get(AXPSettingDefinitionProviderService);
|
|
621
|
+
const defaults = await definitionService.defaultValues();
|
|
622
|
+
return get(defaults, key); // Fallback if no value is found
|
|
675
623
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
624
|
+
async defaultValues(scope) {
|
|
625
|
+
let scopeOrder = [
|
|
626
|
+
AXPPlatformScope.Environment,
|
|
627
|
+
AXPPlatformScope.Global,
|
|
628
|
+
AXPPlatformScope.Tenant,
|
|
629
|
+
AXPPlatformScope.User,
|
|
630
|
+
].reverse();
|
|
631
|
+
const scopeIndex = scopeOrder.indexOf(scope);
|
|
632
|
+
if (scopeIndex === -1) {
|
|
633
|
+
throw new Error(`Invalid scope: ${scope}`);
|
|
634
|
+
}
|
|
635
|
+
scopeOrder = scopeOrder.slice(scopeIndex + 1);
|
|
636
|
+
// Accumulate defaults from the current scope and higher scopes
|
|
637
|
+
const accumulatedDefaults = {};
|
|
638
|
+
for (let i = scopeIndex; i < scopeOrder.length; i++) {
|
|
639
|
+
const currentScope = scopeOrder[i];
|
|
640
|
+
const scopeCache = this.scopedSettingsCache.get(currentScope);
|
|
641
|
+
if (scopeCache) {
|
|
642
|
+
scopeCache.forEach((value, key) => {
|
|
643
|
+
if (!(key in accumulatedDefaults)) {
|
|
644
|
+
accumulatedDefaults[key] = value;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// Merge with global default values from the definition service
|
|
650
|
+
const definitionService = this.injector.get(AXPSettingDefinitionProviderService);
|
|
651
|
+
const globalDefaults = await definitionService.defaultValues();
|
|
652
|
+
return { ...globalDefaults, ...accumulatedDefaults };
|
|
683
653
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
654
|
+
scope(scope) {
|
|
655
|
+
const provider = this.providers.find((p) => p.scope === scope);
|
|
656
|
+
if (!provider) {
|
|
657
|
+
throw new Error(`No provider found for scope: ${scope}`);
|
|
658
|
+
}
|
|
659
|
+
return new ScopedSettingService(this, provider, this.scopedSettingsCache.get(scope));
|
|
660
|
+
}
|
|
661
|
+
invokeChangeEvent(event) {
|
|
662
|
+
this.onChanged.next(event);
|
|
663
|
+
this.eventService.publish("AXPSettingChangedEvent", event);
|
|
664
|
+
}
|
|
665
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
666
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingService, providedIn: 'root' }); }
|
|
687
667
|
}
|
|
688
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
689
|
-
type:
|
|
668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingService, decorators: [{
|
|
669
|
+
type: Injectable,
|
|
690
670
|
args: [{
|
|
691
|
-
|
|
692
|
-
exports: [AXPComponentSlotDirective]
|
|
671
|
+
providedIn: 'root',
|
|
693
672
|
}]
|
|
694
|
-
}], ctorParameters: () => [
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
class AXPTextLogoConfig {
|
|
702
|
-
constructor(text) {
|
|
703
|
-
this.text = text;
|
|
673
|
+
}], ctorParameters: () => [] });
|
|
674
|
+
class ScopedSettingService {
|
|
675
|
+
constructor(parent, provider, scopeCache) {
|
|
676
|
+
this.parent = parent;
|
|
677
|
+
this.provider = provider;
|
|
678
|
+
this.scopeCache = scopeCache;
|
|
704
679
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
680
|
+
async get(key) {
|
|
681
|
+
const settings = await this.provider.load();
|
|
682
|
+
const setting = settings.find((s) => s.key === key);
|
|
683
|
+
return setting ? cloneDeep(setting.value) : undefined;
|
|
709
684
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
this.iconClass = iconClass;
|
|
685
|
+
async all() {
|
|
686
|
+
const settings = await this.provider.load();
|
|
687
|
+
return Object.fromEntries(settings.map((s) => [s.key, cloneDeep(s.value)]));
|
|
714
688
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
constructor(component) {
|
|
718
|
-
this.component = component;
|
|
689
|
+
async defaultValues() {
|
|
690
|
+
return this.parent.defaultValues(this.provider.scope);
|
|
719
691
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
this.
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
692
|
+
async set(keyOrValues, value) {
|
|
693
|
+
if (typeof keyOrValues === 'string') {
|
|
694
|
+
// Single key-value pair
|
|
695
|
+
await this.provider.set(keyOrValues, value);
|
|
696
|
+
this.scopeCache.set(keyOrValues, value); // Sync the cache
|
|
697
|
+
this.parent.invokeChangeEvent({
|
|
698
|
+
scope: this.provider.scope,
|
|
699
|
+
keys: [keyOrValues],
|
|
700
|
+
values: { [keyOrValues]: value },
|
|
701
|
+
entries: [{ key: keyOrValues, value }],
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
// Multiple key-value pairs
|
|
706
|
+
await this.provider.set(keyOrValues);
|
|
707
|
+
Object.entries(keyOrValues).forEach(([key, val]) => this.scopeCache.set(key, val)); // Sync the cache
|
|
708
|
+
const entries = Object.entries(keyOrValues).map(([key, val]) => ({ key, value: val }));
|
|
709
|
+
this.parent.invokeChangeEvent({
|
|
710
|
+
scope: this.provider.scope,
|
|
711
|
+
keys: Object.keys(keyOrValues),
|
|
712
|
+
values: keyOrValues,
|
|
713
|
+
entries,
|
|
714
|
+
});
|
|
739
715
|
}
|
|
740
716
|
}
|
|
741
|
-
|
|
742
|
-
|
|
717
|
+
async update(key, updateFn) {
|
|
718
|
+
const currentValue = await this.get(key);
|
|
719
|
+
const newValue = updateFn(currentValue);
|
|
720
|
+
await this.set(key, newValue);
|
|
721
|
+
}
|
|
743
722
|
}
|
|
744
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLogoComponent, decorators: [{
|
|
745
|
-
type: Component,
|
|
746
|
-
args: [{ selector: 'axp-logo', imports: [CommonModule, AXImageModule, AXDecoratorModule], host: { 'class': 'ax-flex ax-justify-center' }, template: "@switch (logoType) {\n@case ('text') {\n<span class=\"ax-font-bold ax-select-none\">{{ source.text }}</span>\n}\n@case ('url') {\n<ax-image [src]=\"source.url\"></ax-image>\n} @case ('iconClass') {\n<ax-icon class=\"{{ source.classIcon }}\"></ax-icon>\n} @case ('component') {\n<ng-container *ngComponentOutlet=\"source.component\"></ng-container>\n}\n}" }]
|
|
747
|
-
}], propDecorators: { source: [{
|
|
748
|
-
type: Input
|
|
749
|
-
}] } });
|
|
750
723
|
|
|
751
|
-
|
|
752
|
-
|
|
724
|
+
var AXPHomePageSettings;
|
|
725
|
+
(function (AXPHomePageSettings) {
|
|
726
|
+
AXPHomePageSettings["UserHomePath"] = "general:startup:home-page";
|
|
727
|
+
})(AXPHomePageSettings || (AXPHomePageSettings = {}));
|
|
728
|
+
|
|
729
|
+
class AXPHomePageService {
|
|
730
|
+
get flatCandidates() {
|
|
731
|
+
return this.candidates.flatMap((c) => c);
|
|
732
|
+
}
|
|
753
733
|
constructor() {
|
|
754
|
-
this.
|
|
755
|
-
this.
|
|
756
|
-
this.
|
|
757
|
-
this.
|
|
758
|
-
this.
|
|
759
|
-
|
|
734
|
+
this.defaultHomePageKey = inject(AXP_HOME_PAGE_DEFAULT_KEY, { optional: true }) ?? 'home';
|
|
735
|
+
this.userHomePageKey = null;
|
|
736
|
+
this.candidates = inject(AXP_HOME_PAGES, { optional: true }) ?? [];
|
|
737
|
+
this.settingsService = inject(AXPSettingService);
|
|
738
|
+
this.sessionService = inject(AXPSessionService);
|
|
739
|
+
// remove circular dependency
|
|
740
|
+
setTimeout(async () => {
|
|
741
|
+
await this.init();
|
|
742
|
+
});
|
|
760
743
|
}
|
|
761
|
-
async
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (Array.isArray(this.providers)) {
|
|
769
|
-
for (const provider of this.providers) {
|
|
770
|
-
await provider.provide(context);
|
|
744
|
+
async init() {
|
|
745
|
+
await this.load();
|
|
746
|
+
//
|
|
747
|
+
const keys = [AXPHomePageSettings.UserHomePath];
|
|
748
|
+
this.settingsService.onChanged.subscribe(async (c) => {
|
|
749
|
+
if (keys.some((k) => c.keys.includes(k))) {
|
|
750
|
+
await this.load();
|
|
771
751
|
}
|
|
772
|
-
}
|
|
773
|
-
//
|
|
774
|
-
this.
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
// ADD level property to items
|
|
778
|
-
setMenuItemMeta(items);
|
|
779
|
-
// Cache the computed items
|
|
780
|
-
this.cache = items;
|
|
781
|
-
return items;
|
|
752
|
+
});
|
|
753
|
+
//
|
|
754
|
+
merge$1(this.sessionService.status$, this.sessionService.application$, this.sessionService.tenant$).subscribe(async () => {
|
|
755
|
+
await this.load();
|
|
756
|
+
});
|
|
782
757
|
}
|
|
783
|
-
|
|
758
|
+
async load() {
|
|
759
|
+
this.userHomePageKey = await this.settingsService.get(AXPHomePageSettings.UserHomePath);
|
|
760
|
+
}
|
|
761
|
+
getRegisteredList() {
|
|
762
|
+
return this.flatCandidates.filter((c) => c.route);
|
|
763
|
+
}
|
|
764
|
+
getRegisteredRoutes() {
|
|
765
|
+
const defaultHomePage = this.flatCandidates.find((c) => c.key === this.defaultHomePageKey);
|
|
766
|
+
const home = this.flatCandidates.find((c) => this.userHomePageKey && c.key === this.userHomePageKey) ?? defaultHomePage;
|
|
767
|
+
if (home && home.route) {
|
|
768
|
+
const fullPath = this.findPath(home.route);
|
|
769
|
+
return [
|
|
770
|
+
{ path: '', redirectTo: fullPath, pathMatch: 'full' },
|
|
771
|
+
{ path: ':app', redirectTo: fullPath, pathMatch: 'full' },
|
|
772
|
+
{ ...home?.route, ...{ data: { key: home?.key, title: home?.title, path: fullPath } } },
|
|
773
|
+
];
|
|
774
|
+
}
|
|
775
|
+
return [];
|
|
776
|
+
}
|
|
777
|
+
getCurrent() {
|
|
778
|
+
const key = this.userHomePageKey ?? this.defaultHomePageKey;
|
|
779
|
+
const homePage = this.getRegisteredRoutes().find((c) => c.data?.['key'] === key);
|
|
784
780
|
return {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
},
|
|
788
|
-
find: (target) => {
|
|
789
|
-
return {
|
|
790
|
-
insert: (newItems, position) => {
|
|
791
|
-
this.pendingInserts.push({ target, newItems, position });
|
|
792
|
-
},
|
|
793
|
-
remove: () => {
|
|
794
|
-
this.pendingRemovals.push(target);
|
|
795
|
-
},
|
|
796
|
-
update: (updatedItem) => {
|
|
797
|
-
this.pendingUpdates.push({ target, updatedItem });
|
|
798
|
-
},
|
|
799
|
-
addItems: (newItems) => {
|
|
800
|
-
this.pendingAdditions.push({ target, newItems });
|
|
801
|
-
}
|
|
802
|
-
};
|
|
803
|
-
}
|
|
781
|
+
path: homePage.data?.['path'],
|
|
782
|
+
title: homePage.data?.['title'],
|
|
804
783
|
};
|
|
805
784
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
console.warn(`Target "${target}" not found, appending items.`);
|
|
812
|
-
items.push(...newItems);
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
if (position == 'inside') {
|
|
816
|
-
foundItem.children?.push(...newItems);
|
|
817
|
-
}
|
|
818
|
-
else {
|
|
819
|
-
const index = parentItems.indexOf(foundItem);
|
|
820
|
-
const insertPosition = position === 'before' ? index : index + 1;
|
|
821
|
-
parentItems.splice(insertPosition, 0, ...newItems);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
for (const target of this.pendingRemovals) {
|
|
826
|
-
const foundItemInfo = this.findItemWithParent(items, target);
|
|
827
|
-
const { foundItem, parentItems } = foundItemInfo;
|
|
828
|
-
if (!foundItem) {
|
|
829
|
-
console.warn(`Target "${target}" not found, nothing to remove.`);
|
|
830
|
-
}
|
|
831
|
-
else {
|
|
832
|
-
const index = parentItems.indexOf(foundItem);
|
|
833
|
-
parentItems.splice(index, 1);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
for (const { target, updatedItem } of this.pendingUpdates) {
|
|
837
|
-
const foundItemInfo = this.findItemWithParent(items, target);
|
|
838
|
-
const { foundItem } = foundItemInfo;
|
|
839
|
-
if (!foundItem) {
|
|
840
|
-
console.warn(`Target "${target}" not found, nothing to update.`);
|
|
841
|
-
}
|
|
842
|
-
else {
|
|
843
|
-
Object.assign(foundItem, updatedItem);
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
for (const { target, newItems } of this.pendingAdditions) {
|
|
847
|
-
const foundItemInfo = this.findItemWithParent(items, target);
|
|
848
|
-
const { foundItem } = foundItemInfo;
|
|
849
|
-
if (!foundItem) {
|
|
850
|
-
console.warn(`Target "${target}" not found, nothing to add items to.`);
|
|
851
|
-
}
|
|
852
|
-
else {
|
|
853
|
-
if (!foundItem.children) {
|
|
854
|
-
foundItem.children = [];
|
|
855
|
-
}
|
|
856
|
-
foundItem.children.push(...newItems);
|
|
857
|
-
}
|
|
785
|
+
findPath(target) {
|
|
786
|
+
const rawPath = this.buildFullPaths(target).join('/');
|
|
787
|
+
const appName = this.sessionService.application?.name;
|
|
788
|
+
if (appName) {
|
|
789
|
+
return rawPath.replace(':app', appName);
|
|
858
790
|
}
|
|
859
|
-
|
|
860
|
-
this.pendingInserts = [];
|
|
861
|
-
this.pendingRemovals = [];
|
|
862
|
-
this.pendingUpdates = [];
|
|
863
|
-
this.pendingAdditions = [];
|
|
791
|
+
return rawPath;
|
|
864
792
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
}
|
|
870
|
-
if (item.children) {
|
|
871
|
-
const result = this.findItemWithParent(item.children, target, item.children);
|
|
872
|
-
if (result.foundItem) {
|
|
873
|
-
return result;
|
|
874
|
-
}
|
|
875
|
-
}
|
|
793
|
+
buildFullPaths(route, parentPath = []) {
|
|
794
|
+
const segments = [...parentPath];
|
|
795
|
+
if (route.path) {
|
|
796
|
+
segments.push(route.path);
|
|
876
797
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
this.pendingInserts = [];
|
|
883
|
-
this.pendingRemovals = [];
|
|
884
|
-
this.pendingUpdates = [];
|
|
885
|
-
this.pendingAdditions = [];
|
|
798
|
+
// Recursively search the first matched child (deepest first match)
|
|
799
|
+
if (route.children?.length) {
|
|
800
|
+
return this.buildFullPaths(route.children[0], segments);
|
|
801
|
+
}
|
|
802
|
+
return segments;
|
|
886
803
|
}
|
|
887
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
888
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
804
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
805
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageService, providedIn: 'root' }); }
|
|
889
806
|
}
|
|
890
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
807
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageService, decorators: [{
|
|
891
808
|
type: Injectable,
|
|
892
|
-
args: [{
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
809
|
+
args: [{
|
|
810
|
+
providedIn: 'root',
|
|
811
|
+
}]
|
|
812
|
+
}], ctorParameters: () => [] });
|
|
813
|
+
|
|
814
|
+
function dynamicRoutesFactory() {
|
|
815
|
+
const service = inject(AXPHomePageService);
|
|
816
|
+
return service.getRegisteredRoutes();
|
|
817
|
+
}
|
|
818
|
+
function provideDynamicHomePage() {
|
|
819
|
+
return makeEnvironmentProviders([
|
|
820
|
+
{
|
|
821
|
+
provide: ROUTES,
|
|
822
|
+
useFactory: dynamicRoutesFactory,
|
|
823
|
+
multi: true
|
|
906
824
|
}
|
|
907
|
-
|
|
825
|
+
]);
|
|
908
826
|
}
|
|
909
827
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
// Methods for State Management
|
|
922
|
-
withMethods((store, router = inject(Router), workflow = inject(AXPWorkflowService)) => {
|
|
923
|
-
return {
|
|
924
|
-
setMenuItems(items) {
|
|
925
|
-
patchState(store, { items: items });
|
|
926
|
-
},
|
|
927
|
-
selectMenuItemByRoute(path) {
|
|
928
|
-
const findItem = (items) => {
|
|
929
|
-
for (const item of items) {
|
|
930
|
-
// Recursively search children first
|
|
931
|
-
if (item.children) {
|
|
932
|
-
const foundChild = findItem(item.children);
|
|
933
|
-
if (foundChild.item) {
|
|
934
|
-
return foundChild;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
if (item.path) {
|
|
938
|
-
// Check if the item path matches the current path
|
|
939
|
-
const matchResult = pathsMatch(item.path, path, ["list", "view", "edit", "create"]);
|
|
940
|
-
if (matchResult.isMatch) {
|
|
941
|
-
return { item, isPartialMatch: matchResult.isPartial };
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
return { item: null, isPartialMatch: false };
|
|
946
|
-
};
|
|
947
|
-
const pathsMatch = (itemPath, currentPath, trailingSegmentsToIgnore = []) => {
|
|
948
|
-
const itemSegments = itemPath.split('/').filter(segment => segment.length > 0);
|
|
949
|
-
const pathSegments = currentPath.split('/').filter(segment => segment.length > 0);
|
|
950
|
-
const menuLength = itemSegments.length;
|
|
951
|
-
const pathLength = pathSegments.length;
|
|
952
|
-
// Identify the effective base length for the menuPath
|
|
953
|
-
let effectiveMenuLength = menuLength;
|
|
954
|
-
if (menuLength > 0 &&
|
|
955
|
-
trailingSegmentsToIgnore.includes(itemSegments[menuLength - 1])) {
|
|
956
|
-
effectiveMenuLength--; // Exclude trailing non-hierarchical segments
|
|
957
|
-
}
|
|
958
|
-
// Check if the menuPath (base segments) is a prefix of browserPath
|
|
959
|
-
let isPrefix = true;
|
|
960
|
-
for (let i = 0; i < effectiveMenuLength; i++) {
|
|
961
|
-
if (itemSegments[i] !== pathSegments[i]) {
|
|
962
|
-
isPrefix = false;
|
|
963
|
-
break;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
// Partial match: menuPath base is a strict prefix of browserPath
|
|
967
|
-
const isPartialMatch = isPrefix && effectiveMenuLength < pathLength;
|
|
968
|
-
// Exact match: all segments match completely
|
|
969
|
-
const isExactMatch = isPrefix && effectiveMenuLength === pathLength;
|
|
970
|
-
return {
|
|
971
|
-
isMatch: isExactMatch || isPartialMatch,
|
|
972
|
-
isPartial: isPartialMatch && !isExactMatch,
|
|
973
|
-
};
|
|
974
|
-
};
|
|
975
|
-
const items = store.items();
|
|
976
|
-
const { item, isPartialMatch } = findItem(items);
|
|
977
|
-
patchState(store, { selectedMenuItem: { item, isFullMatch: !isPartialMatch } });
|
|
978
|
-
},
|
|
979
|
-
executeCommand(item) {
|
|
980
|
-
if (item.path) {
|
|
981
|
-
workflow.execute('navigate', { type: 'router', options: { path: item.path } });
|
|
982
|
-
patchState(store, { selectedMenuItem: { item, isFullMatch: true } });
|
|
983
|
-
}
|
|
984
|
-
if (item.command) {
|
|
985
|
-
const command = item.command;
|
|
986
|
-
workflow.execute(command.name, command.options);
|
|
987
|
-
}
|
|
988
|
-
},
|
|
989
|
-
isItemOpen(item) {
|
|
990
|
-
const selectedItem = store.selectedMenuItem();
|
|
991
|
-
if (!selectedItem) {
|
|
992
|
-
return false;
|
|
993
|
-
}
|
|
994
|
-
const findParent = (currentItem, targetItem) => {
|
|
995
|
-
if (currentItem.children?.includes(targetItem)) {
|
|
996
|
-
return true;
|
|
997
|
-
}
|
|
998
|
-
return currentItem.children?.some(child => findParent(child, targetItem)) ?? false;
|
|
999
|
-
};
|
|
1000
|
-
return item === selectedItem?.item || findParent(item, selectedItem.item);
|
|
828
|
+
class AXPHomePageSettingProvider {
|
|
829
|
+
constructor(injector) {
|
|
830
|
+
this.injector = injector;
|
|
831
|
+
this.translateService = this.injector.get(AXTranslationService);
|
|
832
|
+
this.homePageService = this.injector.get(AXPHomePageService);
|
|
833
|
+
}
|
|
834
|
+
async provide(context) {
|
|
835
|
+
const trans = async (key) => await this.translateService.translateAsync(`settings.${key}`, { scope: 'general' });
|
|
836
|
+
const list = await this.homePageService.getRegisteredList().map((c) => ({ id: c.key, title: c.title }));
|
|
837
|
+
if (list.length === 0) {
|
|
838
|
+
return;
|
|
1001
839
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
840
|
+
// Define the 'General Settings' group
|
|
841
|
+
context
|
|
842
|
+
.addGroup('general', await trans('general.title'), await trans('general.description'), 'fa-light fa-palette')
|
|
843
|
+
// Add the 'Startup' section
|
|
844
|
+
.addSection('startup', await trans('general.startup.title'), await trans('general.startup.description'))
|
|
845
|
+
// Add the 'Home Page' setting
|
|
846
|
+
.addSetting({
|
|
847
|
+
key: AXPHomePageSettings.UserHomePath,
|
|
848
|
+
title: await trans('general.startup.home-page.title'),
|
|
849
|
+
scope: AXPPlatformScope.User,
|
|
850
|
+
isInherited: true,
|
|
851
|
+
defaultValue: list[0].id,
|
|
852
|
+
valueTransforms: objectKeyValueTransforms('id'),
|
|
853
|
+
widget: {
|
|
854
|
+
type: AXPWidgetsCatalog.select,
|
|
855
|
+
options: {
|
|
856
|
+
valueField: 'id',
|
|
857
|
+
textField: 'title',
|
|
858
|
+
dataSource: list,
|
|
859
|
+
},
|
|
860
|
+
},
|
|
861
|
+
description: await trans('general.startup.home-page.description'),
|
|
862
|
+
})
|
|
863
|
+
// End the 'Startup' section
|
|
864
|
+
.endSection()
|
|
865
|
+
// End the 'General Settings' group
|
|
866
|
+
.endGroup();
|
|
867
|
+
}
|
|
868
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageSettingProvider, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
869
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageSettingProvider }); }
|
|
870
|
+
}
|
|
871
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageSettingProvider, decorators: [{
|
|
872
|
+
type: Injectable
|
|
873
|
+
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
1013
874
|
|
|
1014
|
-
class
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
875
|
+
class AXPHomePageModule {
|
|
876
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
877
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageModule }); }
|
|
878
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageModule, providers: [
|
|
879
|
+
{
|
|
880
|
+
provide: AXP_SETTING_DEFINITION_PROVIDER,
|
|
881
|
+
useClass: AXPHomePageSettingProvider,
|
|
882
|
+
multi: true,
|
|
1019
883
|
},
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
884
|
+
] }); }
|
|
885
|
+
}
|
|
886
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPHomePageModule, decorators: [{
|
|
887
|
+
type: NgModule,
|
|
888
|
+
args: [{
|
|
889
|
+
imports: [],
|
|
890
|
+
providers: [
|
|
891
|
+
{
|
|
892
|
+
provide: AXP_SETTING_DEFINITION_PROVIDER,
|
|
893
|
+
useClass: AXPHomePageSettingProvider,
|
|
894
|
+
multi: true,
|
|
895
|
+
},
|
|
896
|
+
],
|
|
897
|
+
}]
|
|
898
|
+
}] });
|
|
899
|
+
|
|
900
|
+
class AXPDataProvider {
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
class AXPCustomOperatorService {
|
|
904
|
+
}
|
|
905
|
+
class AXPCustomOperatorServiceImpl extends AXPCustomOperatorService {
|
|
906
|
+
getCustomOperators() {
|
|
907
|
+
return {};
|
|
1028
908
|
}
|
|
909
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCustomOperatorServiceImpl, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
910
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCustomOperatorServiceImpl }); }
|
|
1029
911
|
}
|
|
912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCustomOperatorServiceImpl, decorators: [{
|
|
913
|
+
type: Injectable
|
|
914
|
+
}] });
|
|
1030
915
|
|
|
1031
|
-
class
|
|
916
|
+
class AXPFilterOperatorMiddlewareService {
|
|
917
|
+
}
|
|
918
|
+
class AXPFilterOperatorMiddlewareServiceImpl extends AXPFilterOperatorMiddlewareService {
|
|
1032
919
|
constructor() {
|
|
1033
|
-
|
|
1034
|
-
this.
|
|
920
|
+
super(...arguments);
|
|
921
|
+
this.customOperatorService = inject(AXPCustomOperatorService);
|
|
922
|
+
this.operators = {
|
|
923
|
+
...this.getDefaultOperators(),
|
|
924
|
+
...this.customOperatorService.getCustomOperators(),
|
|
925
|
+
};
|
|
1035
926
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
return sortBy(menuItems.map((item) => ({
|
|
1039
|
-
group: 'menu', // Use `name` or empty string if undefined
|
|
1040
|
-
title: item.text, // Use `text` for the `title`
|
|
1041
|
-
icon: item.icon, // Include the `icon` if present
|
|
1042
|
-
data: omit(item, ['parent', 'children']), // Include all data except `parent` and `children`
|
|
1043
|
-
command: item.path ? {
|
|
1044
|
-
name: 'navigate',
|
|
1045
|
-
options: {
|
|
1046
|
-
type: 'router',
|
|
1047
|
-
options: {
|
|
1048
|
-
path: item.path,
|
|
1049
|
-
},
|
|
1050
|
-
}
|
|
1051
|
-
} : item.command,
|
|
1052
|
-
parent: item.parent
|
|
1053
|
-
? {
|
|
1054
|
-
title: item.parent.text,
|
|
1055
|
-
}
|
|
1056
|
-
: undefined,
|
|
1057
|
-
})), [(o) => this.translateService.translateSync(o.title)]);
|
|
927
|
+
transformFilters(filters) {
|
|
928
|
+
return filters.map((filter) => this.transformFilter(filter));
|
|
1058
929
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
930
|
+
transformFilter(filter) {
|
|
931
|
+
const { operator, value, filters, field } = filter;
|
|
932
|
+
// Find the operator (either default or custom)
|
|
933
|
+
const filterOperator = this.operators[operator?.type ?? ''] || null;
|
|
934
|
+
// Start by transforming the filter itself
|
|
935
|
+
const transformedFilter = {
|
|
936
|
+
...filter, // Keep the original filter structure
|
|
937
|
+
operator: filterOperator ? filterOperator : operator, // Add operator name
|
|
938
|
+
};
|
|
939
|
+
// If the filter contains nested filters, recursively transform them
|
|
940
|
+
if (filters && filters.length > 0) {
|
|
941
|
+
transformedFilter.filters = this.transformFilters(filters); // Recursively transform nested filters
|
|
942
|
+
}
|
|
943
|
+
return transformedFilter;
|
|
944
|
+
}
|
|
945
|
+
getOperator(key) {
|
|
946
|
+
return this.operators[key];
|
|
947
|
+
}
|
|
948
|
+
// Helper function to return the default operators
|
|
949
|
+
getDefaultOperators() {
|
|
950
|
+
return ALL_DEFAULT_OPERATORS.reduce((acc, operator) => {
|
|
951
|
+
acc[operator.name] = {
|
|
952
|
+
type: operator.name,
|
|
953
|
+
};
|
|
954
|
+
return acc;
|
|
955
|
+
}, {});
|
|
956
|
+
}
|
|
957
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFilterOperatorMiddlewareServiceImpl, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
958
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFilterOperatorMiddlewareServiceImpl }); }
|
|
959
|
+
}
|
|
960
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFilterOperatorMiddlewareServiceImpl, decorators: [{
|
|
961
|
+
type: Injectable
|
|
962
|
+
}] });
|
|
963
|
+
|
|
964
|
+
class AXPErrorHandlerRegistryService {
|
|
965
|
+
constructor(injector) {
|
|
966
|
+
this.injector = injector;
|
|
967
|
+
this.errorHandlers = [];
|
|
968
|
+
}
|
|
969
|
+
register(...plugins) {
|
|
970
|
+
plugins.forEach(t => {
|
|
971
|
+
const childInjector = Injector.create({ providers: [{ provide: t, useClass: t, deps: [] }], parent: this.injector });
|
|
972
|
+
const handler = childInjector.get(t);
|
|
973
|
+
if (handler) {
|
|
974
|
+
this.errorHandlers.push(handler);
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
get handlers() {
|
|
979
|
+
return this.errorHandlers;
|
|
980
|
+
}
|
|
981
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPErrorHandlerRegistryService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
982
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPErrorHandlerRegistryService, providedIn: 'root' }); }
|
|
983
|
+
}
|
|
984
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPErrorHandlerRegistryService, decorators: [{
|
|
985
|
+
type: Injectable,
|
|
986
|
+
args: [{
|
|
987
|
+
providedIn: 'root'
|
|
988
|
+
}]
|
|
989
|
+
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
990
|
+
|
|
991
|
+
class AXPGlobalErrorHandler extends ErrorHandler {
|
|
992
|
+
constructor(injector, registry) {
|
|
993
|
+
super();
|
|
994
|
+
this.injector = injector;
|
|
995
|
+
this.registry = registry;
|
|
996
|
+
}
|
|
997
|
+
handleError(error) {
|
|
998
|
+
const handleErrorRecursively = (index, error) => {
|
|
999
|
+
const errorHandlers = this.registry.handlers;
|
|
1000
|
+
if (index < errorHandlers.length) {
|
|
1001
|
+
errorHandlers[index].handleError(error, (err) => {
|
|
1002
|
+
handleErrorRecursively(index + 1, err);
|
|
1003
|
+
});
|
|
1074
1004
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
const childResults = await this.searchMenuItems(item.children, searchText);
|
|
1078
|
-
result.push(...childResults.map((x) => ({ ...x, parent: item })));
|
|
1005
|
+
else {
|
|
1006
|
+
super.handleError(error); // Fallback to default handler
|
|
1079
1007
|
}
|
|
1008
|
+
};
|
|
1009
|
+
if (error.message?.startsWith('NG0100')) {
|
|
1010
|
+
//ignore it
|
|
1011
|
+
return;
|
|
1080
1012
|
}
|
|
1081
|
-
|
|
1013
|
+
handleErrorRecursively(0, error);
|
|
1082
1014
|
}
|
|
1015
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGlobalErrorHandler, deps: [{ token: i0.Injector }, { token: AXPErrorHandlerRegistryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1016
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGlobalErrorHandler, providedIn: 'root' }); }
|
|
1083
1017
|
}
|
|
1018
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGlobalErrorHandler, decorators: [{
|
|
1019
|
+
type: Injectable,
|
|
1020
|
+
args: [{ providedIn: 'root' }]
|
|
1021
|
+
}], ctorParameters: () => [{ type: i0.Injector }, { type: AXPErrorHandlerRegistryService }] });
|
|
1084
1022
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
const own = item.badgeKey ? badgeService.getCount(item.badgeKey) : () => 0;
|
|
1091
|
-
const children = item.children?.map(child => this.getTotalCount(child, badgeService)) ?? [];
|
|
1092
|
-
const total = computed(() => own() + children.reduce((sum, s) => sum + s(), 0));
|
|
1093
|
-
this.cache.set(item, total);
|
|
1094
|
-
return total;
|
|
1023
|
+
// src/app/directives/grid-layout.directive.ts
|
|
1024
|
+
class AXPGridLayoutDirective {
|
|
1025
|
+
constructor(el, renderer) {
|
|
1026
|
+
this.el = el;
|
|
1027
|
+
this.renderer = renderer;
|
|
1095
1028
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AXPFooterTextSlotComponent, isStandalone: true, selector: "ng-component", inputs: { text: "text" }, ngImport: i0, template: `
|
|
1101
|
-
<small class="ax-text-sm" [innerHTML]="text"></small>
|
|
1102
|
-
`, isInline: true }); }
|
|
1103
|
-
}
|
|
1104
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFooterTextSlotComponent, decorators: [{
|
|
1105
|
-
type: Component,
|
|
1106
|
-
args: [{
|
|
1107
|
-
template: `
|
|
1108
|
-
<small class="ax-text-sm" [innerHTML]="text"></small>
|
|
1109
|
-
`,
|
|
1110
|
-
standalone: true
|
|
1111
|
-
}]
|
|
1112
|
-
}], propDecorators: { text: [{
|
|
1113
|
-
type: Input
|
|
1114
|
-
}] } });
|
|
1115
|
-
|
|
1116
|
-
class AXPNavBarSlotComponent {
|
|
1117
|
-
handleCommand(action) {
|
|
1118
|
-
// if (action)
|
|
1119
|
-
// this.store.dispatch(action)
|
|
1029
|
+
ngOnChanges(changes) {
|
|
1030
|
+
if (changes['options']) {
|
|
1031
|
+
this.applyTailwindClasses();
|
|
1032
|
+
}
|
|
1120
1033
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1034
|
+
applyTailwindClasses() {
|
|
1035
|
+
if (this.options?.positions == null)
|
|
1036
|
+
return;
|
|
1037
|
+
// Clear existing grid classes
|
|
1038
|
+
this.clearClasses();
|
|
1039
|
+
// Apply new grid classes based on the input options
|
|
1040
|
+
this.setClasses(this.options.positions?.default, '');
|
|
1041
|
+
this.setClasses(this.options.positions?.md, 'md:');
|
|
1042
|
+
this.setClasses(this.options.positions?.lg, 'lg:');
|
|
1043
|
+
this.setClasses(this.options.positions?.xl, 'xl:');
|
|
1044
|
+
this.setClasses(this.options.positions?.xxl, '2xl:');
|
|
1045
|
+
}
|
|
1046
|
+
setClasses(positions, prefix) {
|
|
1047
|
+
if (positions == null)
|
|
1048
|
+
return;
|
|
1049
|
+
const colStart = positions.colStart ? `${prefix}ax-col-start-${positions.colStart}` : '';
|
|
1050
|
+
const colEnd = positions.colEnd ? `${prefix}ax-col-end-${positions.colEnd}` : '';
|
|
1051
|
+
const colSpan = positions.colSpan ? `${prefix}ax-col-span-${positions.colSpan}` : '';
|
|
1052
|
+
const rowStart = positions.rowStart ? `${prefix}ax-row-start-${positions.rowStart}` : '';
|
|
1053
|
+
const rowEnd = positions.rowEnd ? `${prefix}ax-row-end-${positions.rowEnd}` : '';
|
|
1054
|
+
const rowSpan = positions.rowSpan ? `${prefix}ax-row-span-${positions.rowSpan}` : '';
|
|
1055
|
+
const order = positions.order ? `${prefix}ax-order-${positions.order}` : ''; // Handling order
|
|
1056
|
+
[colStart, colEnd, colSpan, rowStart, rowEnd, rowSpan, order].forEach(cls => {
|
|
1057
|
+
if (cls) {
|
|
1058
|
+
this.renderer.addClass(this.el.nativeElement, cls);
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
clearClasses() {
|
|
1063
|
+
const currentClasses = this.el.nativeElement.className.split(' ');
|
|
1064
|
+
currentClasses.forEach((className) => {
|
|
1065
|
+
if (className.startsWith('ax-col-') || className.startsWith('ax-row-') || className.startsWith('ax-order-')) {
|
|
1066
|
+
this.renderer.removeClass(this.el.nativeElement, className);
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGridLayoutDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1071
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXPGridLayoutDirective, isStandalone: true, selector: "[gridLayout]", inputs: { options: ["gridLayout", "options"] }, usesOnChanges: true, ngImport: i0 }); }
|
|
1127
1072
|
}
|
|
1128
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1129
|
-
type:
|
|
1073
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPGridLayoutDirective, decorators: [{
|
|
1074
|
+
type: Directive,
|
|
1130
1075
|
args: [{
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
<a *ngFor="let link of items" (click)="handleCommand(link.command)" >{{ link.text }}</a>
|
|
1134
|
-
</div>
|
|
1135
|
-
`,
|
|
1136
|
-
imports: [CommonModule],
|
|
1137
|
-
encapsulation: ViewEncapsulation.None
|
|
1076
|
+
selector: '[gridLayout]',
|
|
1077
|
+
standalone: true,
|
|
1138
1078
|
}]
|
|
1139
|
-
}], propDecorators: {
|
|
1140
|
-
type: Input
|
|
1079
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { options: [{
|
|
1080
|
+
type: Input,
|
|
1081
|
+
args: ['gridLayout']
|
|
1141
1082
|
}] } });
|
|
1142
1083
|
|
|
1143
|
-
class
|
|
1144
|
-
|
|
1145
|
-
this.
|
|
1146
|
-
this.definitionMap = new Map();
|
|
1084
|
+
class AXPStickyDirective {
|
|
1085
|
+
get isSticky() {
|
|
1086
|
+
return this._isSticky;
|
|
1147
1087
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
icon,
|
|
1154
|
-
order,
|
|
1155
|
-
format: {
|
|
1156
|
-
title: options?.format?.title ?? '{{ title }}',
|
|
1157
|
-
description: options?.format?.description ?? undefined,
|
|
1158
|
-
icon: options?.format?.icon ?? undefined,
|
|
1159
|
-
id: options?.format?.id ?? '{{ id }}',
|
|
1160
|
-
},
|
|
1161
|
-
actions: options?.actions ?? [],
|
|
1162
|
-
};
|
|
1163
|
-
this.definitions.push(definitionSearch);
|
|
1164
|
-
this.definitionMap.set(name, definitionSearch); // Index by name
|
|
1165
|
-
return new AXPSearchDefinitionBuilder(this, definitionSearch);
|
|
1088
|
+
set isSticky(value) {
|
|
1089
|
+
if (this._isSticky !== value) {
|
|
1090
|
+
this._isSticky = value;
|
|
1091
|
+
this.isStickyChange.emit(value);
|
|
1092
|
+
}
|
|
1166
1093
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1094
|
+
constructor(element, renderer, zone, cdr) {
|
|
1095
|
+
this.element = element;
|
|
1096
|
+
this.renderer = renderer;
|
|
1097
|
+
this.zone = zone;
|
|
1098
|
+
this.cdr = cdr;
|
|
1099
|
+
this.stickyOffset = 100;
|
|
1100
|
+
this.isStickyChange = new EventEmitter();
|
|
1101
|
+
this._isSticky = false;
|
|
1102
|
+
this.onParentScroll = () => {
|
|
1103
|
+
this.zone.runOutsideAngular(() => {
|
|
1104
|
+
const scrollTop = this.parentElement === window
|
|
1105
|
+
? window.scrollY
|
|
1106
|
+
: this.parentElement.scrollTop;
|
|
1107
|
+
const shouldStick = scrollTop + this.stickyOffset >= this.topOffset;
|
|
1108
|
+
if (shouldStick !== this.isSticky) {
|
|
1109
|
+
this.zone.run(() => {
|
|
1110
|
+
this.isSticky = shouldStick;
|
|
1111
|
+
this.toggleStickyClasses(shouldStick);
|
|
1112
|
+
this.cdr.markForCheck();
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
};
|
|
1169
1117
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1118
|
+
ngAfterViewInit() {
|
|
1119
|
+
this.initSticky();
|
|
1120
|
+
// Add mutation observer for dynamic content
|
|
1121
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
1122
|
+
this.updateTopOffset();
|
|
1123
|
+
});
|
|
1124
|
+
this.mutationObserver.observe(this.element.nativeElement, {
|
|
1125
|
+
childList: true,
|
|
1126
|
+
subtree: true,
|
|
1127
|
+
});
|
|
1128
|
+
// Add resize event listener
|
|
1129
|
+
window.addEventListener('resize', this.updateTopOffset.bind(this));
|
|
1173
1130
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1131
|
+
initSticky() {
|
|
1132
|
+
if (this.stickyParent instanceof HTMLElement) {
|
|
1133
|
+
this.parentElement = this.stickyParent;
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
this.parentElement =
|
|
1137
|
+
document.querySelector(this.stickyParent) || window;
|
|
1138
|
+
}
|
|
1139
|
+
this.targetElement =
|
|
1140
|
+
document.querySelector(this.stickyTarget) ||
|
|
1141
|
+
this.element.nativeElement;
|
|
1142
|
+
this.updateTopOffset();
|
|
1143
|
+
this.parentElement.addEventListener('scroll', this.onParentScroll);
|
|
1176
1144
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1145
|
+
updateTopOffset() {
|
|
1146
|
+
this.zone.runOutsideAngular(() => {
|
|
1147
|
+
const rect = this.targetElement.getBoundingClientRect();
|
|
1148
|
+
this.topOffset = rect.top + (window.scrollY || 0);
|
|
1149
|
+
});
|
|
1182
1150
|
}
|
|
1183
|
-
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1151
|
+
toggleStickyClasses(isSticky) {
|
|
1152
|
+
const classes = this.stickyClass.split(' ').filter(Boolean);
|
|
1153
|
+
classes.forEach((className) => {
|
|
1154
|
+
if (isSticky) {
|
|
1155
|
+
this.renderer.addClass(this.targetElement, className);
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
this.renderer.removeClass(this.targetElement, className);
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1191
1161
|
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1162
|
+
ngOnDestroy() {
|
|
1163
|
+
this.parentElement.removeEventListener('scroll', this.onParentScroll);
|
|
1164
|
+
window.removeEventListener('resize', this.updateTopOffset.bind(this));
|
|
1165
|
+
if (this.mutationObserver) {
|
|
1166
|
+
this.mutationObserver.disconnect();
|
|
1196
1167
|
}
|
|
1197
|
-
return new AXPSearchDefinitionActionBuilder(this);
|
|
1198
|
-
}
|
|
1199
|
-
endEntity() {
|
|
1200
|
-
return this.context;
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
class AXPSearchDefinitionActionBuilder {
|
|
1204
|
-
constructor(entityBuilder) {
|
|
1205
|
-
this.entityBuilder = entityBuilder;
|
|
1206
|
-
}
|
|
1207
|
-
endAction() {
|
|
1208
|
-
return this.entityBuilder;
|
|
1209
1168
|
}
|
|
1169
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPStickyDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1170
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXPStickyDirective, isStandalone: true, selector: "[axpSticky]", inputs: { stickyClass: ["axpSticky", "stickyClass"], stickyOffset: "stickyOffset", stickyParent: "stickyParent", stickyTarget: "stickyTarget" }, outputs: { isStickyChange: "isStickyChange" }, exportAs: ["axpSticky"], ngImport: i0 }); }
|
|
1210
1171
|
}
|
|
1172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPStickyDirective, decorators: [{
|
|
1173
|
+
type: Directive,
|
|
1174
|
+
args: [{
|
|
1175
|
+
selector: '[axpSticky]',
|
|
1176
|
+
exportAs: 'axpSticky',
|
|
1177
|
+
standalone: true,
|
|
1178
|
+
}]
|
|
1179
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }], propDecorators: { stickyClass: [{
|
|
1180
|
+
type: Input,
|
|
1181
|
+
args: ['axpSticky']
|
|
1182
|
+
}], stickyOffset: [{
|
|
1183
|
+
type: Input,
|
|
1184
|
+
args: ['stickyOffset']
|
|
1185
|
+
}], isStickyChange: [{
|
|
1186
|
+
type: Output
|
|
1187
|
+
}], stickyParent: [{
|
|
1188
|
+
type: Input
|
|
1189
|
+
}], stickyTarget: [{
|
|
1190
|
+
type: Input
|
|
1191
|
+
}] } });
|
|
1211
1192
|
|
|
1212
|
-
|
|
1213
|
-
const AXP_SEARCH_DEFINITION_PROVIDER = new InjectionToken('AXP_SEARCH_DEFINITION_PROVIDER');
|
|
1214
|
-
class AXPSearchDefinitionProviderService {
|
|
1193
|
+
class AXPComponentSlotRegistryService {
|
|
1215
1194
|
constructor() {
|
|
1216
|
-
this.
|
|
1217
|
-
this.cache = null;
|
|
1218
|
-
}
|
|
1219
|
-
async load() {
|
|
1220
|
-
if (this.cache) {
|
|
1221
|
-
return;
|
|
1222
|
-
}
|
|
1223
|
-
const context = new AXPSearchDefinitionProviderContext();
|
|
1224
|
-
if (Array.isArray(this.providers)) {
|
|
1225
|
-
for (const provider of this.providers) {
|
|
1226
|
-
await provider.provide(context);
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
this.cache = context.getDefinitions();
|
|
1230
|
-
}
|
|
1231
|
-
async getListAsync() {
|
|
1232
|
-
await this.load();
|
|
1233
|
-
return this.getList();
|
|
1234
|
-
}
|
|
1235
|
-
getList() {
|
|
1236
|
-
if (!this.cache) {
|
|
1237
|
-
return [];
|
|
1238
|
-
}
|
|
1239
|
-
else {
|
|
1240
|
-
return this.cache;
|
|
1241
|
-
}
|
|
1195
|
+
this.registry = new Map();
|
|
1242
1196
|
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if
|
|
1246
|
-
|
|
1197
|
+
register(slotName, config) {
|
|
1198
|
+
let configs = this.registry.get(slotName) || [];
|
|
1199
|
+
// Check if the component is already registered in this slot
|
|
1200
|
+
const isDuplicate = configs.some(existingConfig => existingConfig.name === config.name);
|
|
1201
|
+
if (!isDuplicate) {
|
|
1202
|
+
configs = [...configs, config]; // Add the new configuration
|
|
1203
|
+
this.registry.set(slotName, configs);
|
|
1247
1204
|
}
|
|
1248
|
-
return definition;
|
|
1249
1205
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
if (!definition) {
|
|
1253
|
-
throw new Error(`Definition with group ${definitionGroup} not found`);
|
|
1254
|
-
}
|
|
1255
|
-
return definition;
|
|
1206
|
+
get(slotName) {
|
|
1207
|
+
return this.registry.get(slotName) || [];
|
|
1256
1208
|
}
|
|
1257
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1258
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1209
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1210
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotRegistryService, providedIn: 'root' }); }
|
|
1259
1211
|
}
|
|
1260
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotRegistryService, decorators: [{
|
|
1261
1213
|
type: Injectable,
|
|
1262
|
-
args: [{
|
|
1214
|
+
args: [{
|
|
1215
|
+
providedIn: 'root'
|
|
1216
|
+
}]
|
|
1263
1217
|
}] });
|
|
1264
1218
|
|
|
1265
|
-
class
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
// Injection token for setting providers
|
|
1272
|
-
const AXP_SEARCH_PROVIDER = new InjectionToken('AXP_SEARCH_PROVIDER');
|
|
1273
|
-
class AXPSearchService {
|
|
1274
|
-
constructor() {
|
|
1275
|
-
this.providers = inject(AXP_SEARCH_PROVIDER, { optional: true });
|
|
1276
|
-
this.definitionService = inject(AXPSearchDefinitionProviderService);
|
|
1277
|
-
this.formatService = inject(AXFormatService);
|
|
1219
|
+
class AXPComponentSlotLoaderService {
|
|
1220
|
+
constructor(registryService, injector) {
|
|
1221
|
+
this.registryService = registryService;
|
|
1222
|
+
this.injector = injector;
|
|
1278
1223
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
if (
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
for (const resultArray of results) {
|
|
1291
|
-
for (const result of resultArray) {
|
|
1292
|
-
try {
|
|
1293
|
-
const definition = this.definitionService.findDefinition(result.group);
|
|
1294
|
-
mergeData.push({
|
|
1295
|
-
definitionName: definition.group,
|
|
1296
|
-
definitionTitle: definition.title,
|
|
1297
|
-
name: result.group,
|
|
1298
|
-
id: `${definition.name}:${this.formatService.format(definition.format.id, 'string', result)}`,
|
|
1299
|
-
title: result.title ??
|
|
1300
|
-
(definition.format.title
|
|
1301
|
-
? this.formatService.format(definition.format.title, 'string', result.data)
|
|
1302
|
-
: 'Unknown'),
|
|
1303
|
-
description: result.description ??
|
|
1304
|
-
(definition.format.description
|
|
1305
|
-
? this.formatService.format(definition.format.description, 'string', result.data)
|
|
1306
|
-
: undefined),
|
|
1307
|
-
icon: result.icon ??
|
|
1308
|
-
(result.icon
|
|
1309
|
-
? this.formatService.format(definition.format.icon, 'string', result.data)
|
|
1310
|
-
: definition.icon),
|
|
1311
|
-
data: result.data,
|
|
1312
|
-
command: result.command,
|
|
1313
|
-
actions: definition.actions,
|
|
1314
|
-
parent: result.parent,
|
|
1315
|
-
order: definition.order,
|
|
1224
|
+
loadComponent(slotName, viewContainerRef) {
|
|
1225
|
+
const configs = sortBy(this.registryService.get(slotName), (c) => c.priority ?? 0);
|
|
1226
|
+
if (configs) {
|
|
1227
|
+
viewContainerRef.clear();
|
|
1228
|
+
configs.forEach(async (config) => {
|
|
1229
|
+
let component;
|
|
1230
|
+
let options = {};
|
|
1231
|
+
if (typeof config.loadComponent === 'function') {
|
|
1232
|
+
// If component is a function
|
|
1233
|
+
runInInjectionContext(this.injector, () => {
|
|
1234
|
+
component = config.loadComponent?.();
|
|
1316
1235
|
});
|
|
1317
1236
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1237
|
+
else if (config.component) {
|
|
1238
|
+
// If component is a Type
|
|
1239
|
+
component = config.component;
|
|
1320
1240
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1241
|
+
//
|
|
1242
|
+
if (typeof config.options === 'function') {
|
|
1243
|
+
// If options is a function
|
|
1244
|
+
runInInjectionContext(this.injector, () => {
|
|
1245
|
+
const fun = config.options;
|
|
1246
|
+
options = fun();
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
else if (config.options) {
|
|
1250
|
+
// If options is a object
|
|
1251
|
+
options = config.options;
|
|
1252
|
+
}
|
|
1253
|
+
//
|
|
1254
|
+
if (component != null) {
|
|
1255
|
+
const componentRef = viewContainerRef.createComponent(component);
|
|
1256
|
+
Object.assign(componentRef.instance, options);
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1339
1259
|
}
|
|
1340
|
-
// Sort groups by order
|
|
1341
|
-
groupedData.sort((a, b) => a.order - b.order);
|
|
1342
|
-
return groupedData;
|
|
1343
1260
|
}
|
|
1344
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1345
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1261
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotLoaderService, deps: [{ token: AXPComponentSlotRegistryService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1262
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotLoaderService, providedIn: 'root' }); }
|
|
1346
1263
|
}
|
|
1347
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotLoaderService, decorators: [{
|
|
1348
1265
|
type: Injectable,
|
|
1349
|
-
args: [{
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
const newGroup = {
|
|
1359
|
-
name,
|
|
1360
|
-
title,
|
|
1361
|
-
description,
|
|
1362
|
-
icon,
|
|
1363
|
-
groups: [],
|
|
1364
|
-
sections: [],
|
|
1365
|
-
};
|
|
1366
|
-
this.rootGroups.push(newGroup);
|
|
1367
|
-
this.groupMap.set(name, newGroup); // Index by name
|
|
1368
|
-
return new AXPSettingDefinitionGroupBuilder(this, newGroup);
|
|
1369
|
-
}
|
|
1370
|
-
group(name) {
|
|
1371
|
-
const foundGroup = this.groupMap.get(name);
|
|
1372
|
-
if (!foundGroup) {
|
|
1373
|
-
throw new Error(`Group with name "${name}" not found.`);
|
|
1374
|
-
}
|
|
1375
|
-
return new AXPSettingDefinitionGroupBuilder(this, foundGroup);
|
|
1376
|
-
}
|
|
1377
|
-
getGroups() {
|
|
1378
|
-
return this.rootGroups;
|
|
1379
|
-
}
|
|
1380
|
-
// Expose groupMap for controlled access
|
|
1381
|
-
hasGroup(name) {
|
|
1382
|
-
return this.groupMap.has(name);
|
|
1266
|
+
args: [{
|
|
1267
|
+
providedIn: 'root',
|
|
1268
|
+
}]
|
|
1269
|
+
}], ctorParameters: () => [{ type: AXPComponentSlotRegistryService }, { type: i0.Injector }] });
|
|
1270
|
+
|
|
1271
|
+
class AXPComponentSlotDirective {
|
|
1272
|
+
constructor(dynamicLoaderService, viewContainerRef) {
|
|
1273
|
+
this.dynamicLoaderService = dynamicLoaderService;
|
|
1274
|
+
this.viewContainerRef = viewContainerRef;
|
|
1383
1275
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1276
|
+
ngOnInit() {
|
|
1277
|
+
this.dynamicLoaderService.loadComponent(this.name, this.viewContainerRef);
|
|
1386
1278
|
}
|
|
1279
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotDirective, deps: [{ token: AXPComponentSlotLoaderService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1280
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXPComponentSlotDirective, isStandalone: false, selector: "axp-component-slot", inputs: { name: "name" }, ngImport: i0 }); }
|
|
1387
1281
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotDirective, decorators: [{
|
|
1283
|
+
type: Directive,
|
|
1284
|
+
args: [{
|
|
1285
|
+
selector: 'axp-component-slot',
|
|
1286
|
+
standalone: false
|
|
1287
|
+
}]
|
|
1288
|
+
}], ctorParameters: () => [{ type: AXPComponentSlotLoaderService }, { type: i0.ViewContainerRef }], propDecorators: { name: [{
|
|
1289
|
+
type: Input
|
|
1290
|
+
}] } });
|
|
1291
|
+
|
|
1292
|
+
class AXPComponentSlotModule {
|
|
1293
|
+
static forRoot(configs) {
|
|
1294
|
+
return {
|
|
1295
|
+
ngModule: AXPComponentSlotModule,
|
|
1296
|
+
providers: [
|
|
1297
|
+
{
|
|
1298
|
+
provide: 'AXPComponentSlotModuleFactory',
|
|
1299
|
+
useFactory: (registry) => () => {
|
|
1300
|
+
if (configs) {
|
|
1301
|
+
for (const [key, value] of Object.entries(configs)) {
|
|
1302
|
+
value.forEach(v => {
|
|
1303
|
+
registry.register(key, v);
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1308
|
+
deps: [AXPComponentSlotRegistryService],
|
|
1309
|
+
multi: true
|
|
1310
|
+
}
|
|
1311
|
+
]
|
|
1399
1312
|
};
|
|
1400
|
-
this.group.sections.push(newSection);
|
|
1401
|
-
return new AXPSettingDefinitionSectionBuilder(this, newSection);
|
|
1402
|
-
}
|
|
1403
|
-
section(name) {
|
|
1404
|
-
const foundSection = this.group.sections.find((section) => section.name === name);
|
|
1405
|
-
if (!foundSection) {
|
|
1406
|
-
throw new Error(`Section with name "${name}" not found in group "${this.group.name}".`);
|
|
1407
|
-
}
|
|
1408
|
-
return new AXPSettingDefinitionSectionBuilder(this, foundSection);
|
|
1409
1313
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1314
|
+
static forChild(configs) {
|
|
1315
|
+
return {
|
|
1316
|
+
ngModule: AXPComponentSlotModule,
|
|
1317
|
+
providers: [
|
|
1318
|
+
{
|
|
1319
|
+
provide: 'AXPComponentSlotModuleFactory',
|
|
1320
|
+
useFactory: (registry) => () => {
|
|
1321
|
+
if (configs) {
|
|
1322
|
+
for (const [key, value] of Object.entries(configs)) {
|
|
1323
|
+
value.forEach(v => {
|
|
1324
|
+
registry.register(key, v);
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
deps: [AXPComponentSlotRegistryService],
|
|
1330
|
+
multi: true
|
|
1331
|
+
}
|
|
1332
|
+
]
|
|
1418
1333
|
};
|
|
1419
|
-
this.group.groups.push(newGroup);
|
|
1420
|
-
if (this.context.hasGroup(name)) {
|
|
1421
|
-
throw new Error(`Group with name "${name}" already exists.`);
|
|
1422
|
-
}
|
|
1423
|
-
this.context['groupMap'].set(name, newGroup);
|
|
1424
|
-
return new AXPSettingDefinitionGroupBuilder(this.context, newGroup);
|
|
1425
1334
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1335
|
+
/**
|
|
1336
|
+
* @ignore
|
|
1337
|
+
*/
|
|
1338
|
+
constructor(instances) {
|
|
1339
|
+
instances?.forEach(f => {
|
|
1340
|
+
f();
|
|
1341
|
+
});
|
|
1428
1342
|
}
|
|
1343
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotModule, deps: [{ token: 'AXPComponentSlotModuleFactory', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1344
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotModule, declarations: [AXPComponentSlotDirective], exports: [AXPComponentSlotDirective] }); }
|
|
1345
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotModule }); }
|
|
1429
1346
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
}
|
|
1462
|
-
endSection() {
|
|
1463
|
-
return this.groupBuilder;
|
|
1347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPComponentSlotModule, decorators: [{
|
|
1348
|
+
type: NgModule,
|
|
1349
|
+
args: [{
|
|
1350
|
+
declarations: [AXPComponentSlotDirective],
|
|
1351
|
+
exports: [AXPComponentSlotDirective]
|
|
1352
|
+
}]
|
|
1353
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1354
|
+
type: Optional
|
|
1355
|
+
}, {
|
|
1356
|
+
type: Inject,
|
|
1357
|
+
args: ['AXPComponentSlotModuleFactory']
|
|
1358
|
+
}] }] });
|
|
1359
|
+
|
|
1360
|
+
class AXPLogoComponent {
|
|
1361
|
+
ngOnInit() {
|
|
1362
|
+
switch (true) {
|
|
1363
|
+
case this.source instanceof AXPTextLogoConfig:
|
|
1364
|
+
this.logoType = 'text';
|
|
1365
|
+
break;
|
|
1366
|
+
case this.source instanceof AXPImageUrlLogoConfig:
|
|
1367
|
+
this.logoType = 'url';
|
|
1368
|
+
break;
|
|
1369
|
+
case this.source instanceof AXPFontIconLogoConfig:
|
|
1370
|
+
this.logoType = 'iconClass';
|
|
1371
|
+
break;
|
|
1372
|
+
case this.source instanceof AXPComponentLogoConfig:
|
|
1373
|
+
this.logoType = 'component';
|
|
1374
|
+
break;
|
|
1375
|
+
default:
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1464
1378
|
}
|
|
1379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLogoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1380
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AXPLogoComponent, isStandalone: true, selector: "axp-logo", inputs: { source: "source" }, host: { classAttribute: "ax-flex ax-justify-center" }, ngImport: i0, template: "@switch (logoType) {\n@case ('text') {\n<span class=\"ax-font-bold ax-select-none\">{{ source.text }}</span>\n}\n@case ('url') {\n<ax-image [src]=\"source.url\"></ax-image>\n} @case ('iconClass') {\n<ax-icon class=\"{{ source.classIcon }}\"></ax-icon>\n} @case ('component') {\n<ng-container *ngComponentOutlet=\"source.component\"></ng-container>\n}\n}", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "ngmodule", type: AXImageModule }, { kind: "component", type: i2.AXImageComponent, selector: "ax-image", inputs: ["overlayMode", "src", "alt", "priority", "lazy"], outputs: ["onLoad", "onError"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i4.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }] }); }
|
|
1465
1381
|
}
|
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPLogoComponent, decorators: [{
|
|
1383
|
+
type: Component,
|
|
1384
|
+
args: [{ selector: 'axp-logo', imports: [CommonModule, AXImageModule, AXDecoratorModule], host: { class: 'ax-flex ax-justify-center' }, template: "@switch (logoType) {\n@case ('text') {\n<span class=\"ax-font-bold ax-select-none\">{{ source.text }}</span>\n}\n@case ('url') {\n<ax-image [src]=\"source.url\"></ax-image>\n} @case ('iconClass') {\n<ax-icon class=\"{{ source.classIcon }}\"></ax-icon>\n} @case ('component') {\n<ng-container *ngComponentOutlet=\"source.component\"></ng-container>\n}\n}" }]
|
|
1385
|
+
}], propDecorators: { source: [{
|
|
1386
|
+
type: Input
|
|
1387
|
+
}] } });
|
|
1466
1388
|
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
class AXPSettingDefinitionProviderService {
|
|
1389
|
+
const AXP_MENU_PROVIDER = new InjectionToken('AXP_MENU_PROVIDER');
|
|
1390
|
+
class AXPMenuProviderService {
|
|
1470
1391
|
constructor() {
|
|
1471
|
-
this.providers = inject(
|
|
1392
|
+
this.providers = inject(AXP_MENU_PROVIDER, { optional: true });
|
|
1472
1393
|
this.cache = null;
|
|
1394
|
+
this.pendingInserts = [];
|
|
1395
|
+
this.pendingRemovals = [];
|
|
1396
|
+
this.pendingUpdates = [];
|
|
1397
|
+
this.pendingAdditions = [];
|
|
1473
1398
|
}
|
|
1474
|
-
async
|
|
1399
|
+
async items() {
|
|
1400
|
+
// Return cached items if available
|
|
1475
1401
|
if (this.cache) {
|
|
1476
|
-
return;
|
|
1402
|
+
return this.cache;
|
|
1403
|
+
}
|
|
1404
|
+
const items = [];
|
|
1405
|
+
const context = this.createMenuProviderContext(items);
|
|
1406
|
+
if (Array.isArray(this.providers)) {
|
|
1407
|
+
for (const provider of this.providers) {
|
|
1408
|
+
await provider.provide(context);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
// Apply pending operations
|
|
1412
|
+
this.applyPendingOperations(items);
|
|
1413
|
+
// Sort items by priority
|
|
1414
|
+
items.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
1415
|
+
// ADD level property to items
|
|
1416
|
+
setMenuItemMeta(items);
|
|
1417
|
+
// Cache the computed items
|
|
1418
|
+
this.cache = items;
|
|
1419
|
+
return items;
|
|
1420
|
+
}
|
|
1421
|
+
createMenuProviderContext(items) {
|
|
1422
|
+
return {
|
|
1423
|
+
addItems: (newItems) => {
|
|
1424
|
+
items.push(...newItems);
|
|
1425
|
+
},
|
|
1426
|
+
find: (target) => {
|
|
1427
|
+
return {
|
|
1428
|
+
insert: (newItems, position) => {
|
|
1429
|
+
this.pendingInserts.push({ target, newItems, position });
|
|
1430
|
+
},
|
|
1431
|
+
remove: () => {
|
|
1432
|
+
this.pendingRemovals.push(target);
|
|
1433
|
+
},
|
|
1434
|
+
update: (updatedItem) => {
|
|
1435
|
+
this.pendingUpdates.push({ target, updatedItem });
|
|
1436
|
+
},
|
|
1437
|
+
addItems: (newItems) => {
|
|
1438
|
+
this.pendingAdditions.push({ target, newItems });
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
applyPendingOperations(items) {
|
|
1445
|
+
for (const { target, newItems, position } of this.pendingInserts) {
|
|
1446
|
+
const foundItemInfo = this.findItemWithParent(items, target);
|
|
1447
|
+
const { foundItem, parentItems } = foundItemInfo;
|
|
1448
|
+
if (!foundItem) {
|
|
1449
|
+
console.warn(`Target "${target}" not found, appending items.`);
|
|
1450
|
+
items.push(...newItems);
|
|
1451
|
+
}
|
|
1452
|
+
else {
|
|
1453
|
+
if (position == 'inside') {
|
|
1454
|
+
foundItem.children?.push(...newItems);
|
|
1455
|
+
}
|
|
1456
|
+
else {
|
|
1457
|
+
const index = parentItems.indexOf(foundItem);
|
|
1458
|
+
const insertPosition = position === 'before' ? index : index + 1;
|
|
1459
|
+
parentItems.splice(insertPosition, 0, ...newItems);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
for (const target of this.pendingRemovals) {
|
|
1464
|
+
const foundItemInfo = this.findItemWithParent(items, target);
|
|
1465
|
+
const { foundItem, parentItems } = foundItemInfo;
|
|
1466
|
+
if (!foundItem) {
|
|
1467
|
+
console.warn(`Target "${target}" not found, nothing to remove.`);
|
|
1468
|
+
}
|
|
1469
|
+
else {
|
|
1470
|
+
const index = parentItems.indexOf(foundItem);
|
|
1471
|
+
parentItems.splice(index, 1);
|
|
1472
|
+
}
|
|
1477
1473
|
}
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1474
|
+
for (const { target, updatedItem } of this.pendingUpdates) {
|
|
1475
|
+
const foundItemInfo = this.findItemWithParent(items, target);
|
|
1476
|
+
const { foundItem } = foundItemInfo;
|
|
1477
|
+
if (!foundItem) {
|
|
1478
|
+
console.warn(`Target "${target}" not found, nothing to update.`);
|
|
1479
|
+
}
|
|
1480
|
+
else {
|
|
1481
|
+
Object.assign(foundItem, updatedItem);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
for (const { target, newItems } of this.pendingAdditions) {
|
|
1485
|
+
const foundItemInfo = this.findItemWithParent(items, target);
|
|
1486
|
+
const { foundItem } = foundItemInfo;
|
|
1487
|
+
if (!foundItem) {
|
|
1488
|
+
console.warn(`Target "${target}" not found, nothing to add items to.`);
|
|
1489
|
+
}
|
|
1490
|
+
else {
|
|
1491
|
+
if (!foundItem.children) {
|
|
1492
|
+
foundItem.children = [];
|
|
1485
1493
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1494
|
+
foundItem.children.push(...newItems);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
// Clear pending operations after applying them
|
|
1498
|
+
this.pendingInserts = [];
|
|
1499
|
+
this.pendingRemovals = [];
|
|
1500
|
+
this.pendingUpdates = [];
|
|
1501
|
+
this.pendingAdditions = [];
|
|
1502
|
+
}
|
|
1503
|
+
findItemWithParent(items, target, parentItems = items) {
|
|
1504
|
+
for (const item of items) {
|
|
1505
|
+
if (item.name === target) {
|
|
1506
|
+
return { foundItem: item, parentItems };
|
|
1507
|
+
}
|
|
1508
|
+
if (item.children) {
|
|
1509
|
+
const result = this.findItemWithParent(item.children, target, item.children);
|
|
1510
|
+
if (result.foundItem) {
|
|
1511
|
+
return result;
|
|
1489
1512
|
}
|
|
1490
1513
|
}
|
|
1491
1514
|
}
|
|
1492
|
-
|
|
1515
|
+
return { foundItem: null, parentItems: items };
|
|
1493
1516
|
}
|
|
1494
|
-
|
|
1517
|
+
// Method to clear the cache, if needed (e.g., when providers change)
|
|
1518
|
+
clearCache() {
|
|
1495
1519
|
this.cache = null;
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
return this.getList(scope);
|
|
1520
|
+
this.pendingInserts = [];
|
|
1521
|
+
this.pendingRemovals = [];
|
|
1522
|
+
this.pendingUpdates = [];
|
|
1523
|
+
this.pendingAdditions = [];
|
|
1501
1524
|
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1525
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPMenuProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1526
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPMenuProviderService, providedIn: 'root' }); }
|
|
1527
|
+
}
|
|
1528
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPMenuProviderService, decorators: [{
|
|
1529
|
+
type: Injectable,
|
|
1530
|
+
args: [{ providedIn: 'root' }]
|
|
1531
|
+
}] });
|
|
1532
|
+
function setMenuItemMeta(items, parentIndex = '', depth = 0) {
|
|
1533
|
+
items.forEach((item, index) => {
|
|
1534
|
+
const currentIndex = parentIndex ? `${parentIndex}-${index}` : `${index}`;
|
|
1535
|
+
const hasChildren = !!(item.children && Array.isArray(item.children) && item.children.length > 0);
|
|
1536
|
+
item.meta = {
|
|
1537
|
+
index: currentIndex,
|
|
1538
|
+
isRoot: depth === 0,
|
|
1539
|
+
hasChildren,
|
|
1540
|
+
depth
|
|
1541
|
+
};
|
|
1542
|
+
if (hasChildren) {
|
|
1543
|
+
setMenuItemMeta(item.children, currentIndex, depth + 1);
|
|
1505
1544
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
const AXPMenuService = signalStore({ providedIn: 'root' },
|
|
1549
|
+
// Initial State
|
|
1550
|
+
withState((router = inject(Router)) => {
|
|
1551
|
+
return {
|
|
1552
|
+
items: [],
|
|
1553
|
+
selectedMenuItem: {
|
|
1554
|
+
item: null,
|
|
1555
|
+
isFullMatch: false
|
|
1556
|
+
},
|
|
1557
|
+
};
|
|
1558
|
+
}),
|
|
1559
|
+
// Methods for State Management
|
|
1560
|
+
withMethods((store, router = inject(Router), workflow = inject(AXPWorkflowService)) => {
|
|
1561
|
+
return {
|
|
1562
|
+
setMenuItems(items) {
|
|
1563
|
+
patchState(store, { items: items });
|
|
1564
|
+
},
|
|
1565
|
+
selectMenuItemByRoute(path) {
|
|
1566
|
+
const findItem = (items) => {
|
|
1567
|
+
for (const item of items) {
|
|
1568
|
+
// Recursively search children first
|
|
1569
|
+
if (item.children) {
|
|
1570
|
+
const foundChild = findItem(item.children);
|
|
1571
|
+
if (foundChild.item) {
|
|
1572
|
+
return foundChild;
|
|
1525
1573
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
.filter((group) => group.sections.length > 0 || group.groups.length > 0); // Keep groups with valid sections or nested groups
|
|
1533
|
-
};
|
|
1534
|
-
return filterByScope(this.cache, scope);
|
|
1535
|
-
}
|
|
1536
|
-
async defaultValues() {
|
|
1537
|
-
const defaults = {};
|
|
1538
|
-
const collectDefaults = (groups) => {
|
|
1539
|
-
groups.forEach((group) => {
|
|
1540
|
-
group.sections.forEach((section) => {
|
|
1541
|
-
section.settings.forEach((setting) => {
|
|
1542
|
-
if (setting.defaultValue !== undefined) {
|
|
1543
|
-
defaults[setting.name] = setting.defaultValue;
|
|
1574
|
+
}
|
|
1575
|
+
if (item.path) {
|
|
1576
|
+
// Check if the item path matches the current path
|
|
1577
|
+
const matchResult = pathsMatch(item.path, path, ["list", "view", "edit", "create"]);
|
|
1578
|
+
if (matchResult.isMatch) {
|
|
1579
|
+
return { item, isPartialMatch: matchResult.isPartial };
|
|
1544
1580
|
}
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
return { item: null, isPartialMatch: false };
|
|
1584
|
+
};
|
|
1585
|
+
const pathsMatch = (itemPath, currentPath, trailingSegmentsToIgnore = []) => {
|
|
1586
|
+
const itemSegments = itemPath.split('/').filter(segment => segment.length > 0);
|
|
1587
|
+
const pathSegments = currentPath.split('/').filter(segment => segment.length > 0);
|
|
1588
|
+
const menuLength = itemSegments.length;
|
|
1589
|
+
const pathLength = pathSegments.length;
|
|
1590
|
+
// Identify the effective base length for the menuPath
|
|
1591
|
+
let effectiveMenuLength = menuLength;
|
|
1592
|
+
if (menuLength > 0 &&
|
|
1593
|
+
trailingSegmentsToIgnore.includes(itemSegments[menuLength - 1])) {
|
|
1594
|
+
effectiveMenuLength--; // Exclude trailing non-hierarchical segments
|
|
1595
|
+
}
|
|
1596
|
+
// Check if the menuPath (base segments) is a prefix of browserPath
|
|
1597
|
+
let isPrefix = true;
|
|
1598
|
+
for (let i = 0; i < effectiveMenuLength; i++) {
|
|
1599
|
+
if (itemSegments[i] !== pathSegments[i]) {
|
|
1600
|
+
isPrefix = false;
|
|
1601
|
+
break;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
// Partial match: menuPath base is a strict prefix of browserPath
|
|
1605
|
+
const isPartialMatch = isPrefix && effectiveMenuLength < pathLength;
|
|
1606
|
+
// Exact match: all segments match completely
|
|
1607
|
+
const isExactMatch = isPrefix && effectiveMenuLength === pathLength;
|
|
1564
1608
|
return {
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
groups: group.groups.length > 0 ? group.groups : null,
|
|
1609
|
+
isMatch: isExactMatch || isPartialMatch,
|
|
1610
|
+
isPartial: isPartialMatch && !isExactMatch,
|
|
1568
1611
|
};
|
|
1612
|
+
};
|
|
1613
|
+
const items = store.items();
|
|
1614
|
+
const { item, isPartialMatch } = findItem(items);
|
|
1615
|
+
patchState(store, { selectedMenuItem: { item, isFullMatch: !isPartialMatch } });
|
|
1616
|
+
},
|
|
1617
|
+
executeCommand(item) {
|
|
1618
|
+
if (item.path) {
|
|
1619
|
+
workflow.execute('navigate', { type: 'router', options: { path: item.path } });
|
|
1620
|
+
patchState(store, { selectedMenuItem: { item, isFullMatch: true } });
|
|
1569
1621
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1622
|
+
if (item.command) {
|
|
1623
|
+
const command = item.command;
|
|
1624
|
+
workflow.execute(command.name, command.options);
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
isItemOpen(item) {
|
|
1628
|
+
const selectedItem = store.selectedMenuItem();
|
|
1629
|
+
if (!selectedItem) {
|
|
1630
|
+
return false;
|
|
1574
1631
|
}
|
|
1632
|
+
const findParent = (currentItem, targetItem) => {
|
|
1633
|
+
if (currentItem.children?.includes(targetItem)) {
|
|
1634
|
+
return true;
|
|
1635
|
+
}
|
|
1636
|
+
return currentItem.children?.some(child => findParent(child, targetItem)) ?? false;
|
|
1637
|
+
};
|
|
1638
|
+
return item === selectedItem?.item || findParent(item, selectedItem.item);
|
|
1575
1639
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1640
|
+
};
|
|
1641
|
+
}), withHooks((store, menuProviderService = inject(AXPMenuProviderService)) => ({
|
|
1642
|
+
onInit() {
|
|
1643
|
+
(async () => {
|
|
1644
|
+
const items = await menuProviderService.items();
|
|
1645
|
+
patchState(store, { items: items });
|
|
1646
|
+
})();
|
|
1647
|
+
},
|
|
1648
|
+
onDestroy() {
|
|
1649
|
+
},
|
|
1650
|
+
})));
|
|
1651
|
+
|
|
1652
|
+
class AXPMenuSearchDefinitionProvider {
|
|
1653
|
+
async provide(context) {
|
|
1654
|
+
context.addDefinition('menu', 'Menu', 'menu', 'fa-thin fa-bars', 2, {
|
|
1655
|
+
format: {
|
|
1656
|
+
id: '{{data.name}}',
|
|
1657
|
+
},
|
|
1658
|
+
actions: [
|
|
1659
|
+
{
|
|
1660
|
+
name: 'navigate',
|
|
1661
|
+
type: 'view',
|
|
1662
|
+
priority: 'primary',
|
|
1663
|
+
},
|
|
1664
|
+
],
|
|
1665
|
+
});
|
|
1582
1666
|
}
|
|
1583
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1584
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, providedIn: 'root' }); }
|
|
1585
1667
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
args: [{ providedIn: 'root' }]
|
|
1589
|
-
}] });
|
|
1590
|
-
class AXPSettingDefaultValueProvider {
|
|
1668
|
+
|
|
1669
|
+
class AXPMenuSearchProvider {
|
|
1591
1670
|
constructor() {
|
|
1592
|
-
this.
|
|
1671
|
+
this.menuService = inject(AXPMenuProviderService);
|
|
1672
|
+
this.translateService = inject(AXTranslationService);
|
|
1593
1673
|
}
|
|
1594
|
-
|
|
1595
|
-
|
|
1674
|
+
async search(text) {
|
|
1675
|
+
const menuItems = await this.searchMenuItems(await this.menuService.items(), text);
|
|
1676
|
+
return sortBy(menuItems.map((item) => ({
|
|
1677
|
+
group: 'menu', // Use `name` or empty string if undefined
|
|
1678
|
+
title: item.text, // Use `text` for the `title`
|
|
1679
|
+
icon: item.icon, // Include the `icon` if present
|
|
1680
|
+
data: omit(item, ['parent', 'children']), // Include all data except `parent` and `children`
|
|
1681
|
+
command: item.path ? {
|
|
1682
|
+
name: 'navigate',
|
|
1683
|
+
options: {
|
|
1684
|
+
type: 'router',
|
|
1685
|
+
options: {
|
|
1686
|
+
path: item.path,
|
|
1687
|
+
},
|
|
1688
|
+
}
|
|
1689
|
+
} : item.command,
|
|
1690
|
+
parent: item.parent
|
|
1691
|
+
? {
|
|
1692
|
+
title: item.parent.text,
|
|
1693
|
+
}
|
|
1694
|
+
: undefined,
|
|
1695
|
+
})), [(o) => this.translateService.translateSync(o.title)]);
|
|
1596
1696
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1697
|
+
/**
|
|
1698
|
+
* Recursively searches AXPMenuItem and its children for a matching text.
|
|
1699
|
+
*
|
|
1700
|
+
* @param menuItems - The array of AXPMenuItem to search in.
|
|
1701
|
+
* @param searchText - The text to search for (case-insensitive).
|
|
1702
|
+
* @returns An array of AXPMenuItem that match the search text.
|
|
1703
|
+
*/
|
|
1704
|
+
async searchMenuItems(menuItems, searchText) {
|
|
1705
|
+
const result = [];
|
|
1706
|
+
for (const item of menuItems) {
|
|
1707
|
+
// Check if the current item's text matches the search text
|
|
1708
|
+
if (item.type != 'group' &&
|
|
1709
|
+
(item.children?.length ?? 0) == 0 &&
|
|
1710
|
+
(await this.translateService.translateAsync(item.text)).toLowerCase().includes(searchText.toLowerCase())) {
|
|
1711
|
+
result.push(item);
|
|
1712
|
+
}
|
|
1713
|
+
// Recursively search in children if they exist
|
|
1714
|
+
if (item.children && item.children.length > 0) {
|
|
1715
|
+
const childResults = await this.searchMenuItems(item.children, searchText);
|
|
1716
|
+
result.push(...childResults.map((x) => ({ ...x, parent: item })));
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
return result;
|
|
1599
1720
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
class AXPMenuBadgeHelper {
|
|
1724
|
+
static { this.cache = new WeakMap(); }
|
|
1725
|
+
static getTotalCount(item, badgeService) {
|
|
1726
|
+
if (this.cache.has(item))
|
|
1727
|
+
return this.cache.get(item);
|
|
1728
|
+
const own = item.badgeKey ? badgeService.getCount(item.badgeKey) : () => 0;
|
|
1729
|
+
const children = item.children?.map(child => this.getTotalCount(child, badgeService)) ?? [];
|
|
1730
|
+
const total = computed(() => own() + children.reduce((sum, s) => sum + s(), 0));
|
|
1731
|
+
this.cache.set(item, total);
|
|
1732
|
+
return total;
|
|
1602
1733
|
}
|
|
1603
1734
|
}
|
|
1604
1735
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1736
|
+
class AXPFooterTextSlotComponent {
|
|
1737
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFooterTextSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1738
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AXPFooterTextSlotComponent, isStandalone: true, selector: "ng-component", inputs: { text: "text" }, ngImport: i0, template: `
|
|
1739
|
+
<small class="ax-text-sm" [innerHTML]="text"></small>
|
|
1740
|
+
`, isInline: true }); }
|
|
1741
|
+
}
|
|
1742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPFooterTextSlotComponent, decorators: [{
|
|
1743
|
+
type: Component,
|
|
1744
|
+
args: [{
|
|
1745
|
+
template: `
|
|
1746
|
+
<small class="ax-text-sm" [innerHTML]="text"></small>
|
|
1747
|
+
`,
|
|
1748
|
+
standalone: true
|
|
1749
|
+
}]
|
|
1750
|
+
}], propDecorators: { text: [{
|
|
1751
|
+
type: Input
|
|
1752
|
+
}] } });
|
|
1753
|
+
|
|
1754
|
+
class AXPNavBarSlotComponent {
|
|
1755
|
+
handleCommand(action) {
|
|
1756
|
+
// if (action)
|
|
1757
|
+
// this.store.dispatch(action)
|
|
1612
1758
|
}
|
|
1613
|
-
});
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1759
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPNavBarSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1760
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AXPNavBarSlotComponent, isStandalone: true, selector: "ng-component", inputs: { items: "items" }, ngImport: i0, template: `
|
|
1761
|
+
<div class="ax-flex ax-items-center ax-justify-between ax-gap-5">
|
|
1762
|
+
<a *ngFor="let link of items" (click)="handleCommand(link.command)" >{{ link.text }}</a>
|
|
1763
|
+
</div>
|
|
1764
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1765
|
+
}
|
|
1766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPNavBarSlotComponent, decorators: [{
|
|
1767
|
+
type: Component,
|
|
1768
|
+
args: [{
|
|
1769
|
+
template: `
|
|
1770
|
+
<div class="ax-flex ax-items-center ax-justify-between ax-gap-5">
|
|
1771
|
+
<a *ngFor="let link of items" (click)="handleCommand(link.command)" >{{ link.text }}</a>
|
|
1772
|
+
</div>
|
|
1773
|
+
`,
|
|
1774
|
+
imports: [CommonModule],
|
|
1775
|
+
encapsulation: ViewEncapsulation.None
|
|
1776
|
+
}]
|
|
1777
|
+
}], propDecorators: { items: [{
|
|
1778
|
+
type: Input
|
|
1779
|
+
}] } });
|
|
1780
|
+
|
|
1781
|
+
class AXPSearchDefinitionProviderContext {
|
|
1782
|
+
constructor() {
|
|
1783
|
+
this.definitions = [];
|
|
1784
|
+
this.definitionMap = new Map();
|
|
1617
1785
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1786
|
+
addDefinition(name, title, group, icon, order, options) {
|
|
1787
|
+
const definitionSearch = {
|
|
1788
|
+
name,
|
|
1789
|
+
title,
|
|
1790
|
+
group,
|
|
1791
|
+
icon,
|
|
1792
|
+
order,
|
|
1793
|
+
format: {
|
|
1794
|
+
title: options?.format?.title ?? '{{ title }}',
|
|
1795
|
+
description: options?.format?.description ?? undefined,
|
|
1796
|
+
icon: options?.format?.icon ?? undefined,
|
|
1797
|
+
id: options?.format?.id ?? '{{ id }}',
|
|
1798
|
+
},
|
|
1799
|
+
actions: options?.actions ?? [],
|
|
1800
|
+
};
|
|
1801
|
+
this.definitions.push(definitionSearch);
|
|
1802
|
+
this.definitionMap.set(name, definitionSearch); // Index by name
|
|
1803
|
+
return new AXPSearchDefinitionBuilder(this, definitionSearch);
|
|
1622
1804
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
const storedSettings = localStorage.getItem(this.localStorageKey);
|
|
1626
|
-
if (storedSettings) {
|
|
1627
|
-
const parsedSettings = JSON.parse(storedSettings);
|
|
1628
|
-
Object.entries(parsedSettings).forEach(([key, value]) => {
|
|
1629
|
-
this.cache.set(key, value);
|
|
1630
|
-
});
|
|
1631
|
-
return Promise.resolve(Array.from(this.cache.entries()).map(c => ({ key: c[0], value: c[1] })));
|
|
1632
|
-
}
|
|
1633
|
-
return Promise.resolve([]);
|
|
1805
|
+
getDefinitions() {
|
|
1806
|
+
return this.definitions;
|
|
1634
1807
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
this.cache.set(keyOrValues, value);
|
|
1639
|
-
}
|
|
1640
|
-
else {
|
|
1641
|
-
// Bulk update
|
|
1642
|
-
for (const [key, val] of Object.entries(keyOrValues)) {
|
|
1643
|
-
this.cache.set(key, val);
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
await this.saveToLocalStorage();
|
|
1808
|
+
// Expose groupMap for controlled access
|
|
1809
|
+
hasEntity(name) {
|
|
1810
|
+
return this.definitionMap.has(name);
|
|
1647
1811
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
this.cache.forEach((value, key) => {
|
|
1651
|
-
settingsObject[key] = value;
|
|
1652
|
-
});
|
|
1653
|
-
localStorage.setItem(this.localStorageKey, JSON.stringify(settingsObject));
|
|
1812
|
+
getDefinition(name) {
|
|
1813
|
+
return this.definitionMap.get(name);
|
|
1654
1814
|
}
|
|
1655
1815
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
this.
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
this.
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1816
|
+
class AXPSearchDefinitionBuilder {
|
|
1817
|
+
constructor(context, definition) {
|
|
1818
|
+
this.context = context;
|
|
1819
|
+
this.definition = definition;
|
|
1820
|
+
}
|
|
1821
|
+
addAction(name) {
|
|
1822
|
+
const newAction = {
|
|
1823
|
+
name,
|
|
1824
|
+
type: 'view',
|
|
1825
|
+
priority: 'primary',
|
|
1826
|
+
};
|
|
1827
|
+
this.definition.actions.push(newAction);
|
|
1828
|
+
return new AXPSearchDefinitionActionBuilder(this);
|
|
1829
|
+
}
|
|
1830
|
+
action(name) {
|
|
1831
|
+
const foundAction = this.definition.actions.find((action) => action.name === name);
|
|
1832
|
+
if (!foundAction) {
|
|
1833
|
+
throw new Error(`action with name "${name}" not found in entity "${this.definition.name}".`);
|
|
1834
|
+
}
|
|
1835
|
+
return new AXPSearchDefinitionActionBuilder(this);
|
|
1836
|
+
}
|
|
1837
|
+
endEntity() {
|
|
1838
|
+
return this.context;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
class AXPSearchDefinitionActionBuilder {
|
|
1842
|
+
constructor(entityBuilder) {
|
|
1843
|
+
this.entityBuilder = entityBuilder;
|
|
1844
|
+
}
|
|
1845
|
+
endAction() {
|
|
1846
|
+
return this.entityBuilder;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
// Injection token for setting providers
|
|
1851
|
+
const AXP_SEARCH_DEFINITION_PROVIDER = new InjectionToken('AXP_SEARCH_DEFINITION_PROVIDER');
|
|
1852
|
+
class AXPSearchDefinitionProviderService {
|
|
1853
|
+
constructor() {
|
|
1854
|
+
this.providers = inject(AXP_SEARCH_DEFINITION_PROVIDER, { optional: true });
|
|
1855
|
+
this.cache = null;
|
|
1685
1856
|
}
|
|
1686
1857
|
async load() {
|
|
1687
|
-
|
|
1688
|
-
|
|
1858
|
+
if (this.cache) {
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
const context = new AXPSearchDefinitionProviderContext();
|
|
1862
|
+
if (Array.isArray(this.providers)) {
|
|
1689
1863
|
for (const provider of this.providers) {
|
|
1690
|
-
|
|
1691
|
-
const providerSettings = await provider.load();
|
|
1692
|
-
providerSettings.forEach((setting) => {
|
|
1693
|
-
scopeCache.set(setting.key, setting.value);
|
|
1694
|
-
});
|
|
1695
|
-
settingsList.push(...providerSettings);
|
|
1864
|
+
await provider.provide(context);
|
|
1696
1865
|
}
|
|
1697
|
-
return settingsList;
|
|
1698
|
-
}
|
|
1699
|
-
catch (error) {
|
|
1700
|
-
console.error('Error loading settings', error);
|
|
1701
|
-
throw error;
|
|
1702
1866
|
}
|
|
1867
|
+
this.cache = context.getDefinitions();
|
|
1703
1868
|
}
|
|
1704
|
-
async
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
}
|
|
1708
|
-
const scopeOrder = [
|
|
1709
|
-
AXPPlatformScope.User,
|
|
1710
|
-
AXPPlatformScope.Tenant,
|
|
1711
|
-
AXPPlatformScope.Global,
|
|
1712
|
-
AXPPlatformScope.Environment,
|
|
1713
|
-
];
|
|
1714
|
-
for (const scope of scopeOrder) {
|
|
1715
|
-
const scopeCache = this.scopedSettingsCache.get(scope);
|
|
1716
|
-
if (scopeCache && scopeCache.has(key)) {
|
|
1717
|
-
const value = scopeCache.get(key);
|
|
1718
|
-
if (value !== undefined && value !== null) {
|
|
1719
|
-
return cloneDeep(value);
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
const definitionService = this.injector.get(AXPSettingDefinitionProviderService);
|
|
1724
|
-
const defaults = await definitionService.defaultValues();
|
|
1725
|
-
return get(defaults, key); // Fallback if no value is found
|
|
1869
|
+
async getListAsync() {
|
|
1870
|
+
await this.load();
|
|
1871
|
+
return this.getList();
|
|
1726
1872
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
AXPPlatformScope.Global,
|
|
1731
|
-
AXPPlatformScope.Tenant,
|
|
1732
|
-
AXPPlatformScope.User,
|
|
1733
|
-
].reverse();
|
|
1734
|
-
const scopeIndex = scopeOrder.indexOf(scope);
|
|
1735
|
-
if (scopeIndex === -1) {
|
|
1736
|
-
throw new Error(`Invalid scope: ${scope}`);
|
|
1873
|
+
getList() {
|
|
1874
|
+
if (!this.cache) {
|
|
1875
|
+
return [];
|
|
1737
1876
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
const accumulatedDefaults = {};
|
|
1741
|
-
for (let i = scopeIndex; i < scopeOrder.length; i++) {
|
|
1742
|
-
const currentScope = scopeOrder[i];
|
|
1743
|
-
const scopeCache = this.scopedSettingsCache.get(currentScope);
|
|
1744
|
-
if (scopeCache) {
|
|
1745
|
-
scopeCache.forEach((value, key) => {
|
|
1746
|
-
if (!(key in accumulatedDefaults)) {
|
|
1747
|
-
accumulatedDefaults[key] = value;
|
|
1748
|
-
}
|
|
1749
|
-
});
|
|
1750
|
-
}
|
|
1877
|
+
else {
|
|
1878
|
+
return this.cache;
|
|
1751
1879
|
}
|
|
1752
|
-
// Merge with global default values from the definition service
|
|
1753
|
-
const definitionService = this.injector.get(AXPSettingDefinitionProviderService);
|
|
1754
|
-
const globalDefaults = await definitionService.defaultValues();
|
|
1755
|
-
return { ...globalDefaults, ...accumulatedDefaults };
|
|
1756
1880
|
}
|
|
1757
|
-
|
|
1758
|
-
const
|
|
1759
|
-
if (!
|
|
1760
|
-
throw new Error(`
|
|
1881
|
+
findDefinition(definitionName) {
|
|
1882
|
+
const definition = this.getList().find((definition) => definition.name === definitionName);
|
|
1883
|
+
if (!definition) {
|
|
1884
|
+
throw new Error(`Definition with name ${definitionName} not found`);
|
|
1761
1885
|
}
|
|
1762
|
-
return
|
|
1886
|
+
return definition;
|
|
1763
1887
|
}
|
|
1764
|
-
|
|
1765
|
-
this.
|
|
1766
|
-
|
|
1888
|
+
findDefinitionByGroup(definitionGroup) {
|
|
1889
|
+
const definition = this.getList().find((definition) => definition.group === definitionGroup);
|
|
1890
|
+
if (!definition) {
|
|
1891
|
+
throw new Error(`Definition with group ${definitionGroup} not found`);
|
|
1892
|
+
}
|
|
1893
|
+
return definition;
|
|
1767
1894
|
}
|
|
1768
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1769
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1895
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSearchDefinitionProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1896
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSearchDefinitionProviderService, providedIn: 'root' }); }
|
|
1770
1897
|
}
|
|
1771
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type:
|
|
1898
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSearchDefinitionProviderService, decorators: [{
|
|
1772
1899
|
type: Injectable,
|
|
1773
|
-
args: [{
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
this.parent = parent;
|
|
1780
|
-
this.provider = provider;
|
|
1781
|
-
this.scopeCache = scopeCache;
|
|
1782
|
-
}
|
|
1783
|
-
async get(key) {
|
|
1784
|
-
const settings = await this.provider.load();
|
|
1785
|
-
const setting = settings.find((s) => s.key === key);
|
|
1786
|
-
return setting ? cloneDeep(setting.value) : undefined;
|
|
1787
|
-
}
|
|
1788
|
-
async all() {
|
|
1789
|
-
const settings = await this.provider.load();
|
|
1790
|
-
return Object.fromEntries(settings.map((s) => [s.key, cloneDeep(s.value)]));
|
|
1900
|
+
args: [{ providedIn: 'root' }]
|
|
1901
|
+
}] });
|
|
1902
|
+
|
|
1903
|
+
class AXPSearchCommandProvider {
|
|
1904
|
+
async search(text) {
|
|
1905
|
+
return this.commands.filter((command) => command.title.toLowerCase().includes(text.toLowerCase()));
|
|
1791
1906
|
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
// Injection token for setting providers
|
|
1910
|
+
const AXP_SEARCH_PROVIDER = new InjectionToken('AXP_SEARCH_PROVIDER');
|
|
1911
|
+
class AXPSearchService {
|
|
1912
|
+
constructor() {
|
|
1913
|
+
this.providers = inject(AXP_SEARCH_PROVIDER, { optional: true });
|
|
1914
|
+
this.definitionService = inject(AXPSearchDefinitionProviderService);
|
|
1915
|
+
this.formatService = inject(AXFormatService);
|
|
1794
1916
|
}
|
|
1795
|
-
async
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
await this.
|
|
1799
|
-
this.scopeCache.set(keyOrValues, value); // Sync the cache
|
|
1800
|
-
this.parent.invokeChangeEvent({
|
|
1801
|
-
scope: this.provider.scope,
|
|
1802
|
-
keys: [keyOrValues],
|
|
1803
|
-
values: { [keyOrValues]: value },
|
|
1804
|
-
entries: [{ key: keyOrValues, value }],
|
|
1805
|
-
});
|
|
1917
|
+
async search(text) {
|
|
1918
|
+
//TODO better handle this
|
|
1919
|
+
if (this.definitionService.getList().length == 0) {
|
|
1920
|
+
await this.definitionService.getListAsync();
|
|
1806
1921
|
}
|
|
1807
|
-
|
|
1808
|
-
//
|
|
1809
|
-
await this.provider.set(keyOrValues);
|
|
1810
|
-
Object.entries(keyOrValues).forEach(([key, val]) => this.scopeCache.set(key, val)); // Sync the cache
|
|
1811
|
-
const entries = Object.entries(keyOrValues).map(([key, val]) => ({ key, value: val }));
|
|
1812
|
-
this.parent.invokeChangeEvent({
|
|
1813
|
-
scope: this.provider.scope,
|
|
1814
|
-
keys: Object.keys(keyOrValues),
|
|
1815
|
-
values: keyOrValues,
|
|
1816
|
-
entries,
|
|
1817
|
-
});
|
|
1922
|
+
if (!this.providers || (this.providers?.length || 0) === 0) {
|
|
1923
|
+
throw new Error('No search providers available'); // No providers available
|
|
1818
1924
|
}
|
|
1925
|
+
const mergeData = [];
|
|
1926
|
+
const promises = this.providers.map((provider) => provider.search(text));
|
|
1927
|
+
const results = await Promise.all(promises);
|
|
1928
|
+
for (const resultArray of results) {
|
|
1929
|
+
for (const result of resultArray) {
|
|
1930
|
+
try {
|
|
1931
|
+
const definition = this.definitionService.findDefinition(result.group);
|
|
1932
|
+
mergeData.push({
|
|
1933
|
+
definitionName: definition.group,
|
|
1934
|
+
definitionTitle: definition.title,
|
|
1935
|
+
name: result.group,
|
|
1936
|
+
id: `${definition.name}:${this.formatService.format(definition.format.id, 'string', result)}`,
|
|
1937
|
+
title: result.title ??
|
|
1938
|
+
(definition.format.title
|
|
1939
|
+
? this.formatService.format(definition.format.title, 'string', result.data)
|
|
1940
|
+
: 'Unknown'),
|
|
1941
|
+
description: result.description ??
|
|
1942
|
+
(definition.format.description
|
|
1943
|
+
? this.formatService.format(definition.format.description, 'string', result.data)
|
|
1944
|
+
: undefined),
|
|
1945
|
+
icon: result.icon ??
|
|
1946
|
+
(result.icon
|
|
1947
|
+
? this.formatService.format(definition.format.icon, 'string', result.data)
|
|
1948
|
+
: definition.icon),
|
|
1949
|
+
data: result.data,
|
|
1950
|
+
command: result.command,
|
|
1951
|
+
actions: definition.actions,
|
|
1952
|
+
parent: result.parent,
|
|
1953
|
+
order: definition.order,
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
catch (e) {
|
|
1957
|
+
console.error(e);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
// Group data
|
|
1962
|
+
const groupedData = [];
|
|
1963
|
+
const groupMap = {};
|
|
1964
|
+
// Create groups
|
|
1965
|
+
for (const item of mergeData) {
|
|
1966
|
+
const groupName = item.definitionName; // Change this to the property you want to group by
|
|
1967
|
+
if (!groupMap[groupName]) {
|
|
1968
|
+
groupMap[groupName] = {
|
|
1969
|
+
name: groupName,
|
|
1970
|
+
title: item.definitionTitle, // You can adjust the title logic if needed
|
|
1971
|
+
order: item.order, // Add order to the group
|
|
1972
|
+
children: [],
|
|
1973
|
+
};
|
|
1974
|
+
groupedData.push(groupMap[groupName]);
|
|
1975
|
+
}
|
|
1976
|
+
groupMap[groupName].children.push(omit(item, ['definitionName', 'definitionTitle', 'order']));
|
|
1977
|
+
}
|
|
1978
|
+
// Sort groups by order
|
|
1979
|
+
groupedData.sort((a, b) => a.order - b.order);
|
|
1980
|
+
return groupedData;
|
|
1819
1981
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
const newValue = updateFn(currentValue);
|
|
1823
|
-
await this.set(key, newValue);
|
|
1824
|
-
}
|
|
1982
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSearchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1983
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSearchService, providedIn: 'root' }); }
|
|
1825
1984
|
}
|
|
1985
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSearchService, decorators: [{
|
|
1986
|
+
type: Injectable,
|
|
1987
|
+
args: [{ providedIn: 'root' }]
|
|
1988
|
+
}] });
|
|
1826
1989
|
|
|
1827
1990
|
//TODO Loading, Redirect, Drawer, Show toast
|
|
1828
1991
|
const AXPRedirectEvent = createWorkFlowEvent('Redirect Event Fired');
|
|
@@ -2133,7 +2296,7 @@ const AXPPlatformDefaultConfigs = {
|
|
|
2133
2296
|
},
|
|
2134
2297
|
network: {
|
|
2135
2298
|
timeOut: 5000,
|
|
2136
|
-
}
|
|
2299
|
+
},
|
|
2137
2300
|
};
|
|
2138
2301
|
function configPlatform(config = AXPPlatformDefaultConfigs) {
|
|
2139
2302
|
return merge(AXPPlatformDefaultConfigs, config);
|
|
@@ -2645,5 +2808,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
2645
2808
|
* Generated bundle index. Do not edit.
|
|
2646
2809
|
*/
|
|
2647
2810
|
|
|
2648
|
-
export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPAppStartUpProvider, AXPAppStartUpService, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule,
|
|
2811
|
+
export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPAppStartUpProvider, AXPAppStartUpService, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPComponentSlotDirective, AXPComponentSlotLoaderService, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataGenerator, AXPDataProvider, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileStorageService, AXPFileStorageStatus, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFiltersProviderService, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPHomePageModule, AXPHomePageService, AXPLogoComponent, AXPMenuBadgeHelper, AXPMenuProviderService, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRegionalService, AXPRelationshipCardinality, AXPRelationshipKind, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValueProvider, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingService, AXPStickyDirective, AXPTaskBadgeProvider, AXPTaskBadgeService, AXPToastAction, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_APP_VERSION_PROVIDER, AXP_FILE_TYPE_INFO_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_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, AXP_TASK_BADGE_PROVIDERS, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_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, resolveActionLook };
|
|
2649
2812
|
//# sourceMappingURL=acorex-platform-common.mjs.map
|