@smartbit4all/ng-client 3.0.10 → 3.0.12
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/esm2020/lib/smart-client/smart-component-api-client.mjs +12 -1
- package/esm2020/lib/smart-form/services/smartform.service.mjs +46 -36
- package/esm2020/lib/smart-form/smartform.form-model.mjs +1 -1
- package/esm2020/lib/smart-grid/models/model.mjs +1 -1
- package/esm2020/lib/smart-grid/smart-grid.component.mjs +39 -15
- package/esm2020/lib/smart-grid/smart-grid.service.mjs +3 -3
- package/fesm2015/smartbit4all-ng-client.mjs +98 -53
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +96 -51
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +1 -0
- package/lib/smart-form/services/smartform.service.d.ts +1 -0
- package/lib/smart-form/smartform.form-model.d.ts +4 -0
- package/lib/smart-grid/models/model.d.ts +1 -0
- package/lib/smart-grid/smart-grid.service.d.ts +1 -1
- package/package.json +1 -1
- package/smartbit4all-ng-client-3.0.12.tgz +0 -0
- package/smartbit4all-ng-client-3.0.10.tgz +0 -0
|
@@ -2932,37 +2932,7 @@ class SmartFormService {
|
|
|
2932
2932
|
widget.showLabel = true;
|
|
2933
2933
|
}
|
|
2934
2934
|
}
|
|
2935
|
-
|
|
2936
|
-
widget.type === SmartFormWidgetType.TEXT_FIELD) {
|
|
2937
|
-
if (widget.selection && smartForm.componentModel.valueSets) {
|
|
2938
|
-
if (widget.selection.type === SelectionDefinition.TypeEnum.Property &&
|
|
2939
|
-
!widget.selection.mapping.length) {
|
|
2940
|
-
let valueSetData = smartForm.componentModel.valueSets[widget.selection.valueSetName].valueSetData;
|
|
2941
|
-
widget.valueList = valueSetData.values.map((value) => {
|
|
2942
|
-
var _a, _b;
|
|
2943
|
-
return {
|
|
2944
|
-
key: value[valueSetData.keyProperty],
|
|
2945
|
-
label: value[(_b = (_a = widget.selection) === null || _a === void 0 ? void 0 : _a.displayProperty) !== null && _b !== void 0 ? _b : 'displayValue'],
|
|
2946
|
-
type: SmartFormWidgetType.ITEM,
|
|
2947
|
-
value: value[valueSetData.keyProperty],
|
|
2948
|
-
};
|
|
2949
|
-
});
|
|
2950
|
-
}
|
|
2951
|
-
else if (widget.selection.type === SelectionDefinition.TypeEnum.Object &&
|
|
2952
|
-
!widget.selection.mapping.length) {
|
|
2953
|
-
let valueSetData = smartForm.componentModel.valueSets[widget.selection.valueSetName].valueSetData;
|
|
2954
|
-
widget.valueList = valueSetData.values.map((value, index) => {
|
|
2955
|
-
var _a, _b;
|
|
2956
|
-
return {
|
|
2957
|
-
key: `${index}`,
|
|
2958
|
-
label: value[(_b = (_a = widget.selection) === null || _a === void 0 ? void 0 : _a.displayProperty) !== null && _b !== void 0 ? _b : 'displayValue'],
|
|
2959
|
-
type: SmartFormWidgetType.ITEM,
|
|
2960
|
-
value: value,
|
|
2961
|
-
};
|
|
2962
|
-
});
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
|
-
}
|
|
2935
|
+
this.copyFromValueSetToValuesList(widget, smartForm.componentModel.valueSets);
|
|
2966
2936
|
if (widget &&
|
|
2967
2937
|
widget.type === SmartFormWidgetType.CHECK_BOX &&
|
|
2968
2938
|
widget.valueList.length === 1) {
|
|
@@ -2978,17 +2948,57 @@ class SmartFormService {
|
|
|
2978
2948
|
let splittedKeys = key.split('.');
|
|
2979
2949
|
splittedKeys.splice(splittedKeys.length - 1, 1);
|
|
2980
2950
|
widget = this.findSmartFormWidgetByKey(smartForm.widgets, splittedKeys.join('.'));
|
|
2981
|
-
if (widget && widget.type === SmartFormWidgetType.CHECK_BOX_2
|
|
2982
|
-
widget
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2951
|
+
if (widget && widget.type === SmartFormWidgetType.CHECK_BOX_2) {
|
|
2952
|
+
this.copyFromValueSetToValuesList(widget, smartForm.componentModel.valueSets);
|
|
2953
|
+
if (widget.valueList) {
|
|
2954
|
+
widget.valueList = widget.valueList.map((item) => {
|
|
2955
|
+
let value = this.getValueDeeply(data, `${widget === null || widget === void 0 ? void 0 : widget.key}.${item.key}`);
|
|
2956
|
+
item.value = value;
|
|
2957
|
+
return item;
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2987
2960
|
}
|
|
2988
2961
|
}
|
|
2989
2962
|
}
|
|
2990
2963
|
}
|
|
2991
2964
|
}
|
|
2965
|
+
copyFromValueSetToValuesList(widget, valueSets) {
|
|
2966
|
+
if (widget.type === SmartFormWidgetType.SELECT ||
|
|
2967
|
+
widget.type === SmartFormWidgetType.SELECT_MULTIPLE ||
|
|
2968
|
+
widget.type === SmartFormWidgetType.RADIO_BUTTON ||
|
|
2969
|
+
widget.type === SmartFormWidgetType.CHECK_BOX ||
|
|
2970
|
+
widget.type === SmartFormWidgetType.CHECK_BOX_2 ||
|
|
2971
|
+
widget.type === SmartFormWidgetType.TEXT_FIELD) {
|
|
2972
|
+
if (widget.selection && valueSets) {
|
|
2973
|
+
if (widget.selection.type === SelectionDefinition.TypeEnum.Property &&
|
|
2974
|
+
!widget.selection.mapping.length) {
|
|
2975
|
+
let valueSetData = valueSets[widget.selection.valueSetName].valueSetData;
|
|
2976
|
+
widget.valueList = valueSetData.values.map((value) => {
|
|
2977
|
+
var _a, _b;
|
|
2978
|
+
return {
|
|
2979
|
+
key: value[valueSetData.keyProperty],
|
|
2980
|
+
label: value[(_b = (_a = widget.selection) === null || _a === void 0 ? void 0 : _a.displayProperty) !== null && _b !== void 0 ? _b : 'displayValue'],
|
|
2981
|
+
type: SmartFormWidgetType.ITEM,
|
|
2982
|
+
value: value[valueSetData.keyProperty],
|
|
2983
|
+
};
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
else if (widget.selection.type === SelectionDefinition.TypeEnum.Object &&
|
|
2987
|
+
!widget.selection.mapping.length) {
|
|
2988
|
+
let valueSetData = valueSets[widget.selection.valueSetName].valueSetData;
|
|
2989
|
+
widget.valueList = valueSetData.values.map((value, index) => {
|
|
2990
|
+
var _a, _b;
|
|
2991
|
+
return {
|
|
2992
|
+
key: `${index}`,
|
|
2993
|
+
label: value[(_b = (_a = widget.selection) === null || _a === void 0 ? void 0 : _a.displayProperty) !== null && _b !== void 0 ? _b : 'displayValue'],
|
|
2994
|
+
type: SmartFormWidgetType.ITEM,
|
|
2995
|
+
value: value,
|
|
2996
|
+
};
|
|
2997
|
+
});
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
2992
3002
|
toFormGroup() {
|
|
2993
3003
|
this.createFormControls(this.smartForm.widgets);
|
|
2994
3004
|
let formGroup = new FormGroup(this.group);
|
|
@@ -10409,12 +10419,12 @@ class SmartGridService extends SmartdialogService {
|
|
|
10409
10419
|
this.gridModelChanged.next();
|
|
10410
10420
|
}
|
|
10411
10421
|
updateGrid(gridModel, method) {
|
|
10422
|
+
this.gridModel = gridModel;
|
|
10412
10423
|
if (gridModel) {
|
|
10413
|
-
this.gridModel = gridModel;
|
|
10414
10424
|
this.gridModelChanged.next();
|
|
10415
10425
|
}
|
|
10416
10426
|
else {
|
|
10417
|
-
console.
|
|
10427
|
+
console.warn(`GridModel is undefined in service after ${method}!`);
|
|
10418
10428
|
}
|
|
10419
10429
|
}
|
|
10420
10430
|
}
|
|
@@ -11029,7 +11039,9 @@ class SmartGridComponent {
|
|
|
11029
11039
|
this.isBlocked = true;
|
|
11030
11040
|
this.service.gridModelChanged.subscribe(() => {
|
|
11031
11041
|
// called after every service call (load, save, refresh, etc.)
|
|
11032
|
-
|
|
11042
|
+
if (this.service.gridModel) {
|
|
11043
|
+
this.smartGrid.gridModel = this.service.gridModel;
|
|
11044
|
+
}
|
|
11033
11045
|
this.render();
|
|
11034
11046
|
});
|
|
11035
11047
|
}
|
|
@@ -11041,7 +11053,29 @@ class SmartGridComponent {
|
|
|
11041
11053
|
this.uuid = changes['uuid'].currentValue;
|
|
11042
11054
|
}
|
|
11043
11055
|
if (this.afterViewInitExecuted && this.uuid && this.smartGrid) {
|
|
11044
|
-
|
|
11056
|
+
if (changes['smartGrid']) {
|
|
11057
|
+
let prev = changes['smartGrid'].previousValue;
|
|
11058
|
+
let curr = changes['smartGrid'].currentValue;
|
|
11059
|
+
if (!prev.pageLoaded && curr.pageLoaded) {
|
|
11060
|
+
if (!this.service.gridModel) {
|
|
11061
|
+
// page just loaded, gridModel was empty
|
|
11062
|
+
this.refresh();
|
|
11063
|
+
} // otherwise gridModel already loaded
|
|
11064
|
+
}
|
|
11065
|
+
else if (prev.pageLoaded && !curr.pageLoaded) {
|
|
11066
|
+
// page change in progress
|
|
11067
|
+
// TODO a bit awkard to clear service.model from here..
|
|
11068
|
+
this.service.gridModel = undefined;
|
|
11069
|
+
// TODO call render to show grid placeholder?
|
|
11070
|
+
}
|
|
11071
|
+
else {
|
|
11072
|
+
// something else changed in smartGrid -> refresh
|
|
11073
|
+
this.refresh();
|
|
11074
|
+
}
|
|
11075
|
+
}
|
|
11076
|
+
else {
|
|
11077
|
+
this.refresh();
|
|
11078
|
+
}
|
|
11045
11079
|
}
|
|
11046
11080
|
}
|
|
11047
11081
|
ngOnDestroy() {
|
|
@@ -11054,7 +11088,7 @@ class SmartGridComponent {
|
|
|
11054
11088
|
this.service.gridModel = this.smartGrid.gridModel;
|
|
11055
11089
|
this.render();
|
|
11056
11090
|
}
|
|
11057
|
-
if (this.uuid && this.smartGrid && !this.
|
|
11091
|
+
else if (this.uuid && this.smartGrid && !this.service.gridModel) {
|
|
11058
11092
|
this.refresh();
|
|
11059
11093
|
}
|
|
11060
11094
|
this.afterViewInitExecuted = true;
|
|
@@ -11158,15 +11192,13 @@ class SmartGridComponent {
|
|
|
11158
11192
|
if (tableConfig.asyncOnExpand) {
|
|
11159
11193
|
tableConfig.rowExpander = this;
|
|
11160
11194
|
}
|
|
11161
|
-
const selectionMode = (_h = (_g = this.
|
|
11195
|
+
const selectionMode = (_h = (_g = this.smartGrid.gridModel.view) === null || _g === void 0 ? void 0 : _g.descriptor) === null || _h === void 0 ? void 0 : _h.selectionMode;
|
|
11162
11196
|
if (!tableConfig.selection &&
|
|
11163
11197
|
!tableConfig.selectionProperty &&
|
|
11164
11198
|
selectionMode !== GridSelectionMode.None) {
|
|
11165
11199
|
const isMultiple = selectionMode === GridSelectionMode.Multiple;
|
|
11166
11200
|
tableConfig.selectionProperty = 'id';
|
|
11167
|
-
const selectedIds = this.
|
|
11168
|
-
.rows.filter((gridRow) => gridRow.selected)
|
|
11169
|
-
.map((gridRow) => gridRow.id);
|
|
11201
|
+
const selectedIds = this.smartGrid.gridModel.page.rows.filter((gridRow) => gridRow.selected).map((gridRow) => gridRow.id);
|
|
11170
11202
|
tableConfig.selection = new SelectionModel(isMultiple, selectedIds);
|
|
11171
11203
|
}
|
|
11172
11204
|
this.smartTable = new SmartTable(tableConfig);
|
|
@@ -11279,8 +11311,8 @@ class SmartGridComponent {
|
|
|
11279
11311
|
filterExpressionOrderByItem.order === FilterExpressionOrderBy.OrderEnum.Asc
|
|
11280
11312
|
? SmartTableOrder.ASC
|
|
11281
11313
|
: SmartTableOrder.DESC;
|
|
11282
|
-
if (this.
|
|
11283
|
-
orderNumber = this.
|
|
11314
|
+
if (this.smartGrid.gridModel.view.orderByList.length > 1) {
|
|
11315
|
+
orderNumber = this.smartGrid.gridModel.view.orderByList.findIndex((filter) => filter.propertyName === descColumn.propertyName);
|
|
11284
11316
|
orderNumber++;
|
|
11285
11317
|
}
|
|
11286
11318
|
}
|
|
@@ -11423,10 +11455,12 @@ class SmartGridComponent {
|
|
|
11423
11455
|
var _a;
|
|
11424
11456
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11425
11457
|
this.isBlocked = true;
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11458
|
+
if (this.service.gridModel) {
|
|
11459
|
+
const row = (_a = this.service.gridModel.page.rows) === null || _a === void 0 ? void 0 : _a.find((gridRow) => gridRow.id === rowId);
|
|
11460
|
+
const viewContextChange = yield this.service.select(this.smartGrid, row);
|
|
11461
|
+
this.smartGrid.viewContextService.handleChanges(viewContextChange.changes);
|
|
11462
|
+
this.refresh();
|
|
11463
|
+
}
|
|
11430
11464
|
});
|
|
11431
11465
|
}
|
|
11432
11466
|
onSelectAll(selected) {
|
|
@@ -11448,7 +11482,7 @@ class SmartGridComponent {
|
|
|
11448
11482
|
config: {
|
|
11449
11483
|
uuid: this.uuid,
|
|
11450
11484
|
identifier: this.smartGrid.gridIdentifier,
|
|
11451
|
-
view: this.
|
|
11485
|
+
view: this.smartGrid.gridModel.view,
|
|
11452
11486
|
},
|
|
11453
11487
|
},
|
|
11454
11488
|
};
|
|
@@ -12441,6 +12475,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12441
12475
|
this.dataChanged = new SmartSubject(this._destroy$);
|
|
12442
12476
|
// Contained Widgets
|
|
12443
12477
|
this.widgets = new WidgetMap();
|
|
12478
|
+
this.smartGrids = new WidgetMap();
|
|
12444
12479
|
this.formWidgets = new WidgetMap();
|
|
12445
12480
|
this.detectChange.subscribe((change) => {
|
|
12446
12481
|
this.handleChanges(change);
|
|
@@ -12461,6 +12496,10 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12461
12496
|
this._uuid = uuid;
|
|
12462
12497
|
if (uuid) {
|
|
12463
12498
|
this.widgets.widgets.forEach((ref, key) => {
|
|
12499
|
+
let smartGrid = this.smartGrids.get(key);
|
|
12500
|
+
if (smartGrid) {
|
|
12501
|
+
smartGrid.pageLoaded = false;
|
|
12502
|
+
}
|
|
12464
12503
|
if (ref instanceof SmartGridComponent) {
|
|
12465
12504
|
ref.uuid = uuid;
|
|
12466
12505
|
}
|
|
@@ -12509,6 +12548,8 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12509
12548
|
_ngOnDestroy() {
|
|
12510
12549
|
this.viewContext.unfollow(this.uuid);
|
|
12511
12550
|
this.widgets.clearWidgets();
|
|
12551
|
+
this.smartGrids.clearWidgets();
|
|
12552
|
+
this.formWidgets.clearWidgets();
|
|
12512
12553
|
this._destroy$.next();
|
|
12513
12554
|
this._destroy$.complete();
|
|
12514
12555
|
}
|
|
@@ -12516,6 +12557,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12516
12557
|
this.initData();
|
|
12517
12558
|
this.initActions();
|
|
12518
12559
|
// TODO: layout, valueSet, widgets
|
|
12560
|
+
this.smartGrids.widgets.forEach((smartGrid) => {
|
|
12561
|
+
smartGrid.pageLoaded = true;
|
|
12562
|
+
});
|
|
12519
12563
|
}
|
|
12520
12564
|
initData() {
|
|
12521
12565
|
var _a, _b;
|
|
@@ -12611,6 +12655,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12611
12655
|
smartGrid.serviceToUse = this;
|
|
12612
12656
|
smartGrid.viewContextService = this.viewContext;
|
|
12613
12657
|
this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
|
|
12658
|
+
this.smartGrids.addWidget(smartGrid.gridIdentifier, smartGrid);
|
|
12614
12659
|
if (useAsDefaultGrid) {
|
|
12615
12660
|
this.smartGrid = smartGrid;
|
|
12616
12661
|
return this.smartGrid;
|