sea-chart 2.0.43 → 2.0.45
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/dist/api/index.js +4 -11
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +4 -11
- package/dist/components/cell-factory/SingleSelectOption.js +11 -18
- package/dist/components/cell-factory/cell-editor-factory.js +5 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
- package/dist/components/cell-factory/link-content.js +27 -35
- package/dist/components/chart-color-selector/color-selector.js +11 -18
- package/dist/components/collaborator/index.js +7 -14
- package/dist/components/color-picker/index.js +11 -18
- package/dist/components/color-popover/color-rules/color-rule.js +25 -33
- package/dist/components/color-popover/color-rules/index.js +6 -14
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
- package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +10 -18
- package/dist/components/color-popover/color-rules-popover.js +26 -34
- package/dist/components/color-popover/color-selector-popover.js +10 -18
- package/dist/components/color-setting/color-group-selector.js +12 -20
- package/dist/components/common-add-tool/index.js +6 -13
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +12 -19
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +16 -24
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +42 -50
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
- package/dist/components/drill-down-settings/index.js +11 -18
- package/dist/components/dtable-popover/index.js +13 -20
- package/dist/components/dtable-search-input/index.js +13 -21
- package/dist/components/font-settings/index.js +14 -22
- package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
- package/dist/components/goal-line-setting/index.js +12 -19
- package/dist/components/highlighter/highlighter.js +7 -14
- package/dist/components/icon/index.js +4 -11
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +4 -11
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +25 -33
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +54 -64
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +15 -22
- package/dist/components/row-card/row-card-header.js +14 -21
- package/dist/components/row-card/row-card-item.js +33 -41
- package/dist/components/row-card/row-card.js +15 -23
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +21 -21
- package/dist/components/types-dialog/index.js +56 -64
- package/dist/components/types-dialog/use-force-update.js +4 -10
- package/dist/constants/color-rules.js +8 -14
- package/dist/constants/common-constants.js +8 -14
- package/dist/constants/error.js +2 -8
- package/dist/constants/geolocation.js +9 -15
- package/dist/constants/index.js +149 -273
- package/dist/constants/key-codes.js +0 -2
- package/dist/constants/model.js +3 -9
- package/dist/constants/regions.js +3 -8
- package/dist/constants/style.js +6 -12
- package/dist/constants/table.js +1 -7
- package/dist/constants/type-image.js +33 -39
- package/dist/constants/type.js +3 -9
- package/dist/context.js +20 -24
- package/dist/editor/index.js +8 -15
- package/dist/index.js +13 -104
- package/dist/intl.js +10 -17
- package/dist/locale/index.js +16 -23
- package/dist/locale/lang/de.js +1 -7
- package/dist/locale/lang/en.js +1 -7
- package/dist/locale/lang/es.js +1 -7
- package/dist/locale/lang/fr.js +1 -7
- package/dist/locale/lang/pt.js +1 -7
- package/dist/locale/lang/ru.js +1 -7
- package/dist/locale/lang/zh_CN.js +1 -7
- package/dist/model/area-group.js +12 -19
- package/dist/model/area.js +12 -19
- package/dist/model/bar-custom.js +11 -18
- package/dist/model/bar-group.js +12 -19
- package/dist/model/bar-stack.js +10 -17
- package/dist/model/bar.js +11 -18
- package/dist/model/base-model.js +8 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +19 -22
- package/dist/model/compare-bar.js +14 -21
- package/dist/model/completeness-group.js +11 -18
- package/dist/model/completeness.js +10 -17
- package/dist/model/dashboard.js +7 -14
- package/dist/model/funnel.js +14 -21
- package/dist/model/generic-model.js +135 -143
- package/dist/model/heat-map.js +9 -16
- package/dist/model/horizontal-bar.js +15 -18
- package/dist/model/horizontal-group-bar.js +14 -17
- package/dist/model/index.js +69 -93
- package/dist/model/line-group.js +13 -20
- package/dist/model/line.js +12 -19
- package/dist/model/map-bubble.js +12 -19
- package/dist/model/map.js +12 -19
- package/dist/model/mirror.js +13 -20
- package/dist/model/pie.js +12 -19
- package/dist/model/ring.js +12 -19
- package/dist/model/scatter.js +10 -17
- package/dist/model/stacked-horizontal-bar.js +15 -18
- package/dist/model/table-element.js +5 -12
- package/dist/model/table.js +7 -14
- package/dist/model/tree-map.js +7 -14
- package/dist/model/trend.js +11 -18
- package/dist/model/user.js +1 -7
- package/dist/model/world-map-bubble.js +12 -19
- package/dist/model/world-map.js +12 -19
- package/dist/services/map-json.js +7 -13
- package/dist/settings/advance-bar-settings/data-settings.js +36 -44
- package/dist/settings/advance-bar-settings/index.js +3 -20
- package/dist/settings/advance-bar-settings/style-settings.js +83 -74
- package/dist/settings/bar-settings/data-settings.js +39 -47
- package/dist/settings/bar-settings/index.js +3 -20
- package/dist/settings/bar-settings/style-settings.js +69 -60
- package/dist/settings/basic-number-card/data-settings.js +49 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +18 -26
- package/dist/settings/combination-settings/data-settings.js +55 -63
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +94 -77
- package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
- package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
- package/dist/settings/completeness-settings/index.js +3 -20
- package/dist/settings/completeness-settings/style-settings.js +19 -26
- package/dist/settings/dashboard-settings/data-settings.js +43 -51
- package/dist/settings/dashboard-settings/index.js +2 -13
- package/dist/settings/data-settings.js +72 -79
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
- package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +20 -28
- package/dist/settings/funnel-settings/data-settings.js +23 -31
- package/dist/settings/funnel-settings/index.js +3 -20
- package/dist/settings/funnel-settings/style-settings.js +11 -19
- package/dist/settings/heat-map-settings/data-settings.js +18 -26
- package/dist/settings/heat-map-settings/index.js +3 -20
- package/dist/settings/heat-map-settings/style-settings.js +18 -26
- package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
- package/dist/settings/horizontal-bar-settings/index.js +3 -20
- package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
- package/dist/settings/index.js +52 -70
- package/dist/settings/map-settings/components/location-field-selector.js +10 -17
- package/dist/settings/map-settings/components/map-level-selector.js +11 -18
- package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
- package/dist/settings/map-settings/index.js +3 -20
- package/dist/settings/map-settings/map-data-settings.js +23 -30
- package/dist/settings/map-settings/map-style-settings.js +26 -34
- package/dist/settings/mirror-settings/data-settings.js +26 -34
- package/dist/settings/mirror-settings/index.js +2 -13
- package/dist/settings/pie-settings/data-settings.js +33 -41
- package/dist/settings/pie-settings/index.js +3 -20
- package/dist/settings/pie-settings/style-settings.js +47 -55
- package/dist/settings/scatter/data-settings.js +27 -34
- package/dist/settings/scatter/index.js +3 -12
- package/dist/settings/stacks-settings/index.js +19 -27
- package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
- package/dist/settings/style-settings.js +64 -72
- package/dist/settings/table-element-settings/components/data-filter.js +30 -38
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +111 -119
- package/dist/settings/table-settings/index.js +2 -13
- package/dist/settings/time-comparison-settings/data-settings.js +43 -51
- package/dist/settings/time-comparison-settings/index.js +3 -20
- package/dist/settings/time-comparison-settings/style-settings.js +62 -53
- package/dist/settings/trend-settings/data-settings.js +24 -32
- package/dist/settings/trend-settings/index.js +3 -20
- package/dist/settings/trend-settings/style-setting.js +17 -25
- package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
- package/dist/settings/widgets/basic-summary/index.js +55 -63
- package/dist/settings/widgets/chart-type/index.js +18 -26
- package/dist/settings/widgets/color-settings/index.js +72 -80
- package/dist/settings/widgets/common-data-settings.js +21 -29
- package/dist/settings/widgets/data-filter/index.js +35 -43
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +24 -32
- package/dist/settings/widgets/display-values-settings/index.js +14 -22
- package/dist/settings/widgets/divider/index.js +8 -16
- package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
- package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
- package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
- package/dist/settings/widgets/font-settings/index.js +4 -27
- package/dist/settings/widgets/group-by.js +51 -59
- package/dist/settings/widgets/min-max-setting.js +10 -18
- package/dist/settings/widgets/mininum-slice-percent.js +10 -18
- package/dist/settings/widgets/numeric-summary-item.js +23 -31
- package/dist/settings/widgets/select-line-type/index.js +10 -17
- package/dist/settings/widgets/select-table/index.js +9 -16
- package/dist/settings/widgets/select-view/index.js +20 -28
- package/dist/settings/widgets/stack.js +14 -22
- package/dist/settings/widgets/summary-method-setting.js +17 -25
- package/dist/settings/widgets/summary-settings.js +72 -80
- package/dist/settings/widgets/switch/index.js +8 -15
- package/dist/settings/widgets/text-horizontal-settings.js +15 -23
- package/dist/settings/widgets/time-picker.js +29 -37
- package/dist/settings/widgets/title-settings/index.js +29 -37
- package/dist/settings/widgets/title-settings/title-text.js +5 -12
- package/dist/settings/widgets/x-axios.js +0 -1
- package/dist/settings/widgets/y-axis-group-settings.js +63 -71
- package/dist/utils/cell-format-utils.js +18 -28
- package/dist/utils/cell-value-utils.js +5 -12
- package/dist/utils/chart-utils/base-utils.js +362 -334
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +80 -86
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +32 -39
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +21 -28
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +91 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
- package/dist/utils/chart-utils/sql-statistics-utils.js +284 -246
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +18 -30
- package/dist/utils/collaborator.js +4 -13
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +65 -92
- package/dist/utils/common-utils.js +27 -52
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +11 -19
- package/dist/utils/digital-sign-utils.js +7 -14
- package/dist/utils/event-bus.js +1 -7
- package/dist/utils/hotkey.js +5 -11
- package/dist/utils/index.js +54 -221
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +1 -7
- package/dist/utils/options-utils.js +8 -16
- package/dist/utils/row-record-utils.js +182 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +49 -55
- package/dist/utils/sql/column-2-sql-column.js +146 -154
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.css +0 -17
- package/dist/view/index.js +89 -95
- package/dist/view/title/index.js +15 -23
- package/dist/view/wrapper/area-group.js +57 -74
- package/dist/view/wrapper/area.js +51 -72
- package/dist/view/wrapper/bar-compare.js +47 -58
- package/dist/view/wrapper/bar-custom-stack.js +53 -121
- package/dist/view/wrapper/bar-group.js +55 -96
- package/dist/view/wrapper/bar-stack.js +58 -92
- package/dist/view/wrapper/bar.js +45 -66
- package/dist/view/wrapper/basic-number-card.js +25 -26
- package/dist/view/wrapper/chart-component.js +600 -166
- package/dist/view/wrapper/combination.js +79 -87
- package/dist/view/wrapper/completeness-group.js +46 -98
- package/dist/view/wrapper/completeness.js +45 -97
- package/dist/view/wrapper/dashboard.js +33 -47
- package/dist/view/wrapper/funnel.js +65 -64
- package/dist/view/wrapper/heat-map.js +126 -104
- package/dist/view/wrapper/horizontal-bar-group.js +61 -78
- package/dist/view/wrapper/horizontal-bar-stack.js +60 -111
- package/dist/view/wrapper/horizontal-bar.js +45 -68
- package/dist/view/wrapper/index.js +110 -115
- package/dist/view/wrapper/line-group.js +52 -68
- package/dist/view/wrapper/line.js +47 -67
- package/dist/view/wrapper/map-bubble.js +46 -59
- package/dist/view/wrapper/map-world-bubble.js +45 -58
- package/dist/view/wrapper/map-world.js +47 -60
- package/dist/view/wrapper/map.js +48 -60
- package/dist/view/wrapper/mirror.js +45 -64
- package/dist/view/wrapper/pie.js +51 -59
- package/dist/view/wrapper/ring.js +57 -64
- package/dist/view/wrapper/scatter.js +53 -69
- package/dist/view/wrapper/table/index.js +13 -21
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +50 -58
- package/dist/view/wrapper/table/pivot-table-display-name.js +83 -91
- package/dist/view/wrapper/table/two-dimension-table.js +76 -84
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +96 -105
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +22 -31
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/record.js +10 -17
- package/dist/view/wrapper/table-element/components/records-body.js +17 -19
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +23 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
- package/dist/view/wrapper/table-element/components/utils.js +5 -15
- package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
- package/dist/view/wrapper/table-element/index.js +18 -26
- package/dist/view/wrapper/treemap.js +39 -57
- package/dist/view/wrapper/trend.js +41 -48
- package/package.json +1 -1
|
@@ -1,57 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _context = _interopRequireDefault(require("../context"));
|
|
22
|
-
var _constants = require("../constants");
|
|
23
|
-
var _type = require("../constants/type");
|
|
24
|
-
var _sql = require("./sql");
|
|
25
|
-
var _chartUtils = require("./chart-utils");
|
|
26
|
-
const UNSHOW_COLUMN_TYPE = exports.UNSHOW_COLUMN_TYPE = [_dtableUtils.CellType.LINK, _dtableUtils.CellType.LONG_TEXT, _dtableUtils.CellType.FORMULA, _dtableUtils.CellType.LINK_FORMULA];
|
|
27
|
-
const getCellRecordWidth = column => {
|
|
1
|
+
import _ButtonFormatter from "dtable-ui-component/lib/ButtonFormatter";
|
|
2
|
+
import _RateFormatter from "dtable-ui-component/lib/RateFormatter";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { CellType, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES, getNumberDisplayString, getDateDisplayString, getCellValueStringResult, isNumber, isValidLink, getColumnOptions, getGeolocationDisplayString } from 'dtable-utils';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import { isEqual } from 'lodash-es';
|
|
7
|
+
import cellFormatterFactory from '../components/cell-factory/cell-formatter-factory';
|
|
8
|
+
import SimpleCellFormatter from '../components/cell-factory/SimpleCellFormatter';
|
|
9
|
+
import SingleSelectOption from '../components/cell-factory/SingleSelectOption';
|
|
10
|
+
import { isFunction, getFileIconUrl, getImageThumbnailUrl, isArchiveViewRowData } from '../utils/common-utils';
|
|
11
|
+
import Highlighter from '../components/highlighter/highlighter';
|
|
12
|
+
import DigitalSignUtils from '../utils/digital-sign-utils';
|
|
13
|
+
import { getColumnByKey } from '../utils/column-utils';
|
|
14
|
+
import context from '../context';
|
|
15
|
+
import { xAxisMap, groupAxisMap } from '../constants';
|
|
16
|
+
import { CHART_TYPE } from '../constants/type';
|
|
17
|
+
import { chartColumn2SqlColumn } from './sql';
|
|
18
|
+
import { BaseUtils } from './chart-utils';
|
|
19
|
+
export const UNSHOW_COLUMN_TYPE = [CellType.LINK, CellType.LONG_TEXT, CellType.FORMULA, CellType.LINK_FORMULA];
|
|
20
|
+
export const getCellRecordWidth = column => {
|
|
28
21
|
let {
|
|
29
22
|
type,
|
|
30
23
|
data
|
|
31
24
|
} = column;
|
|
32
25
|
switch (type) {
|
|
33
|
-
case
|
|
26
|
+
case CellType.DATE:
|
|
34
27
|
{
|
|
35
28
|
let isShowHourAndMinute = data && data.format && data.format.indexOf('HH:mm') > -1;
|
|
36
29
|
return isShowHourAndMinute ? 160 : 100;
|
|
37
30
|
}
|
|
38
|
-
case
|
|
39
|
-
case
|
|
40
|
-
case
|
|
41
|
-
case
|
|
31
|
+
case CellType.CTIME:
|
|
32
|
+
case CellType.MTIME:
|
|
33
|
+
case CellType.LINK:
|
|
34
|
+
case CellType.GEOLOCATION:
|
|
42
35
|
{
|
|
43
36
|
return 160;
|
|
44
37
|
}
|
|
45
|
-
case
|
|
38
|
+
case CellType.COLLABORATOR:
|
|
46
39
|
{
|
|
47
40
|
return 100;
|
|
48
41
|
}
|
|
49
|
-
case
|
|
42
|
+
case CellType.CHECKBOX:
|
|
50
43
|
{
|
|
51
44
|
return 40;
|
|
52
45
|
}
|
|
53
|
-
case
|
|
54
|
-
case
|
|
46
|
+
case CellType.NUMBER:
|
|
47
|
+
case CellType.AUTO_NUMBER:
|
|
55
48
|
{
|
|
56
49
|
return 120;
|
|
57
50
|
}
|
|
@@ -61,8 +54,7 @@ const getCellRecordWidth = column => {
|
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
56
|
};
|
|
64
|
-
|
|
65
|
-
const getRowRecord = function (currentTableId, row, columns, unShowColumnKeyList) {
|
|
57
|
+
export const getRowRecord = function (currentTableId, row, columns, unShowColumnKeyList) {
|
|
66
58
|
let matchedResult = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
67
59
|
if (!Array.isArray(unShowColumnKeyList)) {
|
|
68
60
|
unShowColumnKeyList = [];
|
|
@@ -79,62 +71,60 @@ const getRowRecord = function (currentTableId, row, columns, unShowColumnKeyList
|
|
|
79
71
|
}, column.width);
|
|
80
72
|
});
|
|
81
73
|
};
|
|
82
|
-
|
|
83
|
-
const isLookupImages = column => {
|
|
74
|
+
export const isLookupImages = column => {
|
|
84
75
|
const {
|
|
85
76
|
type,
|
|
86
77
|
data
|
|
87
78
|
} = column;
|
|
88
|
-
if (type !==
|
|
79
|
+
if (type !== CellType.LINK_FORMULA) return false;
|
|
89
80
|
const {
|
|
90
81
|
result_type,
|
|
91
82
|
array_type
|
|
92
83
|
} = data || {};
|
|
93
|
-
if (result_type !==
|
|
94
|
-
return array_type ===
|
|
84
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY) return false;
|
|
85
|
+
return array_type === CellType.IMAGE || array_type === CellType.DIGITAL_SIGN;
|
|
95
86
|
};
|
|
96
|
-
exports.isLookupImages = isLookupImages;
|
|
97
87
|
function _getCellRecord(displayValue, rowId, column, columnWidth) {
|
|
98
88
|
let {
|
|
99
89
|
key
|
|
100
90
|
} = column;
|
|
101
|
-
return /*#__PURE__*/
|
|
91
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
102
92
|
className: "row-cell-value text-truncate",
|
|
103
93
|
key: rowId + '_' + key,
|
|
104
94
|
style: {
|
|
105
95
|
width: columnWidth
|
|
106
96
|
}
|
|
107
|
-
}, displayValue ? displayValue : /*#__PURE__*/
|
|
97
|
+
}, displayValue ? displayValue : /*#__PURE__*/React.createElement("span", {
|
|
108
98
|
className: "row-cell-value-empty"
|
|
109
99
|
}));
|
|
110
100
|
}
|
|
111
101
|
function _renderSearch(value, searchValue) {
|
|
112
|
-
return /*#__PURE__*/
|
|
102
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
113
103
|
className: "cell-value-ellipsis text-truncate",
|
|
114
104
|
title: value
|
|
115
|
-
}, /*#__PURE__*/
|
|
105
|
+
}, /*#__PURE__*/React.createElement(Highlighter, {
|
|
116
106
|
highlight: searchValue
|
|
117
107
|
}, value));
|
|
118
108
|
}
|
|
119
109
|
function getLookupImagesDOMs(value, arrayType) {
|
|
120
110
|
if (!value) return null;
|
|
121
111
|
let images = Array.isArray(value) ? value : [value];
|
|
122
|
-
if (arrayType ===
|
|
123
|
-
images = value.map(sign =>
|
|
112
|
+
if (arrayType === CellType.DIGITAL_SIGN) {
|
|
113
|
+
images = value.map(sign => DigitalSignUtils.getSignImageUrl(sign)).filter(Boolean);
|
|
124
114
|
}
|
|
125
115
|
const amount = images.length;
|
|
126
116
|
if (amount === 0) return null;
|
|
127
|
-
const imgSrc =
|
|
128
|
-
return /*#__PURE__*/
|
|
117
|
+
const imgSrc = getImageThumbnailUrl(images[0]);
|
|
118
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
119
|
className: "image-cell-value"
|
|
130
|
-
}, /*#__PURE__*/
|
|
120
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
131
121
|
alt: "",
|
|
132
122
|
src: imgSrc
|
|
133
|
-
}), amount > 1 && /*#__PURE__*/
|
|
123
|
+
}), amount > 1 && /*#__PURE__*/React.createElement("span", {
|
|
134
124
|
className: "cell-value-size"
|
|
135
125
|
}, '+' + amount));
|
|
136
126
|
}
|
|
137
|
-
const getFormattedCell = function (column, row) {
|
|
127
|
+
export const getFormattedCell = function (column, row) {
|
|
138
128
|
let {
|
|
139
129
|
formulaRow = {},
|
|
140
130
|
searchValue = null,
|
|
@@ -151,15 +141,15 @@ const getFormattedCell = function (column, row) {
|
|
|
151
141
|
let value = row[key];
|
|
152
142
|
let displayValue;
|
|
153
143
|
let isNonEmptyArray = Array.isArray(value) && value.length > 0;
|
|
154
|
-
const departments =
|
|
144
|
+
const departments = context.getDepartments();
|
|
155
145
|
switch (type) {
|
|
156
|
-
case
|
|
146
|
+
case CellType.TEXT:
|
|
157
147
|
{
|
|
158
148
|
if (value && typeof value === 'string') {
|
|
159
149
|
if (searchValue) {
|
|
160
150
|
displayValue = _renderSearch(value, searchValue);
|
|
161
151
|
} else {
|
|
162
|
-
displayValue = /*#__PURE__*/
|
|
152
|
+
displayValue = /*#__PURE__*/React.createElement("span", {
|
|
163
153
|
className: "cell-value-ellipsis text-truncate",
|
|
164
154
|
title: value
|
|
165
155
|
}, value);
|
|
@@ -167,59 +157,59 @@ const getFormattedCell = function (column, row) {
|
|
|
167
157
|
}
|
|
168
158
|
break;
|
|
169
159
|
}
|
|
170
|
-
case
|
|
160
|
+
case CellType.DATE:
|
|
171
161
|
{
|
|
172
162
|
if (value && typeof value === 'string') {
|
|
173
163
|
const format = column.data && column.data.format ? column.data.format : 'YYYY-MM-DD';
|
|
174
|
-
const formatValue =
|
|
164
|
+
const formatValue = getDateDisplayString(value, format);
|
|
175
165
|
displayValue = searchValue ? _renderSearch(formatValue, searchValue) : formatValue;
|
|
176
166
|
}
|
|
177
167
|
break;
|
|
178
168
|
}
|
|
179
|
-
case
|
|
180
|
-
case
|
|
169
|
+
case CellType.CTIME:
|
|
170
|
+
case CellType.MTIME:
|
|
181
171
|
{
|
|
182
172
|
if (value && typeof value === 'string') {
|
|
183
173
|
if (searchValue) {
|
|
184
|
-
displayValue = /*#__PURE__*/
|
|
174
|
+
displayValue = /*#__PURE__*/React.createElement(Highlighter, {
|
|
185
175
|
highlight: searchValue
|
|
186
|
-
}, (
|
|
176
|
+
}, dayjs(value).format('YYYY-MM-DD HH:mm:ss'));
|
|
187
177
|
} else {
|
|
188
|
-
displayValue = (
|
|
178
|
+
displayValue = dayjs(value).format('YYYY-MM-DD HH:mm:ss');
|
|
189
179
|
}
|
|
190
180
|
}
|
|
191
181
|
break;
|
|
192
182
|
}
|
|
193
|
-
case
|
|
183
|
+
case CellType.NUMBER:
|
|
194
184
|
{
|
|
195
|
-
if (
|
|
185
|
+
if (isNumber(value)) {
|
|
196
186
|
const {
|
|
197
187
|
data = {}
|
|
198
188
|
} = column;
|
|
199
|
-
const formatedValue =
|
|
189
|
+
const formatedValue = getNumberDisplayString(value, data);
|
|
200
190
|
if (searchValue) {
|
|
201
191
|
displayValue = _renderSearch(formatedValue, searchValue);
|
|
202
192
|
} else {
|
|
203
|
-
displayValue = /*#__PURE__*/
|
|
193
|
+
displayValue = /*#__PURE__*/React.createElement("div", {
|
|
204
194
|
className: "number-formatter"
|
|
205
195
|
}, formatedValue);
|
|
206
196
|
}
|
|
207
197
|
}
|
|
208
198
|
break;
|
|
209
199
|
}
|
|
210
|
-
case
|
|
200
|
+
case CellType.LINK:
|
|
211
201
|
{
|
|
212
202
|
displayValue = null;
|
|
213
203
|
const {
|
|
214
204
|
data
|
|
215
205
|
} = column;
|
|
216
|
-
if (!
|
|
206
|
+
if (!isValidLink(data)) break;
|
|
217
207
|
|
|
218
208
|
// is default view: row data can get from formula row
|
|
219
209
|
// is archive view: row data can get form rowdata
|
|
220
|
-
value =
|
|
210
|
+
value = isArchiveViewRowData(row, column) ? value : formulaRow[key];
|
|
221
211
|
if (!value || !Array.isArray(value) || value.length === 0) break;
|
|
222
|
-
const collaborators =
|
|
212
|
+
const collaborators = context.getCollaboratorsFromCache();
|
|
223
213
|
const {
|
|
224
214
|
display_column_key,
|
|
225
215
|
array_type,
|
|
@@ -231,9 +221,9 @@ const getFormattedCell = function (column, row) {
|
|
|
231
221
|
type: array_type,
|
|
232
222
|
data: array_data
|
|
233
223
|
};
|
|
234
|
-
displayValue = /*#__PURE__*/
|
|
224
|
+
displayValue = /*#__PURE__*/React.createElement("div", {
|
|
235
225
|
className: "links-formatter"
|
|
236
|
-
}, /*#__PURE__*/
|
|
226
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
237
227
|
className: "formatter-show"
|
|
238
228
|
}, value.map(item => {
|
|
239
229
|
const {
|
|
@@ -247,24 +237,24 @@ const getFormattedCell = function (column, row) {
|
|
|
247
237
|
const formulaRows = {
|
|
248
238
|
[rowId]: linkedRow
|
|
249
239
|
};
|
|
250
|
-
const displayResult =
|
|
240
|
+
const displayResult = getCellValueStringResult(linkedRow, linkedColumn, {
|
|
251
241
|
formulaRows,
|
|
252
242
|
collaborators,
|
|
253
243
|
departments
|
|
254
244
|
});
|
|
255
|
-
return /*#__PURE__*/
|
|
245
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
256
246
|
key: `${rowId}_${display_column_key}`,
|
|
257
247
|
className: "link"
|
|
258
|
-
}, /*#__PURE__*/
|
|
248
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
259
249
|
className: "link-name"
|
|
260
250
|
}, displayResult));
|
|
261
251
|
})));
|
|
262
252
|
break;
|
|
263
253
|
}
|
|
264
|
-
case
|
|
254
|
+
case CellType.COLLABORATOR:
|
|
265
255
|
{
|
|
266
256
|
if (value && isNonEmptyArray) {
|
|
267
|
-
const allCollaborators =
|
|
257
|
+
const allCollaborators = context.getCollaboratorsFromCache();
|
|
268
258
|
let validValue = value.filter(item => {
|
|
269
259
|
return allCollaborators.find(collaborator => collaborator.email === item);
|
|
270
260
|
});
|
|
@@ -276,23 +266,23 @@ const getFormattedCell = function (column, row) {
|
|
|
276
266
|
}
|
|
277
267
|
break;
|
|
278
268
|
}
|
|
279
|
-
case
|
|
269
|
+
case CellType.SINGLE_SELECT:
|
|
280
270
|
{
|
|
281
271
|
if (value && typeof value === 'string') {
|
|
282
|
-
displayValue = /*#__PURE__*/
|
|
272
|
+
displayValue = /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
283
273
|
column: column,
|
|
284
274
|
value: value
|
|
285
275
|
});
|
|
286
276
|
}
|
|
287
277
|
break;
|
|
288
278
|
}
|
|
289
|
-
case
|
|
279
|
+
case CellType.MULTIPLE_SELECT:
|
|
290
280
|
{
|
|
291
281
|
if (value && isNonEmptyArray) {
|
|
292
|
-
displayValue = /*#__PURE__*/
|
|
282
|
+
displayValue = /*#__PURE__*/React.createElement("span", {
|
|
293
283
|
className: "multiple-select-formatter"
|
|
294
284
|
}, value.map((item, index) => {
|
|
295
|
-
return /*#__PURE__*/
|
|
285
|
+
return /*#__PURE__*/React.createElement(SingleSelectOption, {
|
|
296
286
|
column: column,
|
|
297
287
|
value: item,
|
|
298
288
|
key: `row-operation-multiple-select-${index}`
|
|
@@ -301,56 +291,56 @@ const getFormattedCell = function (column, row) {
|
|
|
301
291
|
}
|
|
302
292
|
break;
|
|
303
293
|
}
|
|
304
|
-
case
|
|
294
|
+
case CellType.FILE:
|
|
305
295
|
{
|
|
306
296
|
if (value && isNonEmptyArray) {
|
|
307
297
|
let {
|
|
308
298
|
name,
|
|
309
299
|
type
|
|
310
300
|
} = value[0];
|
|
311
|
-
let fileIconUrl =
|
|
301
|
+
let fileIconUrl = getFileIconUrl(name, type);
|
|
312
302
|
let amount = value.length;
|
|
313
|
-
displayValue = /*#__PURE__*/
|
|
303
|
+
displayValue = /*#__PURE__*/React.createElement("div", {
|
|
314
304
|
className: "image-cell-value"
|
|
315
|
-
}, /*#__PURE__*/
|
|
305
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
316
306
|
alt: "",
|
|
317
307
|
src: fileIconUrl
|
|
318
|
-
}), amount > 1 && /*#__PURE__*/
|
|
308
|
+
}), amount > 1 && /*#__PURE__*/React.createElement("span", {
|
|
319
309
|
className: "cell-value-size"
|
|
320
310
|
}, '+' + amount));
|
|
321
311
|
}
|
|
322
312
|
break;
|
|
323
313
|
}
|
|
324
|
-
case
|
|
314
|
+
case CellType.IMAGE:
|
|
325
315
|
{
|
|
326
316
|
if (value && isNonEmptyArray) {
|
|
327
|
-
const imgSrc =
|
|
317
|
+
const imgSrc = getImageThumbnailUrl(value[0]);
|
|
328
318
|
const amount = value.length;
|
|
329
|
-
displayValue = /*#__PURE__*/
|
|
319
|
+
displayValue = /*#__PURE__*/React.createElement("div", {
|
|
330
320
|
className: "image-cell-value"
|
|
331
|
-
}, /*#__PURE__*/
|
|
321
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
332
322
|
alt: "",
|
|
333
323
|
src: imgSrc
|
|
334
|
-
}), amount > 1 && /*#__PURE__*/
|
|
324
|
+
}), amount > 1 && /*#__PURE__*/React.createElement("span", {
|
|
335
325
|
className: "cell-value-size"
|
|
336
326
|
}, '+' + amount));
|
|
337
327
|
}
|
|
338
328
|
break;
|
|
339
329
|
}
|
|
340
|
-
case
|
|
330
|
+
case CellType.DIGITAL_SIGN:
|
|
341
331
|
{
|
|
342
|
-
const signImageUrl =
|
|
332
|
+
const signImageUrl = getImageThumbnailUrl(DigitalSignUtils.getSignImageUrl(value));
|
|
343
333
|
if (signImageUrl) {
|
|
344
|
-
displayValue = /*#__PURE__*/
|
|
334
|
+
displayValue = /*#__PURE__*/React.createElement("div", {
|
|
345
335
|
className: "image-cell-value"
|
|
346
|
-
}, /*#__PURE__*/
|
|
336
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
347
337
|
src: signImageUrl,
|
|
348
338
|
alt: ""
|
|
349
339
|
}));
|
|
350
340
|
}
|
|
351
341
|
break;
|
|
352
342
|
}
|
|
353
|
-
case
|
|
343
|
+
case CellType.DEPARTMENT_SINGLE_SELECT:
|
|
354
344
|
{
|
|
355
345
|
if (value) {
|
|
356
346
|
displayValue = createColumnFormatter(type, {
|
|
@@ -360,10 +350,10 @@ const getFormattedCell = function (column, row) {
|
|
|
360
350
|
}
|
|
361
351
|
break;
|
|
362
352
|
}
|
|
363
|
-
case
|
|
353
|
+
case CellType.CHECKBOX:
|
|
364
354
|
{
|
|
365
355
|
if (value) {
|
|
366
|
-
displayValue = /*#__PURE__*/
|
|
356
|
+
displayValue = /*#__PURE__*/React.createElement("span", {
|
|
367
357
|
className: "dtable-font dtable-icon-check-mark",
|
|
368
358
|
style: {
|
|
369
359
|
color: '#20c933'
|
|
@@ -372,10 +362,10 @@ const getFormattedCell = function (column, row) {
|
|
|
372
362
|
}
|
|
373
363
|
break;
|
|
374
364
|
}
|
|
375
|
-
case
|
|
365
|
+
case CellType.GEOLOCATION:
|
|
376
366
|
{
|
|
377
367
|
if (value && typeof value === 'object') {
|
|
378
|
-
displayValue = /*#__PURE__*/
|
|
368
|
+
displayValue = /*#__PURE__*/React.createElement("div", {
|
|
379
369
|
className: "geolocation-formatter"
|
|
380
370
|
}, createColumnFormatter(type, {
|
|
381
371
|
value,
|
|
@@ -386,10 +376,10 @@ const getFormattedCell = function (column, row) {
|
|
|
386
376
|
}
|
|
387
377
|
break;
|
|
388
378
|
}
|
|
389
|
-
case
|
|
390
|
-
case
|
|
379
|
+
case CellType.CREATOR:
|
|
380
|
+
case CellType.LAST_MODIFIER:
|
|
391
381
|
{
|
|
392
|
-
const collaborators =
|
|
382
|
+
const collaborators = context.getCollaboratorsFromCache();
|
|
393
383
|
if (value) {
|
|
394
384
|
displayValue = createColumnFormatter(type, {
|
|
395
385
|
value,
|
|
@@ -398,7 +388,7 @@ const getFormattedCell = function (column, row) {
|
|
|
398
388
|
}
|
|
399
389
|
break;
|
|
400
390
|
}
|
|
401
|
-
case
|
|
391
|
+
case CellType.LONG_TEXT:
|
|
402
392
|
{
|
|
403
393
|
if (value) {
|
|
404
394
|
displayValue = createColumnFormatter(type, {
|
|
@@ -408,8 +398,8 @@ const getFormattedCell = function (column, row) {
|
|
|
408
398
|
}
|
|
409
399
|
break;
|
|
410
400
|
}
|
|
411
|
-
case
|
|
412
|
-
case
|
|
401
|
+
case CellType.FORMULA:
|
|
402
|
+
case CellType.LINK_FORMULA:
|
|
413
403
|
{
|
|
414
404
|
if (!formulaRow) {
|
|
415
405
|
break;
|
|
@@ -420,7 +410,7 @@ const getFormattedCell = function (column, row) {
|
|
|
420
410
|
displayValue = getLookupImagesDOMs(newValue, column.data.array_type);
|
|
421
411
|
break;
|
|
422
412
|
}
|
|
423
|
-
const collaborators =
|
|
413
|
+
const collaborators = context.getCollaboratorsFromCache();
|
|
424
414
|
let formatterProps = {
|
|
425
415
|
value: newValue,
|
|
426
416
|
column,
|
|
@@ -433,9 +423,9 @@ const getFormattedCell = function (column, row) {
|
|
|
433
423
|
break;
|
|
434
424
|
}
|
|
435
425
|
// email, url, audo_number are same
|
|
436
|
-
case
|
|
437
|
-
case
|
|
438
|
-
case
|
|
426
|
+
case CellType.EMAIL:
|
|
427
|
+
case CellType.URL:
|
|
428
|
+
case CellType.AUTO_NUMBER:
|
|
439
429
|
{
|
|
440
430
|
if (value) {
|
|
441
431
|
displayValue = searchValue ? _renderSearch(value, searchValue) : createColumnFormatter(type, {
|
|
@@ -444,7 +434,7 @@ const getFormattedCell = function (column, row) {
|
|
|
444
434
|
}
|
|
445
435
|
break;
|
|
446
436
|
}
|
|
447
|
-
case
|
|
437
|
+
case CellType.DURATION:
|
|
448
438
|
{
|
|
449
439
|
if (value) {
|
|
450
440
|
displayValue = createColumnFormatter(type, {
|
|
@@ -454,10 +444,10 @@ const getFormattedCell = function (column, row) {
|
|
|
454
444
|
}
|
|
455
445
|
break;
|
|
456
446
|
}
|
|
457
|
-
case
|
|
447
|
+
case CellType.RATE:
|
|
458
448
|
{
|
|
459
449
|
if (value) {
|
|
460
|
-
displayValue = /*#__PURE__*/
|
|
450
|
+
displayValue = /*#__PURE__*/React.createElement(_RateFormatter, {
|
|
461
451
|
value: value,
|
|
462
452
|
column: column,
|
|
463
453
|
editable: false
|
|
@@ -465,9 +455,9 @@ const getFormattedCell = function (column, row) {
|
|
|
465
455
|
}
|
|
466
456
|
break;
|
|
467
457
|
}
|
|
468
|
-
case
|
|
458
|
+
case CellType.BUTTON:
|
|
469
459
|
{
|
|
470
|
-
displayValue = /*#__PURE__*/
|
|
460
|
+
displayValue = /*#__PURE__*/React.createElement(_ButtonFormatter, {
|
|
471
461
|
row: row,
|
|
472
462
|
column: column,
|
|
473
463
|
preventClickEvent: true,
|
|
@@ -483,46 +473,45 @@ const getFormattedCell = function (column, row) {
|
|
|
483
473
|
}
|
|
484
474
|
return _getCellRecord(displayValue, rowId, column, columnWidth);
|
|
485
475
|
};
|
|
486
|
-
exports.getFormattedCell = getFormattedCell;
|
|
487
476
|
const createColumnFormatter = (columnType, formatterProps) => {
|
|
488
|
-
const Formatter =
|
|
489
|
-
if (
|
|
490
|
-
return
|
|
477
|
+
const Formatter = cellFormatterFactory.createFormatter(columnType);
|
|
478
|
+
if (React.isValidElement(Formatter)) {
|
|
479
|
+
return React.cloneElement(Formatter, {
|
|
491
480
|
...formatterProps
|
|
492
481
|
});
|
|
493
|
-
} else if (
|
|
494
|
-
return /*#__PURE__*/
|
|
482
|
+
} else if (isFunction(Formatter)) {
|
|
483
|
+
return /*#__PURE__*/React.createElement(Formatter, formatterProps);
|
|
495
484
|
}
|
|
496
|
-
return /*#__PURE__*/
|
|
485
|
+
return /*#__PURE__*/React.createElement(SimpleCellFormatter, formatterProps);
|
|
497
486
|
};
|
|
498
487
|
const filterPredicateMap = {
|
|
499
|
-
[
|
|
500
|
-
[
|
|
501
|
-
[
|
|
502
|
-
[
|
|
503
|
-
[
|
|
504
|
-
[
|
|
505
|
-
[
|
|
506
|
-
[
|
|
507
|
-
[
|
|
508
|
-
[
|
|
509
|
-
[
|
|
510
|
-
[
|
|
511
|
-
[
|
|
512
|
-
[
|
|
513
|
-
[
|
|
514
|
-
[
|
|
515
|
-
[
|
|
516
|
-
[
|
|
517
|
-
[
|
|
488
|
+
[CellType.TEXT]: 'is',
|
|
489
|
+
[CellType.NUMBER]: 'equal',
|
|
490
|
+
[CellType.CHECKBOX]: 'is',
|
|
491
|
+
[CellType.DATE]: 'is',
|
|
492
|
+
[CellType.CTIME]: 'is',
|
|
493
|
+
[CellType.MTIME]: 'is',
|
|
494
|
+
[CellType.SINGLE_SELECT]: 'is',
|
|
495
|
+
[CellType.MULTIPLE_SELECT]: 'has_all_of',
|
|
496
|
+
[CellType.DEPARTMENT_SINGLE_SELECT]: 'is',
|
|
497
|
+
[CellType.COLLABORATOR]: 'has_all_of',
|
|
498
|
+
[CellType.CREATOR]: 'is',
|
|
499
|
+
[CellType.LAST_MODIFIER]: 'is',
|
|
500
|
+
[CellType.AUTO_NUMBER]: 'is',
|
|
501
|
+
[CellType.EMAIL]: 'is',
|
|
502
|
+
[CellType.URL]: 'is',
|
|
503
|
+
[CellType.STRING]: 'is',
|
|
504
|
+
[CellType.BOOL]: 'is',
|
|
505
|
+
[CellType.LINK_FORMULA]: 'is',
|
|
506
|
+
[CellType.LINK]: 'is'
|
|
518
507
|
};
|
|
519
|
-
const USE_OPTION_ID_CELL_TYPES = [
|
|
508
|
+
const USE_OPTION_ID_CELL_TYPES = [CellType.SINGLE_SELECT, CellType.MULTIPLE_SELECT];
|
|
520
509
|
const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
|
|
521
510
|
if (!rows) rows = [];
|
|
522
511
|
const filter = {
|
|
523
512
|
column_key: columnKey || ''
|
|
524
513
|
};
|
|
525
|
-
const column =
|
|
514
|
+
const column = getColumnByKey(columnKey, columns);
|
|
526
515
|
if (!column) {
|
|
527
516
|
return filter;
|
|
528
517
|
}
|
|
@@ -534,14 +523,14 @@ const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
|
|
|
534
523
|
} = column.data || {};
|
|
535
524
|
|
|
536
525
|
// get the actual type for formula columns
|
|
537
|
-
if (type ===
|
|
538
|
-
if (result_type ===
|
|
526
|
+
if (type === CellType.FORMULA) {
|
|
527
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY && array_type) {
|
|
539
528
|
type = array_type;
|
|
540
529
|
} else {
|
|
541
530
|
type = result_type;
|
|
542
531
|
}
|
|
543
532
|
}
|
|
544
|
-
if (type ===
|
|
533
|
+
if (type === CellType.LINK_FORMULA) {
|
|
545
534
|
type = array_type;
|
|
546
535
|
// extract display_value from link formula column value
|
|
547
536
|
if (Array.isArray(value) && value.length > 0) {
|
|
@@ -550,7 +539,7 @@ const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
|
|
|
550
539
|
}
|
|
551
540
|
|
|
552
541
|
// handle link column based on array_type
|
|
553
|
-
if (columnType ===
|
|
542
|
+
if (columnType === CellType.LINK) {
|
|
554
543
|
var _column$data, _value$;
|
|
555
544
|
const linkArrayType = (_column$data = column.data) === null || _column$data === void 0 ? void 0 : _column$data.array_type;
|
|
556
545
|
if (linkArrayType) {
|
|
@@ -561,7 +550,11 @@ const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
|
|
|
561
550
|
value = value[0].display_value;
|
|
562
551
|
}
|
|
563
552
|
}
|
|
564
|
-
if (
|
|
553
|
+
if (type === CellType.GEOLOCATION) {
|
|
554
|
+
filter['value'] = getGeolocationDisplayString(Array.isArray(value) ? value[0] : value, column.data);
|
|
555
|
+
return filter;
|
|
556
|
+
}
|
|
557
|
+
if (column && [CellType.DATE, CellType.MTIME, CellType.CTIME].includes(type)) {
|
|
565
558
|
filter['value'] = value;
|
|
566
559
|
return filter;
|
|
567
560
|
}
|
|
@@ -570,9 +563,9 @@ const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
|
|
|
570
563
|
}
|
|
571
564
|
|
|
572
565
|
// handle collaborator type for formula/link_formula columns
|
|
573
|
-
const isFormulaCollaborator = (columnType ===
|
|
566
|
+
const isFormulaCollaborator = (columnType === CellType.FORMULA || columnType === CellType.LINK_FORMULA) && result_type === FORMULA_RESULT_TYPE.ARRAY && COLLABORATOR_COLUMN_TYPES.includes(array_type);
|
|
574
567
|
if (USE_OPTION_ID_CELL_TYPES.includes(column.type)) {
|
|
575
|
-
const options =
|
|
568
|
+
const options = getColumnOptions(column);
|
|
576
569
|
// name may contains spaces
|
|
577
570
|
// value maybe id or name, find option by name or id
|
|
578
571
|
const selectedOption = options.find(o => o.name.trim() === value || o.id === value);
|
|
@@ -584,8 +577,8 @@ const getFilterByColumnTypeForPivot = (columnKey, columns, value, rows) => {
|
|
|
584
577
|
filter['filter_term'] = value;
|
|
585
578
|
}
|
|
586
579
|
if (isFormulaCollaborator) {
|
|
587
|
-
filter['filter_predicate'] = filterPredicateMap[
|
|
588
|
-
} else if ([
|
|
580
|
+
filter['filter_predicate'] = filterPredicateMap[CellType.COLLABORATOR];
|
|
581
|
+
} else if ([CellType.LINK_FORMULA, CellType.LINK].includes(columnType)) {
|
|
589
582
|
filter['filter_predicate'] = filterPredicateMap[columnType];
|
|
590
583
|
} else {
|
|
591
584
|
filter['filter_predicate'] = filterPredicateMap[type];
|
|
@@ -599,7 +592,7 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
|
|
|
599
592
|
};
|
|
600
593
|
|
|
601
594
|
// need column to get type
|
|
602
|
-
const column =
|
|
595
|
+
const column = getColumnByKey(columnKey, columns);
|
|
603
596
|
if (!column) {
|
|
604
597
|
return filter;
|
|
605
598
|
}
|
|
@@ -616,14 +609,14 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
|
|
|
616
609
|
value = correctRow && correctRow[sqlColumnKey];
|
|
617
610
|
|
|
618
611
|
// get the actual type for formula columns
|
|
619
|
-
if (type ===
|
|
620
|
-
if (result_type ===
|
|
612
|
+
if (type === CellType.FORMULA) {
|
|
613
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY && array_type) {
|
|
621
614
|
type = array_type;
|
|
622
615
|
} else {
|
|
623
616
|
type = result_type;
|
|
624
617
|
}
|
|
625
618
|
}
|
|
626
|
-
if (type ===
|
|
619
|
+
if (type === CellType.LINK_FORMULA) {
|
|
627
620
|
type = array_type;
|
|
628
621
|
// extract display_value from link formula column value
|
|
629
622
|
if (Array.isArray(value) && value.length > 0) {
|
|
@@ -632,7 +625,7 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
|
|
|
632
625
|
}
|
|
633
626
|
|
|
634
627
|
// handle link column based on array_type
|
|
635
|
-
if (columnType ===
|
|
628
|
+
if (columnType === CellType.LINK) {
|
|
636
629
|
var _column$data2, _value$2;
|
|
637
630
|
const linkArrayType = (_column$data2 = column.data) === null || _column$data2 === void 0 ? void 0 : _column$data2.array_type;
|
|
638
631
|
if (linkArrayType) {
|
|
@@ -643,7 +636,11 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
|
|
|
643
636
|
value = value[0].display_value;
|
|
644
637
|
}
|
|
645
638
|
}
|
|
646
|
-
if (
|
|
639
|
+
if (type === CellType.GEOLOCATION) {
|
|
640
|
+
filter['value'] = getGeolocationDisplayString(Array.isArray(value) ? value[0] : value, column.data);
|
|
641
|
+
return filter;
|
|
642
|
+
}
|
|
643
|
+
if (column && [CellType.DATE, CellType.MTIME, CellType.CTIME].includes(type)) {
|
|
647
644
|
// link_formula result is an array, but can't pass the value directly as an array here
|
|
648
645
|
if (Array.isArray(value)) value = value[0];
|
|
649
646
|
filter['value'] = value;
|
|
@@ -651,7 +648,7 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
|
|
|
651
648
|
}
|
|
652
649
|
|
|
653
650
|
// handle collaborator type for formula/link_formula columns
|
|
654
|
-
const isFormulaCollaborator = (columnType ===
|
|
651
|
+
const isFormulaCollaborator = (columnType === CellType.FORMULA || columnType === CellType.LINK_FORMULA) && result_type === FORMULA_RESULT_TYPE.ARRAY && COLLABORATOR_COLUMN_TYPES.includes(array_type);
|
|
655
652
|
|
|
656
653
|
// value may contains spaces
|
|
657
654
|
if (typeof value === 'string') {
|
|
@@ -663,21 +660,23 @@ const getFilterByColumnType = (columnKey, columns, rows, sqlColumnKey) => {
|
|
|
663
660
|
filter['filter_term'] = value;
|
|
664
661
|
}
|
|
665
662
|
if (isFormulaCollaborator) {
|
|
666
|
-
filter['filter_predicate'] = filterPredicateMap[
|
|
667
|
-
} else if ([
|
|
663
|
+
filter['filter_predicate'] = filterPredicateMap[CellType.COLLABORATOR];
|
|
664
|
+
} else if ([CellType.LINK_FORMULA, CellType.LINK].includes(columnType)) {
|
|
668
665
|
filter['filter_predicate'] = filterPredicateMap[columnType];
|
|
669
666
|
} else {
|
|
670
667
|
filter['filter_predicate'] = filterPredicateMap[type];
|
|
671
668
|
}
|
|
672
669
|
return filter;
|
|
673
670
|
};
|
|
674
|
-
const getFilterConditions = (statisticRecord, chart, table) => {
|
|
671
|
+
export const getFilterConditions = (statisticRecord, chart, table) => {
|
|
675
672
|
const columns = table.columns || [];
|
|
676
673
|
const {
|
|
677
674
|
name = '',
|
|
678
|
-
rows,
|
|
679
675
|
isPivot
|
|
680
676
|
} = statisticRecord || {};
|
|
677
|
+
let {
|
|
678
|
+
rows
|
|
679
|
+
} = statisticRecord || {};
|
|
681
680
|
const {
|
|
682
681
|
config
|
|
683
682
|
} = chart;
|
|
@@ -685,32 +684,38 @@ const getFilterConditions = (statisticRecord, chart, table) => {
|
|
|
685
684
|
type
|
|
686
685
|
} = config;
|
|
687
686
|
const filters = [];
|
|
688
|
-
const columnKey =
|
|
689
|
-
const groupColumnKey =
|
|
690
|
-
chart.config =
|
|
691
|
-
const chartSQLMap =
|
|
687
|
+
const columnKey = xAxisMap[type];
|
|
688
|
+
const groupColumnKey = groupAxisMap[type];
|
|
689
|
+
chart.config = BaseUtils.convertConfig(config);
|
|
690
|
+
const chartSQLMap = chartColumn2SqlColumn(chart, table);
|
|
692
691
|
let {
|
|
693
692
|
sqlColumnGroupbyColumnKey,
|
|
694
693
|
sqlGroupbyColumnKey,
|
|
695
694
|
sqlXColumnKey,
|
|
696
695
|
sqlYColumnKey
|
|
697
696
|
} = chartSQLMap;
|
|
698
|
-
if (type ===
|
|
697
|
+
if (type === CHART_TYPE.COMPLETENESS_GROUP || type === CHART_TYPE.COMPLETENESS) {
|
|
699
698
|
const {
|
|
700
699
|
sqlColumns
|
|
701
700
|
} = chartSQLMap;
|
|
702
701
|
sqlGroupbyColumnKey = sqlColumns.name_column.key;
|
|
703
702
|
}
|
|
703
|
+
if ((!Array.isArray(rows) || rows.length === 0) && statisticRecord && Object.prototype.hasOwnProperty.call(statisticRecord, 'original_name')) {
|
|
704
|
+
rows = [{
|
|
705
|
+
[sqlGroupbyColumnKey]: statisticRecord.original_name,
|
|
706
|
+
[sqlColumnGroupbyColumnKey]: statisticRecord.original_group_name
|
|
707
|
+
}];
|
|
708
|
+
}
|
|
704
709
|
if (isPivot && rows.length) {
|
|
705
710
|
const xValueList = [];
|
|
706
711
|
const yValueList = [];
|
|
707
712
|
rows.forEach(r => {
|
|
708
713
|
const xValue = r[sqlGroupbyColumnKey];
|
|
709
714
|
const yValue = r[sqlColumnGroupbyColumnKey];
|
|
710
|
-
if (!xValueList.some(v =>
|
|
715
|
+
if (!xValueList.some(v => isEqual(v, xValue))) {
|
|
711
716
|
xValueList.push(xValue);
|
|
712
717
|
}
|
|
713
|
-
if (!yValueList.some(v =>
|
|
718
|
+
if (!yValueList.some(v => isEqual(v, yValue))) {
|
|
714
719
|
yValueList.push(yValue);
|
|
715
720
|
}
|
|
716
721
|
});
|
|
@@ -727,13 +732,13 @@ const getFilterConditions = (statisticRecord, chart, table) => {
|
|
|
727
732
|
const flters = rows.map(row => getFilterByColumnType(config[columnKey], columns, [row], sqlGroupbyColumnKey));
|
|
728
733
|
filters.push(...flters);
|
|
729
734
|
} else {
|
|
730
|
-
if (['map', 'map_bubble'].includes(type)) {
|
|
735
|
+
if (['map', 'map_bubble', 'heat_map'].includes(type)) {
|
|
731
736
|
const filter = {
|
|
732
737
|
column_key: config[columnKey],
|
|
733
738
|
value: name
|
|
734
739
|
};
|
|
735
740
|
filters.push(filter);
|
|
736
|
-
} else if (type ===
|
|
741
|
+
} else if (type === CHART_TYPE.SCATTER) {
|
|
737
742
|
const filterX = getFilterByColumnType(config['x_axis_column_key'], columns, rows, sqlXColumnKey);
|
|
738
743
|
const filterY = getFilterByColumnType(config['y_axis_column_key'], columns, rows, sqlYColumnKey);
|
|
739
744
|
filters.push(filterX, filterY);
|
|
@@ -748,5 +753,4 @@ const getFilterConditions = (statisticRecord, chart, table) => {
|
|
|
748
753
|
}
|
|
749
754
|
}
|
|
750
755
|
return filters;
|
|
751
|
-
};
|
|
752
|
-
exports.getFilterConditions = getFilterConditions;
|
|
756
|
+
};
|