@singularsystems/neo-react 1.0.17 → 1.0.19

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.
@@ -66,10 +66,15 @@ var ReactModelCreator = /** @class */ (function (_super) {
66
66
  makeObservable(object, annotations, { proxy: false });
67
67
  // Setup once properties have been converted to observables.
68
68
  for (var propertyKey in observables) {
69
- var property = observables[propertyKey];
70
- this.addChangeTracking(object, propertyKey, property);
71
- if (property.convertList) {
72
- this.setupList(object, propertyKey, property.convertList);
69
+ try {
70
+ var property = observables[propertyKey];
71
+ this.addChangeTracking(object, propertyKey, property);
72
+ if (property.convertList) {
73
+ this.setupList(object, propertyKey, property.convertList);
74
+ }
75
+ }
76
+ catch (e) {
77
+ throw "Error setting up property '".concat(propertyKey, "' on type '").concat(typeInfo.typeName, "': ").concat(e);
73
78
  }
74
79
  }
75
80
  };
@@ -145,7 +150,8 @@ var ReactModelCreator = /** @class */ (function (_super) {
145
150
  currentValue.length = 0;
146
151
  }
147
152
  else {
148
- if (newValue.childObjectType && newValue.setParent) {
153
+ var newValueAsList = newValue;
154
+ if (newValueAsList.createChild !== undefined && newValueAsList.addNew !== undefined) {
149
155
  // Cannot re-assign this property, so we have to clear the array, and copy the items from the source array.
150
156
  Utils.batchUpdate(function () {
151
157
  currentValue.length = 0;
@@ -59,12 +59,14 @@ export declare class ChildRow extends ComponentBase<INeoChildRowProps> {
59
59
  lastExpandValue: boolean | null;
60
60
  expandProperty?: Model.IPropertyInstance;
61
61
  inBody?: boolean;
62
+ margin: number;
62
63
  containerDiv: React.RefObject<HTMLDivElement>;
63
64
  private get isExpanded();
64
65
  protected onFirstRender(): void;
65
66
  protected afterRender(isInitial: boolean): void;
66
67
  private afterTransition;
67
68
  private setHeight;
69
+ private fixPadding;
68
70
  render(): false | React.JSX.Element | undefined;
69
71
  }
70
72
  interface INeoRowGroupProps {
@@ -100,6 +100,7 @@ var ChildRow = /** @class */ (function (_super) {
100
100
  var _this = _super.call(this, props) || this;
101
101
  _this.wasExpanded = false;
102
102
  _this.lastExpandValue = null;
103
+ _this.margin = 0;
103
104
  _this.containerDiv = React.createRef();
104
105
  _this.afterTransition = _this.afterTransition.bind(_this);
105
106
  _this.afterRender = _this.afterRender.bind(_this);
@@ -130,8 +131,12 @@ var ChildRow = /** @class */ (function (_super) {
130
131
  };
131
132
  ChildRow.prototype.afterTransition = function () {
132
133
  if (this.containerDiv.current) {
133
- this.containerDiv.current.style.maxHeight = 'none';
134
- this.containerDiv.current.style.overflow = "visible";
134
+ if (this.isExpanded) {
135
+ var childDiv = this.containerDiv.current;
136
+ childDiv.style.maxHeight = "";
137
+ childDiv.style.overflow = "";
138
+ this.fixPadding(childDiv, true);
139
+ }
135
140
  if (this.wasExpanded && !this.isExpanded) {
136
141
  // When collapsing, the child element must be removed after animation.
137
142
  this.wasExpanded = false;
@@ -142,20 +147,40 @@ var ChildRow = /** @class */ (function (_super) {
142
147
  ChildRow.prototype.setHeight = function (expand) {
143
148
  var childDiv = this.containerDiv.current;
144
149
  if (childDiv) {
150
+ this.fixPadding(childDiv, false);
145
151
  var transitionDuration = window.getComputedStyle(childDiv).transitionDuration;
146
152
  if (transitionDuration) {
147
153
  // If expand / collapse has a transition, reset the max height after the transition ends.
148
- // Subtract 50ms on collapse to prevent wierd chrome padding animation issue.
149
154
  var delay = parseFloat(transitionDuration) * 1000;
150
- setTimeout(this.afterTransition, delay - (expand ? 0 : 50));
155
+ setTimeout(this.afterTransition, delay);
151
156
  }
152
157
  else {
153
158
  this.afterTransition();
154
159
  }
155
- childDiv.style.maxHeight = (!expand ? childDiv.scrollHeight : 0) + 'px';
160
+ var maxHeight = childDiv.scrollHeight + (this.margin * 2);
161
+ childDiv.style.maxHeight = (!expand ? maxHeight : 0) + 'px';
156
162
  childDiv.style.overflow = "hidden";
157
163
  Components.AnimationHelper.triggerReflow(childDiv);
158
- childDiv.style.maxHeight = (expand ? childDiv.scrollHeight : 0) + 'px';
164
+ childDiv.style.maxHeight = (expand ? maxHeight : 0) + 'px';
165
+ }
166
+ };
167
+ // Fix animation by moving child cell padding to inner div margin.
168
+ ChildRow.prototype.fixPadding = function (childDiv, remove) {
169
+ var cell = childDiv.parentElement;
170
+ var innerDiv = childDiv.children[0];
171
+ if (remove) {
172
+ cell.style.paddingTop = "";
173
+ cell.style.paddingBottom = "";
174
+ innerDiv.style.marginTop = "";
175
+ innerDiv.style.marginBottom = "";
176
+ }
177
+ else {
178
+ var style = window.getComputedStyle(cell);
179
+ this.margin = parseInt(style.paddingTop);
180
+ innerDiv.style.marginTop = style.paddingTop;
181
+ innerDiv.style.marginBottom = style.paddingBottom;
182
+ cell.style.paddingTop = "0";
183
+ cell.style.paddingBottom = "0";
159
184
  }
160
185
  };
161
186
  ChildRow.prototype.render = function () {
@@ -179,9 +204,10 @@ var ChildRow = /** @class */ (function (_super) {
179
204
  var colSpan = this.context.columnCount + (showExpandButtonColumn ? 0 : 1);
180
205
  return (this.inBody && (isExpanded || this.wasExpanded) &&
181
206
  React.createElement("tr", __assign({}, domProps),
182
- showExpandButtonColumn && React.createElement("td", null),
207
+ showExpandButtonColumn && React.createElement("td", { className: "p-0" }),
183
208
  React.createElement("td", __assign({}, childCellProps, { colSpan: colSpan }),
184
- React.createElement("div", { ref: this.containerDiv, className: "neo-child-row-container" }, this.props.children))));
209
+ React.createElement("div", { ref: this.containerDiv, className: "neo-child-row-container" },
210
+ React.createElement("div", { className: "neo-child-row-container-inner" }, this.props.children)))));
185
211
  };
186
212
  ChildRow.contextType = GridContext;
187
213
  ChildRow = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
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",
@@ -31,10 +31,10 @@
31
31
  "typescript": "5.4.2"
32
32
  },
33
33
  "dependencies": {
34
- "@singularsystems/neo-core": "1.0.13",
34
+ "@singularsystems/neo-core": "1.0.14",
35
35
  "@types/rc-slider": "^8.6.5",
36
36
  "@types/react-color": "^3.0.1",
37
- "axios": "1.6.7",
37
+ "axios": "1.7.4",
38
38
  "history": "4.10.1",
39
39
  "inversify": "^6.0.2",
40
40
  "memoize-one": "6.0.0",
@@ -49,7 +49,7 @@
49
49
  "tslib": "2.5.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@singularsystems/neo-core": ">=1.0.13",
52
+ "@singularsystems/neo-core": ">=1.0.14",
53
53
  "axios": ">=1.6.2",
54
54
  "inversify": ">=5.0.1",
55
55
  "mobx": ">=6.9.0",