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