@longline/aqua-ui 1.0.208 → 1.0.210

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.
@@ -60,7 +60,7 @@ interface IListViewProps {
60
60
  }>;
61
61
  /**
62
62
  * Component to show when there is no data (`data` is `null` or `data` is `[]`).
63
- * The component is placed under the header, and the component is responsable
63
+ * The component is placed under the header, and the component is responsible
64
64
  * for any styling.
65
65
  * If not set, a default component is shown.
66
66
  * If set to `false`, no component is shown at all.
@@ -43,7 +43,8 @@ var TableBase = function (_a) {
43
43
  var activeColumns = props.columns.filter(function (c) { return c.active; });
44
44
  var _b = React.useState(null), activeRef = _b[0], setActiveRef = _b[1];
45
45
  var _c = React.useState(0), time = _c[0], setTime = _c[1];
46
- var _d = usePopper(activeRef, auxRef.current, {
46
+ var _d = React.useState(false), showingNoData = _d[0], setShowingNoData = _d[1];
47
+ var _e = usePopper(activeRef, auxRef.current, {
47
48
  placement: 'right-start',
48
49
  modifiers: [
49
50
  {
@@ -63,7 +64,7 @@ var TableBase = function (_a) {
63
64
  }
64
65
  }
65
66
  ]
66
- }), styles = _d.styles, attributes = _d.attributes, update = _d.update;
67
+ }), styles = _e.styles, attributes = _e.attributes, update = _e.update;
67
68
  React.useEffect(function () {
68
69
  if (update)
69
70
  update();
@@ -93,12 +94,25 @@ var TableBase = function (_a) {
93
94
  }
94
95
  }
95
96
  }, [activeRef]);
97
+ // Show no-data element only after an additional render tick. Race conditions
98
+ // in evaluating multiple states in ListView's user can result in a situation
99
+ // where data is present, and yet "no data" appears.
100
+ React.useEffect(function () {
101
+ var _a;
102
+ if ((!Array.isArray(props.data) || ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) === 0) && !props.ghost) {
103
+ var id_1 = requestAnimationFrame(function () { return setShowingNoData(true); });
104
+ return function () { return cancelAnimationFrame(id_1); };
105
+ }
106
+ else {
107
+ setShowingNoData(false);
108
+ }
109
+ return function () { };
110
+ }, [props.data, props.ghost]);
96
111
  return (React.createElement(Wrapper, { "$dark": props.dark },
97
112
  props.columnsMode &&
98
113
  React.createElement(Anchor, { right: "32px", top: "64px" },
99
114
  React.createElement(ColumnsManager, { columns: props.columns, onChange: props.onChangeColumns, onClose: props.onCloseColumns, onReset: props.onResetColumns })),
100
- (!Array.isArray(props.data) || props.data.length == 0) &&
101
- React.createElement(NoData, { dark: props.dark, component: props.noData }),
115
+ showingNoData && React.createElement(NoData, { dark: props.dark, component: props.noData }),
102
116
  React.createElement(AuxHolder, __assign({ ref: auxRef, style: __assign({ visibility: (props.active && props.aux && Array.isArray(props.data) && props.data.includes(props.active)) ? 'visible' : 'hidden' }, styles.popper) }, attributes.popper), (props.active && props.aux && Array.isArray(props.data) && props.data.includes(props.active)) && React.cloneElement(props.aux, { value: props.active })),
103
117
  React.createElement(OverlayScrollbarsComponent, { ref: innerRef, defer: true, options: { scrollbars: { theme: 'os-theme-light', autoHide: 'leave' } }, style: {
104
118
  position: "absolute",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.208",
3
+ "version": "1.0.210",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",
@@ -3,6 +3,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  return cooked;
4
4
  };
5
5
  import { createGlobalStyle } from 'styled-components';
6
- var StyleBase = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"], ["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"])), function (p) { return p.theme.colors.font; });
6
+ var StyleBase = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n a, a:visited, a:active, a:link {\n color: ", ";\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"], ["\n\n body {\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n color: ", ";\n }\n\n b, strong {\n font-weight: 700;\n }\n\n i, em {\n font-style: italic;\n }\n\n a, a:visited, a:active, a:link {\n color: ", ";\n }\n\n small, sub, sup { font-size: .83em; }\n sub { vertical-align: sub; }\n sup { vertical-align: super; }\n"])), function (p) { return p.theme.colors.font; }, function (p) { return p.theme.colors.primary[1]; });
7
7
  export { StyleBase };
8
8
  var templateObject_1;