@singularsystems/neo-react 0.10.63 → 0.10.64

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.
@@ -50,12 +50,12 @@ var Button = /** @class */ (function (_super) {
50
50
  };
51
51
  Button.prototype.render = function () {
52
52
  var _this = this;
53
- var _a;
54
- var _b = this.props, isSubmit = _b.isSubmit, variant = _b.variant, size = _b.size, isOutline = _b.isOutline, icon = _b.icon, iconAlignment = _b.iconAlignment, text = _b.text, menuItems = _b.menuItems, splitMenu = _b.splitMenu, menuAlignment = _b.menuAlignment, buttonGroupClassName = _b.buttonGroupClassName, tooltip = _b.tooltip, task = _b.task, isBusy = _b.isBusy, pulse = _b.pulse, native = __rest(_b, ["isSubmit", "variant", "size", "isOutline", "icon", "iconAlignment", "text", "menuItems", "splitMenu", "menuAlignment", "buttonGroupClassName", "tooltip", "task", "isBusy", "pulse"]);
53
+ var _a, _b;
54
+ var _c = this.props, isSubmit = _c.isSubmit, variant = _c.variant, size = _c.size, isOutline = _c.isOutline, icon = _c.icon, iconAlignment = _c.iconAlignment, text = _c.text, menuItems = _c.menuItems, splitMenu = _c.splitMenu, menuAlignment = _c.menuAlignment, buttonGroupClassName = _c.buttonGroupClassName, tooltip = _c.tooltip, task = _c.task, isBusy = _c.isBusy, pulse = _c.pulse, customVariant = _c.customVariant, native = __rest(_c, ["isSubmit", "variant", "size", "isOutline", "icon", "iconAlignment", "text", "menuItems", "splitMenu", "menuAlignment", "buttonGroupClassName", "tooltip", "task", "isBusy", "pulse", "customVariant"]);
55
55
  native.type = isSubmit ? "submit" : "button";
56
- variant = (variant !== null && variant !== void 0 ? variant : "primary");
56
+ var variantClassName = (_a = (customVariant !== null && customVariant !== void 0 ? customVariant : variant), (_a !== null && _a !== void 0 ? _a : "primary"));
57
57
  var isDropDown = menuItems && menuItems.length;
58
- var buttonClasses = "btn btn-" + (isOutline ? "outline-" : "") + variant;
58
+ var buttonClasses = "btn btn-" + (isOutline ? "outline-" : "") + variantClassName;
59
59
  if (size)
60
60
  buttonClasses += " btn-" + size;
61
61
  if (isDropDown && !splitMenu) {
@@ -66,14 +66,14 @@ var Button = /** @class */ (function (_super) {
66
66
  if (isBusy !== undefined || task !== undefined) {
67
67
  iconStyle = { fixedWidth: true };
68
68
  }
69
- if (isBusy || ((_a = task) === null || _a === void 0 ? void 0 : _a.isBusy)) {
69
+ if (isBusy || ((_b = task) === null || _b === void 0 ? void 0 : _b.isBusy)) {
70
70
  iconStyle.fixedWidth = true;
71
71
  iconStyle.spin = true;
72
72
  icon = Misc.Settings.icons.loadingIcon;
73
73
  native.disabled = true;
74
74
  }
75
75
  if (pulse) {
76
- buttonClasses += " " + variant + "-color-pulse";
76
+ buttonClasses += " " + variantClassName + "-color-pulse";
77
77
  }
78
78
  native.className = (native.className || "") + " " + buttonClasses;
79
79
  // Button text
@@ -19,7 +19,7 @@ var Card = /** @class */ (function (_super) {
19
19
  var isCollapsible = collapsible || isExpanded !== undefined || initiallyCollapsed !== undefined;
20
20
  var expandState = (isExpanded !== null && isExpanded !== void 0 ? isExpanded : this.expandState);
21
21
  if (isCollapsible) {
22
- var expandIndicator = React.createElement("i", { onClick: function () { return expandState.value = !expandState.value; }, className: "card-expand-indicator fa fa-fw fa-angle-" + (expandState.value ? "up" : "down") });
22
+ var expandIndicator = React.createElement("i", { onClick: function (e) { return expandState.value = !expandState.value; }, className: "card-expand-indicator fa fa-fw fa-angle-" + (expandState.value ? "up" : "down") });
23
23
  if (headerElements) {
24
24
  headerElements = React.createElement(React.Fragment, null,
25
25
  headerElements,
@@ -31,6 +31,7 @@ var Card = /** @class */ (function (_super) {
31
31
  if (!expandState.value) {
32
32
  className += " collapsed";
33
33
  }
34
+ className += " card-collapsible";
34
35
  }
35
36
  var body = React.createElement("div", { className: "card-body" },
36
37
  useCustomScrollbar && React.createElement(Scrollbar, null, children),
@@ -41,11 +42,11 @@ var Card = /** @class */ (function (_super) {
41
42
  }
42
43
  return (React.createElement("div", __assign({}, domProps, { className: className }),
43
44
  (icon || title) &&
44
- React.createElement("div", { className: "card-header" },
45
+ React.createElement("div", { className: "card-header", onClick: function (e) { return expandState.value = !expandState.value; } },
45
46
  React.createElement("div", { className: "card-header-title" },
46
47
  this.iconFactory.getIconComponent(icon),
47
48
  React.createElement("span", null, title)),
48
- headerElements && React.createElement("div", { className: "card-header-right-section" }, headerElements)),
49
+ headerElements && React.createElement("div", { className: "card-header-right-section", onClick: function (e) { return e.stopPropagation(); } }, headerElements)),
49
50
  body));
50
51
  };
51
52
  Card = __decorate([
@@ -20,5 +20,8 @@ export declare class StickyTableHeader {
20
20
  private onPossibleContentChange;
21
21
  private setColumnWidths;
22
22
  dispose(): void;
23
+ /**
24
+ * Returns the first parent element that has a scrollbar.
25
+ */
23
26
  private static getParentScrollElement;
24
27
  }
@@ -27,6 +27,9 @@ var StickyTableHeader = /** @class */ (function () {
27
27
  table.addEventListener("mouseup", this.onPossibleContentChange);
28
28
  }
29
29
  StickyTableHeader.prototype.handleScroll = function () {
30
+ // If the grid is in an element with a scrollbar, then the header should stick to the top of that element,
31
+ // otherwise if there is a fixed (non scrolling) element at the top of the page, then the headers must appear below that.
32
+ // otherwise the headers will stick to the top of the screen.
30
33
  var fixedElement = null;
31
34
  if (!this.scrollParent && this.fixedElement && getComputedStyle(this.fixedElement).position === "fixed") {
32
35
  fixedElement = this.fixedElement;
@@ -36,6 +39,9 @@ var StickyTableHeader = /** @class */ (function () {
36
39
  var tbodyBounds = this.table.tBodies[this.table.tBodies.length - 1].getBoundingClientRect();
37
40
  if (tableBounds.top < topBoundary && tbodyBounds.bottom - this.headerHeight > topBoundary) {
38
41
  if (!this.headerCopy) {
42
+ // Clone the header, and re-insert it into the table. The table will then have 2 headers.
43
+ // The original headers position is set to "fixed" which makes it float.
44
+ // The column widths of the floating header then need to be synchronised with the header that is still inside the table layout.
39
45
  this.headerHeight = this.header.getBoundingClientRect().height;
40
46
  this.headerCopy = this.header.cloneNode(true);
41
47
  this.table.insertBefore(this.headerCopy, this.header);
@@ -82,6 +88,9 @@ var StickyTableHeader = /** @class */ (function () {
82
88
  this.table.removeEventListener("mouseup", this.onPossibleContentChange);
83
89
  this.removeCopy();
84
90
  };
91
+ /**
92
+ * Returns the first parent element that has a scrollbar.
93
+ */
85
94
  StickyTableHeader.getParentScrollElement = function (element) {
86
95
  var current = element;
87
96
  while (current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "0.10.63",
3
+ "version": "0.10.64",
4
4
  "description": "React application logic and components for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "@types/rc-slider": "^8.6.5",
34
34
  "@types/react-color": "^3.0.1",
35
35
  "@types/react-select": "3.1.0",
36
- "@singularsystems/neo-core": "^0.10.74",
36
+ "@singularsystems/neo-core": "^0.10.75",
37
37
  "axios": "^0.21.1",
38
38
  "decimal.js-light": "2.5.1",
39
39
  "history": "4.10.1",
package/styles/Card.scss CHANGED
@@ -14,11 +14,18 @@
14
14
  margin: -10px 0;
15
15
 
16
16
  .card-expand-indicator {
17
- cursor: pointer;
18
17
  margin-left: 0.5rem;
19
18
  padding-top: 0.5rem;
20
19
  padding-bottom: 0.5rem;
21
20
  }
22
21
  }
23
22
  }
23
+
24
+ &.card-collapsible {
25
+ .card-header {
26
+ &:hover {
27
+ cursor: pointer;
28
+ }
29
+ }
30
+ }
24
31
  }