ydb-embedded-ui 1.8.6 → 1.8.7

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.7](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.6...v1.8.7) (2022-07-18)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **Preview:** sort numbers as numbers, not string ([6c42a62](https://github.com/ydb-platform/ydb-embedded-ui/commit/6c42a62d077fcb9419ceb680906d4cef78a0134f))
9
+
3
10
  ## [1.8.6](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.5...v1.8.6) (2022-07-14)
4
11
 
5
12
 
@@ -3,7 +3,7 @@ import {connect} from 'react-redux';
3
3
  import PropTypes from 'prop-types';
4
4
 
5
5
  import {configure as configureUiKit} from '@yandex-cloud/uikit';
6
- import {i18n as YDBComponentsI18N} from 'ydb-ui-components';
6
+ import {configure as configureYdbUiComponents} from 'ydb-ui-components';
7
7
  import {i18n, Lang} from '../../utils/i18n';
8
8
 
9
9
  import ContentWrapper, {Content} from './Content';
@@ -27,10 +27,8 @@ class App extends React.Component {
27
27
  constructor(props) {
28
28
  super(props);
29
29
  i18n.setLang(Lang.En);
30
- YDBComponentsI18N.setLang(Lang.En);
31
- configureUiKit({
32
- lang: Lang.En,
33
- });
30
+ configureYdbUiComponents({lang: Lang.En});
31
+ configureUiKit({lang: Lang.En});
34
32
  }
35
33
 
36
34
  componentDidMount() {
@@ -12,6 +12,7 @@ import Fullscreen from '../../../components/Fullscreen/Fullscreen';
12
12
  import {sendQuery, setQueryOptions} from '../../../store/reducers/preview';
13
13
  import {showTooltip, hideTooltip} from '../../../store/reducers/tooltip';
14
14
  import {prepareQueryError, prepareQueryResponse} from '../../../utils/index';
15
+ import {isNumeric} from '../../../utils/utils';
15
16
 
16
17
  import {isTableType} from '../utils/schema';
17
18
  import {AutoFetcher} from '../../../utils/autofetcher';
@@ -127,6 +128,8 @@ class Preview extends React.Component {
127
128
  if (data && data.length > 0) {
128
129
  columns = Object.keys(data[0]).map((key) => ({
129
130
  name: key,
131
+ align: isNumeric(data[0][key]) ? DataTable.RIGHT : DataTable.LEFT,
132
+ sortAccessor: (row) => isNumeric(row[key]) ? Number(row[key]) : row[key],
130
133
  render: ({value}) => {
131
134
  return (
132
135
  <span
@@ -81,4 +81,11 @@ export function pad9(val) {
81
81
  result = "0" + result;
82
82
  }
83
83
  return result;
84
- }
84
+ }
85
+
86
+ export function isNumeric(value) {
87
+ // need both isNaN and isNaN(parseFloat):
88
+ // - isNaN treats true/false/''/etc. as numbers, parseFloat fixes this
89
+ // - parseFloat treats '123qwe' as number, isNaN fixes this
90
+ return !isNaN(value) && !isNaN(parseFloat(value));
91
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -40,7 +40,7 @@
40
40
  "reselect": "4.0.0",
41
41
  "sass": "1.32.8",
42
42
  "web-vitals": "1.1.2",
43
- "ydb-ui-components": "2.2.0"
43
+ "ydb-ui-components": "2.3.0"
44
44
  },
45
45
  "scripts": {
46
46
  "start": "react-app-rewired start",