@osovitny/anatoly 2.1.0 → 2.1.2

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.
@@ -98,11 +98,15 @@
98
98
  function BaseGoService(route, router) {
99
99
  this.route = route;
100
100
  this.router = router;
101
+ this.route = route;
102
+ this.router = router;
101
103
  }
102
104
  BaseGoService.prototype.locationReload = function () {
103
- // this.router.navigate([this.route.url]);
104
105
  window.location.reload();
105
106
  };
107
+ BaseGoService.prototype.homeReload = function () {
108
+ window.location.href = "/";
109
+ };
106
110
  return BaseGoService;
107
111
  }());
108
112
  BaseGoService.decorators = [
@@ -680,6 +684,32 @@
680
684
  }
681
685
  return null;
682
686
  };
687
+ Convert.enumToString = function (enumeration, value) {
688
+ for (var k in enumeration)
689
+ if (enumeration[k] == value)
690
+ return k;
691
+ return null;
692
+ };
693
+ Convert.enumToArray = function (enumeration, notIncludes) {
694
+ var notIncludeFiler = function (value) {
695
+ if (isNaN(Number(value))) {
696
+ return false;
697
+ }
698
+ if (notIncludes) {
699
+ for (var i in notIncludes) {
700
+ if (notIncludes[i] == value)
701
+ return false;
702
+ }
703
+ }
704
+ return true;
705
+ };
706
+ return Object.keys(enumeration)
707
+ .filter(notIncludeFiler)
708
+ .map(function (key) { return ({
709
+ value: key,
710
+ text: enumeration[key]
711
+ }); });
712
+ };
683
713
  return Convert;
684
714
  }());
685
715
 
@@ -2223,6 +2253,202 @@
2223
2253
  { type: AnatolyDataModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
2224
2254
  ]; };
2225
2255
 
2256
+ /*
2257
+ <file>
2258
+ Project:
2259
+ @osovitny/anatoly
2260
+
2261
+ Authors:
2262
+ Vadim Osovitny
2263
+ Anatoly Osovitny
2264
+
2265
+ Created:
2266
+ 28 Aug 2018
2267
+
2268
+ Version:
2269
+ 1.0
2270
+
2271
+ Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2272
+ </file>
2273
+ */
2274
+ var BaseComponent = /** @class */ (function () {
2275
+ function BaseComponent() {
2276
+ this.subs = new Subs();
2277
+ }
2278
+ BaseComponent.prototype.getQSId = function () {
2279
+ var id = Utils.getValueByNameInQS("id");
2280
+ if (typeof id === "undefined" || id == "")
2281
+ return null;
2282
+ return id;
2283
+ };
2284
+ BaseComponent.prototype.ngOnDestroy = function () {
2285
+ this.subs.unsubscribe();
2286
+ };
2287
+ return BaseComponent;
2288
+ }());
2289
+ BaseComponent.decorators = [
2290
+ { type: i0.Component, args: [{
2291
+ template: ''
2292
+ },] }
2293
+ ];
2294
+
2295
+ var BaseEditComponent = /** @class */ (function (_super) {
2296
+ __extends(BaseEditComponent, _super);
2297
+ function BaseEditComponent() {
2298
+ var _this = _super.call(this) || this;
2299
+ _this.formSubmitted = false;
2300
+ return _this;
2301
+ }
2302
+ BaseEditComponent.prototype.isActionAdding = function () {
2303
+ var id = Utils.getValueByNameInQS("id");
2304
+ if (typeof id === "undefined" || id == "")
2305
+ return true;
2306
+ return false;
2307
+ };
2308
+ BaseEditComponent.prototype.getEntityId = function () {
2309
+ return this.getQSId();
2310
+ };
2311
+ BaseEditComponent.prototype.isControlValid = function (name, frmGroup) {
2312
+ if (frmGroup === void 0) { frmGroup = null; }
2313
+ return !this.isControlInvalid(name, frmGroup);
2314
+ };
2315
+ BaseEditComponent.prototype.isControlInvalid = function (name, frmGroup) {
2316
+ if (frmGroup === void 0) { frmGroup = null; }
2317
+ if (typeof name === "undefined" || name == "") {
2318
+ return false;
2319
+ }
2320
+ var fg = frmGroup ? frmGroup : this.formGroup;
2321
+ if (!fg) {
2322
+ return false;
2323
+ }
2324
+ if (fg.get(name)) {
2325
+ return ((this.formSubmitted && fg.get(name).invalid) ||
2326
+ (fg.get(name).touched && fg.get(name).invalid));
2327
+ }
2328
+ return false;
2329
+ };
2330
+ //FormGroup functions
2331
+ BaseEditComponent.prototype.getFormValue = function (name, frmGroup) {
2332
+ if (frmGroup === void 0) { frmGroup = null; }
2333
+ var fg = frmGroup ? frmGroup : this.formGroup;
2334
+ return fg.controls[name].value;
2335
+ };
2336
+ BaseEditComponent.prototype.setFormValue = function (name, value, frmGroup) {
2337
+ if (frmGroup === void 0) { frmGroup = null; }
2338
+ var fg = frmGroup ? frmGroup : this.formGroup;
2339
+ fg.controls[name].setValue(value);
2340
+ };
2341
+ BaseEditComponent.prototype.getFormGroupValue = function (groupName, name, frmGroup) {
2342
+ if (frmGroup === void 0) { frmGroup = null; }
2343
+ var fg = frmGroup ? frmGroup : this.formGroup;
2344
+ return fg.controls[groupName].get(name).value;
2345
+ };
2346
+ BaseEditComponent.prototype.setFormGroupValue = function (groupName, name, value, frmGroup) {
2347
+ if (frmGroup === void 0) { frmGroup = null; }
2348
+ var fg = frmGroup ? frmGroup : this.formGroup;
2349
+ fg.controls[groupName].get(name).setValue(value);
2350
+ };
2351
+ /**
2352
+ * Add control to form group
2353
+ * @param name
2354
+ * @param formControl
2355
+ * @param formGroup
2356
+ */
2357
+ BaseEditComponent.prototype.addControl = function (name, formControl, frmGroup) {
2358
+ if (frmGroup === void 0) { frmGroup = null; }
2359
+ var fg = frmGroup ? frmGroup : this.formGroup;
2360
+ fg.addControl(name, formControl);
2361
+ };
2362
+ /**
2363
+ * Removes control from form group
2364
+ * @param name
2365
+ * @param formGroup
2366
+ */
2367
+ BaseEditComponent.prototype.removeControl = function (name, frmGroup) {
2368
+ if (frmGroup === void 0) { frmGroup = null; }
2369
+ var fg = frmGroup ? frmGroup : this.formGroup;
2370
+ if (fg.get(name)) {
2371
+ fg.removeControl(name);
2372
+ }
2373
+ };
2374
+ /**
2375
+ * return new form control
2376
+ * @param formState
2377
+ * @param validatorOrOpts
2378
+ * @param asyncValidator
2379
+ */
2380
+ BaseEditComponent.prototype.createFormControl = function (formState, validatorOrOpts, asyncValidator) {
2381
+ return new forms.FormControl(formState, validatorOrOpts, asyncValidator);
2382
+ };
2383
+ /**
2384
+ * Set error to control
2385
+ * @param controlName formControl name
2386
+ * @param err error expect {erroname: boolean} format
2387
+ * @param formGroup Specific form group. default it will apply on this.formGroup property
2388
+ */
2389
+ BaseEditComponent.prototype.setControlError = function (controlName, err, frmGroup) {
2390
+ if (frmGroup === void 0) { frmGroup = null; }
2391
+ var _a;
2392
+ var fg = frmGroup ? frmGroup : this.formGroup;
2393
+ (_a = fg.get(controlName)) === null || _a === void 0 ? void 0 : _a.setErrors(err);
2394
+ };
2395
+ /**
2396
+ * Set {invalid: true} for the specified form
2397
+ * @param controlName form control name
2398
+ * @param formGroup
2399
+ */
2400
+ BaseEditComponent.prototype.setInValidError = function (controlName, frmGroup) {
2401
+ if (frmGroup === void 0) { frmGroup = null; }
2402
+ var _a;
2403
+ var fg = frmGroup ? frmGroup : this.formGroup;
2404
+ (_a = fg.get(controlName)) === null || _a === void 0 ? void 0 : _a.setErrors({ invalid: true });
2405
+ };
2406
+ Object.defineProperty(BaseEditComponent.prototype, "fc", {
2407
+ /**
2408
+ * returns formgroup controls.
2409
+ * main use case is used in html pages
2410
+ */
2411
+ get: function () {
2412
+ return this.formGroup.controls;
2413
+ },
2414
+ enumerable: false,
2415
+ configurable: true
2416
+ });
2417
+ return BaseEditComponent;
2418
+ }(BaseComponent));
2419
+ BaseEditComponent.decorators = [
2420
+ { type: i0.Component, args: [{
2421
+ template: ''
2422
+ },] }
2423
+ ];
2424
+ BaseEditComponent.ctorParameters = function () { return []; };
2425
+ BaseEditComponent.propDecorators = {
2426
+ formGroup: [{ type: i0.Input }],
2427
+ formSubmitted: [{ type: i0.Input }]
2428
+ };
2429
+
2430
+ var BaseDialogComponent = /** @class */ (function (_super) {
2431
+ __extends(BaseDialogComponent, _super);
2432
+ function BaseDialogComponent() {
2433
+ var _this = _super.call(this) || this;
2434
+ _this.opened = false;
2435
+ return _this;
2436
+ }
2437
+ BaseDialogComponent.prototype.show = function () {
2438
+ this.opened = true;
2439
+ };
2440
+ BaseDialogComponent.prototype.hide = function () {
2441
+ this.opened = false;
2442
+ };
2443
+ return BaseDialogComponent;
2444
+ }(BaseEditComponent));
2445
+ BaseDialogComponent.decorators = [
2446
+ { type: i0.Component, args: [{
2447
+ template: ''
2448
+ },] }
2449
+ ];
2450
+ BaseDialogComponent.ctorParameters = function () { return []; };
2451
+
2226
2452
  /*
2227
2453
  <file>
2228
2454
  Project:
@@ -2532,180 +2758,6 @@
2532
2758
  imageUploadParams: { uploadType: "", uploadParentId: "" },
2533
2759
  };
2534
2760
 
2535
- /*
2536
- <file>
2537
- Project:
2538
- @osovitny/anatoly
2539
-
2540
- Authors:
2541
- Vadim Osovitny
2542
- Anatoly Osovitny
2543
-
2544
- Created:
2545
- 28 Aug 2018
2546
-
2547
- Version:
2548
- 1.0
2549
-
2550
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2551
- </file>
2552
- */
2553
- var BaseComponent = /** @class */ (function () {
2554
- function BaseComponent() {
2555
- this.subs = new Subs();
2556
- }
2557
- BaseComponent.prototype.getQSId = function () {
2558
- var id = Utils.getValueByNameInQS("id");
2559
- if (typeof id === "undefined" || id == "")
2560
- return null;
2561
- return id;
2562
- };
2563
- BaseComponent.prototype.ngOnDestroy = function () {
2564
- this.subs.unsubscribe();
2565
- };
2566
- return BaseComponent;
2567
- }());
2568
- BaseComponent.decorators = [
2569
- { type: i0.Component, args: [{
2570
- template: ''
2571
- },] }
2572
- ];
2573
-
2574
- var BaseEditComponent = /** @class */ (function (_super) {
2575
- __extends(BaseEditComponent, _super);
2576
- function BaseEditComponent() {
2577
- var _this = _super.call(this) || this;
2578
- _this.formSubmitted = false;
2579
- return _this;
2580
- }
2581
- BaseEditComponent.prototype.isActionAdding = function () {
2582
- var id = Utils.getValueByNameInQS("id");
2583
- if (typeof id === "undefined" || id == "")
2584
- return true;
2585
- return false;
2586
- };
2587
- BaseEditComponent.prototype.getEntityId = function () {
2588
- return this.getQSId();
2589
- };
2590
- BaseEditComponent.prototype.isControlValid = function (name, frmGroup) {
2591
- if (frmGroup === void 0) { frmGroup = null; }
2592
- return !this.isControlInvalid(name, frmGroup);
2593
- };
2594
- BaseEditComponent.prototype.isControlInvalid = function (name, frmGroup) {
2595
- if (frmGroup === void 0) { frmGroup = null; }
2596
- if (typeof name === "undefined" || name == "") {
2597
- return false;
2598
- }
2599
- var fg = frmGroup ? frmGroup : this.formGroup;
2600
- if (!fg) {
2601
- return false;
2602
- }
2603
- if (fg.get(name)) {
2604
- return ((this.formSubmitted && fg.get(name).invalid) ||
2605
- (fg.get(name).touched && fg.get(name).invalid));
2606
- }
2607
- return false;
2608
- };
2609
- //FormGroup functions
2610
- BaseEditComponent.prototype.getFormValue = function (name, frmGroup) {
2611
- if (frmGroup === void 0) { frmGroup = null; }
2612
- var fg = frmGroup ? frmGroup : this.formGroup;
2613
- return fg.controls[name].value;
2614
- };
2615
- BaseEditComponent.prototype.setFormValue = function (name, value, frmGroup) {
2616
- if (frmGroup === void 0) { frmGroup = null; }
2617
- var fg = frmGroup ? frmGroup : this.formGroup;
2618
- fg.controls[name].setValue(value);
2619
- };
2620
- BaseEditComponent.prototype.getFormGroupValue = function (groupName, name, frmGroup) {
2621
- if (frmGroup === void 0) { frmGroup = null; }
2622
- var fg = frmGroup ? frmGroup : this.formGroup;
2623
- return fg.controls[groupName].get(name).value;
2624
- };
2625
- BaseEditComponent.prototype.setFormGroupValue = function (groupName, name, value, frmGroup) {
2626
- if (frmGroup === void 0) { frmGroup = null; }
2627
- var fg = frmGroup ? frmGroup : this.formGroup;
2628
- fg.controls[groupName].get(name).setValue(value);
2629
- };
2630
- /**
2631
- * Add control to form group
2632
- * @param name
2633
- * @param formControl
2634
- * @param formGroup
2635
- */
2636
- BaseEditComponent.prototype.addControl = function (name, formControl, frmGroup) {
2637
- if (frmGroup === void 0) { frmGroup = null; }
2638
- var fg = frmGroup ? frmGroup : this.formGroup;
2639
- fg.addControl(name, formControl);
2640
- };
2641
- /**
2642
- * Removes control from form group
2643
- * @param name
2644
- * @param formGroup
2645
- */
2646
- BaseEditComponent.prototype.removeControl = function (name, frmGroup) {
2647
- if (frmGroup === void 0) { frmGroup = null; }
2648
- var fg = frmGroup ? frmGroup : this.formGroup;
2649
- if (fg.get(name)) {
2650
- fg.removeControl(name);
2651
- }
2652
- };
2653
- /**
2654
- * return new form control
2655
- * @param formState
2656
- * @param validatorOrOpts
2657
- * @param asyncValidator
2658
- */
2659
- BaseEditComponent.prototype.createFormControl = function (formState, validatorOrOpts, asyncValidator) {
2660
- return new forms.FormControl(formState, validatorOrOpts, asyncValidator);
2661
- };
2662
- /**
2663
- * Set error to control
2664
- * @param controlName formControl name
2665
- * @param err error expect {erroname: boolean} format
2666
- * @param formGroup Specific form group. default it will apply on this.formGroup property
2667
- */
2668
- BaseEditComponent.prototype.setControlError = function (controlName, err, frmGroup) {
2669
- if (frmGroup === void 0) { frmGroup = null; }
2670
- var _a;
2671
- var fg = frmGroup ? frmGroup : this.formGroup;
2672
- (_a = fg.get(controlName)) === null || _a === void 0 ? void 0 : _a.setErrors(err);
2673
- };
2674
- /**
2675
- * Set {invalid: true} for the specified form
2676
- * @param controlName form control name
2677
- * @param formGroup
2678
- */
2679
- BaseEditComponent.prototype.setInValidError = function (controlName, frmGroup) {
2680
- if (frmGroup === void 0) { frmGroup = null; }
2681
- var _a;
2682
- var fg = frmGroup ? frmGroup : this.formGroup;
2683
- (_a = fg.get(controlName)) === null || _a === void 0 ? void 0 : _a.setErrors({ invalid: true });
2684
- };
2685
- Object.defineProperty(BaseEditComponent.prototype, "fc", {
2686
- /**
2687
- * returns formgroup controls.
2688
- * main use case is used in html pages
2689
- */
2690
- get: function () {
2691
- return this.formGroup.controls;
2692
- },
2693
- enumerable: false,
2694
- configurable: true
2695
- });
2696
- return BaseEditComponent;
2697
- }(BaseComponent));
2698
- BaseEditComponent.decorators = [
2699
- { type: i0.Component, args: [{
2700
- template: ''
2701
- },] }
2702
- ];
2703
- BaseEditComponent.ctorParameters = function () { return []; };
2704
- BaseEditComponent.propDecorators = {
2705
- formGroup: [{ type: i0.Input }],
2706
- formSubmitted: [{ type: i0.Input }]
2707
- };
2708
-
2709
2761
  var BaseHtmlEditorComponent = /** @class */ (function (_super) {
2710
2762
  __extends(BaseHtmlEditorComponent, _super);
2711
2763
  function BaseHtmlEditorComponent() {
@@ -3490,6 +3542,7 @@
3490
3542
  exports.AppCoreSettings = AppCoreSettings;
3491
3543
  exports.BaseApiService = BaseApiService;
3492
3544
  exports.BaseComponent = BaseComponent;
3545
+ exports.BaseDialogComponent = BaseDialogComponent;
3493
3546
  exports.BaseEditComponent = BaseEditComponent;
3494
3547
  exports.BaseGoService = BaseGoService;
3495
3548
  exports.BaseGridEditService = BaseGridEditService;