@acorex/platform 20.3.0-next.16 → 20.3.0-next.18
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/core/index.d.ts +1 -0
- package/fesm2022/acorex-platform-layout-components.mjs +7 -4
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +143 -299
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/layout/entity/index.d.ts +52 -76
- package/package.json +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AXPSessionService, AXPAuthGuard } from '@acorex/platform/auth';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Injectable, input, viewChild, signal, ElementRef, ChangeDetectionStrategy, Component, ApplicationRef, EnvironmentInjector, createComponent, InjectionToken, computed, Injector, runInInjectionContext, viewChildren, linkedSignal, effect, untracked, HostBinding, ViewChild, NgModule
|
|
3
|
+
import { inject, Injectable, input, viewChild, signal, ElementRef, ChangeDetectionStrategy, Component, ApplicationRef, EnvironmentInjector, createComponent, InjectionToken, computed, Injector, runInInjectionContext, viewChildren, linkedSignal, effect, untracked, HostBinding, ViewChild, NgModule } from '@angular/core';
|
|
4
4
|
import { Router, RouterModule, ROUTES } from '@angular/router';
|
|
5
5
|
import * as i3 from '@acorex/components/button';
|
|
6
6
|
import { AXButtonModule } from '@acorex/components/button';
|
|
@@ -15,12 +15,12 @@ import { AXPWidgetsCatalog, AXPWidgetCoreModule, AXPPageStatus, AXPWidgetRegistr
|
|
|
15
15
|
import { AXPCommandService, AXPQueryService, provideCommandSetups, provideQuerySetups } from '@acorex/platform/runtime';
|
|
16
16
|
import * as i5 from '@angular/common';
|
|
17
17
|
import { CommonModule } from '@angular/common';
|
|
18
|
-
import { castArray, get, cloneDeep, set, merge, isNil, isEmpty, sortBy } from 'lodash-es';
|
|
18
|
+
import { castArray, get, cloneDeep, set, merge, isEqual, isNil, isEmpty, sortBy } from 'lodash-es';
|
|
19
19
|
import { AXDataSource } from '@acorex/cdk/common';
|
|
20
20
|
import { AXFormatService } from '@acorex/core/format';
|
|
21
21
|
import { AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPSettingService, AXPRefreshEvent, AXPReloadEvent, AXPCleanNestedFilters, AXPWorkflowNavigateAction, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER } from '@acorex/platform/common';
|
|
22
22
|
import * as i1$2 from '@acorex/platform/core';
|
|
23
|
-
import { resolveActionLook, AXPExpressionEvaluatorService, AXPDistributedEventListenerService, AXPPlatformScope, getChangedPaths, extractValue, setSmart, AXPSystemActionType } from '@acorex/platform/core';
|
|
23
|
+
import { resolveActionLook, AXPExpressionEvaluatorService, AXPDistributedEventListenerService, AXPBroadcastEventService, AXPPlatformScope, getChangedPaths, extractValue, setSmart, AXPSystemActionType } from '@acorex/platform/core';
|
|
24
24
|
import * as i2$2 from '@acorex/platform/workflow';
|
|
25
25
|
import { AXPWorkflowService, ofType, createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowModule } from '@acorex/platform/workflow';
|
|
26
26
|
import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
|
|
@@ -37,21 +37,21 @@ import { AXDropdownModule } from '@acorex/components/dropdown';
|
|
|
37
37
|
import { AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY, AXP_DISABLED_PROPERTY, AXP_ALLOW_CLEAR_PROPERTY, AXP_DATA_PROPERTY_GROUP, AXP_ALLOW_MULTIPLE_PROPERTY, AXPFileUploaderWidgetService } from '@acorex/platform/layout/widgets';
|
|
38
38
|
import * as i1$1 from '@angular/forms';
|
|
39
39
|
import { FormsModule } from '@angular/forms';
|
|
40
|
-
import * as i1 from '@acorex/components/badge';
|
|
41
|
-
import { AXBadgeModule } from '@acorex/components/badge';
|
|
42
40
|
import * as i5$1 from '@acorex/components/form';
|
|
43
41
|
import { AXFormModule } from '@acorex/components/form';
|
|
44
|
-
import * as i6$2 from '@acorex/components/search-box';
|
|
45
|
-
import { AXSearchBoxComponent, AXSearchBoxModule } from '@acorex/components/search-box';
|
|
46
42
|
import * as i7 from '@acorex/components/select-box';
|
|
47
43
|
import { AXSelectBoxModule } from '@acorex/components/select-box';
|
|
44
|
+
import * as i2$1 from '@acorex/components/text-box';
|
|
45
|
+
import { AXTextBoxModule, AXTextBoxComponent } from '@acorex/components/text-box';
|
|
46
|
+
import { AXValidationModule } from '@acorex/core/validation';
|
|
47
|
+
import * as i1 from '@acorex/components/badge';
|
|
48
|
+
import { AXBadgeModule } from '@acorex/components/badge';
|
|
49
|
+
import * as i6$2 from '@acorex/components/search-box';
|
|
50
|
+
import { AXSearchBoxComponent, AXSearchBoxModule } from '@acorex/components/search-box';
|
|
48
51
|
import * as i6$1 from '@acorex/components/tag-box';
|
|
49
52
|
import { AXTagBoxComponent, AXTagBoxModule } from '@acorex/components/tag-box';
|
|
50
|
-
import { AXValidationModule } from '@acorex/core/validation';
|
|
51
53
|
import { AXPDataSelectorService, AXPWidgetPropertyViewerComponent, AXPDynamicFormBuilderService } from '@acorex/platform/layout/components';
|
|
52
|
-
import
|
|
53
|
-
import { AXTextBoxModule, AXTextBoxComponent } from '@acorex/components/text-box';
|
|
54
|
-
import { transform, isEqual } from 'lodash';
|
|
54
|
+
import { transform, isEqual as isEqual$1 } from 'lodash';
|
|
55
55
|
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region ---- Entity Open Details Command ----
|
|
@@ -1544,6 +1544,7 @@ class AXPEntityMasterListViewModel {
|
|
|
1544
1544
|
this.widgetResolver = this.injector.get(AXPWidgetRegistryService);
|
|
1545
1545
|
this.expressionEvaluator = this.injector.get(AXPExpressionEvaluatorService);
|
|
1546
1546
|
this.commandService = this.injector.get(AXPCommandService);
|
|
1547
|
+
this.eventService = this.injector.get(AXPBroadcastEventService);
|
|
1547
1548
|
this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
|
|
1548
1549
|
this.settingEntityKey = `${this.config.module}:${this.config.name}`;
|
|
1549
1550
|
this.destroyed = new Subject();
|
|
@@ -1688,6 +1689,15 @@ class AXPEntityMasterListViewModel {
|
|
|
1688
1689
|
this.events$.next({ action: 'refresh', meta: event.payload.meta });
|
|
1689
1690
|
}
|
|
1690
1691
|
});
|
|
1692
|
+
this.eventService
|
|
1693
|
+
.listen('REFRESH_LAYOUT')
|
|
1694
|
+
.pipe(takeUntil(this.destroyed))
|
|
1695
|
+
.subscribe((e) => {
|
|
1696
|
+
if (e.data.name == getEntityInfo(this.entityDef).source) {
|
|
1697
|
+
this.selectedItems.set([]);
|
|
1698
|
+
this.events$.next({ action: 'refresh' });
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1691
1701
|
this.sortedFields.set(this.sortableFields());
|
|
1692
1702
|
}
|
|
1693
1703
|
async applySettings() {
|
|
@@ -5436,6 +5446,121 @@ const AXPEntityReferenceWidget = {
|
|
|
5436
5446
|
},
|
|
5437
5447
|
};
|
|
5438
5448
|
|
|
5449
|
+
class AXPLookupFilterWidgetEditComponent extends AXPValueWidgetComponent {
|
|
5450
|
+
constructor() {
|
|
5451
|
+
super(...arguments);
|
|
5452
|
+
//#region ---- Computed Properties ----
|
|
5453
|
+
this.editorPath = `__${this.path}EditorValue`;
|
|
5454
|
+
this.entity = computed(() => this.options()['entity'], ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
5455
|
+
this.textField = computed(() => this.options()['textField'] ?? 'title', ...(ngDevMode ? [{ debugName: "textField" }] : []));
|
|
5456
|
+
this.valueField = computed(() => this.options()['valueField'] ?? 'id', ...(ngDevMode ? [{ debugName: "valueField" }] : []));
|
|
5457
|
+
// protected expose = computed<string | undefined | any[]>(() => this.options()['expose'] as string);
|
|
5458
|
+
this.customFilter = computed(() => this.options()['filter'], ...(ngDevMode ? [{ debugName: "customFilter" }] : []));
|
|
5459
|
+
this.multiple = computed(() => (this.options()['multiple'] ?? false), ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
5460
|
+
//#endregion
|
|
5461
|
+
//#region ---- Lookup Node ----
|
|
5462
|
+
this.lookupNode = signal({
|
|
5463
|
+
type: 'lookup-editor',
|
|
5464
|
+
defaultValue: undefined,
|
|
5465
|
+
path: this.path,
|
|
5466
|
+
options: {},
|
|
5467
|
+
}, ...(ngDevMode ? [{ debugName: "lookupNode" }] : []));
|
|
5468
|
+
//#endregion
|
|
5469
|
+
//#region ---- Effects ----
|
|
5470
|
+
this.#efUpdateLookupNode = effect(() => {
|
|
5471
|
+
// console.log('path:', this.path, this.expose());
|
|
5472
|
+
const node = {
|
|
5473
|
+
type: 'lookup-editor',
|
|
5474
|
+
// defaultValue: this.getValue()?.value,
|
|
5475
|
+
path: this.editorPath,
|
|
5476
|
+
options: {
|
|
5477
|
+
entity: this.entity(),
|
|
5478
|
+
expose: [
|
|
5479
|
+
{
|
|
5480
|
+
source: this.textField(),
|
|
5481
|
+
target: `${this.path}EditorObj.title`,
|
|
5482
|
+
},
|
|
5483
|
+
{
|
|
5484
|
+
source: this.valueField(),
|
|
5485
|
+
target: `${this.path}EditorObj.id`,
|
|
5486
|
+
},
|
|
5487
|
+
],
|
|
5488
|
+
look: 'select',
|
|
5489
|
+
multiple: this.multiple(),
|
|
5490
|
+
textField: this.textField(),
|
|
5491
|
+
filter: this.customFilter(),
|
|
5492
|
+
allowClear: true,
|
|
5493
|
+
},
|
|
5494
|
+
};
|
|
5495
|
+
this.lookupNode.set(node);
|
|
5496
|
+
}, ...(ngDevMode ? [{ debugName: "#efUpdateLookupNode" }] : []));
|
|
5497
|
+
this.#efUpdateValue = effect(() => {
|
|
5498
|
+
const newValueObj = this.contextService.getValue(`${this.path}EditorObj`);
|
|
5499
|
+
const prevValue = untracked(() => this.getValue()?.value);
|
|
5500
|
+
if (isEqual(prevValue, newValueObj?.[this.valueField()])) {
|
|
5501
|
+
return;
|
|
5502
|
+
}
|
|
5503
|
+
const value = this.multiple()
|
|
5504
|
+
? newValueObj?.[this.valueField()].map((v) => v[this.valueField()])
|
|
5505
|
+
: newValueObj?.[this.valueField()];
|
|
5506
|
+
const displayText = this.multiple()
|
|
5507
|
+
? newValueObj?.[this.textField()].map((v) => v[this.textField()]).join(',')
|
|
5508
|
+
: newValueObj?.[this.textField()];
|
|
5509
|
+
this.setValue({
|
|
5510
|
+
value: value,
|
|
5511
|
+
operation: {
|
|
5512
|
+
type: this.multiple() ? 'in' : 'equal',
|
|
5513
|
+
},
|
|
5514
|
+
displayText: displayText,
|
|
5515
|
+
});
|
|
5516
|
+
}, ...(ngDevMode ? [{ debugName: "#efUpdateValue" }] : []));
|
|
5517
|
+
}
|
|
5518
|
+
//#endregion
|
|
5519
|
+
//#region ---- Effects ----
|
|
5520
|
+
#efUpdateLookupNode;
|
|
5521
|
+
#efUpdateValue;
|
|
5522
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXPLookupFilterWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
5523
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.3", type: AXPLookupFilterWidgetEditComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: ` <ng-container axp-widget-renderer [node]="lookupNode()" [mode]="'edit'"></ng-container> `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: AXSelectBoxModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "directive", type: i3$1.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged"], exportAs: ["widgetRenderer"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
5524
|
+
}
|
|
5525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXPLookupFilterWidgetEditComponent, decorators: [{
|
|
5526
|
+
type: Component,
|
|
5527
|
+
args: [{
|
|
5528
|
+
template: ` <ng-container axp-widget-renderer [node]="lookupNode()" [mode]="'edit'"></ng-container> `,
|
|
5529
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
5530
|
+
imports: [
|
|
5531
|
+
FormsModule,
|
|
5532
|
+
AXSelectBoxModule,
|
|
5533
|
+
AXTextBoxModule,
|
|
5534
|
+
AXButtonModule,
|
|
5535
|
+
AXDecoratorModule,
|
|
5536
|
+
AXLoadingModule,
|
|
5537
|
+
AXValidationModule,
|
|
5538
|
+
AXFormModule,
|
|
5539
|
+
AXPWidgetCoreModule,
|
|
5540
|
+
],
|
|
5541
|
+
}]
|
|
5542
|
+
}] });
|
|
5543
|
+
|
|
5544
|
+
var lookupFilterWidgetEdit_component = /*#__PURE__*/Object.freeze({
|
|
5545
|
+
__proto__: null,
|
|
5546
|
+
AXPLookupFilterWidgetEditComponent: AXPLookupFilterWidgetEditComponent
|
|
5547
|
+
});
|
|
5548
|
+
|
|
5549
|
+
const AXPLookupFilterWidget = {
|
|
5550
|
+
name: 'lookup-filter',
|
|
5551
|
+
title: 'Lookup Filter',
|
|
5552
|
+
// categories: AXP_WIDGETS_FILTER_CATEGORY,
|
|
5553
|
+
type: 'filter',
|
|
5554
|
+
groups: [AXPWidgetGroupEnum.EntityWidget],
|
|
5555
|
+
icon: 'fa-light fa-square',
|
|
5556
|
+
properties: [AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY, AXP_DISABLED_PROPERTY],
|
|
5557
|
+
components: {
|
|
5558
|
+
edit: {
|
|
5559
|
+
component: () => Promise.resolve().then(function () { return lookupFilterWidgetEdit_component; }).then((c) => c.AXPLookupFilterWidgetEditComponent),
|
|
5560
|
+
},
|
|
5561
|
+
},
|
|
5562
|
+
};
|
|
5563
|
+
|
|
5439
5564
|
class AXPLookupWidgetViewComponent extends AXPValueWidgetComponent {
|
|
5440
5565
|
constructor() {
|
|
5441
5566
|
super(...arguments);
|
|
@@ -6288,6 +6413,7 @@ const AXPLookupWidget = {
|
|
|
6288
6413
|
groups: [AXPWidgetGroupEnum.EntityWidget],
|
|
6289
6414
|
defaultFilterWidgetName: 'lookup-filter',
|
|
6290
6415
|
type: 'editor',
|
|
6416
|
+
icon: 'fa-light fa-list-radio',
|
|
6291
6417
|
properties: [
|
|
6292
6418
|
AXP_DISABLED_PROPERTY,
|
|
6293
6419
|
AXP_ALLOW_CLEAR_PROPERTY,
|
|
@@ -6320,7 +6446,7 @@ const AXPLookupWidget = {
|
|
|
6320
6446
|
},
|
|
6321
6447
|
visible: true,
|
|
6322
6448
|
},
|
|
6323
|
-
AXP_ALLOW_MULTIPLE_PROPERTY
|
|
6449
|
+
AXP_ALLOW_MULTIPLE_PROPERTY,
|
|
6324
6450
|
],
|
|
6325
6451
|
components: {
|
|
6326
6452
|
view: {
|
|
@@ -7360,6 +7486,7 @@ class AXPEntityModule {
|
|
|
7360
7486
|
AXPWidgetCoreModule.forChild({
|
|
7361
7487
|
widgets: [
|
|
7362
7488
|
AXPLookupWidget,
|
|
7489
|
+
AXPLookupFilterWidget,
|
|
7363
7490
|
AXPWidgetSelectorWidget,
|
|
7364
7491
|
AXPTagableBoxWidget,
|
|
7365
7492
|
AXPEntityListWidget,
|
|
@@ -7402,6 +7529,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
|
|
|
7402
7529
|
AXPWidgetCoreModule.forChild({
|
|
7403
7530
|
widgets: [
|
|
7404
7531
|
AXPLookupWidget,
|
|
7532
|
+
AXPLookupFilterWidget,
|
|
7405
7533
|
AXPWidgetSelectorWidget,
|
|
7406
7534
|
AXPTagableBoxWidget,
|
|
7407
7535
|
AXPEntityListWidget,
|
|
@@ -8100,7 +8228,7 @@ function entityDetailsReferenceCreateActions(type) {
|
|
|
8100
8228
|
*/
|
|
8101
8229
|
function detectEntityChanges(oldObj, newObj) {
|
|
8102
8230
|
return transform(newObj, (result, value, key) => {
|
|
8103
|
-
if (!isEqual(value, oldObj[key])) {
|
|
8231
|
+
if (!isEqual$1(value, oldObj[key])) {
|
|
8104
8232
|
const oldValue = oldObj[key];
|
|
8105
8233
|
if (Array.isArray(value) || Array.isArray(oldValue)) {
|
|
8106
8234
|
const oldArray = Array.isArray(oldValue) ? oldValue : [];
|
|
@@ -8112,8 +8240,8 @@ function detectEntityChanges(oldObj, newObj) {
|
|
|
8112
8240
|
result[key] = { oldValue, newValue: value, added, removed };
|
|
8113
8241
|
}
|
|
8114
8242
|
else {
|
|
8115
|
-
const added = newArray.filter((item) => !oldArray.some((oldItem) => isEqual(item, oldItem)));
|
|
8116
|
-
const removed = oldArray.filter((item) => !newArray.some((newItem) => isEqual(item, newItem)));
|
|
8243
|
+
const added = newArray.filter((item) => !oldArray.some((oldItem) => isEqual$1(item, oldItem)));
|
|
8244
|
+
const removed = oldArray.filter((item) => !newArray.some((newItem) => isEqual$1(item, newItem)));
|
|
8117
8245
|
result[key] = { oldValue, newValue: value, added, removed };
|
|
8118
8246
|
}
|
|
8119
8247
|
}
|
|
@@ -8125,290 +8253,6 @@ function detectEntityChanges(oldObj, newObj) {
|
|
|
8125
8253
|
}
|
|
8126
8254
|
//#endregion
|
|
8127
8255
|
|
|
8128
|
-
class AXPLookupFilterWidgetEditComponent extends AXPValueWidgetComponent {
|
|
8129
|
-
constructor() {
|
|
8130
|
-
super(...arguments);
|
|
8131
|
-
this.injector = inject(Injector);
|
|
8132
|
-
this.entityResolver = inject(AXPEntityResolver);
|
|
8133
|
-
this.formatService = inject(AXFormatService);
|
|
8134
|
-
this.popupService = inject(AXPopupService);
|
|
8135
|
-
this.entityDataSelectorService = inject(AXPEntityDataSelectorService);
|
|
8136
|
-
this.destroyRef = inject(DestroyRef);
|
|
8137
|
-
this.translateService = inject(AXTranslationService);
|
|
8138
|
-
this.expose = computed(() => this.options()['expose'], ...(ngDevMode ? [{ debugName: "expose" }] : []));
|
|
8139
|
-
this.entity = computed(() => this.options()['entity'], ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
8140
|
-
this.textField = computed(() => {
|
|
8141
|
-
return (this.entityDef()?.formats.lookup ?? this.entityDef()?.properties.find((c) => c.name != 'id')?.name ?? 'title');
|
|
8142
|
-
}, ...(ngDevMode ? [{ debugName: "textField" }] : []));
|
|
8143
|
-
this.entityDef = signal(null, ...(ngDevMode ? [{ debugName: "entityDef" }] : []));
|
|
8144
|
-
this.searchTerm = signal(null, ...(ngDevMode ? [{ debugName: "searchTerm" }] : []));
|
|
8145
|
-
this.displayText = signal('', ...(ngDevMode ? [{ debugName: "displayText" }] : []));
|
|
8146
|
-
this.selectedItem = signal(null, ...(ngDevMode ? [{ debugName: "selectedItem" }] : []));
|
|
8147
|
-
this.isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
8148
|
-
this.isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
8149
|
-
this.placeholder = computed(() => {
|
|
8150
|
-
return this.translateService.translateSync('widget.lookup.search');
|
|
8151
|
-
}, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
8152
|
-
this.efDisplay = effect(async () => {
|
|
8153
|
-
const value = this.getValue();
|
|
8154
|
-
if (isNil(value)) {
|
|
8155
|
-
this.displayText.set('');
|
|
8156
|
-
}
|
|
8157
|
-
else if (typeof value == 'object' && !Array.isArray(value)) {
|
|
8158
|
-
this.displayText.set(this.formatService.format(this.textField(), 'string', value));
|
|
8159
|
-
}
|
|
8160
|
-
else if (value != null) {
|
|
8161
|
-
await this.findByValue();
|
|
8162
|
-
}
|
|
8163
|
-
}, ...(ngDevMode ? [{ debugName: "efDisplay" }] : []));
|
|
8164
|
-
this.efEntity = effect(async () => {
|
|
8165
|
-
const [module, entity] = this.entity().split('.');
|
|
8166
|
-
this.entityDef.set(await this.entityResolver.get(module, entity));
|
|
8167
|
-
}, ...(ngDevMode ? [{ debugName: "efEntity" }] : []));
|
|
8168
|
-
}
|
|
8169
|
-
ngOnInit() {
|
|
8170
|
-
super.ngOnInit();
|
|
8171
|
-
//
|
|
8172
|
-
// this.builderService.onContextChanged.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(async (c) => {
|
|
8173
|
-
// if (c.path == this.path) {
|
|
8174
|
-
// if (this.getValue()) {
|
|
8175
|
-
// await this.findByValue();
|
|
8176
|
-
// }
|
|
8177
|
-
// }
|
|
8178
|
-
// });
|
|
8179
|
-
}
|
|
8180
|
-
async findByValue() {
|
|
8181
|
-
this.isLoading.set(true);
|
|
8182
|
-
const byKey = this.entityDef()?.queries.byKey?.execute;
|
|
8183
|
-
if (byKey) {
|
|
8184
|
-
const item = await byKey(this.getValue());
|
|
8185
|
-
this.setItems(item);
|
|
8186
|
-
}
|
|
8187
|
-
this.isLoading.set(false);
|
|
8188
|
-
}
|
|
8189
|
-
handleOnClick(e) {
|
|
8190
|
-
this.showSelector();
|
|
8191
|
-
}
|
|
8192
|
-
async showSelector() {
|
|
8193
|
-
this.isOpen.set(true);
|
|
8194
|
-
try {
|
|
8195
|
-
const result = await this.entityDataSelectorService.open({
|
|
8196
|
-
entity: this.entityDef(),
|
|
8197
|
-
title: `${this.translateService.translateSync('@general:widgets.lookup.search')} ${this.translateService.translateSync(this.entityDef()?.formats.plural)}`,
|
|
8198
|
-
allowMultiple: false,
|
|
8199
|
-
filters: this.filter,
|
|
8200
|
-
parentFilters: null,
|
|
8201
|
-
columns: [],
|
|
8202
|
-
allowCreate: false
|
|
8203
|
-
});
|
|
8204
|
-
if (result && 'items' in result && result.items.length > 0) {
|
|
8205
|
-
this.setItems(result.items[0]);
|
|
8206
|
-
}
|
|
8207
|
-
}
|
|
8208
|
-
catch (error) {
|
|
8209
|
-
console.error('Error opening entity data selector:', error);
|
|
8210
|
-
}
|
|
8211
|
-
finally {
|
|
8212
|
-
this.isOpen.set(false);
|
|
8213
|
-
this.textbox.focus();
|
|
8214
|
-
}
|
|
8215
|
-
}
|
|
8216
|
-
handleValueChange(e) {
|
|
8217
|
-
this.searchTerm.set(e.value);
|
|
8218
|
-
}
|
|
8219
|
-
handleOnBlur(e) {
|
|
8220
|
-
const com = e.component;
|
|
8221
|
-
const input = com['input'].nativeElement;
|
|
8222
|
-
setTimeout(() => {
|
|
8223
|
-
if (this.selectedItem()) {
|
|
8224
|
-
input.value = this.displayText();
|
|
8225
|
-
}
|
|
8226
|
-
else {
|
|
8227
|
-
if (!this.isOpen()) {
|
|
8228
|
-
input.value = '';
|
|
8229
|
-
this.searchTerm.set(null);
|
|
8230
|
-
}
|
|
8231
|
-
}
|
|
8232
|
-
}, 100);
|
|
8233
|
-
}
|
|
8234
|
-
async handleKeyDown(e) {
|
|
8235
|
-
const keyEvent = e.nativeEvent;
|
|
8236
|
-
const value = this.searchTerm()?.trim();
|
|
8237
|
-
if ((keyEvent.code == 'Enter' || keyEvent.code == 'NumpadEnter') && value) {
|
|
8238
|
-
this.isLoading.set(true);
|
|
8239
|
-
const result = await this.searchByValue(value);
|
|
8240
|
-
if (result?.total == 1) {
|
|
8241
|
-
this.setItems(result.items[0]);
|
|
8242
|
-
}
|
|
8243
|
-
else {
|
|
8244
|
-
this.showSelector();
|
|
8245
|
-
}
|
|
8246
|
-
this.isLoading.set(false);
|
|
8247
|
-
}
|
|
8248
|
-
}
|
|
8249
|
-
setItems(item) {
|
|
8250
|
-
this.searchTerm.set(null);
|
|
8251
|
-
this.displayText.set('');
|
|
8252
|
-
this.selectedItem.set(item);
|
|
8253
|
-
const text = this.formatService.format(this.textField(), 'string', item);
|
|
8254
|
-
this.displayText.set(text);
|
|
8255
|
-
this.setValue(item.id);
|
|
8256
|
-
// extract data from valueField and set context by expose path
|
|
8257
|
-
if (this.expose()) {
|
|
8258
|
-
if (typeof this.expose() == 'string') {
|
|
8259
|
-
this.contextService.update(this.expose(), item);
|
|
8260
|
-
}
|
|
8261
|
-
// support multiple expose items
|
|
8262
|
-
else if (Array.isArray(this.expose())) {
|
|
8263
|
-
this.expose().forEach((i) => {
|
|
8264
|
-
if (typeof i == 'string') {
|
|
8265
|
-
this.contextService.update(i, item);
|
|
8266
|
-
}
|
|
8267
|
-
else {
|
|
8268
|
-
// extract data from item by source path and set context by target path
|
|
8269
|
-
const key = get(item, i.source);
|
|
8270
|
-
this.contextService.update(i.target, key);
|
|
8271
|
-
}
|
|
8272
|
-
});
|
|
8273
|
-
}
|
|
8274
|
-
// extract data from item by source path and set context by target path
|
|
8275
|
-
else if (typeof this.expose() == 'object') {
|
|
8276
|
-
const i = this.expose();
|
|
8277
|
-
const key = get(item, i.source);
|
|
8278
|
-
this.contextService.update(i.target, key);
|
|
8279
|
-
}
|
|
8280
|
-
}
|
|
8281
|
-
}
|
|
8282
|
-
handleClearClick() {
|
|
8283
|
-
this.clear();
|
|
8284
|
-
}
|
|
8285
|
-
async searchByValue(value) {
|
|
8286
|
-
if (!this.entityDef())
|
|
8287
|
-
return null;
|
|
8288
|
-
const entity = this.entityDef();
|
|
8289
|
-
const searchFields = entity.properties.filter(p => p.options?.filter?.inline?.enabled);
|
|
8290
|
-
const inlineFilters = {
|
|
8291
|
-
field: null,
|
|
8292
|
-
logic: 'or',
|
|
8293
|
-
operator: null,
|
|
8294
|
-
filters: [],
|
|
8295
|
-
};
|
|
8296
|
-
if (value && searchFields.length > 0) {
|
|
8297
|
-
searchFields.forEach((p) => {
|
|
8298
|
-
inlineFilters.filters?.push({
|
|
8299
|
-
field: p.name,
|
|
8300
|
-
operator: { type: 'contains' },
|
|
8301
|
-
value,
|
|
8302
|
-
});
|
|
8303
|
-
});
|
|
8304
|
-
}
|
|
8305
|
-
const func = entity.queries.list?.execute;
|
|
8306
|
-
return await func({ filter: inlineFilters, take: 10 });
|
|
8307
|
-
}
|
|
8308
|
-
clear() {
|
|
8309
|
-
this.setValue(null);
|
|
8310
|
-
this.searchTerm.set('');
|
|
8311
|
-
this.selectedItem.set(null);
|
|
8312
|
-
}
|
|
8313
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXPLookupFilterWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
8314
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: AXPLookupFilterWidgetEditComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "textbox", first: true, predicate: AXTextBoxComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
8315
|
-
<ax-text-box
|
|
8316
|
-
[ngModel]="displayText()"
|
|
8317
|
-
(onValueChanged)="handleValueChange($event)"
|
|
8318
|
-
[placeholder]="placeholder()"
|
|
8319
|
-
(onKeyUp)="handleKeyDown($event)"
|
|
8320
|
-
(onBlur)="handleOnBlur($event)"
|
|
8321
|
-
>
|
|
8322
|
-
@for (validation of validationRules(); track $index) {
|
|
8323
|
-
<ax-validation-rule
|
|
8324
|
-
[rule]="validation.rule"
|
|
8325
|
-
[message]="validation.options?.message"
|
|
8326
|
-
[options]="validation.options"
|
|
8327
|
-
></ax-validation-rule>
|
|
8328
|
-
}
|
|
8329
|
-
<ax-clear-button (click)="handleClearClick()"></ax-clear-button>
|
|
8330
|
-
|
|
8331
|
-
<ax-suffix>
|
|
8332
|
-
<ax-button color="ghost" look="twotone" [disabled]="isLoading()" (onClick)="handleOnClick($event)">
|
|
8333
|
-
@if (isLoading()) {
|
|
8334
|
-
<ax-loading></ax-loading>
|
|
8335
|
-
} @else {
|
|
8336
|
-
<ax-icon icon="far fa-search"> </ax-icon>
|
|
8337
|
-
}
|
|
8338
|
-
</ax-button>
|
|
8339
|
-
</ax-suffix>
|
|
8340
|
-
</ax-text-box>
|
|
8341
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AXSelectBoxModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "component", type: i2$1.AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "mask-options", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i3.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3$2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3$2.AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "component", type: i3$2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i4.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "directive", type: i5$1.AXValidationRuleDirective, selector: "ax-validation-rule", inputs: ["rule", "options", "message", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
8342
|
-
}
|
|
8343
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: AXPLookupFilterWidgetEditComponent, decorators: [{
|
|
8344
|
-
type: Component,
|
|
8345
|
-
args: [{
|
|
8346
|
-
template: `
|
|
8347
|
-
<ax-text-box
|
|
8348
|
-
[ngModel]="displayText()"
|
|
8349
|
-
(onValueChanged)="handleValueChange($event)"
|
|
8350
|
-
[placeholder]="placeholder()"
|
|
8351
|
-
(onKeyUp)="handleKeyDown($event)"
|
|
8352
|
-
(onBlur)="handleOnBlur($event)"
|
|
8353
|
-
>
|
|
8354
|
-
@for (validation of validationRules(); track $index) {
|
|
8355
|
-
<ax-validation-rule
|
|
8356
|
-
[rule]="validation.rule"
|
|
8357
|
-
[message]="validation.options?.message"
|
|
8358
|
-
[options]="validation.options"
|
|
8359
|
-
></ax-validation-rule>
|
|
8360
|
-
}
|
|
8361
|
-
<ax-clear-button (click)="handleClearClick()"></ax-clear-button>
|
|
8362
|
-
|
|
8363
|
-
<ax-suffix>
|
|
8364
|
-
<ax-button color="ghost" look="twotone" [disabled]="isLoading()" (onClick)="handleOnClick($event)">
|
|
8365
|
-
@if (isLoading()) {
|
|
8366
|
-
<ax-loading></ax-loading>
|
|
8367
|
-
} @else {
|
|
8368
|
-
<ax-icon icon="far fa-search"> </ax-icon>
|
|
8369
|
-
}
|
|
8370
|
-
</ax-button>
|
|
8371
|
-
</ax-suffix>
|
|
8372
|
-
</ax-text-box>
|
|
8373
|
-
`,
|
|
8374
|
-
standalone: true,
|
|
8375
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8376
|
-
imports: [
|
|
8377
|
-
FormsModule,
|
|
8378
|
-
AXSelectBoxModule,
|
|
8379
|
-
AXTextBoxModule,
|
|
8380
|
-
AXButtonModule,
|
|
8381
|
-
AXDecoratorModule,
|
|
8382
|
-
AXLoadingModule,
|
|
8383
|
-
AXValidationModule,
|
|
8384
|
-
AXFormModule,
|
|
8385
|
-
],
|
|
8386
|
-
}]
|
|
8387
|
-
}], propDecorators: { textbox: [{
|
|
8388
|
-
type: ViewChild,
|
|
8389
|
-
args: [AXTextBoxComponent]
|
|
8390
|
-
}] } });
|
|
8391
|
-
|
|
8392
|
-
var lookupFilterWidgetEdit_component = /*#__PURE__*/Object.freeze({
|
|
8393
|
-
__proto__: null,
|
|
8394
|
-
AXPLookupFilterWidgetEditComponent: AXPLookupFilterWidgetEditComponent
|
|
8395
|
-
});
|
|
8396
|
-
|
|
8397
|
-
const AXPLookupFilterWidget = {
|
|
8398
|
-
name: 'lookup-filter',
|
|
8399
|
-
title: 'Lookup Filter',
|
|
8400
|
-
// categories: AXP_WIDGETS_FILTER_CATEGORY,
|
|
8401
|
-
type: 'filter',
|
|
8402
|
-
groups: [AXPWidgetGroupEnum.EntityWidget],
|
|
8403
|
-
icon: 'fa-light fa-square',
|
|
8404
|
-
properties: [AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY, AXP_DISABLED_PROPERTY],
|
|
8405
|
-
components: {
|
|
8406
|
-
edit: {
|
|
8407
|
-
component: () => Promise.resolve().then(function () { return lookupFilterWidgetEdit_component; }).then((c) => c.AXPLookupFilterWidgetEditComponent),
|
|
8408
|
-
},
|
|
8409
|
-
},
|
|
8410
|
-
};
|
|
8411
|
-
|
|
8412
8256
|
/**
|
|
8413
8257
|
* Generated bundle index. Do not edit.
|
|
8414
8258
|
*/
|