sea-chart 1.1.53-alpha.4 → 1.1.55

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,5 +1,6 @@
1
+ import _DTableModalHeader from "dtable-ui-component/lib/DTableModalHeader";
1
2
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { Modal, ModalHeader, ModalBody, ModalFooter, UncontrolledTooltip, Button } from 'reactstrap';
3
+ import { Modal, ModalBody, ModalFooter, UncontrolledTooltip, Button } from 'reactstrap';
3
4
  import classnames from 'classnames';
4
5
  import { CHART_TYPE, CHART_TYPES, CHART_TYPE_SHOW, ZH_CN_SUPPORT_CHARTS } from '../../constants';
5
6
  import { eventStopPropagation } from '../../utils';
@@ -62,7 +63,7 @@ const TypesDialog = _ref => {
62
63
  toggle: onToggle,
63
64
  className: "sea-chart-types-dialog",
64
65
  zIndex: 1048
65
- }, /*#__PURE__*/React.createElement(ModalHeader, {
66
+ }, /*#__PURE__*/React.createElement(_DTableModalHeader, {
66
67
  toggle: onToggle
67
68
  }, type ? intl.get('Edit_type') : intl.get('All_charts')), /*#__PURE__*/React.createElement(ModalBody, {
68
69
  className: "sea-chart-types-body"
@@ -14,7 +14,7 @@ export { getDateColumnFormat, isCheckboxColumn, getColumnByKey, isStatisticMapCo
14
14
  export { generatorKey } from './key-generator';
15
15
  export { translateCalendar } from './date-translate';
16
16
  export { isFunction } from './common-utils';
17
- export function formatXAxisLabel(label) {
17
+ const splitLabelWithoutEnglish = label => {
18
18
  let newLabel = '';
19
19
  while (label.length > 0) {
20
20
  if (label.length > 12) {
@@ -26,6 +26,48 @@ export function formatXAxisLabel(label) {
26
26
  }
27
27
  }
28
28
  return newLabel;
29
+ };
30
+ export function formatXAxisLabel(label) {
31
+ let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
32
+ const regex = /\b[a-zA-Z0-9'.,-]+\b/g;
33
+ const words = label.match(regex);
34
+ if (!words || words.length === 0) {
35
+ return splitLabelWithoutEnglish(label);
36
+ }
37
+ let currentLine = '';
38
+ let result = [];
39
+ for (let i = 0; i < words.length; i++) {
40
+ const word = words[i];
41
+ const index = label.indexOf(word);
42
+ if (!currentLine) {
43
+ currentLine = label.slice(0, index);
44
+ label = label.slice(index + word.length);
45
+ } else {
46
+ currentLine = currentLine + label.slice(0, index);
47
+ label = label.slice(index + word.length);
48
+ }
49
+ if (currentLine.length > maxLength) {
50
+ while (currentLine.length > maxLength) {
51
+ result.push(currentLine.slice(0, maxLength));
52
+ currentLine = currentLine.slice(maxLength);
53
+ }
54
+ }
55
+ currentLine = currentLine + word;
56
+ if (currentLine.length > maxLength) {
57
+ while (currentLine.length > maxLength) {
58
+ result.push(currentLine.slice(0, maxLength) + '-');
59
+ currentLine = currentLine.slice(maxLength);
60
+ }
61
+ }
62
+ if (currentLine.length === maxLength || currentLine.length + 1 === maxLength) {
63
+ result.push(currentLine.slice(0, maxLength));
64
+ currentLine = '';
65
+ }
66
+ if (i === words.length - 1 && currentLine) {
67
+ result.push(currentLine);
68
+ }
69
+ }
70
+ return result.join('\n');
29
71
  }
30
72
  export function formatRowTotal(rowTotal) {
31
73
  const rowTotalNum = parseFloat(rowTotal);
@@ -641,7 +641,15 @@ export const getFilterConditions = (statisticRecord, chart, table) => {
641
641
  const columnFilters = rows.map(row => getFilterByColumnType(config[columnKey], columns, [row], sqlGroupbyColumnKey));
642
642
  filters.push(...columnFilters);
643
643
  } else {
644
- const columnFilter = getFilterByColumnType(config[columnKey], columns, rows, sqlGroupbyColumnKey);
644
+ let columnFilter;
645
+ if (['map', 'map_bubble'].includes(type)) {
646
+ columnFilter = {
647
+ column_key: config[columnKey],
648
+ value: name
649
+ };
650
+ } else {
651
+ columnFilter = getFilterByColumnType(config[columnKey], columns, rows, sqlGroupbyColumnKey);
652
+ }
645
653
  filters.push(columnFilter);
646
654
  }
647
655
  if (sqlColumnGroupbyColumnKey) {
@@ -1,6 +1,8 @@
1
1
  import _ButtonFormatter from "dtable-ui-component/lib/ButtonFormatter";
2
2
  import _RateFormatter from "dtable-ui-component/lib/RateFormatter";
3
3
  import _DurationFormatter from "dtable-ui-component/lib/DurationFormatter";
4
+ import _EmailFormatter from "dtable-ui-component/lib/EmailFormatter";
5
+ import _UrlFormatter from "dtable-ui-component/lib/UrlFormatter";
4
6
  import _AutoNumberFormatter from "dtable-ui-component/lib/AutoNumberFormatter";
5
7
  import _LastModifierFormatter from "dtable-ui-component/lib/LastModifierFormatter";
6
8
  import _CreatorFormatter from "dtable-ui-component/lib/CreatorFormatter";
@@ -24,8 +26,8 @@ import intl from '../../../../intl';
24
26
  import DtableFormulaFormatter from './formatters/formula-formatter';
25
27
  import LinkFormatter from './formatters/link-formatter';
26
28
  import FileFormatter from './formatters/FileFormatter/index';
27
- import UrlFormatter from './formatters/UrlFormatter/index';
28
- import EmailFormatter from './formatters/EmailFormatter/index';
29
+ // import UrlFormatter from './formatters/UrlFormatter/index';
30
+ // import EmailFormatter from './formatters/EmailFormatter/index';
29
31
  import { getTrimmedString, getValidUrl, openUrlLink } from './utils';
30
32
  class Formatter extends React.Component {
31
33
  constructor() {
@@ -247,20 +249,22 @@ class Formatter extends React.Component {
247
249
  case CellType.URL:
248
250
  {
249
251
  if (!cellValue) return this.renderEmptyFormatter();
250
- return /*#__PURE__*/React.createElement(UrlFormatter, {
251
- onClick: () => this.onUrlClick(cellValue),
252
+ return /*#__PURE__*/React.createElement("div", {
253
+ onClick: () => this.onUrlClick(cellValue)
254
+ }, /*#__PURE__*/React.createElement(_UrlFormatter, {
252
255
  value: cellValue,
253
256
  containerClassName: containerClassName
254
- });
257
+ }), ";");
255
258
  }
256
259
  case CellType.EMAIL:
257
260
  {
258
261
  if (!cellValue) return this.renderEmptyFormatter();
259
- return /*#__PURE__*/React.createElement(EmailFormatter, {
260
- onClick: () => this.onEmailClick(cellValue),
262
+ return /*#__PURE__*/React.createElement("div", {
263
+ onClick: () => this.onEmailClick(cellValue)
264
+ }, /*#__PURE__*/React.createElement(_EmailFormatter, {
261
265
  value: cellValue,
262
266
  containerClassName: containerClassName
263
- });
267
+ }), ";");
264
268
  }
265
269
  case CellType.DURATION:
266
270
  {
@@ -1,4 +1,8 @@
1
- @import url('../css/cell-formatter.css');
1
+ .dtable-ui.cell-formatter-container {
2
+ overflow: hidden;
3
+ line-height: 1;
4
+ width: 100%;
5
+ }
2
6
 
3
7
  .dtable-ui.file-formatter {
4
8
  display: flex;
@@ -30,4 +34,4 @@
30
34
  background-color: #999;
31
35
  -webkit-transform: translate(-50%, 8px) scale(.8);
32
36
  transform: translate(-50%, 8px) scale(.8);
33
- }
37
+ }
@@ -1,8 +1,9 @@
1
+ import _ImagePreviewerLightbox from "dtable-ui-component/lib/ImagePreviewerLightbox";
1
2
  import _FileItemFormatter from "dtable-ui-component/lib/FileItemFormatter";
2
3
  import React, { Fragment } from 'react';
3
4
  import classnames from 'classnames';
4
5
  import { imageCheck } from '../../../../../../utils/common-utils';
5
- import ImagePreviewerLightbox from './image-previewer-lightbox';
6
+ import context from '../../../../../../context';
6
7
  import './index.css';
7
8
  export default class FileFormatter extends React.PureComponent {
8
9
  constructor(props) {
@@ -70,6 +71,9 @@ export default class FileFormatter extends React.PureComponent {
70
71
  largeImageIndex: -1
71
72
  });
72
73
  };
74
+ this.server = context.getSetting('server');
75
+ this.workspaceID = context.getSetting('workspaceID');
76
+ this.dtableUuid = context.getSetting('dtableUuid');
73
77
  this.state = {
74
78
  isShowLargeImage: false,
75
79
  largeImageIndex: -1,
@@ -114,7 +118,10 @@ export default class FileFormatter extends React.PureComponent {
114
118
  }, /*#__PURE__*/React.createElement(_FileItemFormatter, {
115
119
  file: item
116
120
  })));
117
- }), this.state.isShowLargeImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
121
+ }), this.state.isShowLargeImage && /*#__PURE__*/React.createElement(_ImagePreviewerLightbox, {
122
+ server: this.server,
123
+ workspaceID: this.workspaceID,
124
+ dtableUuid: this.dtableUuid,
118
125
  readOnly: true,
119
126
  imageItems: this.state.fileImageUrlList,
120
127
  imageIndex: this.state.largeImageIndex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sea-chart",
3
- "version": "1.1.53-alpha.4",
3
+ "version": "1.1.55",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@antv/data-set": "0.11.8",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@antv/scale": "0.3.14",
30
- "dtable-ui-component": "^5.1.10",
30
+ "dtable-ui-component": "^5.2.13",
31
31
  "dtable-utils": "~5.0.*",
32
32
  "prop-types": "15.8.1",
33
33
  "react": "^17.0.0",
@@ -165,4 +165,4 @@
165
165
  "publishConfig": {
166
166
  "access": "public"
167
167
  }
168
- }
168
+ }
@@ -1,6 +0,0 @@
1
- @import url('../css/cell-formatter.css');
2
-
3
- .dtable-ui.email-formatter {
4
- text-decoration: underline;
5
- cursor: pointer;
6
- }
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import classnames from 'classnames';
3
- import './index.css';
4
- class EmailFormatter extends React.Component {
5
- render() {
6
- const {
7
- containerClassName,
8
- value,
9
- onClick
10
- } = this.props;
11
- let classname = classnames('dtable-ui cell-formatter-container email-formatter', containerClassName);
12
- const props = {
13
- title: value
14
- };
15
- if (onClick) {
16
- props.onClick = onClick;
17
- }
18
- return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
19
- className: classname
20
- }), value);
21
- }
22
- }
23
- export default EmailFormatter;
@@ -1,14 +0,0 @@
1
- import _ImagePreviewerLightbox from "dtable-ui-component/lib/ImagePreviewerLightbox";
2
- import React from 'react';
3
- import context from '../../../../../../context';
4
- function ImagePreviewerLightbox(props) {
5
- const server = context.getSetting('server');
6
- const workspaceID = context.getSetting('workspaceID');
7
- const dtableUuid = context.getSetting('dtableUuid');
8
- return /*#__PURE__*/React.createElement(_ImagePreviewerLightbox, Object.assign({}, props, {
9
- server: server,
10
- workspaceID: workspaceID,
11
- dtableUuid: dtableUuid
12
- }));
13
- }
14
- export default ImagePreviewerLightbox;
@@ -1,6 +0,0 @@
1
- @import url('../css/cell-formatter.css');
2
-
3
- .dtable-ui.url-formatter {
4
- text-decoration: underline;
5
- cursor: pointer;
6
- }
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import classnames from 'classnames';
3
- import './index.css';
4
- class UrlFormatter extends React.Component {
5
- render() {
6
- const {
7
- containerClassName,
8
- value,
9
- onClick
10
- } = this.props;
11
- let classname = classnames('dtable-ui cell-formatter-container url-formatter', containerClassName);
12
- const props = {
13
- title: value
14
- };
15
- if (onClick) {
16
- props.onClick = onClick;
17
- }
18
- return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
19
- className: classname
20
- }), value);
21
- }
22
- }
23
- export default UrlFormatter;
@@ -1,5 +0,0 @@
1
- .dtable-ui.cell-formatter-container {
2
- overflow: hidden;
3
- line-height: 1;
4
- width: 100%;
5
- }