sea-chart 1.1.65 → 2.0.0
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 +13 -6
- package/dist/assets/css/sea-chart-d3-tooltip.css +64 -0
- package/dist/components/cell-factory/FormatterConfig.js +62 -55
- package/dist/components/cell-factory/SimpleCellFormatter.js +11 -4
- 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 +35 -27
- 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 +18 -11
- package/dist/components/color-popover/color-rules/color-rule.js +33 -25
- package/dist/components/color-popover/color-rules/index.js +14 -6
- 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 +33 -25
- package/dist/components/color-popover/color-selector-popover.js +18 -10
- package/dist/components/color-setting/color-group-selector.js +20 -12
- package/dist/components/common-add-tool/index.js +13 -6
- package/dist/components/data-process-setter/data-setting-header.js +14 -7
- package/dist/components/data-process-setter/hide-column-setter.js +19 -12
- package/dist/components/data-process-setter/index.js +27 -4
- package/dist/components/data-process-setter/sort-setter.js +24 -16
- 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 +14 -7
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +35 -27
- 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 +22 -15
- package/dist/components/row-card/row-card-header.js +21 -14
- package/dist/components/row-card/row-card-item.js +41 -33
- package/dist/components/row-card/row-card.js +23 -15
- package/dist/components/statistic-record-dialog/index.js +63 -55
- package/dist/components/types-dialog/index.js +63 -55
- 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 +19 -12
- package/dist/editor/index.js +15 -12
- 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 +17 -10
- 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 +13 -7
- package/dist/settings/advance-bar-settings/data-settings.js +46 -42
- package/dist/settings/advance-bar-settings/index.js +20 -3
- package/dist/settings/advance-bar-settings/style-settings.js +73 -69
- package/dist/settings/bar-settings/data-settings.js +49 -45
- package/dist/settings/bar-settings/index.js +20 -3
- package/dist/settings/bar-settings/style-settings.js +59 -55
- 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 +26 -18
- package/dist/settings/combination-settings/data-settings.js +65 -60
- package/dist/settings/combination-settings/index.js +20 -3
- package/dist/settings/combination-settings/style-settings.js +74 -69
- 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 +30 -22
- 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 +75 -58
- 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 +34 -26
- 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 +72 -64
- package/dist/settings/table-element-settings/components/data-filter.js +37 -29
- 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 +119 -111
- 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 +25 -17
- package/dist/settings/widgets/basic-summary/index.js +66 -66
- package/dist/settings/widgets/chart-type/index.js +34 -19
- package/dist/settings/widgets/color-settings/index.js +80 -72
- package/dist/settings/widgets/common-data-settings.js +30 -25
- package/dist/settings/widgets/data-filter/index.js +40 -32
- package/dist/settings/widgets/data-sort.js +24 -16
- package/dist/settings/widgets/date-summary-item.js +32 -24
- 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 +31 -23
- 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 +80 -72
- package/dist/settings/widgets/switch/index.js +15 -8
- 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 +71 -63
- package/dist/utils/cell-format-utils.js +29 -19
- package/dist/utils/cell-value-utils.js +11 -4
- package/dist/utils/chart-utils/base-utils.js +290 -279
- package/dist/utils/chart-utils/index.js +39 -26
- 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 +26 -19
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +39 -32
- 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 +25 -18
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +34 -27
- 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 +30 -18
- package/dist/utils/collaborator.js +13 -4
- package/dist/utils/color-utils.js +29 -18
- package/dist/utils/column-utils.js +88 -63
- package/dist/utils/common-utils.js +52 -27
- package/dist/utils/concurrency-manager.js +7 -1
- package/dist/utils/contexts.js +11 -4
- package/dist/utils/custom-g2.js +241 -212
- package/dist/utils/date-translate.js +19 -11
- 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 +219 -53
- package/dist/utils/key-generator.js +9 -2
- package/dist/utils/map.js +31 -22
- package/dist/utils/object-utils.js +7 -1
- package/dist/utils/options-utils.js +16 -8
- package/dist/utils/row-record-utils.js +164 -152
- package/dist/utils/row-utils.js +38 -27
- package/dist/utils/search.js +32 -24
- package/dist/utils/sql/chart-data-sql.js +55 -49
- package/dist/utils/sql/column-2-sql-column.js +153 -143
- package/dist/utils/sql/index.js +27 -3
- package/dist/utils/trend-utils.js +45 -37
- package/dist/view/index.js +96 -87
- package/dist/view/title/index.js +23 -15
- package/dist/view/wrapper/area.js +46 -39
- package/dist/view/wrapper/bar-custom.js +40 -33
- package/dist/view/wrapper/bar-group.js +58 -51
- package/dist/view/wrapper/bar.js +42 -35
- package/dist/view/wrapper/basic-number-card.js +25 -17
- package/dist/view/wrapper/chart-component.js +116 -54
- package/dist/view/wrapper/combination.js +82 -75
- package/dist/view/wrapper/compare.js +57 -50
- package/dist/view/wrapper/completeness.js +32 -24
- package/dist/view/wrapper/dashboard.js +21 -14
- package/dist/view/wrapper/funnel.js +26 -19
- package/dist/view/wrapper/heat-map.js +60 -53
- package/dist/view/wrapper/horizontal-bar-group.js +48 -41
- package/dist/view/wrapper/horizontal-bar.js +39 -32
- package/dist/view/wrapper/horizontal-component.js +23 -15
- package/dist/view/wrapper/index.js +148 -96
- package/dist/view/wrapper/line-group.js +41 -34
- package/dist/view/wrapper/line.js +39 -32
- package/dist/view/wrapper/map.js +54 -46
- package/dist/view/wrapper/mirror.js +38 -31
- package/dist/view/wrapper/pie.js +50 -43
- package/dist/view/wrapper/ring.js +59 -52
- package/dist/view/wrapper/scatter.js +30 -22
- package/dist/view/wrapper/table/index.js +21 -13
- 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 +58 -50
- package/dist/view/wrapper/table/pivot-table-display-name.js +90 -82
- package/dist/view/wrapper/table/two-dimension-table.js +84 -76
- package/dist/view/wrapper/table-element/components/dataset-utils.js +36 -23
- package/dist/view/wrapper/table-element/components/formatter.js +98 -89
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +31 -22
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/formula-formatter.js +16 -9
- package/dist/view/wrapper/table-element/components/link-formatter.js +80 -73
- package/dist/view/wrapper/table-element/components/record.js +17 -10
- package/dist/view/wrapper/table-element/components/records-body.js +17 -9
- package/dist/view/wrapper/table-element/components/records-header/index.js +16 -8
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +16 -8
- package/dist/view/wrapper/table-element/components/records.js +29 -21
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +13 -6
- package/dist/view/wrapper/table-element/components/utils.js +15 -5
- 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 +24 -16
- package/dist/view/wrapper/treemap.js +43 -36
- package/dist/view/wrapper/trend.js +47 -39
- package/dist/view/wrapper/world-map.js +60 -52
- package/dist/view/wrapper/wrappers-d3/bar.js +262 -0
- package/package.json +15 -17
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.convertQuarterToDate = convertQuarterToDate;
|
|
8
|
+
exports.getMobileDatePickerLocale = getMobileDatePickerLocale;
|
|
9
|
+
exports.translateCalendar = translateCalendar;
|
|
10
|
+
var _intl = _interopRequireDefault(require("../intl"));
|
|
2
11
|
const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
|
|
3
12
|
const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
|
|
4
13
|
const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
|
|
@@ -53,14 +62,14 @@ function translateCalendar(lang) {
|
|
|
53
62
|
function getMobileDatePickerLocale() {
|
|
54
63
|
return {
|
|
55
64
|
DatePickerLocale: {
|
|
56
|
-
year:
|
|
57
|
-
month:
|
|
58
|
-
day:
|
|
59
|
-
hour:
|
|
60
|
-
minute:
|
|
65
|
+
year: _intl.default.get('Year'),
|
|
66
|
+
month: _intl.default.get('Month'),
|
|
67
|
+
day: _intl.default.get('Day'),
|
|
68
|
+
hour: _intl.default.get('Hour'),
|
|
69
|
+
minute: _intl.default.get('Minute')
|
|
61
70
|
},
|
|
62
|
-
okText:
|
|
63
|
-
dismissText:
|
|
71
|
+
okText: _intl.default.get('Done'),
|
|
72
|
+
dismissText: _intl.default.get('Cancel')
|
|
64
73
|
};
|
|
65
74
|
}
|
|
66
75
|
const quarterTimeMap = {
|
|
@@ -69,12 +78,11 @@ const quarterTimeMap = {
|
|
|
69
78
|
'Q3': '07-01',
|
|
70
79
|
'Q4': '10-01'
|
|
71
80
|
};
|
|
72
|
-
|
|
81
|
+
function convertQuarterToDate(yearQuarter) {
|
|
73
82
|
const timeDetailList = yearQuarter.split('-');
|
|
74
83
|
const year = timeDetailList[0];
|
|
75
84
|
const quarter = timeDetailList[1];
|
|
76
85
|
const quarterTime = quarterTimeMap[quarter];
|
|
77
86
|
const timeString = "".concat(year, "-").concat(quarterTime);
|
|
78
87
|
return new Date(timeString);
|
|
79
|
-
}
|
|
80
|
-
export { translateCalendar, getMobileDatePickerLocale };
|
|
88
|
+
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
|
+
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
10
|
+
var _dtableUtils = require("dtable-utils");
|
|
11
|
+
_dayjs.default.extend(_utc.default);
|
|
5
12
|
class DigitalSignUtils {
|
|
6
13
|
static getSignImageUrl(sign) {
|
|
7
|
-
return getDigitalSignImageUrl(sign);
|
|
14
|
+
return (0, _dtableUtils.getDigitalSignImageUrl)(sign);
|
|
8
15
|
}
|
|
9
16
|
static getUpdatedSign(_ref) {
|
|
10
17
|
let {
|
|
11
18
|
username,
|
|
12
19
|
sign_image_url
|
|
13
20
|
} = _ref;
|
|
14
|
-
const time =
|
|
21
|
+
const time = (0, _dayjs.default)().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
|
15
22
|
return {
|
|
16
23
|
username,
|
|
17
24
|
sign_image_url,
|
|
@@ -19,4 +26,4 @@ class DigitalSignUtils {
|
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
|
-
|
|
29
|
+
var _default = exports.default = DigitalSignUtils;
|
package/dist/utils/event-bus.js
CHANGED
|
@@ -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 EventBus {
|
|
2
8
|
constructor() {
|
|
3
9
|
this.subscribers = {};
|
|
@@ -25,4 +31,4 @@ class EventBus {
|
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
|
-
|
|
34
|
+
var _default = exports.default = new EventBus();
|
package/dist/utils/hotkey.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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.isSpace = exports.isEsc = exports.isEnter = void 0;
|
|
8
|
+
var _isHotkey = _interopRequireDefault(require("is-hotkey"));
|
|
9
|
+
const isEsc = exports.isEsc = (0, _isHotkey.default)('esc');
|
|
10
|
+
const isSpace = exports.isSpace = (0, _isHotkey.default)('space');
|
|
11
|
+
const isEnter = exports.isEnter = (0, _isHotkey.default)('enter');
|
package/dist/utils/index.js
CHANGED
|
@@ -1,19 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "BaseUtils", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _chartUtils.BaseUtils;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "ChartDataSQL", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _sql.ChartDataSQL;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "ChartUtils", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _chartUtils.ChartUtils;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "ObjectUtils", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _objectUtils.default;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "chartColumn2SqlColumn", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _sql.chartColumn2SqlColumn;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.fixGeoGranularity = exports.eventStopPropagation = void 0;
|
|
38
|
+
exports.formatRowTotal = formatRowTotal;
|
|
39
|
+
exports.formatXAxisLabel = formatXAxisLabel;
|
|
40
|
+
Object.defineProperty(exports, "generateChartConfig", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return _chart.generateChartConfig;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "generateDefaultUser", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _collaboratorUtils.generateDefaultUser;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "generatorCommonOptions", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _optionsUtils.generatorCommonOptions;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "generatorKey", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () {
|
|
61
|
+
return _keyGenerator.generatorKey;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
exports.getChartConfigValueFromKeys = exports.getChartConfigValueByKey = void 0;
|
|
65
|
+
Object.defineProperty(exports, "getClientFormulaDisplayString", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _cellFormatUtils.getClientFormulaDisplayString;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "getClientLinkDisplayString", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () {
|
|
74
|
+
return _cellFormatUtils.getClientLinkDisplayString;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, "getColorFromSingleSelectColumn", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _columnUtils.getColorFromSingleSelectColumn;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "getColumnByKey", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () {
|
|
86
|
+
return _columnUtils.getColumnByKey;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(exports, "getColumnOptions", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () {
|
|
92
|
+
return _dtableUtils.getColumnOptions;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "getDateColumnFormat", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () {
|
|
98
|
+
return _columnUtils.getDateColumnFormat;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
exports.getGeoGranularityByLevel = exports.getEventClassName = exports.getErrorMessage = void 0;
|
|
102
|
+
Object.defineProperty(exports, "getKnownCollaboratorByEmail", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _collaboratorUtils.getKnownCollaboratorByEmail;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "getKnownCollaboratorsByEmails", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _collaboratorUtils.getKnownCollaboratorsByEmails;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
exports.getMapCanvasStyle = getMapCanvasStyle;
|
|
115
|
+
exports.isBoolean = exports.getSortedDataByGivenOrder = exports.getSimilarKeys = void 0;
|
|
116
|
+
Object.defineProperty(exports, "isCheckboxColumn", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _columnUtils.isCheckboxColumn;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "isFunction", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () {
|
|
125
|
+
return _commonUtils.isFunction;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
Object.defineProperty(exports, "isStatisticMapColumn", {
|
|
129
|
+
enumerable: true,
|
|
130
|
+
get: function () {
|
|
131
|
+
return _columnUtils.isStatisticMapColumn;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(exports, "isStatisticMirrorColumn", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function () {
|
|
137
|
+
return _columnUtils.isStatisticMirrorColumn;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(exports, "isStatisticWorldMapColumn", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function () {
|
|
143
|
+
return _columnUtils.isStatisticWorldMapColumn;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, "summaryMethodColumn2SqlColumn", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () {
|
|
149
|
+
return _sql.summaryMethodColumn2SqlColumn;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(exports, "translateCalendar", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function () {
|
|
155
|
+
return _dateTranslate.translateCalendar;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
var _lodashEs = require("lodash-es");
|
|
159
|
+
var _constants = require("../constants");
|
|
160
|
+
var _intl = _interopRequireDefault(require("../intl"));
|
|
161
|
+
var _error = require("../constants/error");
|
|
162
|
+
var _objectUtils = _interopRequireDefault(require("./object-utils"));
|
|
163
|
+
var _chartUtils = require("./chart-utils");
|
|
164
|
+
var _sql = require("./sql");
|
|
165
|
+
var _optionsUtils = require("./options-utils");
|
|
166
|
+
var _dtableUtils = require("dtable-utils");
|
|
167
|
+
var _cellFormatUtils = require("./cell-format-utils");
|
|
168
|
+
var _chart = require("./chart");
|
|
169
|
+
var _collaboratorUtils = require("./collaborator-utils");
|
|
170
|
+
var _columnUtils = require("./column-utils");
|
|
171
|
+
var _keyGenerator = require("./key-generator");
|
|
172
|
+
var _dateTranslate = require("./date-translate");
|
|
173
|
+
var _commonUtils = require("./common-utils");
|
|
17
174
|
const splitLabelWithoutEnglish = label => {
|
|
18
175
|
let newLabel = '';
|
|
19
176
|
while (label.length > 0) {
|
|
@@ -27,7 +184,7 @@ const splitLabelWithoutEnglish = label => {
|
|
|
27
184
|
}
|
|
28
185
|
return newLabel;
|
|
29
186
|
};
|
|
30
|
-
|
|
187
|
+
function formatXAxisLabel(label) {
|
|
31
188
|
let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
|
|
32
189
|
const regex = /\b[a-zA-Z0-9'.,-]+\b/g;
|
|
33
190
|
const words = label.match(regex);
|
|
@@ -69,7 +226,7 @@ export function formatXAxisLabel(label) {
|
|
|
69
226
|
}
|
|
70
227
|
return result.join('\n');
|
|
71
228
|
}
|
|
72
|
-
|
|
229
|
+
function formatRowTotal(rowTotal) {
|
|
73
230
|
const rowTotalNum = parseFloat(rowTotal);
|
|
74
231
|
if (!Number.isNaN(rowTotalNum) && rowTotalNum % 1 !== 0) {
|
|
75
232
|
return rowTotalNum.toFixed(2);
|
|
@@ -86,7 +243,7 @@ export function formatRowTotal(rowTotal) {
|
|
|
86
243
|
* @param {Array} x_axis_option_list
|
|
87
244
|
* @returns {Array} sortedData
|
|
88
245
|
*/
|
|
89
|
-
|
|
246
|
+
const getSortedDataByGivenOrder = (data, x_axis_option_list) => {
|
|
90
247
|
const idIndexMap = {};
|
|
91
248
|
x_axis_option_list.forEach((item, index) => {
|
|
92
249
|
idIndexMap[item.id] = index;
|
|
@@ -94,12 +251,13 @@ export const getSortedDataByGivenOrder = (data, x_axis_option_list) => {
|
|
|
94
251
|
let sortedData = [];
|
|
95
252
|
data.forEach(item => {
|
|
96
253
|
const index = idIndexMap[item.group_name];
|
|
97
|
-
sortedData[index] = cloneDeep(item);
|
|
254
|
+
sortedData[index] = (0, _lodashEs.cloneDeep)(item);
|
|
98
255
|
});
|
|
99
256
|
sortedData = sortedData.filter(Boolean);
|
|
100
257
|
return sortedData;
|
|
101
258
|
};
|
|
102
|
-
|
|
259
|
+
exports.getSortedDataByGivenOrder = getSortedDataByGivenOrder;
|
|
260
|
+
function getMapCanvasStyle(container, ratio) {
|
|
103
261
|
let cWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
|
|
104
262
|
let cHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 200;
|
|
105
263
|
let width, height;
|
|
@@ -123,11 +281,11 @@ export function getMapCanvasStyle(container, ratio) {
|
|
|
123
281
|
height
|
|
124
282
|
};
|
|
125
283
|
}
|
|
126
|
-
|
|
284
|
+
const getErrorMessage = err => {
|
|
127
285
|
// log error to locate problems
|
|
128
286
|
console.error(err);
|
|
129
287
|
if (!err.response) {
|
|
130
|
-
return
|
|
288
|
+
return _intl.default.get('Network_error');
|
|
131
289
|
}
|
|
132
290
|
const {
|
|
133
291
|
status,
|
|
@@ -135,42 +293,44 @@ export const getErrorMessage = err => {
|
|
|
135
293
|
} = err.response;
|
|
136
294
|
const error_msg = data ? data.error_msg : '';
|
|
137
295
|
if (status === 400) {
|
|
138
|
-
if (error_msg === SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED) {
|
|
139
|
-
return
|
|
296
|
+
if (error_msg === _error.SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED) {
|
|
297
|
+
return _intl.default.get(_error.SERVER_ERROR_DISPLAY_KEY[_error.SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED]);
|
|
140
298
|
}
|
|
141
299
|
}
|
|
142
300
|
if (status === 403) {
|
|
143
|
-
return
|
|
301
|
+
return _intl.default.get('Permission_denied');
|
|
144
302
|
}
|
|
145
303
|
if (status === 500 || status === 502) {
|
|
146
|
-
return
|
|
304
|
+
return _intl.default.get('Internal_server_error');
|
|
147
305
|
}
|
|
148
|
-
return
|
|
306
|
+
return _intl.default.get('Error');
|
|
149
307
|
};
|
|
150
|
-
|
|
308
|
+
exports.getErrorMessage = getErrorMessage;
|
|
309
|
+
const getGeoGranularityByLevel = mapLevel => {
|
|
151
310
|
switch (mapLevel) {
|
|
152
|
-
case MAP_LEVEL.PROVINCE:
|
|
311
|
+
case _constants.MAP_LEVEL.PROVINCE:
|
|
153
312
|
{
|
|
154
|
-
return GEOLOCATION_GRANULARITY.CITY;
|
|
313
|
+
return _constants.GEOLOCATION_GRANULARITY.CITY;
|
|
155
314
|
}
|
|
156
|
-
case MAP_LEVEL.CITY:
|
|
315
|
+
case _constants.MAP_LEVEL.CITY:
|
|
157
316
|
{
|
|
158
|
-
return GEOLOCATION_GRANULARITY.DISTRICT;
|
|
317
|
+
return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
|
|
159
318
|
}
|
|
160
319
|
default:
|
|
161
320
|
{
|
|
162
321
|
// default as 'country'
|
|
163
|
-
return GEOLOCATION_GRANULARITY.PROVINCE;
|
|
322
|
+
return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
|
|
164
323
|
}
|
|
165
324
|
}
|
|
166
325
|
};
|
|
167
|
-
|
|
326
|
+
exports.getGeoGranularityByLevel = getGeoGranularityByLevel;
|
|
327
|
+
const fixGeoGranularity = _ref => {
|
|
168
328
|
let {
|
|
169
329
|
mapLevel,
|
|
170
330
|
mapLocation
|
|
171
331
|
} = _ref;
|
|
172
|
-
if (!mapLevel || mapLevel === MAP_LEVEL.COUNTRY || !mapLocation) {
|
|
173
|
-
return GEOLOCATION_GRANULARITY.PROVINCE;
|
|
332
|
+
if (!mapLevel || mapLevel === _constants.MAP_LEVEL.COUNTRY || !mapLocation) {
|
|
333
|
+
return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
|
|
174
334
|
}
|
|
175
335
|
|
|
176
336
|
// e.g. Beijing
|
|
@@ -178,56 +338,62 @@ export const fixGeoGranularity = _ref => {
|
|
|
178
338
|
province: provinceName,
|
|
179
339
|
city: cityName
|
|
180
340
|
} = mapLocation;
|
|
181
|
-
if (provinceName && MUNICIPALITIES.includes(provinceName)) {
|
|
182
|
-
return GEOLOCATION_GRANULARITY.DISTRICT;
|
|
341
|
+
if (provinceName && _constants.MUNICIPALITIES.includes(provinceName)) {
|
|
342
|
+
return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
|
|
183
343
|
}
|
|
184
344
|
|
|
185
345
|
// e.g. HongKong
|
|
186
|
-
const selectedProvince = provinceName && regions.find(province => province.name === provinceName);
|
|
346
|
+
const selectedProvince = provinceName && _constants.regions.find(province => province.name === provinceName);
|
|
187
347
|
if (selectedProvince && selectedProvince.disable_drill_down) {
|
|
188
|
-
return GEOLOCATION_GRANULARITY.PROVINCE;
|
|
348
|
+
return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
|
|
189
349
|
}
|
|
190
350
|
const cities = selectedProvince && selectedProvince.cities;
|
|
191
351
|
const selectedCity = cities && cityName && cities.find(city => city.name === cityName);
|
|
192
|
-
if (mapLevel === MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
|
|
193
|
-
return GEOLOCATION_GRANULARITY.CITY;
|
|
352
|
+
if (mapLevel === _constants.MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
|
|
353
|
+
return _constants.GEOLOCATION_GRANULARITY.CITY;
|
|
194
354
|
}
|
|
195
355
|
|
|
196
356
|
// others
|
|
197
357
|
return getGeoGranularityByLevel(mapLevel);
|
|
198
358
|
};
|
|
199
|
-
|
|
359
|
+
exports.fixGeoGranularity = fixGeoGranularity;
|
|
360
|
+
const isBoolean = val => {
|
|
200
361
|
return typeof val === 'boolean';
|
|
201
362
|
};
|
|
202
|
-
|
|
203
|
-
|
|
363
|
+
exports.isBoolean = isBoolean;
|
|
364
|
+
const getSimilarKeys = genericKey => {
|
|
365
|
+
const similarKeys = _constants.GENERIC_KEY_2_SIMILAR_KEYS[genericKey];
|
|
204
366
|
return similarKeys || [];
|
|
205
367
|
};
|
|
206
|
-
|
|
368
|
+
exports.getSimilarKeys = getSimilarKeys;
|
|
369
|
+
const getChartConfigValueFromKeys = (keys, object) => {
|
|
207
370
|
// eslint-disable-next-line
|
|
208
|
-
const existKey = keys.find(key =>
|
|
371
|
+
const existKey = keys.find(key => _objectUtils.default.hasOwnProperty(object, key));
|
|
209
372
|
return existKey ? object[existKey] : null;
|
|
210
373
|
};
|
|
211
|
-
|
|
374
|
+
exports.getChartConfigValueFromKeys = getChartConfigValueFromKeys;
|
|
375
|
+
const getChartConfigValueByKey = (key, object) => {
|
|
212
376
|
const similarKeys = getSimilarKeys(key);
|
|
213
377
|
if (!Array.isArray(similarKeys) || similarKeys.length === 0) {
|
|
214
378
|
// get value by the given 'genericKey' directly when has no similar keys.
|
|
215
379
|
// eslint-disable-next-line
|
|
216
|
-
return
|
|
380
|
+
return _objectUtils.default.hasOwnProperty(object, key) ? object[key] : null;
|
|
217
381
|
}
|
|
218
382
|
|
|
219
383
|
// try to get value from the similar keys
|
|
220
384
|
return getChartConfigValueFromKeys(similarKeys, object);
|
|
221
385
|
};
|
|
222
|
-
|
|
386
|
+
exports.getChartConfigValueByKey = getChartConfigValueByKey;
|
|
387
|
+
const eventStopPropagation = event => {
|
|
223
388
|
if (!event) return;
|
|
224
389
|
event.stopPropagation();
|
|
225
390
|
event.preventDefault && event.preventDefault();
|
|
226
391
|
event.nativeEvent && event.nativeEvent.stopImmediatePropagation && event.nativeEvent.stopImmediatePropagation();
|
|
227
392
|
};
|
|
228
|
-
|
|
393
|
+
exports.eventStopPropagation = eventStopPropagation;
|
|
394
|
+
const getEventClassName = e => {
|
|
229
395
|
// svg mouseEvent event.target.className is an object
|
|
230
396
|
if (!e || !e.target) return '';
|
|
231
397
|
return e.target.getAttribute('class') || '';
|
|
232
398
|
};
|
|
233
|
-
|
|
399
|
+
exports.getEventClassName = getEventClassName;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generatorKey = void 0;
|
|
1
7
|
const generatorBase64Code = function () {
|
|
2
8
|
let keyLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4;
|
|
3
9
|
let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789';
|
|
@@ -7,7 +13,8 @@ const generatorBase64Code = function () {
|
|
|
7
13
|
}
|
|
8
14
|
return key;
|
|
9
15
|
};
|
|
10
|
-
|
|
16
|
+
const generatorKey = function () {
|
|
11
17
|
let length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4;
|
|
12
18
|
return generatorBase64Code(length);
|
|
13
|
-
};
|
|
19
|
+
};
|
|
20
|
+
exports.generatorKey = generatorKey;
|
package/dist/utils/map.js
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRegionScaleOffsets = exports.getGeoGranularityByLevel = exports.fixGeoGranularity = void 0;
|
|
7
|
+
var _constants = require("../constants");
|
|
2
8
|
const COUNTY_SCALE_WIDTH = 5.95;
|
|
3
9
|
const COUNTY_SCALE_HEIGHT = 4.37;
|
|
4
|
-
|
|
10
|
+
const getGeoGranularityByLevel = mapLevel => {
|
|
5
11
|
switch (mapLevel) {
|
|
6
|
-
case MAP_LEVEL.PROVINCE:
|
|
12
|
+
case _constants.MAP_LEVEL.PROVINCE:
|
|
7
13
|
{
|
|
8
|
-
return GEOLOCATION_GRANULARITY.CITY;
|
|
14
|
+
return _constants.GEOLOCATION_GRANULARITY.CITY;
|
|
9
15
|
}
|
|
10
|
-
case MAP_LEVEL.CITY:
|
|
16
|
+
case _constants.MAP_LEVEL.CITY:
|
|
11
17
|
{
|
|
12
|
-
return GEOLOCATION_GRANULARITY.DISTRICT;
|
|
18
|
+
return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
|
|
13
19
|
}
|
|
14
20
|
default:
|
|
15
21
|
{
|
|
16
22
|
// default as 'country'
|
|
17
|
-
return GEOLOCATION_GRANULARITY.PROVINCE;
|
|
23
|
+
return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
exports.getGeoGranularityByLevel = getGeoGranularityByLevel;
|
|
28
|
+
const fixGeoGranularity = (mapLevel, mapLocation) => {
|
|
29
|
+
if (!mapLevel || mapLevel === _constants.MAP_LEVEL.COUNTRY || !mapLocation) {
|
|
30
|
+
return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
// e.g. Beijing
|
|
@@ -28,44 +35,45 @@ export const fixGeoGranularity = (mapLevel, mapLocation) => {
|
|
|
28
35
|
province: provinceName,
|
|
29
36
|
city: cityName
|
|
30
37
|
} = mapLocation;
|
|
31
|
-
if (provinceName && MUNICIPALITIES.includes(provinceName)) {
|
|
32
|
-
return GEOLOCATION_GRANULARITY.DISTRICT;
|
|
38
|
+
if (provinceName && _constants.MUNICIPALITIES.includes(provinceName)) {
|
|
39
|
+
return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
// e.g. HongKong
|
|
36
|
-
const selectedProvince = provinceName && regions.find(province => province.name === provinceName);
|
|
43
|
+
const selectedProvince = provinceName && _constants.regions.find(province => province.name === provinceName);
|
|
37
44
|
if (selectedProvince && selectedProvince.disable_drill_down) {
|
|
38
|
-
return GEOLOCATION_GRANULARITY.PROVINCE;
|
|
45
|
+
return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
|
|
39
46
|
}
|
|
40
47
|
const cities = selectedProvince && selectedProvince.cities;
|
|
41
48
|
const selectedCity = cities && cityName && cities.find(city => city.name === cityName);
|
|
42
|
-
if (mapLevel === MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
|
|
43
|
-
return GEOLOCATION_GRANULARITY.CITY;
|
|
49
|
+
if (mapLevel === _constants.MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
|
|
50
|
+
return _constants.GEOLOCATION_GRANULARITY.CITY;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
// others
|
|
47
54
|
return getGeoGranularityByLevel(mapLevel);
|
|
48
55
|
};
|
|
49
|
-
|
|
56
|
+
exports.fixGeoGranularity = fixGeoGranularity;
|
|
57
|
+
const getRegionScaleOffsets = (mapLevel, mapLocation) => {
|
|
50
58
|
const countryScaleOffsets = {
|
|
51
59
|
scale_w: COUNTY_SCALE_WIDTH,
|
|
52
60
|
scale_h: COUNTY_SCALE_HEIGHT
|
|
53
61
|
};
|
|
54
62
|
switch (mapLevel) {
|
|
55
|
-
case MAP_LEVEL.PROVINCE:
|
|
63
|
+
case _constants.MAP_LEVEL.PROVINCE:
|
|
56
64
|
{
|
|
57
65
|
const provinceName = mapLocation && mapLocation.province;
|
|
58
|
-
const province = provinceName && regions.find(province => province.name === provinceName);
|
|
66
|
+
const province = provinceName && _constants.regions.find(province => province.name === provinceName);
|
|
59
67
|
if (!province) return countryScaleOffsets;
|
|
60
68
|
return {
|
|
61
69
|
scale_w: province.scale_w,
|
|
62
70
|
scale_h: province.scale_h
|
|
63
71
|
};
|
|
64
72
|
}
|
|
65
|
-
case MAP_LEVEL.CITY:
|
|
73
|
+
case _constants.MAP_LEVEL.CITY:
|
|
66
74
|
{
|
|
67
75
|
const provinceName = mapLocation && mapLocation.province;
|
|
68
|
-
const province = provinceName && regions.find(province => province.name === provinceName);
|
|
76
|
+
const province = provinceName && _constants.regions.find(province => province.name === provinceName);
|
|
69
77
|
const cities = province && province.cities;
|
|
70
78
|
const cityName = mapLocation.city;
|
|
71
79
|
const city = cityName && Array.isArray(cities) && cities.find(city => city.name === cityName);
|
|
@@ -81,4 +89,5 @@ export const getRegionScaleOffsets = (mapLevel, mapLocation) => {
|
|
|
81
89
|
return countryScaleOffsets;
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
|
-
};
|
|
92
|
+
};
|
|
93
|
+
exports.getRegionScaleOffsets = getRegionScaleOffsets;
|
|
@@ -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 ObjectUtils {
|
|
2
8
|
static getDataType(data) {
|
|
3
9
|
let type = typeof data;
|
|
@@ -42,4 +48,4 @@ class ObjectUtils {
|
|
|
42
48
|
return Object.prototype.hasOwnProperty.call(obj, propertyKey);
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
|
-
|
|
51
|
+
var _default = exports.default = ObjectUtils;
|