sea-chart 2.0.36 → 2.0.38
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 +8 -15
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +5 -12
- 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 +30 -38
- 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 +12 -19
- package/dist/components/color-popover/color-rules/color-rule.js +26 -34
- package/dist/components/color-popover/color-rules/index.js +7 -15
- 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 +9 -17
- package/dist/components/color-popover/color-rules-popover.js +30 -38
- package/dist/components/color-popover/color-selector-popover.js +12 -20
- package/dist/components/color-setting/color-group-selector.js +13 -21
- package/dist/components/common-add-tool/index.js +8 -15
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +13 -20
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +18 -26
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +40 -48
- 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 +5 -12
- 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 +26 -34
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +55 -65
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +17 -24
- package/dist/components/row-card/row-card-header.js +15 -22
- package/dist/components/row-card/row-card-item.js +35 -43
- package/dist/components/row-card/row-card.js +17 -25
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +14 -21
- package/dist/components/types-dialog/index.js +62 -70
- 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 +142 -271
- 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 +13 -20
- 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 +4 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +15 -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 +11 -18
- package/dist/model/horizontal-group-bar.js +10 -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 +11 -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 +11 -17
- 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 +63 -71
- 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 +49 -57
- 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 +19 -27
- 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 +65 -73
- 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 +27 -35
- 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 +65 -73
- 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 +112 -120
- 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 +42 -50
- 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 +19 -27
- 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 +26 -34
- 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 +25 -33
- 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 +74 -82
- package/dist/settings/widgets/switch/index.js +9 -16
- 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 +64 -72
- package/dist/utils/cell-format-utils.js +17 -27
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +324 -332
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +77 -84
- 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 +21 -28
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +33 -40
- 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 +19 -26
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +90 -96
- 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 +229 -237
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +19 -31
- package/dist/utils/collaborator.js +6 -15
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +77 -104
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +12 -20
- 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 +2 -8
- package/dist/utils/options-utils.js +10 -18
- package/dist/utils/row-record-utils.js +166 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +106 -112
- package/dist/utils/sql/column-2-sql-column.js +158 -168
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.js +90 -96
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +45 -53
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +38 -46
- package/dist/view/wrapper/bar-custom-stack.js +39 -47
- package/dist/view/wrapper/bar-group.js +45 -53
- package/dist/view/wrapper/bar-stack.js +48 -56
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +26 -34
- package/dist/view/wrapper/chart-component.js +123 -131
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +40 -48
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +39 -44
- package/dist/view/wrapper/funnel.js +40 -43
- package/dist/view/wrapper/heat-map.js +62 -70
- package/dist/view/wrapper/horizontal-bar-group.js +52 -60
- package/dist/view/wrapper/horizontal-bar-stack.js +47 -55
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +43 -51
- package/dist/view/wrapper/line.js +42 -50
- package/dist/view/wrapper/map-bubble.js +40 -48
- package/dist/view/wrapper/map-world-bubble.js +39 -47
- package/dist/view/wrapper/map-world.js +41 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +44 -52
- package/dist/view/wrapper/ring.js +49 -57
- package/dist/view/wrapper/scatter.js +42 -50
- package/dist/view/wrapper/table/index.js +14 -22
- 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 +53 -61
- package/dist/view/wrapper/table/pivot-table-display-name.js +82 -90
- package/dist/view/wrapper/table/two-dimension-table.js +85 -93
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +90 -99
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +23 -32
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/record.js +13 -20
- package/dist/view/wrapper/table-element/components/records-body.js +9 -17
- 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 +25 -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 +6 -16
- 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 +38 -46
- package/dist/view/wrapper/trend.js +58 -66
- package/package.json +5 -5
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
exports.getColumnByKey = exports.getColorFromSingleSelectColumn = exports.formatNumericValue = void 0;
|
|
8
|
-
exports.getColumnOptions = getColumnOptions;
|
|
9
|
-
exports.getFormattedValue = exports.getDateColumnFormat = void 0;
|
|
10
|
-
exports.getSelectColumnOptions = getSelectColumnOptions;
|
|
11
|
-
exports.sortDataByGroupSum = exports.isWorldMapColumn = exports.isStatisticWorldMapColumn = exports.isStatisticMirrorColumn = exports.isStatisticMapColumn = exports.isMapColumn = exports.isDateFormulaColumn = exports.isDateColumn = exports.isCheckboxColumn = exports.getSummaryResult = exports.getSqlGroup = void 0;
|
|
12
|
-
var _DTableColumnIcon2 = _interopRequireDefault(require("dtable-ui-component/lib/DTableColumnIcon"));
|
|
13
|
-
var _dtableUtils = require("dtable-utils");
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
var _constants = require("../constants");
|
|
16
|
-
var _cellFormatUtils = require("./cell-format-utils");
|
|
17
|
-
var _chartUtils = require("./chart-utils");
|
|
1
|
+
import _DTableColumnIcon from "dtable-ui-component/lib/DTableColumnIcon";
|
|
2
|
+
import { CellType, DEFAULT_DATE_FORMAT, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, isNumber, isNumericColumn, getNumberDisplayString } from 'dtable-utils';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { MIRROR_COLUMN_LIST, CHART_SUMMARY_TYPE } from '../constants';
|
|
5
|
+
import { getClientFormulaDisplayString } from './cell-format-utils';
|
|
6
|
+
import { BaseUtils } from './chart-utils';
|
|
18
7
|
const UN_SUPPORTED_MAP_CN_COLUMN_TYPES = ['lng_lat', 'country_region', 'map_selection'];
|
|
19
8
|
const MAPLEVEL_SUPPORTED_COLUMN_TYPES = {
|
|
20
9
|
country: ['province', 'province_city', 'province_city_district', 'geolocation'],
|
|
@@ -23,13 +12,13 @@ const MAPLEVEL_SUPPORTED_COLUMN_TYPES = {
|
|
|
23
12
|
};
|
|
24
13
|
|
|
25
14
|
// is
|
|
26
|
-
const isMapColumn = (column, mapLevel) => {
|
|
15
|
+
export const isMapColumn = (column, mapLevel) => {
|
|
27
16
|
if (!column || !mapLevel) return false;
|
|
28
17
|
const {
|
|
29
18
|
type,
|
|
30
19
|
data
|
|
31
20
|
} = column;
|
|
32
|
-
if (type ===
|
|
21
|
+
if (type === CellType.GEOLOCATION) {
|
|
33
22
|
const {
|
|
34
23
|
geo_format
|
|
35
24
|
} = data || {};
|
|
@@ -38,13 +27,13 @@ const isMapColumn = (column, mapLevel) => {
|
|
|
38
27
|
}
|
|
39
28
|
return MAPLEVEL_SUPPORTED_COLUMN_TYPES[mapLevel].includes(geo_format);
|
|
40
29
|
}
|
|
41
|
-
if (
|
|
30
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
42
31
|
const {
|
|
43
32
|
result_type,
|
|
44
33
|
array_type,
|
|
45
34
|
array_data
|
|
46
35
|
} = data || {};
|
|
47
|
-
if (result_type !==
|
|
36
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
48
37
|
return false;
|
|
49
38
|
}
|
|
50
39
|
const {
|
|
@@ -57,15 +46,14 @@ const isMapColumn = (column, mapLevel) => {
|
|
|
57
46
|
}
|
|
58
47
|
return false;
|
|
59
48
|
};
|
|
60
|
-
|
|
61
|
-
const isWorldMapColumn = column => {
|
|
49
|
+
export const isWorldMapColumn = column => {
|
|
62
50
|
if (!column) return false;
|
|
63
51
|
const {
|
|
64
52
|
type,
|
|
65
53
|
data
|
|
66
54
|
} = column;
|
|
67
|
-
if (type ===
|
|
68
|
-
if (type ===
|
|
55
|
+
if (type === CellType.TEXT) return true;
|
|
56
|
+
if (type === CellType.GEOLOCATION) {
|
|
69
57
|
const {
|
|
70
58
|
geo_format
|
|
71
59
|
} = data || {};
|
|
@@ -73,7 +61,7 @@ const isWorldMapColumn = column => {
|
|
|
73
61
|
return true;
|
|
74
62
|
}
|
|
75
63
|
}
|
|
76
|
-
if (
|
|
64
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
77
65
|
const {
|
|
78
66
|
data
|
|
79
67
|
} = column;
|
|
@@ -82,7 +70,7 @@ const isWorldMapColumn = column => {
|
|
|
82
70
|
array_type,
|
|
83
71
|
array_data
|
|
84
72
|
} = data || {};
|
|
85
|
-
if (result_type !==
|
|
73
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
86
74
|
return false;
|
|
87
75
|
}
|
|
88
76
|
const {
|
|
@@ -94,32 +82,30 @@ const isWorldMapColumn = column => {
|
|
|
94
82
|
}
|
|
95
83
|
return false;
|
|
96
84
|
};
|
|
97
|
-
|
|
98
|
-
const isCheckboxColumn = column => {
|
|
85
|
+
export const isCheckboxColumn = column => {
|
|
99
86
|
let {
|
|
100
87
|
type,
|
|
101
88
|
data
|
|
102
89
|
} = column;
|
|
103
|
-
if (
|
|
90
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
104
91
|
const {
|
|
105
92
|
result_type,
|
|
106
93
|
array_type
|
|
107
94
|
} = data || {};
|
|
108
|
-
if (result_type ===
|
|
109
|
-
return array_type ===
|
|
95
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
96
|
+
return array_type === CellType.CHECKBOX;
|
|
110
97
|
}
|
|
111
98
|
return false;
|
|
112
99
|
}
|
|
113
|
-
return type ===
|
|
100
|
+
return type === CellType.CHECKBOX;
|
|
114
101
|
};
|
|
115
|
-
|
|
116
|
-
const isStatisticMapColumn = column => {
|
|
102
|
+
export const isStatisticMapColumn = column => {
|
|
117
103
|
if (!column) return false;
|
|
118
104
|
const {
|
|
119
105
|
type,
|
|
120
106
|
data
|
|
121
107
|
} = column;
|
|
122
|
-
if (type ===
|
|
108
|
+
if (type === CellType.GEOLOCATION) {
|
|
123
109
|
const {
|
|
124
110
|
geo_format
|
|
125
111
|
} = data || {};
|
|
@@ -128,13 +114,13 @@ const isStatisticMapColumn = column => {
|
|
|
128
114
|
}
|
|
129
115
|
return true;
|
|
130
116
|
}
|
|
131
|
-
if (
|
|
117
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
132
118
|
const {
|
|
133
119
|
result_type,
|
|
134
120
|
array_type,
|
|
135
121
|
array_data
|
|
136
122
|
} = data || {};
|
|
137
|
-
if (result_type !==
|
|
123
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
138
124
|
return false;
|
|
139
125
|
}
|
|
140
126
|
const {
|
|
@@ -147,15 +133,14 @@ const isStatisticMapColumn = column => {
|
|
|
147
133
|
}
|
|
148
134
|
return false;
|
|
149
135
|
};
|
|
150
|
-
|
|
151
|
-
const isStatisticWorldMapColumn = column => {
|
|
136
|
+
export const isStatisticWorldMapColumn = column => {
|
|
152
137
|
if (!column) return false;
|
|
153
138
|
const {
|
|
154
139
|
type,
|
|
155
140
|
data
|
|
156
141
|
} = column;
|
|
157
|
-
if (type ===
|
|
158
|
-
if (type ===
|
|
142
|
+
if (type === CellType.TEXT) return true;
|
|
143
|
+
if (type === CellType.GEOLOCATION) {
|
|
159
144
|
const {
|
|
160
145
|
geo_format
|
|
161
146
|
} = data || {};
|
|
@@ -163,7 +148,7 @@ const isStatisticWorldMapColumn = column => {
|
|
|
163
148
|
return true;
|
|
164
149
|
}
|
|
165
150
|
}
|
|
166
|
-
if (
|
|
151
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
167
152
|
const {
|
|
168
153
|
data
|
|
169
154
|
} = column;
|
|
@@ -172,7 +157,7 @@ const isStatisticWorldMapColumn = column => {
|
|
|
172
157
|
array_type,
|
|
173
158
|
array_data
|
|
174
159
|
} = data || {};
|
|
175
|
-
if (result_type !==
|
|
160
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
176
161
|
return false;
|
|
177
162
|
}
|
|
178
163
|
const {
|
|
@@ -184,13 +169,11 @@ const isStatisticWorldMapColumn = column => {
|
|
|
184
169
|
}
|
|
185
170
|
return false;
|
|
186
171
|
};
|
|
187
|
-
|
|
188
|
-
const isStatisticMirrorColumn = column => {
|
|
172
|
+
export const isStatisticMirrorColumn = column => {
|
|
189
173
|
if (!column) return false;
|
|
190
|
-
return
|
|
174
|
+
return MIRROR_COLUMN_LIST.includes(column.type);
|
|
191
175
|
};
|
|
192
|
-
|
|
193
|
-
const isDateFormulaColumn = column => {
|
|
176
|
+
export const isDateFormulaColumn = column => {
|
|
194
177
|
if (column) {
|
|
195
178
|
const {
|
|
196
179
|
type,
|
|
@@ -201,56 +184,52 @@ const isDateFormulaColumn = column => {
|
|
|
201
184
|
result_type
|
|
202
185
|
} = data || {};
|
|
203
186
|
// formula or link formula
|
|
204
|
-
if (type === 'link-formula' && array_type === 'date' || type === 'formula' && result_type ===
|
|
187
|
+
if (type === 'link-formula' && array_type === 'date' || type === 'formula' && result_type === FORMULA_RESULT_TYPE.DATE) return true;
|
|
205
188
|
}
|
|
206
189
|
return false;
|
|
207
190
|
};
|
|
208
|
-
|
|
209
|
-
const isDateColumn = column => {
|
|
191
|
+
export const isDateColumn = column => {
|
|
210
192
|
if (column) {
|
|
211
193
|
const {
|
|
212
194
|
type
|
|
213
195
|
} = column;
|
|
214
|
-
return type ===
|
|
196
|
+
return type === CellType.CTIME || type === CellType.MTIME || type === CellType.DATE;
|
|
215
197
|
}
|
|
216
198
|
return false;
|
|
217
199
|
};
|
|
218
200
|
|
|
219
201
|
// get
|
|
220
|
-
|
|
221
|
-
function getColumnOptions(columns) {
|
|
202
|
+
export function getColumnOptions(columns) {
|
|
222
203
|
return columns.map(column => {
|
|
223
204
|
return {
|
|
224
205
|
value: column,
|
|
225
|
-
label: /*#__PURE__*/
|
|
206
|
+
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
226
207
|
className: "sea-chart-column-icon"
|
|
227
|
-
}, /*#__PURE__*/
|
|
208
|
+
}, /*#__PURE__*/React.createElement(_DTableColumnIcon, {
|
|
228
209
|
column: column
|
|
229
|
-
})), /*#__PURE__*/
|
|
210
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
230
211
|
className: 'select-module select-module-name ml-0'
|
|
231
212
|
}, column.name))
|
|
232
213
|
};
|
|
233
214
|
});
|
|
234
215
|
}
|
|
235
|
-
const getDateColumnFormat = column => {
|
|
236
|
-
const format = column && column.data && column.data.format ? column.data.format :
|
|
216
|
+
export const getDateColumnFormat = column => {
|
|
217
|
+
const format = column && column.data && column.data.format ? column.data.format : DEFAULT_DATE_FORMAT;
|
|
237
218
|
// Old Europe format is D/M/YYYY new format is DD/MM/YYYY
|
|
238
219
|
return format;
|
|
239
220
|
};
|
|
240
|
-
|
|
241
|
-
const getColumnByKey = (columnKey, columns) => {
|
|
221
|
+
export const getColumnByKey = (columnKey, columns) => {
|
|
242
222
|
if (!columnKey || !Array.isArray(columns)) {
|
|
243
223
|
return null;
|
|
244
224
|
}
|
|
245
225
|
return columns.find(column => column.key === columnKey);
|
|
246
226
|
};
|
|
247
|
-
|
|
248
|
-
const getColorFromSingleSelectColumn = (column, target) => {
|
|
227
|
+
export const getColorFromSingleSelectColumn = (column, target) => {
|
|
249
228
|
let {
|
|
250
229
|
type: columnType,
|
|
251
230
|
data: columnData
|
|
252
231
|
} = column;
|
|
253
|
-
if (columnType !==
|
|
232
|
+
if (columnType !== CellType.SINGLE_SELECT) return null;
|
|
254
233
|
const options = columnData ? columnData.options : [];
|
|
255
234
|
const selectedOption = options.find(option => {
|
|
256
235
|
let id = target;
|
|
@@ -262,27 +241,25 @@ const getColorFromSingleSelectColumn = (column, target) => {
|
|
|
262
241
|
const color = selectedOption && selectedOption.color;
|
|
263
242
|
return color || null;
|
|
264
243
|
};
|
|
265
|
-
|
|
266
|
-
const getFormattedValue = (value, column, summaryMethod) => {
|
|
244
|
+
export const getFormattedValue = (value, column, summaryMethod) => {
|
|
267
245
|
if (!column) {
|
|
268
246
|
return value;
|
|
269
247
|
}
|
|
270
|
-
if (summaryMethod ===
|
|
248
|
+
if (summaryMethod === CHART_SUMMARY_TYPE.Distinct_values) {
|
|
271
249
|
return value;
|
|
272
250
|
}
|
|
273
251
|
const {
|
|
274
252
|
type,
|
|
275
253
|
data
|
|
276
254
|
} = column;
|
|
277
|
-
if (
|
|
278
|
-
return
|
|
255
|
+
if (isNumericColumn(column)) {
|
|
256
|
+
return getNumberDisplayString(value, data);
|
|
279
257
|
}
|
|
280
|
-
if (
|
|
281
|
-
return
|
|
258
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
259
|
+
return getClientFormulaDisplayString(value, data);
|
|
282
260
|
}
|
|
283
261
|
return value;
|
|
284
262
|
};
|
|
285
|
-
exports.getFormattedValue = getFormattedValue;
|
|
286
263
|
const getMax = list => {
|
|
287
264
|
if (list.length === 0) return 0;
|
|
288
265
|
return Number.parseFloat(Math.max.apply(null, list));
|
|
@@ -305,27 +282,27 @@ const getMean = function (list) {
|
|
|
305
282
|
const sum = getSum(list);
|
|
306
283
|
return Number.parseFloat((sum / list.length).toFixed(precision));
|
|
307
284
|
};
|
|
308
|
-
const getSummaryResult = function (results, summaryMethod) {
|
|
285
|
+
export const getSummaryResult = function (results, summaryMethod) {
|
|
309
286
|
let precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
|
|
310
|
-
const numericResults = Array.isArray(results) && results.length > 0 ? results.filter(res =>
|
|
287
|
+
const numericResults = Array.isArray(results) && results.length > 0 ? results.filter(res => isNumber(res)) : [];
|
|
311
288
|
switch (summaryMethod) {
|
|
312
|
-
case
|
|
289
|
+
case CHART_SUMMARY_TYPE.MAX:
|
|
313
290
|
{
|
|
314
291
|
return getMax(numericResults);
|
|
315
292
|
}
|
|
316
|
-
case
|
|
293
|
+
case CHART_SUMMARY_TYPE.MIN:
|
|
317
294
|
{
|
|
318
295
|
return getMin(numericResults);
|
|
319
296
|
}
|
|
320
|
-
case
|
|
297
|
+
case CHART_SUMMARY_TYPE.SUM:
|
|
321
298
|
{
|
|
322
299
|
return getSum(numericResults, precision);
|
|
323
300
|
}
|
|
324
|
-
case
|
|
301
|
+
case CHART_SUMMARY_TYPE.MEAN:
|
|
325
302
|
{
|
|
326
303
|
return getMean(numericResults, precision);
|
|
327
304
|
}
|
|
328
|
-
case
|
|
305
|
+
case CHART_SUMMARY_TYPE.DISTINCT_VALUES:
|
|
329
306
|
{
|
|
330
307
|
let count = 0;
|
|
331
308
|
let existMap = {};
|
|
@@ -351,53 +328,51 @@ const getSummaryResult = function (results, summaryMethod) {
|
|
|
351
328
|
}
|
|
352
329
|
}
|
|
353
330
|
};
|
|
354
|
-
|
|
355
|
-
const getSqlGroup = (column, groupBy) => {
|
|
331
|
+
export const getSqlGroup = (column, groupBy) => {
|
|
356
332
|
const columnName = (column === null || column === void 0 ? void 0 : column.name) || '';
|
|
357
|
-
const validColumnName =
|
|
333
|
+
const validColumnName = `\`${columnName}\``;
|
|
358
334
|
const type = (column === null || column === void 0 ? void 0 : column.type) || '';
|
|
359
|
-
if (type ===
|
|
335
|
+
if (type === CellType.CTIME || type === CellType.MTIME || type === CellType.DATE) {
|
|
360
336
|
const dateGranularity = (groupBy['date_granularity'] || '').toUpperCase();
|
|
361
337
|
if (['DAY', 'DAYS_7', 'DAYS_30'].includes(dateGranularity)) {
|
|
362
|
-
return
|
|
338
|
+
return `ISODATE(${validColumnName})`;
|
|
363
339
|
}
|
|
364
340
|
if (dateGranularity === 'WEEK') {
|
|
365
|
-
return
|
|
341
|
+
return `ISODATE(STARTOFWEEK(${validColumnName}, "monday"))`;
|
|
366
342
|
}
|
|
367
343
|
if (dateGranularity === 'MONTH') {
|
|
368
|
-
return
|
|
344
|
+
return `ISOMONTH(${validColumnName})`;
|
|
369
345
|
}
|
|
370
346
|
if (dateGranularity === 'QUARTER') {
|
|
371
|
-
return
|
|
347
|
+
return `CONCATENATE(year(${validColumnName}), "-Q", quarter(${validColumnName}))`;
|
|
372
348
|
}
|
|
373
349
|
if (dateGranularity === 'YEAR') {
|
|
374
|
-
return
|
|
350
|
+
return `YEAR(${validColumnName})`;
|
|
375
351
|
}
|
|
376
352
|
if (dateGranularity === 'MAX') {
|
|
377
|
-
return
|
|
353
|
+
return `MAX(${validColumnName})`;
|
|
378
354
|
}
|
|
379
355
|
if (dateGranularity === 'MIN') {
|
|
380
|
-
return
|
|
356
|
+
return `MIN(${validColumnName})`;
|
|
381
357
|
}
|
|
382
|
-
return
|
|
358
|
+
return `ISOMONTH(${validColumnName})`;
|
|
383
359
|
}
|
|
384
|
-
if (type ===
|
|
360
|
+
if (type === CellType.GEOLOCATION) {
|
|
385
361
|
const geolocationGranularity = (groupBy['geolocation_granularity'] || '').toUpperCase();
|
|
386
362
|
if (geolocationGranularity === 'PROVINCE') {
|
|
387
|
-
return
|
|
363
|
+
return `PROVINCE(${validColumnName})`;
|
|
388
364
|
}
|
|
389
365
|
if (geolocationGranularity === 'CITY') {
|
|
390
|
-
return
|
|
366
|
+
return `CITY(${validColumnName})`;
|
|
391
367
|
}
|
|
392
368
|
if (geolocationGranularity === 'DISTRICT') {
|
|
393
|
-
return
|
|
369
|
+
return `DISTRICT(${validColumnName})`;
|
|
394
370
|
}
|
|
395
371
|
return validColumnName;
|
|
396
372
|
}
|
|
397
373
|
return validColumnName;
|
|
398
374
|
};
|
|
399
|
-
|
|
400
|
-
function getSelectColumnOptions(column) {
|
|
375
|
+
export function getSelectColumnOptions(column) {
|
|
401
376
|
if (!column || !column.data || !Array.isArray(column.data.options)) {
|
|
402
377
|
return [];
|
|
403
378
|
}
|
|
@@ -405,7 +380,7 @@ function getSelectColumnOptions(column) {
|
|
|
405
380
|
}
|
|
406
381
|
|
|
407
382
|
// for stacked bar, stacked horizontal bar
|
|
408
|
-
const sortDataByGroupSum = (data, sortType) => {
|
|
383
|
+
export const sortDataByGroupSum = (data, sortType) => {
|
|
409
384
|
const nameSumMap = [];
|
|
410
385
|
data.forEach(item => {
|
|
411
386
|
if (nameSumMap.filter(filteredItem => filteredItem.name === item.name).length === 0) {
|
|
@@ -420,11 +395,10 @@ const sortDataByGroupSum = (data, sortType) => {
|
|
|
420
395
|
});
|
|
421
396
|
|
|
422
397
|
// sort group
|
|
423
|
-
|
|
398
|
+
BaseUtils.sortDataByKey(nameSumMap, 'valueSum', sortType);
|
|
424
399
|
return nameSumMap.reduce((accumulator, currentItem) => accumulator.concat(currentItem.items), []);
|
|
425
400
|
};
|
|
426
|
-
|
|
427
|
-
const formatNumericValue = function (value) {
|
|
401
|
+
export const formatNumericValue = function (value) {
|
|
428
402
|
let column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
429
403
|
const data = column.data || {};
|
|
430
404
|
let {
|
|
@@ -432,5 +406,4 @@ const formatNumericValue = function (value) {
|
|
|
432
406
|
} = data;
|
|
433
407
|
value = value || 0;
|
|
434
408
|
return parseFloat(value.toFixed(precision));
|
|
435
|
-
};
|
|
436
|
-
exports.formatNumericValue = formatNumericValue;
|
|
409
|
+
};
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.checkSVGImage = void 0;
|
|
8
|
-
exports.createObjectWithProperties = createObjectWithProperties;
|
|
9
|
-
exports.isTargetUrl = exports.isInternalUrl = exports.isInternalURL = exports.isFunction = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.isArchiveViewRowData = exports.imageCheck = exports.hexToRgb = exports.getRowName = exports.getImageThumbnailUrl = exports.getFileIconUrl = exports.getEventClassName = exports.generateCurrentBaseImageThumbnailUrl = exports.escapeRegExp = void 0;
|
|
10
|
-
var _dtableUtils = require("dtable-utils");
|
|
11
|
-
var _context = _interopRequireDefault(require("../context"));
|
|
1
|
+
import { getCellValueDisplayString } from 'dtable-utils';
|
|
2
|
+
import context from '../context';
|
|
12
3
|
const FILEEXT_ICON_MAP = {
|
|
13
4
|
// text file
|
|
14
5
|
'md': 'txt.png',
|
|
@@ -57,18 +48,16 @@ const FILEEXT_ICON_MAP = {
|
|
|
57
48
|
// default
|
|
58
49
|
'default': 'file.png'
|
|
59
50
|
};
|
|
60
|
-
const isFunction = functionToCheck => {
|
|
51
|
+
export const isFunction = functionToCheck => {
|
|
61
52
|
const getType = {};
|
|
62
53
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
63
54
|
};
|
|
64
|
-
|
|
65
|
-
const getEventClassName = e => {
|
|
55
|
+
export const getEventClassName = e => {
|
|
66
56
|
// svg mouseEvent event.target.className is an object
|
|
67
57
|
if (!e || !e.target) return '';
|
|
68
58
|
return e.target.getAttribute('class') || '';
|
|
69
59
|
};
|
|
70
|
-
|
|
71
|
-
const hexToRgb = hex => {
|
|
60
|
+
export const hexToRgb = hex => {
|
|
72
61
|
hex = hex.replace('#', '');
|
|
73
62
|
const bigint = parseInt(hex, 16);
|
|
74
63
|
return {
|
|
@@ -77,8 +66,7 @@ const hexToRgb = hex => {
|
|
|
77
66
|
b: bigint & 255
|
|
78
67
|
};
|
|
79
68
|
};
|
|
80
|
-
|
|
81
|
-
const getRowName = (columns, row, formula_rows) => {
|
|
69
|
+
export const getRowName = (columns, row, formula_rows) => {
|
|
82
70
|
if (!row) return '';
|
|
83
71
|
const displayColumn = columns.find(column => column.key === '0000');
|
|
84
72
|
if (!displayColumn) return '';
|
|
@@ -91,17 +79,16 @@ const getRowName = (columns, row, formula_rows) => {
|
|
|
91
79
|
if (formula_rows) {
|
|
92
80
|
formulaRows = formula_rows;
|
|
93
81
|
}
|
|
94
|
-
const collaborators =
|
|
95
|
-
const departments =
|
|
96
|
-
return
|
|
82
|
+
const collaborators = context.getCollaboratorsFromCache() || [];
|
|
83
|
+
const departments = context.getDepartments();
|
|
84
|
+
return getCellValueDisplayString(row, type, key, {
|
|
97
85
|
formulaRows,
|
|
98
86
|
data,
|
|
99
87
|
collaborators,
|
|
100
88
|
departments
|
|
101
89
|
});
|
|
102
90
|
};
|
|
103
|
-
|
|
104
|
-
function createObjectWithProperties(originalObj, properties) {
|
|
91
|
+
export function createObjectWithProperties(originalObj, properties) {
|
|
105
92
|
return properties.reduce((result, property) => {
|
|
106
93
|
if (property in originalObj) {
|
|
107
94
|
result[property] = originalObj[property];
|
|
@@ -109,35 +96,30 @@ function createObjectWithProperties(originalObj, properties) {
|
|
|
109
96
|
return result;
|
|
110
97
|
}, {});
|
|
111
98
|
}
|
|
112
|
-
const checkSVGImage = url => {
|
|
99
|
+
export const checkSVGImage = url => {
|
|
113
100
|
if (!url || typeof url !== 'string') return false;
|
|
114
101
|
const isSVGImage = url.substr(-4).toLowerCase() === '.svg';
|
|
115
102
|
return isSVGImage;
|
|
116
103
|
};
|
|
117
|
-
|
|
118
|
-
const isInternalURL = url => {
|
|
104
|
+
export const isInternalURL = url => {
|
|
119
105
|
if (!url || typeof url !== 'string') return false;
|
|
120
106
|
const {
|
|
121
107
|
server
|
|
122
|
-
} =
|
|
108
|
+
} = context.getSettings();
|
|
123
109
|
return url.indexOf(server) > -1;
|
|
124
110
|
};
|
|
125
|
-
|
|
126
|
-
const isTargetUrl = (target, url) => {
|
|
111
|
+
export const isTargetUrl = (target, url) => {
|
|
127
112
|
if (!url || typeof url !== 'string') return false;
|
|
128
113
|
return target && url ? url.indexOf(target) > -1 : false;
|
|
129
114
|
};
|
|
130
|
-
|
|
131
|
-
const isCustomAssetUrl = url => {
|
|
115
|
+
export const isCustomAssetUrl = url => {
|
|
132
116
|
return isTargetUrl('custom-asset://', url);
|
|
133
117
|
};
|
|
134
|
-
|
|
135
|
-
const isDigitalSignsUrl = url => {
|
|
118
|
+
export const isDigitalSignsUrl = url => {
|
|
136
119
|
if (!url || typeof url !== 'string') return false;
|
|
137
120
|
return isTargetUrl('/digital-signs/', url) && !url.includes('http');
|
|
138
121
|
};
|
|
139
|
-
|
|
140
|
-
const generateCurrentBaseImageThumbnailUrl = _ref => {
|
|
122
|
+
export const generateCurrentBaseImageThumbnailUrl = _ref => {
|
|
141
123
|
let {
|
|
142
124
|
server,
|
|
143
125
|
workspaceID,
|
|
@@ -146,25 +128,23 @@ const generateCurrentBaseImageThumbnailUrl = _ref => {
|
|
|
146
128
|
size
|
|
147
129
|
} = _ref;
|
|
148
130
|
if (!partUrl || typeof partUrl !== 'string') return '';
|
|
149
|
-
return
|
|
131
|
+
return `${server}/thumbnail/workspace/${workspaceID}/asset/${dtableUuid}${partUrl}?size=${size}`;
|
|
150
132
|
};
|
|
151
|
-
|
|
152
|
-
const isInternalUrl = url => {
|
|
133
|
+
export const isInternalUrl = url => {
|
|
153
134
|
if (!url || typeof url !== 'string') return false;
|
|
154
135
|
const {
|
|
155
136
|
server
|
|
156
|
-
} =
|
|
137
|
+
} = context.getSettings();
|
|
157
138
|
return url.indexOf(server) > -1;
|
|
158
139
|
};
|
|
159
|
-
|
|
160
|
-
const getImageThumbnailUrl = function (url) {
|
|
140
|
+
export const getImageThumbnailUrl = function (url) {
|
|
161
141
|
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 256;
|
|
162
142
|
if (!url || typeof url !== 'string') return '';
|
|
163
143
|
const {
|
|
164
144
|
server,
|
|
165
145
|
workspaceID,
|
|
166
146
|
dtableUuid
|
|
167
|
-
} =
|
|
147
|
+
} = context.getSettings();
|
|
168
148
|
if (isCustomAssetUrl(url)) {
|
|
169
149
|
let assetUuid = url.slice(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
|
|
170
150
|
return server + '/dtable/' + dtableUuid + '/custom-asset-thumbnail/' + assetUuid + '?size=' + size;
|
|
@@ -183,8 +163,7 @@ const getImageThumbnailUrl = function (url) {
|
|
|
183
163
|
}
|
|
184
164
|
return url.replace('/workspace', '/thumbnail/workspace') + '?size=' + size;
|
|
185
165
|
};
|
|
186
|
-
|
|
187
|
-
const imageCheck = filename => {
|
|
166
|
+
export const imageCheck = filename => {
|
|
188
167
|
// no file ext
|
|
189
168
|
if (!filename || typeof filename !== 'string') return false;
|
|
190
169
|
if (filename.lastIndexOf('.') === -1) {
|
|
@@ -194,8 +173,7 @@ const imageCheck = filename => {
|
|
|
194
173
|
const image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'webp'];
|
|
195
174
|
return image_exts.includes(file_ext);
|
|
196
175
|
};
|
|
197
|
-
|
|
198
|
-
const getFileIconUrl = (filename, direntType) => {
|
|
176
|
+
export const getFileIconUrl = (filename, direntType) => {
|
|
199
177
|
let commonUrl = '';
|
|
200
178
|
let file_ext = '';
|
|
201
179
|
if (filename.lastIndexOf('.') === -1) {
|
|
@@ -212,19 +190,17 @@ const getFileIconUrl = (filename, direntType) => {
|
|
|
212
190
|
}
|
|
213
191
|
const {
|
|
214
192
|
mediaUrl
|
|
215
|
-
} =
|
|
193
|
+
} = context.getSettings();
|
|
216
194
|
let url = mediaUrl + commonUrl;
|
|
217
195
|
return url;
|
|
218
196
|
};
|
|
219
197
|
|
|
220
198
|
// The special symbols should not be used as wildcards in regular expressions, need to be escaped into normal symbols
|
|
221
|
-
|
|
222
|
-
const escapeRegExp = value => {
|
|
199
|
+
export const escapeRegExp = value => {
|
|
223
200
|
if (typeof value !== 'string') return '';
|
|
224
201
|
return value.replace(/[.\\[\]{}()|^$?*+]/g, '\\$&');
|
|
225
202
|
};
|
|
226
|
-
|
|
227
|
-
const isArchiveViewRowData = (row, column) => {
|
|
203
|
+
export const isArchiveViewRowData = (row, column) => {
|
|
228
204
|
const values = row[column.key];
|
|
229
205
|
if (values && Array.isArray(values) && values.length > 0) {
|
|
230
206
|
const valueKeys = ['row_id', 'display_value'];
|
|
@@ -232,5 +208,4 @@ const isArchiveViewRowData = (row, column) => {
|
|
|
232
208
|
return valueKeys.every(key => item[key]);
|
|
233
209
|
}
|
|
234
210
|
return false;
|
|
235
|
-
};
|
|
236
|
-
exports.isArchiveViewRowData = isArchiveViewRowData;
|
|
211
|
+
};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
class ConcurrencyManager {
|
|
8
2
|
constructor(concurrentCount) {
|
|
9
3
|
this.concurrentCount = concurrentCount;
|
|
@@ -44,4 +38,4 @@ class ConcurrencyManager {
|
|
|
44
38
|
}
|
|
45
39
|
// request once a time
|
|
46
40
|
const concurrencyManager = new ConcurrencyManager(1);
|
|
47
|
-
|
|
41
|
+
export default concurrencyManager;
|
package/dist/utils/contexts.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.settingsContext = exports.GlobalThemeContext = exports.FirstDayOfWeekContext = exports.DepartmentsContext = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
const settingsContext = exports.settingsContext = /*#__PURE__*/_react.default.createContext('');
|
|
10
|
-
const DepartmentsContext = exports.DepartmentsContext = /*#__PURE__*/_react.default.createContext([]);
|
|
11
|
-
const GlobalThemeContext = exports.GlobalThemeContext = /*#__PURE__*/_react.default.createContext({});
|
|
12
|
-
const FirstDayOfWeekContext = exports.FirstDayOfWeekContext = /*#__PURE__*/_react.default.createContext({
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const settingsContext = React.createContext('');
|
|
3
|
+
export const DepartmentsContext = React.createContext([]);
|
|
4
|
+
export const GlobalThemeContext = React.createContext({});
|
|
5
|
+
export const FirstDayOfWeekContext = React.createContext({
|
|
13
6
|
firstDayOfWeek: 'Sunday'
|
|
14
7
|
});
|