@trudb/tru-common-lib 0.0.179 → 0.0.181

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.
@@ -2960,7 +2960,13 @@ TruToolbarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
2960
2960
  TruToolbarDropdownModule,
2961
2961
  TruToolbarSeparatorModule,
2962
2962
  TruToolbarContextFilterModule,
2963
- TruToolbarTextModule], exports: [TruToolbar] });
2963
+ TruToolbarTextModule], exports: [TruToolbar,
2964
+ TruToolbarMenuModule,
2965
+ TruToolbarButtonModule,
2966
+ TruToolbarDropdownModule,
2967
+ TruToolbarSeparatorModule,
2968
+ TruToolbarContextFilterModule,
2969
+ TruToolbarTextModule] });
2964
2970
  TruToolbarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruToolbarModule, imports: [CommonModule,
2965
2971
  FormsModule,
2966
2972
  TruToolbarMenuModule,
@@ -2968,6 +2974,11 @@ TruToolbarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", versio
2968
2974
  TruToolbarDropdownModule,
2969
2975
  TruToolbarSeparatorModule,
2970
2976
  TruToolbarContextFilterModule,
2977
+ TruToolbarTextModule, TruToolbarMenuModule,
2978
+ TruToolbarButtonModule,
2979
+ TruToolbarDropdownModule,
2980
+ TruToolbarSeparatorModule,
2981
+ TruToolbarContextFilterModule,
2971
2982
  TruToolbarTextModule] });
2972
2983
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruToolbarModule, decorators: [{
2973
2984
  type: NgModule,
@@ -2983,7 +2994,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
2983
2994
  TruToolbarContextFilterModule,
2984
2995
  TruToolbarTextModule
2985
2996
  ],
2986
- exports: [TruToolbar]
2997
+ exports: [TruToolbar,
2998
+ TruToolbarMenuModule,
2999
+ TruToolbarButtonModule,
3000
+ TruToolbarDropdownModule,
3001
+ TruToolbarSeparatorModule,
3002
+ TruToolbarContextFilterModule,
3003
+ TruToolbarTextModule
3004
+ ]
2987
3005
  }]
2988
3006
  }] });
2989
3007
 
@@ -3205,6 +3223,198 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
3205
3223
  }]
3206
3224
  }] });
3207
3225
 
3226
+ class PredicateMap {
3227
+ constructor() { }
3228
+ }
3229
+ PredicateMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: PredicateMap, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3230
+ PredicateMap.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: PredicateMap });
3231
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: PredicateMap, decorators: [{
3232
+ type: Injectable
3233
+ }], ctorParameters: function () { return []; } });
3234
+
3235
+ class TruTextManager {
3236
+ constructor() {
3237
+ /**
3238
+ * If text.length exceeds length, then returns a string that is the first length chars
3239
+ * of text plus suffix. Otherwise, returns text.
3240
+ * @param {string} text
3241
+ * @param {number} length
3242
+ * @param {string} suffix
3243
+ * @return {string}
3244
+ */
3245
+ this.truncate = (text, length, suffix) => {
3246
+ return text.length > length ? text.substr(0, length) + suffix : text.toString();
3247
+ };
3248
+ this.isMac = () => {
3249
+ return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
3250
+ };
3251
+ /**
3252
+ * Formats the text to use for the window title.
3253
+ * @param {string} text
3254
+ * @return {string} - Window title.
3255
+ */
3256
+ this.formatWindowTitle = (text) => {
3257
+ return this.truncate(text, 60, '...');
3258
+ };
3259
+ /**
3260
+ * Returns a message indicating that an entity or entities were deleted in another view.
3261
+ * @param {string} entityTypeLabel - Description of the entity type.
3262
+ * @param [{string}] entityTypePluralLabel - Description of more than one of the entity type.
3263
+ * @param [{number}] count - Number of entities.
3264
+ */
3265
+ this.fmtEntityDeletedInOtherView = (entityTypeLabel, entityTypePluralLabel, count) => {
3266
+ if (!count || count === 1)
3267
+ return entityTypeLabel + ' deleted in another view';
3268
+ return count + ' ' + entityTypePluralLabel + ' deleted in another view';
3269
+ };
3270
+ /**
3271
+ * Returns a message used to confirm deletion of an entity or entities.
3272
+ * @param {string} entityTypeLabel - Description of the entity type.
3273
+ * @param [{string}] entityTypePluralLabel - Description of more than one of the entity type.
3274
+ * @param [{number}] count - Number of entities.
3275
+ */
3276
+ this.fmtDeleteConfirmation = (entityTypeLabel, entityTypePluralLabel = null, count = null) => {
3277
+ if (count === null)
3278
+ return 'Are you sure you want to delete this ' + entityTypeLabel + '?';
3279
+ if (count === 1)
3280
+ return 'Are you sure you want to delete 1 ' + entityTypeLabel + '?';
3281
+ return 'Are you sure you want to delete ' + count + ' ' + entityTypePluralLabel + '?';
3282
+ };
3283
+ /**
3284
+ * Returns a message formatted from an error object.
3285
+ * @param {error|string} error
3286
+ * @returns {string}
3287
+ */
3288
+ this.fmtErrorToShow = (error) => {
3289
+ if (typeof error === 'string')
3290
+ error = new Error(error);
3291
+ var lines = [];
3292
+ lines.push(error.message);
3293
+ var exception = error.detail;
3294
+ while (exception) {
3295
+ var message = exception.ExceptionMessage;
3296
+ if (!_.contains(lines, message))
3297
+ lines.push(message);
3298
+ exception = exception.InnerException;
3299
+ }
3300
+ if (error.entityErrors) {
3301
+ error.entityErrors.forEach((entityError) => {
3302
+ lines.push('Entity <' + entityError.propertyName + '>: ' + entityError.errorMessage);
3303
+ });
3304
+ }
3305
+ if (error.stack)
3306
+ lines.push(error.stack);
3307
+ var text = lines.join('\r\n\r\n');
3308
+ if (!text)
3309
+ text = _.map(error, (value, key) => { return key + ': ' + value; }).join('\r\n');
3310
+ return text;
3311
+ };
3312
+ /**
3313
+ * Returns a message formatted from an exception object.
3314
+ * @param {object} exception
3315
+ * @returns {string}
3316
+ */
3317
+ this.fmtExceptionToShow = (exception) => {
3318
+ var lines = [];
3319
+ while (exception) {
3320
+ var message = exception.Message;
3321
+ if (!_.contains(lines, message))
3322
+ lines.push(message);
3323
+ exception = exception.InnerException;
3324
+ }
3325
+ return lines.join('\r\n\r\n');
3326
+ };
3327
+ /**
3328
+ * Returns a message for a data error type.
3329
+ * @param {string} typeName
3330
+ * @returns {string}
3331
+ */
3332
+ this.fmtDataError = (typeName) => {
3333
+ if (typeName.indexOf('OptimisticLockViolation') >= 0)
3334
+ return 'The record was edited already, by another user. Please reload and attempt your edit again.';
3335
+ if (typeName.indexOf('DataConstraintViolation') >= 0)
3336
+ return 'Foreign key constraint violation';
3337
+ if (typeName.indexOf('DuplicateKeyError') >= 0)
3338
+ return 'Duplicate key error';
3339
+ return typeName;
3340
+ };
3341
+ this.msgModifierKeyLabel = this.isMac() ? 'Cmd' : 'Ctrl';
3342
+ this.msgConfirmExitWithChangesPending = 'You have unsaved changes that will be lost.';
3343
+ this.msgDeleteSuccessful = 'Delete succeeded';
3344
+ this.msgSaveSuccessful = 'Save succeeded';
3345
+ this.msgNoChangesToSave = 'No changes to save';
3346
+ this.msgSaveInProgress = 'Save in progress';
3347
+ this.msgInvalidData = 'Invalid data';
3348
+ this.msgDirtyPreventsReadOnly = 'Save or revert before disabling editing';
3349
+ this.msgDirtyPreventsNavigate = 'Save or revert before navigating';
3350
+ this.msgDirtyPreventsClose = 'Save or revert before closing window';
3351
+ this.msgDirtyPreventsDeleteExistingRecord = 'Save or revert before deleting';
3352
+ this.msgNoDeleteAccess = 'Contact administrator about delete access';
3353
+ this.msgCannotDeleteNewAndExistingRecords = 'Delete new or existing records - but not both';
3354
+ this.msgDeleteReferencingRecordsFirst = 'Delete all referencing records first';
3355
+ }
3356
+ }
3357
+ TruTextManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruTextManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3358
+ TruTextManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruTextManager, providedIn: 'root' });
3359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruTextManager, decorators: [{
3360
+ type: Injectable,
3361
+ args: [{
3362
+ providedIn: 'root',
3363
+ }]
3364
+ }], ctorParameters: function () { return []; } });
3365
+
3366
+ class TruUser {
3367
+ constructor() {
3368
+ this._ref = -1;
3369
+ this._username = null;
3370
+ this._firstName = null;
3371
+ this._lastName = null;
3372
+ this._roles = null;
3373
+ this.hasRoles = (roles) => {
3374
+ if (this._roles === null)
3375
+ return true;
3376
+ return true; //_.intersection(roles, this._roles).length > 0;
3377
+ };
3378
+ }
3379
+ get activeUserRef() {
3380
+ if (this._ref < 0)
3381
+ throw new Error('Inavlid User.');
3382
+ return this._ref;
3383
+ }
3384
+ set activeUserRef(ref) {
3385
+ this._ref = ref;
3386
+ }
3387
+ get username() {
3388
+ return this._username;
3389
+ }
3390
+ set username(username) {
3391
+ this._username = username;
3392
+ }
3393
+ get firstName() {
3394
+ return this._firstName;
3395
+ }
3396
+ set firstName(firstName) {
3397
+ this._firstName = firstName;
3398
+ }
3399
+ get lastName() {
3400
+ return this._lastName;
3401
+ }
3402
+ set lastName(lastName) {
3403
+ this._lastName = lastName;
3404
+ }
3405
+ set roles(roles) {
3406
+ this._roles = roles;
3407
+ }
3408
+ }
3409
+ TruUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruUser, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3410
+ TruUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruUser, providedIn: 'root' });
3411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: TruUser, decorators: [{
3412
+ type: Injectable,
3413
+ args: [{
3414
+ providedIn: 'root',
3415
+ }]
3416
+ }], ctorParameters: function () { return []; } });
3417
+
3208
3418
  class TruSearchGroupEventHandler {
3209
3419
  constructor() {
3210
3420
  this.search$ = new EventEmitter();
@@ -3333,5 +3543,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
3333
3543
  * Generated bundle index. Do not edit.
3334
3544
  */
3335
3545
 
3336
- export { TruCommonModule, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConfirmDialogModule, TruDesktop, TruDesktopModule, TruEntityBase, TruExportDialog, TruExportDialogConfig, TruExportDialogModule, TruPredicate, TruPropertyConfigBase, TruQueryPredicateManager, TruSearchComponentBase, TruSearchComponentConfigBase, TruSearchGroupEventHandler, TruSearchIconModule, TruToolbar, TruToolbarModule, TruWindowActionEventHandler, TruWindowAddViewEvent, TruWindowEvent, TruWindowEventHandler };
3546
+ export { PredicateMap, TruAppEnvironment, TruBreezeContext, TruBreezeContextFactory, TruCommonModule, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConfirmDialogModule, TruDataContext, TruDesktop, TruDesktopModule, TruEntityAccessor, TruEntityBase, TruExportDialog, TruExportDialogConfig, TruExportDialogModule, TruPredicate, TruPropertyConfigBase, TruQueryPredicateManager, TruSearchComponentBase, TruSearchComponentConfigBase, TruSearchGroupEventHandler, TruSearchIconModule, TruTextManager, TruToolbar, TruToolbarButton, TruToolbarButtonModule, TruToolbarContextFilter, TruToolbarContextFilterModule, TruToolbarDropdown, TruToolbarDropdownModule, TruToolbarMenu, TruToolbarMenuModule, TruToolbarModule, TruToolbarSeparator, TruToolbarSeparatorModule, TruToolbarText, TruToolbarTextModule, TruUiNotification, TruUser, TruWindowActionEventHandler, TruWindowAddViewEvent, TruWindowEvent, TruWindowEventHandler };
3337
3547
  //# sourceMappingURL=trudb-tru-common-lib.mjs.map