@datarailsshared/datarailsshared 1.3.4 → 1.3.5

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/material/core'), require('@angular/material-moment-adapter'), require('moment'), require('@angular/common'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/button-toggle'), require('@ng-select/ng-select')) :
3
- typeof define === 'function' && define.amd ? define('@datarailsshared/datarailsshared', ['exports', '@angular/core', '@angular/forms', '@angular/material/core', '@angular/material-moment-adapter', 'moment', '@angular/common', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/button-toggle', '@ng-select/ng-select'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.datarailsshared = global.datarailsshared || {}, global.datarailsshared.datarailsshared = {}), global.ng.core, global.ng.forms, global.ng.material.core, global.ng.materialMomentAdapter, global.momentImported, global.ng.common, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.buttonToggle, global.ngSelect));
5
- }(this, (function (exports, core, forms, core$1, materialMomentAdapter, momentImported, common, datepicker, formField, input, select, buttonToggle, ngSelect) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/material/core'), require('@angular/material-moment-adapter'), require('moment'), require('@angular/animations'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/common'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/button-toggle'), require('@ng-select/ng-select'), require('@angular/material/tooltip')) :
3
+ typeof define === 'function' && define.amd ? define('@datarailsshared/datarailsshared', ['exports', '@angular/core', '@angular/forms', '@angular/material/core', '@angular/material-moment-adapter', 'moment', '@angular/animations', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/common', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/button-toggle', '@ng-select/ng-select', '@angular/material/tooltip'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.datarailsshared = global.datarailsshared || {}, global.datarailsshared.datarailsshared = {}), global.ng.core, global.ng.forms, global.ng.material.core, global.ng.materialMomentAdapter, global.momentImported, global.ng.animations, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.common, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.buttonToggle, global.ngSelect, global.ng.material.tooltip));
5
+ }(this, (function (exports, core, forms, core$1, materialMomentAdapter, momentImported, animations, overlay, portal, common, datepicker, formField, input, select, buttonToggle, ngSelect, tooltip) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -609,7 +609,8 @@
609
609
  }
610
610
  MonthTagComponent.prototype.initDate = function () {
611
611
  if (this.defaultValue) {
612
- this.dateObj.date = moment$5(new Date(this.defaultValue * 1000)).utc().format("YYYY-MM");
612
+ this.dateObj.date = moment$5(this.defaultValue * 1000).utc().format("YYYY-MM");
613
+ this.date = new forms.FormControl(moment$5(this.defaultValue * 1000));
613
614
  }
614
615
  else {
615
616
  this.dateObj.date = moment$5(new Date()).format("YYYY-MM");
@@ -1469,6 +1470,239 @@
1469
1470
  optionTemplate: [{ type: core.ContentChild, args: ['optionTemplate',] }]
1470
1471
  };
1471
1472
 
1473
+ var DrAvatarComponent = /** @class */ (function () {
1474
+ function DrAvatarComponent() {
1475
+ this.users = [];
1476
+ this.userClicked = new core.EventEmitter();
1477
+ }
1478
+ DrAvatarComponent.prototype.ngOnChanges = function (changes) {
1479
+ var _this = this;
1480
+ var _a;
1481
+ if (changes.users && ((_a = changes.users.currentValue) === null || _a === void 0 ? void 0 : _a.length)) {
1482
+ this.getFirstUsers().forEach(function (user, index) { return user.class = "icon-" + index; });
1483
+ this.getLastUsers().forEach(function (user) { return user.class = "icon-" + _this.getRandomValue(5); });
1484
+ }
1485
+ };
1486
+ DrAvatarComponent.prototype.getFirstUsers = function () {
1487
+ return this.users.slice(0, 2);
1488
+ };
1489
+ DrAvatarComponent.prototype.getLastUsers = function () {
1490
+ if (this.users.length > 2) {
1491
+ return this.users.slice(2, this.users.length - 1);
1492
+ }
1493
+ };
1494
+ DrAvatarComponent.prototype.getRandomValue = function (limit) {
1495
+ return ~~(limit * Math.random());
1496
+ };
1497
+ return DrAvatarComponent;
1498
+ }());
1499
+ DrAvatarComponent.decorators = [
1500
+ { type: core.Component, args: [{
1501
+ selector: 'dr-avatar',
1502
+ template: "<div class=\"users-section\">\r\n <div class=\"users-section__user\"\r\n [class]=\"user.class\"\r\n *ngFor=\"let user of getFirstUsers()\"\r\n (click)=\"userClicked.emit()\"\r\n [matTooltip]=\"user.first_name + ' ' + user.last_name\"\r\n [matTooltipPosition]=\"'below'\">\r\n {{user.first_name[0] + user.last_name[0]}}\r\n </div>\r\n\r\n <div class=\"users-section__user icon-2\" *ngIf=\"users.length > 2\"\r\n [drTooltip]=\"usersTemplate\"\r\n [drTooltipPosition]=\"'bottom'\">\r\n {{getLastUsers().length}}\r\n </div>\r\n</div>\r\n\r\n<ng-template #usersTemplate>\r\n <div *ngFor=\"let user of getLastUsers()\" class=\"users-popover-item\">\r\n <div class=\"users-section__user\"\r\n (click)=\"userClicked.emit()\"\r\n [class]=\"user.class\">\r\n {{user.first_name[0] + user.last_name[0]}}\r\n </div>\r\n <span class=\"username\">\r\n {{user.first_name + ' ' + user.last_name}}\r\n </span>\r\n </div>\r\n</ng-template>\r\n",
1503
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1504
+ styles: [":host{width:627px}.users-section{display:flex;position:absolute;height:28px;top:5px}.users-popover-item{display:flex;align-items:center;margin:12px}.users-popover-item .username{color:#51566f;font-size:14px}.users-popover-item .users-section__user{margin-right:8px}.users-section__user{display:flex;justify-content:center;align-items:center;height:28px;width:28px;border-radius:14px;background:red;color:#fff;font-size:12px}.users-section__user.icon-0{background-color:#7b61ff}.users-section__user.icon-1{background-color:#21b8f1}.users-section__user.icon-2{background-color:#2969b0}.users-section__user.icon-3{background-color:#51566f}.users-section__user.icon-4{background-color:#0061ff}.users-section__user:hover{cursor:pointer}.users-section__user:not(:first-child){margin-left:4px}\n"]
1505
+ },] }
1506
+ ];
1507
+ DrAvatarComponent.ctorParameters = function () { return []; };
1508
+ DrAvatarComponent.propDecorators = {
1509
+ users: [{ type: core.Input }],
1510
+ userClicked: [{ type: core.Output }]
1511
+ };
1512
+
1513
+ var TooltipComponent = /** @class */ (function () {
1514
+ function TooltipComponent() {
1515
+ this.isContentTemplate = false;
1516
+ }
1517
+ TooltipComponent.prototype.ngOnInit = function () {
1518
+ this.isContentTemplate = this.content instanceof core.TemplateRef;
1519
+ };
1520
+ return TooltipComponent;
1521
+ }());
1522
+ TooltipComponent.decorators = [
1523
+ { type: core.Component, args: [{
1524
+ selector: 'dr-tooltip',
1525
+ template: "<div [class]=\"position + ' ' + class\" [ngClass]=\"{'dr-tooltip': !options?.withoutContainerStyles}\">\r\n <div class=\"dr-tooltip-arrow\"></div>\r\n <ng-container *ngIf=\"isContentTemplate; else defaultContent\">\r\n <ng-container *ngTemplateOutlet=\"content; context: contentContext\"></ng-container>\r\n </ng-container>\r\n <ng-template #defaultContent>\r\n <div class=\"default-content\">{{ content }}</div>\r\n </ng-template>\r\n</div>\r\n",
1526
+ animations: [
1527
+ animations.trigger('tooltip', [
1528
+ animations.transition(':enter', [
1529
+ animations.style({ opacity: 0 }),
1530
+ animations.animate(300, animations.style({ opacity: 1 })),
1531
+ ]),
1532
+ animations.transition(':leave', [
1533
+ animations.animate(300, animations.style({ opacity: 0 })),
1534
+ ]),
1535
+ ]),
1536
+ ],
1537
+ styles: [":host{display:block}.dr-tooltip{background:#fff;border:1px solid #cfd7dd;box-sizing:border-box;border-radius:4px;font-size:12px;color:#545a6b;max-width:80vh!important;box-shadow:0 2px 4px #919907}.dr-tooltip .default-content{padding:.5rem;font-size:11px;line-height:16px;white-space:pre;text-overflow:ellipsis;overflow:hidden}.dr-tooltip-arrow{border-width:8px}.dr-tooltip-arrow,.dr-tooltip-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.dr-tooltip-arrow:after{content:\"\";border-width:8px}.top .dr-tooltip-arrow,.top-left .dr-tooltip-arrow,.top-right .dr-tooltip-arrow{bottom:-16px;border-top-color:#cfd7dd!important}.top .dr-tooltip-arrow:after,.top-left .dr-tooltip-arrow:after,.top-right .dr-tooltip-arrow:after{bottom:-6px;left:-8px;border-top-color:#fff}.bottom .dr-tooltip-arrow,.bottom-left .dr-tooltip-arrow,.bottom-right .dr-tooltip-arrow{top:-7px;border-top:none;border-bottom-color:#cfd7dd!important}.bottom .dr-tooltip-arrow:after,.bottom-left .dr-tooltip-arrow:after,.bottom-right .dr-tooltip-arrow:after{border-top:none;top:1px;left:-8px;border-bottom-color:#fff}.left .dr-tooltip-arrow,.left-top .dr-tooltip-arrow,.left-bottom .dr-tooltip-arrow{right:-16px;border-left-color:#cfd7dd!important}.left .dr-tooltip-arrow:after,.left-top .dr-tooltip-arrow:after,.left-bottom .dr-tooltip-arrow:after{bottom:-8px;left:-9px;border-left-color:#fff}.right .dr-tooltip-arrow,.right-top .dr-tooltip-arrow,.right-bottom .dr-tooltip-arrow{left:-16px;border-right-color:#cfd7dd!important}.right .dr-tooltip-arrow:after,.right-top .dr-tooltip-arrow:after,.right-bottom .dr-tooltip-arrow:after{bottom:-8px;left:-7px;border-right-color:#fff}.top .dr-tooltip-arrow,.bottom .dr-tooltip-arrow{left:calc(50% - 4px)}.bottom-left .dr-tooltip-arrow,.top-left .dr-tooltip-arrow{left:4px}.bottom-right .dr-tooltip-arrow,.top-right .dr-tooltip-arrow{right:4px}.left .dr-tooltip-arrow,.right .dr-tooltip-arrow{top:calc(50% - 4px)}.left-top .dr-tooltip-arrow,.dr-tooltip-arrow .right-top{top:4px}.right-bottom .dr-tooltip-arrow,.left-bottom .dr-tooltip-arrow{bottom:4px}\n"]
1538
+ },] }
1539
+ ];
1540
+ TooltipComponent.ctorParameters = function () { return []; };
1541
+ TooltipComponent.propDecorators = {
1542
+ content: [{ type: core.Input }],
1543
+ contentContext: [{ type: core.Input }],
1544
+ position: [{ type: core.Input }],
1545
+ options: [{ type: core.Input }],
1546
+ class: [{ type: core.Input }]
1547
+ };
1548
+
1549
+ var DrTooltipDirective = /** @class */ (function () {
1550
+ function DrTooltipDirective(overlay, overlayPositionBuilder, elementRef) {
1551
+ this.overlay = overlay;
1552
+ this.overlayPositionBuilder = overlayPositionBuilder;
1553
+ this.elementRef = elementRef;
1554
+ this.contentContext = {};
1555
+ this.position = 'top';
1556
+ this.class = '';
1557
+ this.tooltipPositions = {
1558
+ top: {
1559
+ originX: 'center',
1560
+ originY: 'top',
1561
+ overlayX: 'center',
1562
+ overlayY: 'bottom',
1563
+ offsetY: -8
1564
+ },
1565
+ 'top-left': {
1566
+ originX: 'start',
1567
+ originY: 'top',
1568
+ overlayX: 'start',
1569
+ overlayY: 'bottom',
1570
+ offsetY: -8
1571
+ },
1572
+ 'top-right': {
1573
+ originX: 'end',
1574
+ originY: 'top',
1575
+ overlayX: 'end',
1576
+ overlayY: 'bottom',
1577
+ offsetY: -8
1578
+ },
1579
+ bottom: {
1580
+ originX: 'center',
1581
+ originY: 'bottom',
1582
+ overlayX: 'center',
1583
+ overlayY: 'top',
1584
+ offsetY: 7
1585
+ },
1586
+ 'bottom-left': {
1587
+ originX: 'start',
1588
+ originY: 'bottom',
1589
+ overlayX: 'start',
1590
+ overlayY: 'top',
1591
+ offsetY: 7
1592
+ },
1593
+ 'bottom-right': {
1594
+ originX: 'end',
1595
+ originY: 'bottom',
1596
+ overlayX: 'end',
1597
+ overlayY: 'top',
1598
+ offsetY: 7
1599
+ },
1600
+ left: {
1601
+ originX: 'start',
1602
+ originY: 'center',
1603
+ overlayX: 'end',
1604
+ overlayY: 'center',
1605
+ offsetX: -8
1606
+ },
1607
+ 'left-top': {
1608
+ originX: 'start',
1609
+ originY: 'top',
1610
+ overlayX: 'end',
1611
+ overlayY: 'top',
1612
+ offsetX: -8
1613
+ },
1614
+ 'left-bottom': {
1615
+ originX: 'start',
1616
+ originY: 'bottom',
1617
+ overlayX: 'end',
1618
+ overlayY: 'bottom',
1619
+ offsetX: -8
1620
+ },
1621
+ right: {
1622
+ originX: 'end',
1623
+ originY: 'center',
1624
+ overlayX: 'start',
1625
+ overlayY: 'center',
1626
+ offsetX: 8
1627
+ },
1628
+ 'right-top': {
1629
+ originX: 'end',
1630
+ originY: 'top',
1631
+ overlayX: 'start',
1632
+ overlayY: 'top',
1633
+ offsetX: 8
1634
+ },
1635
+ 'right-bottom': {
1636
+ originX: 'end',
1637
+ originY: 'bottom',
1638
+ overlayX: 'start',
1639
+ overlayY: 'bottom',
1640
+ offsetX: 8
1641
+ }
1642
+ };
1643
+ }
1644
+ Object.defineProperty(DrTooltipDirective.prototype, "drTooltipOptions", {
1645
+ set: function (options) {
1646
+ if (options === null || options === void 0 ? void 0 : options.indent) {
1647
+ var position = this.tooltipPositions[this.position];
1648
+ if (position.offsetY) {
1649
+ position.offsetY = position.offsetY < 0 ? -options.indent : options.indent;
1650
+ }
1651
+ if (position.offsetX) {
1652
+ position.offsetX = position.offsetX < 0 ? -options.indent : options.indent;
1653
+ }
1654
+ }
1655
+ this.options = options;
1656
+ },
1657
+ enumerable: false,
1658
+ configurable: true
1659
+ });
1660
+ DrTooltipDirective.prototype.ngOnInit = function () {
1661
+ var positionStrategy = this.overlayPositionBuilder
1662
+ .flexibleConnectedTo(this.elementRef)
1663
+ .withPositions([this.tooltipPositions[this.position]]);
1664
+ this.overlayRef = this.overlay.create({ positionStrategy: positionStrategy });
1665
+ };
1666
+ DrTooltipDirective.prototype.ngOnDestroy = function () {
1667
+ if (this.overlayRef.hasAttached()) {
1668
+ this.hide();
1669
+ }
1670
+ this.overlayRef.dispose();
1671
+ };
1672
+ DrTooltipDirective.prototype.show = function () {
1673
+ if (!this.overlayRef.hasAttached() && this.content) {
1674
+ var tooltipRef = this.overlayRef.attach(new portal.ComponentPortal(TooltipComponent));
1675
+ tooltipRef.instance.content = this.content;
1676
+ tooltipRef.instance.contentContext = this.contentContext;
1677
+ tooltipRef.instance.position = this.position;
1678
+ tooltipRef.instance.options = this.options;
1679
+ }
1680
+ };
1681
+ DrTooltipDirective.prototype.hide = function () {
1682
+ this.overlayRef.detach();
1683
+ };
1684
+ return DrTooltipDirective;
1685
+ }());
1686
+ DrTooltipDirective.decorators = [
1687
+ { type: core.Directive, args: [{
1688
+ selector: '[drTooltip]'
1689
+ },] }
1690
+ ];
1691
+ DrTooltipDirective.ctorParameters = function () { return [
1692
+ { type: overlay.Overlay },
1693
+ { type: overlay.OverlayPositionBuilder },
1694
+ { type: core.ElementRef }
1695
+ ]; };
1696
+ DrTooltipDirective.propDecorators = {
1697
+ content: [{ type: core.Input, args: ['drTooltip',] }],
1698
+ contentContext: [{ type: core.Input, args: ['drTooltipContext',] }],
1699
+ position: [{ type: core.Input, args: ['drTooltipPosition',] }],
1700
+ class: [{ type: core.Input, args: ['drTooltipClass',] }],
1701
+ drTooltipOptions: [{ type: core.Input }],
1702
+ show: [{ type: core.HostListener, args: ['mouseenter',] }],
1703
+ hide: [{ type: core.HostListener, args: ['mouseleave',] }]
1704
+ };
1705
+
1472
1706
  var DrToggleComponent = /** @class */ (function () {
1473
1707
  function DrToggleComponent(cdr) {
1474
1708
  this.cdr = cdr;
@@ -1715,6 +1949,49 @@
1715
1949
  },] }
1716
1950
  ];
1717
1951
 
1952
+ var DrTooltipModule = /** @class */ (function () {
1953
+ function DrTooltipModule() {
1954
+ }
1955
+ return DrTooltipModule;
1956
+ }());
1957
+ DrTooltipModule.decorators = [
1958
+ { type: core.NgModule, args: [{
1959
+ imports: [
1960
+ common.CommonModule
1961
+ ],
1962
+ exports: [
1963
+ TooltipComponent,
1964
+ DrTooltipDirective,
1965
+ ],
1966
+ providers: [],
1967
+ declarations: [
1968
+ TooltipComponent,
1969
+ DrTooltipDirective,
1970
+ ],
1971
+ },] }
1972
+ ];
1973
+
1974
+ var DrAvatarModule = /** @class */ (function () {
1975
+ function DrAvatarModule() {
1976
+ }
1977
+ return DrAvatarModule;
1978
+ }());
1979
+ DrAvatarModule.decorators = [
1980
+ { type: core.NgModule, args: [{
1981
+ declarations: [
1982
+ DrAvatarComponent
1983
+ ],
1984
+ exports: [
1985
+ DrAvatarComponent
1986
+ ],
1987
+ imports: [
1988
+ tooltip.MatTooltipModule,
1989
+ DrTooltipModule,
1990
+ common.CommonModule
1991
+ ]
1992
+ },] }
1993
+ ];
1994
+
1718
1995
  var components = [DrSpinnerComponent];
1719
1996
  var directives = [DrSpinnerDirective];
1720
1997
  var DrSpinnerModule = /** @class */ (function () {
@@ -1743,6 +2020,8 @@
1743
2020
  exports.DateTagComponent = DateTagComponent;
1744
2021
  exports.DateTagModule = DateTagModule;
1745
2022
  exports.DayTagComponent = DayTagComponent;
2023
+ exports.DrAvatarComponent = DrAvatarComponent;
2024
+ exports.DrAvatarModule = DrAvatarModule;
1746
2025
  exports.DrInputComponent = DrInputComponent;
1747
2026
  exports.DrInputsModule = DrInputsModule;
1748
2027
  exports.DrSelectComponent = DrSelectComponent;
@@ -1752,6 +2031,8 @@
1752
2031
  exports.DrTagComponent = DrTagComponent;
1753
2032
  exports.DrTagModule = DrTagModule;
1754
2033
  exports.DrToggleComponent = DrToggleComponent;
2034
+ exports.DrTooltipDirective = DrTooltipDirective;
2035
+ exports.DrTooltipModule = DrTooltipModule;
1755
2036
  exports.ForecastTagComponent = ForecastTagComponent;
1756
2037
  exports.ISpinnerOptions = ISpinnerOptions;
1757
2038
  exports.ListTagComponent = ListTagComponent;
@@ -1759,6 +2040,7 @@
1759
2040
  exports.MonthTagComponent = MonthTagComponent;
1760
2041
  exports.QuarterTagComponent = QuarterTagComponent;
1761
2042
  exports.RadioButtonComponent = RadioButtonComponent;
2043
+ exports.TooltipComponent = TooltipComponent;
1762
2044
  exports.WeekTagComponent = WeekTagComponent;
1763
2045
  exports.YearTagComponent = YearTagComponent;
1764
2046
  exports.ɵa = components$2;