sea-chart 2.0.37 → 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 +20 -69
- package/dist/assets/css/sea-chart-d3-tooltip.css +0 -1
- 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 +31 -37
- 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 +41 -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 +12 -23
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +11 -24
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +13 -16
- package/dist/components/popover/hide-column-popover/hide-column-popover.css +5 -1
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +28 -38
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +58 -69
- 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 +61 -68
- package/dist/components/tooltip/index.js +39 -28
- 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 +13 -16
- 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 +2 -7
- package/dist/locale/lang/en.js +2 -7
- package/dist/locale/lang/es.js +2 -7
- package/dist/locale/lang/fr.js +2 -7
- package/dist/locale/lang/pt.js +2 -7
- package/dist/locale/lang/ru.js +2 -7
- package/dist/locale/lang/zh_CN.js +2 -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 +14 -17
- 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 +14 -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 +66 -73
- 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 +51 -59
- package/dist/settings/basic-number-card/data-settings.js +50 -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 -64
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +67 -75
- 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 +44 -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 +22 -30
- 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 +57 -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 +49 -58
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.css +1 -31
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +113 -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 +44 -52
- 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 +59 -66
- 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 +27 -34
- package/dist/settings/widgets/data-filter/index.js +59 -59
- 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 +52 -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 +75 -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 +65 -72
- package/dist/utils/cell-format-utils.js +25 -33
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +467 -367
- package/dist/utils/chart-utils/index.js +29 -40
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +78 -85
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -21
- 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 +28 -26
- 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 +94 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -25
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +50 -36
- package/dist/utils/chart-utils/sql-statistics-utils.js +385 -388
- 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 +88 -102
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +7 -11
- 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 +73 -219
- 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 +251 -183
- 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 +162 -172
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +50 -45
- package/dist/view/index.css +2 -8
- package/dist/view/index.js +102 -103
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +57 -57
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +56 -48
- package/dist/view/wrapper/bar-custom-stack.js +73 -55
- package/dist/view/wrapper/bar-group.js +94 -73
- package/dist/view/wrapper/bar-stack.js +49 -57
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +50 -34
- package/dist/view/wrapper/chart-component.js +164 -569
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +140 -93
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +104 -59
- 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 +70 -58
- package/dist/view/wrapper/horizontal-bar-stack.js +48 -56
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +49 -52
- 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 +40 -47
- package/dist/view/wrapper/map-world.js +42 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +45 -53
- package/dist/view/wrapper/ring.js +50 -58
- package/dist/view/wrapper/scatter.js +50 -56
- 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 -92
- 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 -16
- 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 +8 -13
- 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 +30 -43
- package/dist/view/wrapper/treemap.js +38 -46
- package/dist/view/wrapper/trend.js +80 -65
- package/package.json +15 -12
|
@@ -1,19 +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.islinkDateFormula = exports.isWorldMapColumn = exports.isStatisticWorldMapColumn = exports.isStatisticMirrorColumn = exports.isStatisticMapColumn = exports.isMapColumn = exports.isCheckboxColumn = exports.getSummaryResult = exports.getSqlGroup = void 0;
|
|
12
|
-
var _dtableUtils = require("dtable-utils");
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _constants = require("../constants");
|
|
15
|
-
var _cellFormatUtils = require("./cell-format-utils");
|
|
16
|
-
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';
|
|
17
7
|
const UN_SUPPORTED_MAP_CN_COLUMN_TYPES = ['lng_lat', 'country_region', 'map_selection'];
|
|
18
8
|
const MAPLEVEL_SUPPORTED_COLUMN_TYPES = {
|
|
19
9
|
country: ['province', 'province_city', 'province_city_district', 'geolocation'],
|
|
@@ -22,13 +12,13 @@ const MAPLEVEL_SUPPORTED_COLUMN_TYPES = {
|
|
|
22
12
|
};
|
|
23
13
|
|
|
24
14
|
// is
|
|
25
|
-
const isMapColumn = (column, mapLevel) => {
|
|
15
|
+
export const isMapColumn = (column, mapLevel) => {
|
|
26
16
|
if (!column || !mapLevel) return false;
|
|
27
17
|
const {
|
|
28
18
|
type,
|
|
29
19
|
data
|
|
30
20
|
} = column;
|
|
31
|
-
if (type ===
|
|
21
|
+
if (type === CellType.GEOLOCATION) {
|
|
32
22
|
const {
|
|
33
23
|
geo_format
|
|
34
24
|
} = data || {};
|
|
@@ -37,13 +27,13 @@ const isMapColumn = (column, mapLevel) => {
|
|
|
37
27
|
}
|
|
38
28
|
return MAPLEVEL_SUPPORTED_COLUMN_TYPES[mapLevel].includes(geo_format);
|
|
39
29
|
}
|
|
40
|
-
if (
|
|
30
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
41
31
|
const {
|
|
42
32
|
result_type,
|
|
43
33
|
array_type,
|
|
44
34
|
array_data
|
|
45
35
|
} = data || {};
|
|
46
|
-
if (result_type !==
|
|
36
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
47
37
|
return false;
|
|
48
38
|
}
|
|
49
39
|
const {
|
|
@@ -56,15 +46,14 @@ const isMapColumn = (column, mapLevel) => {
|
|
|
56
46
|
}
|
|
57
47
|
return false;
|
|
58
48
|
};
|
|
59
|
-
|
|
60
|
-
const isWorldMapColumn = column => {
|
|
49
|
+
export const isWorldMapColumn = column => {
|
|
61
50
|
if (!column) return false;
|
|
62
51
|
const {
|
|
63
52
|
type,
|
|
64
53
|
data
|
|
65
54
|
} = column;
|
|
66
|
-
if (type ===
|
|
67
|
-
if (type ===
|
|
55
|
+
if (type === CellType.TEXT) return true;
|
|
56
|
+
if (type === CellType.GEOLOCATION) {
|
|
68
57
|
const {
|
|
69
58
|
geo_format
|
|
70
59
|
} = data || {};
|
|
@@ -72,7 +61,7 @@ const isWorldMapColumn = column => {
|
|
|
72
61
|
return true;
|
|
73
62
|
}
|
|
74
63
|
}
|
|
75
|
-
if (
|
|
64
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
76
65
|
const {
|
|
77
66
|
data
|
|
78
67
|
} = column;
|
|
@@ -81,7 +70,7 @@ const isWorldMapColumn = column => {
|
|
|
81
70
|
array_type,
|
|
82
71
|
array_data
|
|
83
72
|
} = data || {};
|
|
84
|
-
if (result_type !==
|
|
73
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
85
74
|
return false;
|
|
86
75
|
}
|
|
87
76
|
const {
|
|
@@ -93,32 +82,30 @@ const isWorldMapColumn = column => {
|
|
|
93
82
|
}
|
|
94
83
|
return false;
|
|
95
84
|
};
|
|
96
|
-
|
|
97
|
-
const isCheckboxColumn = column => {
|
|
85
|
+
export const isCheckboxColumn = column => {
|
|
98
86
|
let {
|
|
99
87
|
type,
|
|
100
88
|
data
|
|
101
89
|
} = column;
|
|
102
|
-
if (
|
|
90
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
103
91
|
const {
|
|
104
92
|
result_type,
|
|
105
93
|
array_type
|
|
106
94
|
} = data || {};
|
|
107
|
-
if (result_type ===
|
|
108
|
-
return array_type ===
|
|
95
|
+
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
96
|
+
return array_type === CellType.CHECKBOX;
|
|
109
97
|
}
|
|
110
98
|
return false;
|
|
111
99
|
}
|
|
112
|
-
return type ===
|
|
100
|
+
return type === CellType.CHECKBOX;
|
|
113
101
|
};
|
|
114
|
-
|
|
115
|
-
const isStatisticMapColumn = column => {
|
|
102
|
+
export const isStatisticMapColumn = column => {
|
|
116
103
|
if (!column) return false;
|
|
117
104
|
const {
|
|
118
105
|
type,
|
|
119
106
|
data
|
|
120
107
|
} = column;
|
|
121
|
-
if (type ===
|
|
108
|
+
if (type === CellType.GEOLOCATION) {
|
|
122
109
|
const {
|
|
123
110
|
geo_format
|
|
124
111
|
} = data || {};
|
|
@@ -127,13 +114,13 @@ const isStatisticMapColumn = column => {
|
|
|
127
114
|
}
|
|
128
115
|
return true;
|
|
129
116
|
}
|
|
130
|
-
if (
|
|
117
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
131
118
|
const {
|
|
132
119
|
result_type,
|
|
133
120
|
array_type,
|
|
134
121
|
array_data
|
|
135
122
|
} = data || {};
|
|
136
|
-
if (result_type !==
|
|
123
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
137
124
|
return false;
|
|
138
125
|
}
|
|
139
126
|
const {
|
|
@@ -146,15 +133,14 @@ const isStatisticMapColumn = column => {
|
|
|
146
133
|
}
|
|
147
134
|
return false;
|
|
148
135
|
};
|
|
149
|
-
|
|
150
|
-
const isStatisticWorldMapColumn = column => {
|
|
136
|
+
export const isStatisticWorldMapColumn = column => {
|
|
151
137
|
if (!column) return false;
|
|
152
138
|
const {
|
|
153
139
|
type,
|
|
154
140
|
data
|
|
155
141
|
} = column;
|
|
156
|
-
if (type ===
|
|
157
|
-
if (type ===
|
|
142
|
+
if (type === CellType.TEXT) return true;
|
|
143
|
+
if (type === CellType.GEOLOCATION) {
|
|
158
144
|
const {
|
|
159
145
|
geo_format
|
|
160
146
|
} = data || {};
|
|
@@ -162,7 +148,7 @@ const isStatisticWorldMapColumn = column => {
|
|
|
162
148
|
return true;
|
|
163
149
|
}
|
|
164
150
|
}
|
|
165
|
-
if (
|
|
151
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
166
152
|
const {
|
|
167
153
|
data
|
|
168
154
|
} = column;
|
|
@@ -171,7 +157,7 @@ const isStatisticWorldMapColumn = column => {
|
|
|
171
157
|
array_type,
|
|
172
158
|
array_data
|
|
173
159
|
} = data || {};
|
|
174
|
-
if (result_type !==
|
|
160
|
+
if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
|
|
175
161
|
return false;
|
|
176
162
|
}
|
|
177
163
|
const {
|
|
@@ -183,61 +169,67 @@ const isStatisticWorldMapColumn = column => {
|
|
|
183
169
|
}
|
|
184
170
|
return false;
|
|
185
171
|
};
|
|
186
|
-
|
|
187
|
-
const isStatisticMirrorColumn = column => {
|
|
172
|
+
export const isStatisticMirrorColumn = column => {
|
|
188
173
|
if (!column) return false;
|
|
189
|
-
return
|
|
174
|
+
return MIRROR_COLUMN_LIST.includes(column.type);
|
|
190
175
|
};
|
|
191
|
-
|
|
192
|
-
const islinkDateFormula = column => {
|
|
176
|
+
export const isDateFormulaColumn = column => {
|
|
193
177
|
if (column) {
|
|
194
178
|
const {
|
|
195
179
|
type,
|
|
196
180
|
data
|
|
197
181
|
} = column;
|
|
198
182
|
const {
|
|
199
|
-
array_type
|
|
183
|
+
array_type,
|
|
184
|
+
result_type
|
|
200
185
|
} = data || {};
|
|
201
|
-
|
|
186
|
+
// formula or link formula
|
|
187
|
+
if (type === 'link-formula' && array_type === 'date' || type === 'formula' && result_type === FORMULA_RESULT_TYPE.DATE) return true;
|
|
188
|
+
}
|
|
189
|
+
return false;
|
|
190
|
+
};
|
|
191
|
+
export const isDateColumn = column => {
|
|
192
|
+
if (column) {
|
|
193
|
+
const {
|
|
194
|
+
type
|
|
195
|
+
} = column;
|
|
196
|
+
return type === CellType.CTIME || type === CellType.MTIME || type === CellType.DATE;
|
|
202
197
|
}
|
|
203
198
|
return false;
|
|
204
199
|
};
|
|
205
200
|
|
|
206
201
|
// get
|
|
207
|
-
|
|
208
|
-
function getColumnOptions(columns) {
|
|
202
|
+
export function getColumnOptions(columns) {
|
|
209
203
|
return columns.map(column => {
|
|
210
204
|
return {
|
|
211
205
|
value: column,
|
|
212
|
-
label: /*#__PURE__*/
|
|
206
|
+
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
213
207
|
className: "sea-chart-column-icon"
|
|
214
|
-
}, /*#__PURE__*/
|
|
215
|
-
|
|
216
|
-
})), /*#__PURE__*/
|
|
208
|
+
}, /*#__PURE__*/React.createElement(_DTableColumnIcon, {
|
|
209
|
+
column: column
|
|
210
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
217
211
|
className: 'select-module select-module-name ml-0'
|
|
218
212
|
}, column.name))
|
|
219
213
|
};
|
|
220
214
|
});
|
|
221
215
|
}
|
|
222
|
-
const getDateColumnFormat = column => {
|
|
223
|
-
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;
|
|
224
218
|
// Old Europe format is D/M/YYYY new format is DD/MM/YYYY
|
|
225
219
|
return format;
|
|
226
220
|
};
|
|
227
|
-
|
|
228
|
-
const getColumnByKey = (columnKey, columns) => {
|
|
221
|
+
export const getColumnByKey = (columnKey, columns) => {
|
|
229
222
|
if (!columnKey || !Array.isArray(columns)) {
|
|
230
223
|
return null;
|
|
231
224
|
}
|
|
232
225
|
return columns.find(column => column.key === columnKey);
|
|
233
226
|
};
|
|
234
|
-
|
|
235
|
-
const getColorFromSingleSelectColumn = (column, target) => {
|
|
227
|
+
export const getColorFromSingleSelectColumn = (column, target) => {
|
|
236
228
|
let {
|
|
237
229
|
type: columnType,
|
|
238
230
|
data: columnData
|
|
239
231
|
} = column;
|
|
240
|
-
if (columnType !==
|
|
232
|
+
if (columnType !== CellType.SINGLE_SELECT) return null;
|
|
241
233
|
const options = columnData ? columnData.options : [];
|
|
242
234
|
const selectedOption = options.find(option => {
|
|
243
235
|
let id = target;
|
|
@@ -249,27 +241,25 @@ const getColorFromSingleSelectColumn = (column, target) => {
|
|
|
249
241
|
const color = selectedOption && selectedOption.color;
|
|
250
242
|
return color || null;
|
|
251
243
|
};
|
|
252
|
-
|
|
253
|
-
const getFormattedValue = (value, column, summaryMethod) => {
|
|
244
|
+
export const getFormattedValue = (value, column, summaryMethod) => {
|
|
254
245
|
if (!column) {
|
|
255
246
|
return value;
|
|
256
247
|
}
|
|
257
|
-
if (summaryMethod ===
|
|
248
|
+
if (summaryMethod === CHART_SUMMARY_TYPE.Distinct_values) {
|
|
258
249
|
return value;
|
|
259
250
|
}
|
|
260
251
|
const {
|
|
261
252
|
type,
|
|
262
253
|
data
|
|
263
254
|
} = column;
|
|
264
|
-
if (
|
|
265
|
-
return
|
|
255
|
+
if (isNumericColumn(column)) {
|
|
256
|
+
return getNumberDisplayString(value, data);
|
|
266
257
|
}
|
|
267
|
-
if (
|
|
268
|
-
return
|
|
258
|
+
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
259
|
+
return getClientFormulaDisplayString(value, data);
|
|
269
260
|
}
|
|
270
261
|
return value;
|
|
271
262
|
};
|
|
272
|
-
exports.getFormattedValue = getFormattedValue;
|
|
273
263
|
const getMax = list => {
|
|
274
264
|
if (list.length === 0) return 0;
|
|
275
265
|
return Number.parseFloat(Math.max.apply(null, list));
|
|
@@ -292,27 +282,27 @@ const getMean = function (list) {
|
|
|
292
282
|
const sum = getSum(list);
|
|
293
283
|
return Number.parseFloat((sum / list.length).toFixed(precision));
|
|
294
284
|
};
|
|
295
|
-
const getSummaryResult = function (results, summaryMethod) {
|
|
285
|
+
export const getSummaryResult = function (results, summaryMethod) {
|
|
296
286
|
let precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
|
|
297
|
-
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)) : [];
|
|
298
288
|
switch (summaryMethod) {
|
|
299
|
-
case
|
|
289
|
+
case CHART_SUMMARY_TYPE.MAX:
|
|
300
290
|
{
|
|
301
291
|
return getMax(numericResults);
|
|
302
292
|
}
|
|
303
|
-
case
|
|
293
|
+
case CHART_SUMMARY_TYPE.MIN:
|
|
304
294
|
{
|
|
305
295
|
return getMin(numericResults);
|
|
306
296
|
}
|
|
307
|
-
case
|
|
297
|
+
case CHART_SUMMARY_TYPE.SUM:
|
|
308
298
|
{
|
|
309
299
|
return getSum(numericResults, precision);
|
|
310
300
|
}
|
|
311
|
-
case
|
|
301
|
+
case CHART_SUMMARY_TYPE.MEAN:
|
|
312
302
|
{
|
|
313
303
|
return getMean(numericResults, precision);
|
|
314
304
|
}
|
|
315
|
-
case
|
|
305
|
+
case CHART_SUMMARY_TYPE.DISTINCT_VALUES:
|
|
316
306
|
{
|
|
317
307
|
let count = 0;
|
|
318
308
|
let existMap = {};
|
|
@@ -338,53 +328,51 @@ const getSummaryResult = function (results, summaryMethod) {
|
|
|
338
328
|
}
|
|
339
329
|
}
|
|
340
330
|
};
|
|
341
|
-
|
|
342
|
-
const getSqlGroup = (column, groupBy) => {
|
|
331
|
+
export const getSqlGroup = (column, groupBy) => {
|
|
343
332
|
const columnName = (column === null || column === void 0 ? void 0 : column.name) || '';
|
|
344
|
-
const validColumnName =
|
|
333
|
+
const validColumnName = `\`${columnName}\``;
|
|
345
334
|
const type = (column === null || column === void 0 ? void 0 : column.type) || '';
|
|
346
|
-
if (type ===
|
|
335
|
+
if (type === CellType.CTIME || type === CellType.MTIME || type === CellType.DATE) {
|
|
347
336
|
const dateGranularity = (groupBy['date_granularity'] || '').toUpperCase();
|
|
348
337
|
if (['DAY', 'DAYS_7', 'DAYS_30'].includes(dateGranularity)) {
|
|
349
|
-
return
|
|
338
|
+
return `ISODATE(${validColumnName})`;
|
|
350
339
|
}
|
|
351
340
|
if (dateGranularity === 'WEEK') {
|
|
352
|
-
return
|
|
341
|
+
return `ISODATE(STARTOFWEEK(${validColumnName}, "monday"))`;
|
|
353
342
|
}
|
|
354
343
|
if (dateGranularity === 'MONTH') {
|
|
355
|
-
return
|
|
344
|
+
return `ISOMONTH(${validColumnName})`;
|
|
356
345
|
}
|
|
357
346
|
if (dateGranularity === 'QUARTER') {
|
|
358
|
-
return
|
|
347
|
+
return `CONCATENATE(year(${validColumnName}), "-Q", quarter(${validColumnName}))`;
|
|
359
348
|
}
|
|
360
349
|
if (dateGranularity === 'YEAR') {
|
|
361
|
-
return
|
|
350
|
+
return `YEAR(${validColumnName})`;
|
|
362
351
|
}
|
|
363
352
|
if (dateGranularity === 'MAX') {
|
|
364
|
-
return
|
|
353
|
+
return `MAX(${validColumnName})`;
|
|
365
354
|
}
|
|
366
355
|
if (dateGranularity === 'MIN') {
|
|
367
|
-
return
|
|
356
|
+
return `MIN(${validColumnName})`;
|
|
368
357
|
}
|
|
369
|
-
return
|
|
358
|
+
return `ISOMONTH(${validColumnName})`;
|
|
370
359
|
}
|
|
371
|
-
if (type ===
|
|
360
|
+
if (type === CellType.GEOLOCATION) {
|
|
372
361
|
const geolocationGranularity = (groupBy['geolocation_granularity'] || '').toUpperCase();
|
|
373
362
|
if (geolocationGranularity === 'PROVINCE') {
|
|
374
|
-
return
|
|
363
|
+
return `PROVINCE(${validColumnName})`;
|
|
375
364
|
}
|
|
376
365
|
if (geolocationGranularity === 'CITY') {
|
|
377
|
-
return
|
|
366
|
+
return `CITY(${validColumnName})`;
|
|
378
367
|
}
|
|
379
368
|
if (geolocationGranularity === 'DISTRICT') {
|
|
380
|
-
return
|
|
369
|
+
return `DISTRICT(${validColumnName})`;
|
|
381
370
|
}
|
|
382
371
|
return validColumnName;
|
|
383
372
|
}
|
|
384
373
|
return validColumnName;
|
|
385
374
|
};
|
|
386
|
-
|
|
387
|
-
function getSelectColumnOptions(column) {
|
|
375
|
+
export function getSelectColumnOptions(column) {
|
|
388
376
|
if (!column || !column.data || !Array.isArray(column.data.options)) {
|
|
389
377
|
return [];
|
|
390
378
|
}
|
|
@@ -392,7 +380,7 @@ function getSelectColumnOptions(column) {
|
|
|
392
380
|
}
|
|
393
381
|
|
|
394
382
|
// for stacked bar, stacked horizontal bar
|
|
395
|
-
const sortDataByGroupSum = (data, sortType) => {
|
|
383
|
+
export const sortDataByGroupSum = (data, sortType) => {
|
|
396
384
|
const nameSumMap = [];
|
|
397
385
|
data.forEach(item => {
|
|
398
386
|
if (nameSumMap.filter(filteredItem => filteredItem.name === item.name).length === 0) {
|
|
@@ -407,11 +395,10 @@ const sortDataByGroupSum = (data, sortType) => {
|
|
|
407
395
|
});
|
|
408
396
|
|
|
409
397
|
// sort group
|
|
410
|
-
|
|
398
|
+
BaseUtils.sortDataByKey(nameSumMap, 'valueSum', sortType);
|
|
411
399
|
return nameSumMap.reduce((accumulator, currentItem) => accumulator.concat(currentItem.items), []);
|
|
412
400
|
};
|
|
413
|
-
|
|
414
|
-
const formatNumericValue = function (value) {
|
|
401
|
+
export const formatNumericValue = function (value) {
|
|
415
402
|
let column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
416
403
|
const data = column.data || {};
|
|
417
404
|
let {
|
|
@@ -419,5 +406,4 @@ const formatNumericValue = function (value) {
|
|
|
419
406
|
} = data;
|
|
420
407
|
value = value || 0;
|
|
421
408
|
return parseFloat(value.toFixed(precision));
|
|
422
|
-
};
|
|
423
|
-
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,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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({});
|
|
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({
|
|
6
|
+
firstDayOfWeek: 'Sunday'
|
|
7
|
+
});
|