@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
|
@@ -3048,35 +3048,7 @@ class SmartFormService {
|
|
|
3048
3048
|
widget.showLabel = true;
|
|
3049
3049
|
}
|
|
3050
3050
|
}
|
|
3051
|
-
|
|
3052
|
-
widget.type === SmartFormWidgetType.TEXT_FIELD) {
|
|
3053
|
-
if (widget.selection && smartForm.componentModel.valueSets) {
|
|
3054
|
-
if (widget.selection.type === SelectionDefinition.TypeEnum.Property &&
|
|
3055
|
-
!widget.selection.mapping.length) {
|
|
3056
|
-
let valueSetData = smartForm.componentModel.valueSets[widget.selection.valueSetName].valueSetData;
|
|
3057
|
-
widget.valueList = valueSetData.values.map((value) => {
|
|
3058
|
-
return {
|
|
3059
|
-
key: value[valueSetData.keyProperty],
|
|
3060
|
-
label: value[widget.selection?.displayProperty ?? 'displayValue'],
|
|
3061
|
-
type: SmartFormWidgetType.ITEM,
|
|
3062
|
-
value: value[valueSetData.keyProperty],
|
|
3063
|
-
};
|
|
3064
|
-
});
|
|
3065
|
-
}
|
|
3066
|
-
else if (widget.selection.type === SelectionDefinition.TypeEnum.Object &&
|
|
3067
|
-
!widget.selection.mapping.length) {
|
|
3068
|
-
let valueSetData = smartForm.componentModel.valueSets[widget.selection.valueSetName].valueSetData;
|
|
3069
|
-
widget.valueList = valueSetData.values.map((value, index) => {
|
|
3070
|
-
return {
|
|
3071
|
-
key: `${index}`,
|
|
3072
|
-
label: value[widget.selection?.displayProperty ?? 'displayValue'],
|
|
3073
|
-
type: SmartFormWidgetType.ITEM,
|
|
3074
|
-
value: value,
|
|
3075
|
-
};
|
|
3076
|
-
});
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3051
|
+
this.copyFromValueSetToValuesList(widget, smartForm.componentModel.valueSets);
|
|
3080
3052
|
if (widget &&
|
|
3081
3053
|
widget.type === SmartFormWidgetType.CHECK_BOX &&
|
|
3082
3054
|
widget.valueList.length === 1) {
|
|
@@ -3092,17 +3064,55 @@ class SmartFormService {
|
|
|
3092
3064
|
let splittedKeys = key.split('.');
|
|
3093
3065
|
splittedKeys.splice(splittedKeys.length - 1, 1);
|
|
3094
3066
|
widget = this.findSmartFormWidgetByKey(smartForm.widgets, splittedKeys.join('.'));
|
|
3095
|
-
if (widget && widget.type === SmartFormWidgetType.CHECK_BOX_2
|
|
3096
|
-
widget
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3067
|
+
if (widget && widget.type === SmartFormWidgetType.CHECK_BOX_2) {
|
|
3068
|
+
this.copyFromValueSetToValuesList(widget, smartForm.componentModel.valueSets);
|
|
3069
|
+
if (widget.valueList) {
|
|
3070
|
+
widget.valueList = widget.valueList.map((item) => {
|
|
3071
|
+
let value = this.getValueDeeply(data, `${widget?.key}.${item.key}`);
|
|
3072
|
+
item.value = value;
|
|
3073
|
+
return item;
|
|
3074
|
+
});
|
|
3075
|
+
}
|
|
3101
3076
|
}
|
|
3102
3077
|
}
|
|
3103
3078
|
}
|
|
3104
3079
|
}
|
|
3105
3080
|
}
|
|
3081
|
+
copyFromValueSetToValuesList(widget, valueSets) {
|
|
3082
|
+
if (widget.type === SmartFormWidgetType.SELECT ||
|
|
3083
|
+
widget.type === SmartFormWidgetType.SELECT_MULTIPLE ||
|
|
3084
|
+
widget.type === SmartFormWidgetType.RADIO_BUTTON ||
|
|
3085
|
+
widget.type === SmartFormWidgetType.CHECK_BOX ||
|
|
3086
|
+
widget.type === SmartFormWidgetType.CHECK_BOX_2 ||
|
|
3087
|
+
widget.type === SmartFormWidgetType.TEXT_FIELD) {
|
|
3088
|
+
if (widget.selection && valueSets) {
|
|
3089
|
+
if (widget.selection.type === SelectionDefinition.TypeEnum.Property &&
|
|
3090
|
+
!widget.selection.mapping.length) {
|
|
3091
|
+
let valueSetData = valueSets[widget.selection.valueSetName].valueSetData;
|
|
3092
|
+
widget.valueList = valueSetData.values.map((value) => {
|
|
3093
|
+
return {
|
|
3094
|
+
key: value[valueSetData.keyProperty],
|
|
3095
|
+
label: value[widget.selection?.displayProperty ?? 'displayValue'],
|
|
3096
|
+
type: SmartFormWidgetType.ITEM,
|
|
3097
|
+
value: value[valueSetData.keyProperty],
|
|
3098
|
+
};
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
else if (widget.selection.type === SelectionDefinition.TypeEnum.Object &&
|
|
3102
|
+
!widget.selection.mapping.length) {
|
|
3103
|
+
let valueSetData = valueSets[widget.selection.valueSetName].valueSetData;
|
|
3104
|
+
widget.valueList = valueSetData.values.map((value, index) => {
|
|
3105
|
+
return {
|
|
3106
|
+
key: `${index}`,
|
|
3107
|
+
label: value[widget.selection?.displayProperty ?? 'displayValue'],
|
|
3108
|
+
type: SmartFormWidgetType.ITEM,
|
|
3109
|
+
value: value,
|
|
3110
|
+
};
|
|
3111
|
+
});
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3106
3116
|
toFormGroup() {
|
|
3107
3117
|
this.createFormControls(this.smartForm.widgets);
|
|
3108
3118
|
let formGroup = new FormGroup(this.group);
|
|
@@ -10328,12 +10338,12 @@ class SmartGridService extends SmartdialogService {
|
|
|
10328
10338
|
this.gridModelChanged.next();
|
|
10329
10339
|
}
|
|
10330
10340
|
updateGrid(gridModel, method) {
|
|
10341
|
+
this.gridModel = gridModel;
|
|
10331
10342
|
if (gridModel) {
|
|
10332
|
-
this.gridModel = gridModel;
|
|
10333
10343
|
this.gridModelChanged.next();
|
|
10334
10344
|
}
|
|
10335
10345
|
else {
|
|
10336
|
-
console.
|
|
10346
|
+
console.warn(`GridModel is undefined in service after ${method}!`);
|
|
10337
10347
|
}
|
|
10338
10348
|
}
|
|
10339
10349
|
}
|
|
@@ -10941,7 +10951,9 @@ class SmartGridComponent {
|
|
|
10941
10951
|
this.isBlocked = true;
|
|
10942
10952
|
this.service.gridModelChanged.subscribe(() => {
|
|
10943
10953
|
// called after every service call (load, save, refresh, etc.)
|
|
10944
|
-
|
|
10954
|
+
if (this.service.gridModel) {
|
|
10955
|
+
this.smartGrid.gridModel = this.service.gridModel;
|
|
10956
|
+
}
|
|
10945
10957
|
this.render();
|
|
10946
10958
|
});
|
|
10947
10959
|
}
|
|
@@ -10953,7 +10965,29 @@ class SmartGridComponent {
|
|
|
10953
10965
|
this.uuid = changes['uuid'].currentValue;
|
|
10954
10966
|
}
|
|
10955
10967
|
if (this.afterViewInitExecuted && this.uuid && this.smartGrid) {
|
|
10956
|
-
|
|
10968
|
+
if (changes['smartGrid']) {
|
|
10969
|
+
let prev = changes['smartGrid'].previousValue;
|
|
10970
|
+
let curr = changes['smartGrid'].currentValue;
|
|
10971
|
+
if (!prev.pageLoaded && curr.pageLoaded) {
|
|
10972
|
+
if (!this.service.gridModel) {
|
|
10973
|
+
// page just loaded, gridModel was empty
|
|
10974
|
+
this.refresh();
|
|
10975
|
+
} // otherwise gridModel already loaded
|
|
10976
|
+
}
|
|
10977
|
+
else if (prev.pageLoaded && !curr.pageLoaded) {
|
|
10978
|
+
// page change in progress
|
|
10979
|
+
// TODO a bit awkard to clear service.model from here..
|
|
10980
|
+
this.service.gridModel = undefined;
|
|
10981
|
+
// TODO call render to show grid placeholder?
|
|
10982
|
+
}
|
|
10983
|
+
else {
|
|
10984
|
+
// something else changed in smartGrid -> refresh
|
|
10985
|
+
this.refresh();
|
|
10986
|
+
}
|
|
10987
|
+
}
|
|
10988
|
+
else {
|
|
10989
|
+
this.refresh();
|
|
10990
|
+
}
|
|
10957
10991
|
}
|
|
10958
10992
|
}
|
|
10959
10993
|
ngOnDestroy() {
|
|
@@ -10966,7 +11000,7 @@ class SmartGridComponent {
|
|
|
10966
11000
|
this.service.gridModel = this.smartGrid.gridModel;
|
|
10967
11001
|
this.render();
|
|
10968
11002
|
}
|
|
10969
|
-
if (this.uuid && this.smartGrid && !this.
|
|
11003
|
+
else if (this.uuid && this.smartGrid && !this.service.gridModel) {
|
|
10970
11004
|
this.refresh();
|
|
10971
11005
|
}
|
|
10972
11006
|
this.afterViewInitExecuted = true;
|
|
@@ -11072,15 +11106,13 @@ class SmartGridComponent {
|
|
|
11072
11106
|
if (tableConfig.asyncOnExpand) {
|
|
11073
11107
|
tableConfig.rowExpander = this;
|
|
11074
11108
|
}
|
|
11075
|
-
const selectionMode = this.
|
|
11109
|
+
const selectionMode = this.smartGrid.gridModel.view?.descriptor?.selectionMode;
|
|
11076
11110
|
if (!tableConfig.selection &&
|
|
11077
11111
|
!tableConfig.selectionProperty &&
|
|
11078
11112
|
selectionMode !== GridSelectionMode.None) {
|
|
11079
11113
|
const isMultiple = selectionMode === GridSelectionMode.Multiple;
|
|
11080
11114
|
tableConfig.selectionProperty = 'id';
|
|
11081
|
-
const selectedIds = this.
|
|
11082
|
-
.rows.filter((gridRow) => gridRow.selected)
|
|
11083
|
-
.map((gridRow) => gridRow.id);
|
|
11115
|
+
const selectedIds = this.smartGrid.gridModel.page.rows.filter((gridRow) => gridRow.selected).map((gridRow) => gridRow.id);
|
|
11084
11116
|
tableConfig.selection = new SelectionModel(isMultiple, selectedIds);
|
|
11085
11117
|
}
|
|
11086
11118
|
this.smartTable = new SmartTable(tableConfig);
|
|
@@ -11187,8 +11219,8 @@ class SmartGridComponent {
|
|
|
11187
11219
|
filterExpressionOrderByItem.order === FilterExpressionOrderBy.OrderEnum.Asc
|
|
11188
11220
|
? SmartTableOrder.ASC
|
|
11189
11221
|
: SmartTableOrder.DESC;
|
|
11190
|
-
if (this.
|
|
11191
|
-
orderNumber = this.
|
|
11222
|
+
if (this.smartGrid.gridModel.view.orderByList.length > 1) {
|
|
11223
|
+
orderNumber = this.smartGrid.gridModel.view.orderByList.findIndex((filter) => filter.propertyName === descColumn.propertyName);
|
|
11192
11224
|
orderNumber++;
|
|
11193
11225
|
}
|
|
11194
11226
|
}
|
|
@@ -11330,10 +11362,12 @@ class SmartGridComponent {
|
|
|
11330
11362
|
}
|
|
11331
11363
|
async onSelect(rowId) {
|
|
11332
11364
|
this.isBlocked = true;
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11365
|
+
if (this.service.gridModel) {
|
|
11366
|
+
const row = this.service.gridModel.page.rows?.find((gridRow) => gridRow.id === rowId);
|
|
11367
|
+
const viewContextChange = await this.service.select(this.smartGrid, row);
|
|
11368
|
+
this.smartGrid.viewContextService.handleChanges(viewContextChange.changes);
|
|
11369
|
+
this.refresh();
|
|
11370
|
+
}
|
|
11337
11371
|
}
|
|
11338
11372
|
async onSelectAll(selected) {
|
|
11339
11373
|
this.isBlocked = true;
|
|
@@ -11352,7 +11386,7 @@ class SmartGridComponent {
|
|
|
11352
11386
|
config: {
|
|
11353
11387
|
uuid: this.uuid,
|
|
11354
11388
|
identifier: this.smartGrid.gridIdentifier,
|
|
11355
|
-
view: this.
|
|
11389
|
+
view: this.smartGrid.gridModel.view,
|
|
11356
11390
|
},
|
|
11357
11391
|
},
|
|
11358
11392
|
};
|
|
@@ -12328,6 +12362,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12328
12362
|
this.dataChanged = new SmartSubject(this._destroy$);
|
|
12329
12363
|
// Contained Widgets
|
|
12330
12364
|
this.widgets = new WidgetMap();
|
|
12365
|
+
this.smartGrids = new WidgetMap();
|
|
12331
12366
|
this.formWidgets = new WidgetMap();
|
|
12332
12367
|
this.detectChange.subscribe((change) => {
|
|
12333
12368
|
this.handleChanges(change);
|
|
@@ -12348,6 +12383,10 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12348
12383
|
this._uuid = uuid;
|
|
12349
12384
|
if (uuid) {
|
|
12350
12385
|
this.widgets.widgets.forEach((ref, key) => {
|
|
12386
|
+
let smartGrid = this.smartGrids.get(key);
|
|
12387
|
+
if (smartGrid) {
|
|
12388
|
+
smartGrid.pageLoaded = false;
|
|
12389
|
+
}
|
|
12351
12390
|
if (ref instanceof SmartGridComponent) {
|
|
12352
12391
|
ref.uuid = uuid;
|
|
12353
12392
|
}
|
|
@@ -12396,6 +12435,8 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12396
12435
|
_ngOnDestroy() {
|
|
12397
12436
|
this.viewContext.unfollow(this.uuid);
|
|
12398
12437
|
this.widgets.clearWidgets();
|
|
12438
|
+
this.smartGrids.clearWidgets();
|
|
12439
|
+
this.formWidgets.clearWidgets();
|
|
12399
12440
|
this._destroy$.next();
|
|
12400
12441
|
this._destroy$.complete();
|
|
12401
12442
|
}
|
|
@@ -12403,6 +12444,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12403
12444
|
this.initData();
|
|
12404
12445
|
this.initActions();
|
|
12405
12446
|
// TODO: layout, valueSet, widgets
|
|
12447
|
+
this.smartGrids.widgets.forEach((smartGrid) => {
|
|
12448
|
+
smartGrid.pageLoaded = true;
|
|
12449
|
+
});
|
|
12406
12450
|
}
|
|
12407
12451
|
initData() {
|
|
12408
12452
|
if (this.model?.data) {
|
|
@@ -12491,6 +12535,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
12491
12535
|
smartGrid.serviceToUse = this;
|
|
12492
12536
|
smartGrid.viewContextService = this.viewContext;
|
|
12493
12537
|
this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
|
|
12538
|
+
this.smartGrids.addWidget(smartGrid.gridIdentifier, smartGrid);
|
|
12494
12539
|
if (useAsDefaultGrid) {
|
|
12495
12540
|
this.smartGrid = smartGrid;
|
|
12496
12541
|
return this.smartGrid;
|