ngx-smz-ui 3.1.14 → 3.1.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/bundles/ngx-smz-ui.umd.js +118 -11
- package/bundles/ngx-smz-ui.umd.js.map +1 -1
- package/esm2015/lib/builders/smz-dialogs/dialog-input-conversion.js +5 -2
- package/esm2015/lib/common/utils/debounce-distinct.operator.js +42 -0
- package/esm2015/lib/modules/rbk-utils/misc/toast.service.js +62 -0
- package/esm2015/lib/modules/rbk-utils/ngx-rbk-utils.config.js +1 -1
- package/esm2015/lib/modules/rbk-utils/public-api.js +2 -1
- package/esm2015/lib/state/global/application/application.state.js +11 -11
- package/fesm2015/ngx-smz-ui.js +112 -12
- package/fesm2015/ngx-smz-ui.js.map +1 -1
- package/lib/builders/smz-dialogs/dialog-input-conversion.d.ts +3 -0
- package/lib/common/utils/debounce-distinct.operator.d.ts +3 -0
- package/lib/modules/rbk-utils/misc/toast.service.d.ts +18 -0
- package/lib/modules/rbk-utils/ngx-rbk-utils.config.d.ts +1 -0
- package/lib/modules/rbk-utils/public-api.d.ts +1 -0
- package/lib/state/global/application/application.state.d.ts +3 -3
- package/package.json +1 -1
|
@@ -10251,14 +10251,19 @@
|
|
|
10251
10251
|
}
|
|
10252
10252
|
|
|
10253
10253
|
function convertFormFeature(entityName, store, entity, options) {
|
|
10254
|
-
var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
|
|
10255
10254
|
if (entity === void 0) { entity = null; }
|
|
10256
10255
|
if (options === void 0) { options = null; }
|
|
10257
|
-
var _a, _b, _c;
|
|
10258
10256
|
var state = store.selectSnapshot(function (x) { return x.database['uiDefinitions']; });
|
|
10259
10257
|
var groups = entity != null ? lodashEs.cloneDeep(state.data[entityName].update) : lodashEs.cloneDeep(state.data[entityName].create);
|
|
10260
10258
|
if (groups == null)
|
|
10261
10259
|
throw new Error('UI definitions are empty. Were they manually loaded or set as required state?');
|
|
10260
|
+
return convertFormFeatureFromInputData(groups, entity, options, store);
|
|
10261
|
+
}
|
|
10262
|
+
function convertFormFeatureFromInputData(groups, entity, options, store) {
|
|
10263
|
+
var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
|
|
10264
|
+
if (entity === void 0) { entity = null; }
|
|
10265
|
+
if (options === void 0) { options = null; }
|
|
10266
|
+
var _a, _b, _c;
|
|
10262
10267
|
var form = {
|
|
10263
10268
|
groups: [],
|
|
10264
10269
|
behaviors: {}
|
|
@@ -13984,6 +13989,106 @@
|
|
|
13984
13989
|
return HttpErrorHandler;
|
|
13985
13990
|
}());
|
|
13986
13991
|
|
|
13992
|
+
function debounceDistinctMessage(delay) {
|
|
13993
|
+
return function (source) {
|
|
13994
|
+
return new rxjs.Observable(function (subscriber) {
|
|
13995
|
+
var hasValue = false;
|
|
13996
|
+
var lastValue = null;
|
|
13997
|
+
var durationSub = null;
|
|
13998
|
+
var emit = function () {
|
|
13999
|
+
durationSub === null || durationSub === void 0 ? void 0 : durationSub.unsubscribe();
|
|
14000
|
+
durationSub = null;
|
|
14001
|
+
if (hasValue) {
|
|
14002
|
+
// We have a value! Free up memory first, then emit the value.
|
|
14003
|
+
hasValue = false;
|
|
14004
|
+
var value = lastValue;
|
|
14005
|
+
lastValue = null;
|
|
14006
|
+
subscriber.next(value);
|
|
14007
|
+
}
|
|
14008
|
+
};
|
|
14009
|
+
return source.subscribe(function (value) {
|
|
14010
|
+
// new value received cancel timer
|
|
14011
|
+
durationSub === null || durationSub === void 0 ? void 0 : durationSub.unsubscribe();
|
|
14012
|
+
// emit lastValue if the value has changed
|
|
14013
|
+
if (hasValue && (value === null || value === void 0 ? void 0 : value.detail) !== (lastValue === null || lastValue === void 0 ? void 0 : lastValue.detail)) {
|
|
14014
|
+
var value_1 = lastValue;
|
|
14015
|
+
subscriber.next(value_1);
|
|
14016
|
+
}
|
|
14017
|
+
hasValue = true;
|
|
14018
|
+
lastValue = value;
|
|
14019
|
+
// restart timer
|
|
14020
|
+
durationSub = rxjs.timer(delay).subscribe(function () {
|
|
14021
|
+
emit();
|
|
14022
|
+
});
|
|
14023
|
+
}, function (error) {
|
|
14024
|
+
}, function () {
|
|
14025
|
+
emit();
|
|
14026
|
+
subscriber.complete();
|
|
14027
|
+
lastValue = null;
|
|
14028
|
+
});
|
|
14029
|
+
});
|
|
14030
|
+
};
|
|
14031
|
+
}
|
|
14032
|
+
|
|
14033
|
+
var ToastService = /** @class */ (function () {
|
|
14034
|
+
function ToastService(messageService, config, appRef) {
|
|
14035
|
+
// if (this.config.toastConfig == null || this.config.toastConfig.debounceDistinctDelay == null) {
|
|
14036
|
+
// throw Error('You need to set the \'debounceDistinctDelay\' at rbkconfig.toastConfig.');
|
|
14037
|
+
// }
|
|
14038
|
+
this.messageService = messageService;
|
|
14039
|
+
this.config = config;
|
|
14040
|
+
this.appRef = appRef;
|
|
14041
|
+
this.messages$ = new rxjs.BehaviorSubject(null);
|
|
14042
|
+
if (this.config.toastConfig.debounceDistinctDelay != null) {
|
|
14043
|
+
this.watch();
|
|
14044
|
+
}
|
|
14045
|
+
}
|
|
14046
|
+
ToastService.prototype.add = function (message) {
|
|
14047
|
+
if (this.config.toastConfig.debounceDistinctDelay != null) {
|
|
14048
|
+
this.messages$.next(message);
|
|
14049
|
+
}
|
|
14050
|
+
else {
|
|
14051
|
+
this.messageService.add(message);
|
|
14052
|
+
this.appRef.tick();
|
|
14053
|
+
}
|
|
14054
|
+
};
|
|
14055
|
+
ToastService.prototype.watch = function () {
|
|
14056
|
+
var _this = this;
|
|
14057
|
+
this.messages$
|
|
14058
|
+
.pipe(debounceDistinctMessage(this.config.toastConfig.debounceDistinctDelay))
|
|
14059
|
+
.subscribe(function (message) {
|
|
14060
|
+
_this.messageService.add(message);
|
|
14061
|
+
_this.appRef.tick();
|
|
14062
|
+
});
|
|
14063
|
+
};
|
|
14064
|
+
ToastService.prototype.test = function () {
|
|
14065
|
+
var _this = this;
|
|
14066
|
+
var messages = [
|
|
14067
|
+
{ severity: 'error', detail: 'message' },
|
|
14068
|
+
{ severity: 'error', detail: 'message' },
|
|
14069
|
+
{ severity: 'error', detail: 'message' },
|
|
14070
|
+
{ severity: 'error', detail: 'other' },
|
|
14071
|
+
{ severity: 'error', detail: 'message' },
|
|
14072
|
+
{ severity: 'error', detail: 'message' },
|
|
14073
|
+
];
|
|
14074
|
+
var index = 0;
|
|
14075
|
+
var timer = setInterval(function () {
|
|
14076
|
+
if (index === messages.length - 1) {
|
|
14077
|
+
clearInterval(timer);
|
|
14078
|
+
}
|
|
14079
|
+
_this.add(messages[index]);
|
|
14080
|
+
index++;
|
|
14081
|
+
}, 50);
|
|
14082
|
+
};
|
|
14083
|
+
return ToastService;
|
|
14084
|
+
}());
|
|
14085
|
+
ToastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ToastService, deps: [{ token: i1__namespace$6.MessageService }, { token: NgxRbkUtilsConfig }, { token: i0__namespace.ApplicationRef }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
14086
|
+
ToastService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ToastService, providedIn: 'root' });
|
|
14087
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: ToastService, decorators: [{
|
|
14088
|
+
type: i0.Injectable,
|
|
14089
|
+
args: [{ providedIn: 'root' }]
|
|
14090
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$6.MessageService }, { type: NgxRbkUtilsConfig }, { type: i0__namespace.ApplicationRef }]; } });
|
|
14091
|
+
|
|
13987
14092
|
// Initial application state, to be used ONLY when the application is starting
|
|
13988
14093
|
var getInitialApplicationState = function () { return ({
|
|
13989
14094
|
globalIsLoading: false,
|
|
@@ -14012,8 +14117,8 @@
|
|
|
14012
14117
|
// Do not remove the @dynamic flag, it's not a comment, it an Angular flag!
|
|
14013
14118
|
// @dynamic
|
|
14014
14119
|
exports.ApplicationState = /** @class */ (function () {
|
|
14015
|
-
function ApplicationState(
|
|
14016
|
-
this.
|
|
14120
|
+
function ApplicationState(toastService, rbkConfig) {
|
|
14121
|
+
this.toastService = toastService;
|
|
14017
14122
|
this.rbkConfig = rbkConfig;
|
|
14018
14123
|
}
|
|
14019
14124
|
ApplicationState.prototype.handleErrorWithDialog$ = function (ctx, action) {
|
|
@@ -14108,27 +14213,27 @@
|
|
|
14108
14213
|
};
|
|
14109
14214
|
ApplicationState.prototype.showToastMessage = function (ctx, action) {
|
|
14110
14215
|
var message = Object.assign(Object.assign({}, this.rbkConfig.toastConfig), action.message);
|
|
14111
|
-
this.
|
|
14216
|
+
this.toastService.add(message);
|
|
14112
14217
|
};
|
|
14113
14218
|
ApplicationState.prototype.showToastSuccessMessage = function (ctx, action) {
|
|
14114
14219
|
var _a;
|
|
14115
14220
|
var message = Object.assign(Object.assign({}, this.rbkConfig.toastConfig), { severity: 'success', summary: (_a = action.title) !== null && _a !== void 0 ? _a : this.rbkConfig.toastConfig.successTitle, detail: action.message });
|
|
14116
|
-
this.
|
|
14221
|
+
this.toastService.add(message);
|
|
14117
14222
|
};
|
|
14118
14223
|
ApplicationState.prototype.showToastErrorMessage = function (ctx, action) {
|
|
14119
14224
|
var _a;
|
|
14120
14225
|
var message = Object.assign(Object.assign({}, this.rbkConfig.toastConfig), { severity: 'error', summary: (_a = action.title) !== null && _a !== void 0 ? _a : this.rbkConfig.toastConfig.errorTitle, detail: action.message });
|
|
14121
|
-
this.
|
|
14226
|
+
this.toastService.add(message);
|
|
14122
14227
|
};
|
|
14123
14228
|
ApplicationState.prototype.showToastInfoMessage = function (ctx, action) {
|
|
14124
14229
|
var _a;
|
|
14125
14230
|
var message = Object.assign(Object.assign({}, this.rbkConfig.toastConfig), { severity: 'info', summary: (_a = action.title) !== null && _a !== void 0 ? _a : this.rbkConfig.toastConfig.infoTitle, detail: action.message });
|
|
14126
|
-
this.
|
|
14231
|
+
this.toastService.add(message);
|
|
14127
14232
|
};
|
|
14128
14233
|
ApplicationState.prototype.showToastWarningMessage = function (ctx, action) {
|
|
14129
14234
|
var _a;
|
|
14130
14235
|
var message = Object.assign(Object.assign({}, this.rbkConfig.toastConfig), { severity: 'warn', summary: (_a = action.title) !== null && _a !== void 0 ? _a : this.rbkConfig.toastConfig.warningTitle, detail: action.message });
|
|
14131
|
-
this.
|
|
14236
|
+
this.toastService.add(message);
|
|
14132
14237
|
};
|
|
14133
14238
|
ApplicationState.prototype.setRequiredDatabaseActions = function (ctx) {
|
|
14134
14239
|
ctx.patchState({
|
|
@@ -14157,7 +14262,7 @@
|
|
|
14157
14262
|
};
|
|
14158
14263
|
return ApplicationState;
|
|
14159
14264
|
}());
|
|
14160
|
-
exports.ApplicationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: exports.ApplicationState, deps: [{ token:
|
|
14265
|
+
exports.ApplicationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: exports.ApplicationState, deps: [{ token: ToastService }, { token: NgxRbkUtilsConfig }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
14161
14266
|
exports.ApplicationState.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: exports.ApplicationState });
|
|
14162
14267
|
__decorate([
|
|
14163
14268
|
i1$5.Action(exports.ApplicationActions.HandleHttpErrorWithDialog)
|
|
@@ -14218,7 +14323,7 @@
|
|
|
14218
14323
|
], exports.ApplicationState);
|
|
14219
14324
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: exports.ApplicationState, decorators: [{
|
|
14220
14325
|
type: i0.Injectable
|
|
14221
|
-
}], ctorParameters: function () { return [{ type:
|
|
14326
|
+
}], ctorParameters: function () { return [{ type: ToastService }, { type: NgxRbkUtilsConfig }]; }, propDecorators: { handleErrorWithDialog$: [], handleErrorWithToast$: [], startLoading$: [], stopLoading$: [], pushLocalLoading$: [], popLocalLoading$: [], logout: [], showToastMessage: [], showToastSuccessMessage: [], showToastErrorMessage: [], showToastInfoMessage: [], showToastWarningMessage: [], setRequiredDatabaseActions: [], setLogInfo: [], setArea: [], setExtraData: [], setApplicationAreaAndExtraData: [] } });
|
|
14222
14327
|
|
|
14223
14328
|
var ApplicationSelectors = /** @class */ (function () {
|
|
14224
14329
|
function ApplicationSelectors() {
|
|
@@ -22381,6 +22486,7 @@
|
|
|
22381
22486
|
exports.TableClearExtensionDirective = TableClearExtensionDirective;
|
|
22382
22487
|
exports.ThemeManagerService = ThemeManagerService;
|
|
22383
22488
|
exports.TitleService = TitleService;
|
|
22489
|
+
exports.ToastService = ToastService;
|
|
22384
22490
|
exports.TooltipTouchSupportDirective = TooltipTouchSupportDirective;
|
|
22385
22491
|
exports.UI_DEFINITIONS_STATE_NAME = UI_DEFINITIONS_STATE_NAME;
|
|
22386
22492
|
exports.UiDefinitionsDbSelectors = UiDefinitionsDbSelectors;
|
|
@@ -22393,6 +22499,7 @@
|
|
|
22393
22499
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
22394
22500
|
exports.clearArray = clearArray;
|
|
22395
22501
|
exports.convertFormFeature = convertFormFeature;
|
|
22502
|
+
exports.convertFormFeatureFromInputData = convertFormFeatureFromInputData;
|
|
22396
22503
|
exports.count = count;
|
|
22397
22504
|
exports.createRound = createRound;
|
|
22398
22505
|
exports.deepClone = deepClone;
|