dtable-statistic 4.4.24-alpha.9 → 5.0.0-alpha.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/es/assets/css/dialog.css +9 -4
- package/es/components/dialog/chart-edit-dialog.js +1 -1
- package/es/components/dialog/statistic-record-dialog/index.js +4 -3
- package/es/constants/index.js +3 -498
- package/es/dashboard.js +2 -58
- package/es/index.js +56 -1
- package/es/service/chart-service.js +0 -12
- package/es/stat-list/index.js +2 -2
- package/es/stat-view/index.js +1 -1
- package/es/tabs/tab.js +17 -14
- package/package.json +3 -3
- package/es/components/dtable-popover.js +0 -97
- package/es/components/dtable-search-input.js +0 -135
- package/es/components/index.js +0 -41
- package/es/components/loading.js +0 -15
- package/es/components/modal-portal.js +0 -26
- package/es/constants/color-rules.js +0 -17
- package/es/constants/map.js +0 -13
- package/es/constants/model.js +0 -26
- package/es/constants/regions.js +0 -2111
- package/es/constants/zIndexes.js +0 -7
- package/es/service/map-json.js +0 -140
package/es/dashboard.js
CHANGED
|
@@ -12,7 +12,6 @@ var _dtableUtils = require("dtable-utils");
|
|
|
12
12
|
var _statisticDashboard = _interopRequireDefault(require("./model/statistic-dashboard"));
|
|
13
13
|
var _dashboardService = _interopRequireDefault(require("./service/dashboard-service"));
|
|
14
14
|
var _chartService = _interopRequireDefault(require("./service/chart-service"));
|
|
15
|
-
var _mapJson = require("./service/map-json");
|
|
16
15
|
var _desktopDashboard = _interopRequireDefault(require("./desktop-dashboard"));
|
|
17
16
|
var _mobileDashboard = _interopRequireDefault(require("./mobile-dashboard"));
|
|
18
17
|
var _utils = require("./utils");
|
|
@@ -37,7 +36,6 @@ class DashBoard extends _react.Component {
|
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
this.onLocalDTableChanged = value => {
|
|
40
|
-
console.log('onLocalDTableChanged');
|
|
41
39
|
if (this.updatingLocalStatistics) {
|
|
42
40
|
// it's unnecessary to notify data changed during update statistics
|
|
43
41
|
this.value = value;
|
|
@@ -49,7 +47,6 @@ class DashBoard extends _react.Component {
|
|
|
49
47
|
});
|
|
50
48
|
};
|
|
51
49
|
this.onServerDTableChanged = value => {
|
|
52
|
-
console.log('onServerDTableChanged', value);
|
|
53
50
|
this.onDTableChanged({
|
|
54
51
|
value
|
|
55
52
|
});
|
|
@@ -83,7 +80,6 @@ class DashBoard extends _react.Component {
|
|
|
83
80
|
updateStatistics: this.props.updateStatistics,
|
|
84
81
|
deletePluginSettings: this.props.deletePluginSettings
|
|
85
82
|
});
|
|
86
|
-
this.initLabelColorConfigs();
|
|
87
83
|
const statistics = this.dashboardService.getStatistics();
|
|
88
84
|
const validStatistics = this.dashboardService.getValidStatistics(statistics);
|
|
89
85
|
let selectedDashboardIdx = this.getSelectedDashboardIdxFromLocal(_constants.KEY_SELECTED_DASHBOARD) || 0;
|
|
@@ -95,22 +91,6 @@ class DashBoard extends _react.Component {
|
|
|
95
91
|
selectedDashboardIdx
|
|
96
92
|
};
|
|
97
93
|
};
|
|
98
|
-
this.initLabelColorConfigs = () => {
|
|
99
|
-
const systemCustomColors = window.dtable.customColors || [];
|
|
100
|
-
const baseSettings = this.value && this.value.settings;
|
|
101
|
-
const baseCustomColors = baseSettings && baseSettings.custom_colors || [];
|
|
102
|
-
this.labelColorConfigs = [..._constants.LABEL_COLORS.map(color => ({
|
|
103
|
-
color: color.toUpperCase(),
|
|
104
|
-
text_color: '#fff'
|
|
105
|
-
})), ...systemCustomColors.map(customColor => ({
|
|
106
|
-
...customColor,
|
|
107
|
-
color: customColor.color.toUpperCase()
|
|
108
|
-
})), ...baseCustomColors.map(customColor => ({
|
|
109
|
-
color: customColor.COLOR.toUpperCase(),
|
|
110
|
-
text_color: customColor.TEXT_COLOR,
|
|
111
|
-
border_color: customColor.BORDER_COLOR
|
|
112
|
-
}))];
|
|
113
|
-
};
|
|
114
94
|
this.getSelectedDashboardIdxFromLocal = key => {
|
|
115
95
|
const {
|
|
116
96
|
dtableUuid
|
|
@@ -148,18 +128,6 @@ class DashBoard extends _react.Component {
|
|
|
148
128
|
activeView
|
|
149
129
|
});
|
|
150
130
|
};
|
|
151
|
-
this.getConvertedChart = _ref3 => {
|
|
152
|
-
let {
|
|
153
|
-
originalStatistic,
|
|
154
|
-
targetStatisticType,
|
|
155
|
-
activeTable
|
|
156
|
-
} = _ref3;
|
|
157
|
-
return this.chartService.getConvertedChart({
|
|
158
|
-
originalStatistic,
|
|
159
|
-
targetStatisticType,
|
|
160
|
-
activeTable
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
131
|
this.selectDashboard = selectedDashboardIdx => {
|
|
164
132
|
this.disabledUpdateLayout = true;
|
|
165
133
|
this.setSelectedDashboardIdx(selectedDashboardIdx);
|
|
@@ -380,19 +348,6 @@ class DashBoard extends _react.Component {
|
|
|
380
348
|
const permission = window.dtable.permission || '';
|
|
381
349
|
return permission === 'r' || permission.slice(0, 2) === 'c-';
|
|
382
350
|
};
|
|
383
|
-
this.queryMapJson = (_ref4, callback) => {
|
|
384
|
-
let {
|
|
385
|
-
map_level,
|
|
386
|
-
map_location
|
|
387
|
-
} = _ref4;
|
|
388
|
-
this.mapJsonService.queryMapJson({
|
|
389
|
-
map_level,
|
|
390
|
-
map_location
|
|
391
|
-
}, callback);
|
|
392
|
-
};
|
|
393
|
-
const {
|
|
394
|
-
mediaUrl
|
|
395
|
-
} = window.dtable;
|
|
396
351
|
const {
|
|
397
352
|
value: _value
|
|
398
353
|
} = props;
|
|
@@ -402,9 +357,6 @@ class DashBoard extends _react.Component {
|
|
|
402
357
|
this.chartService = new _chartService.default({
|
|
403
358
|
defaultChartTitle
|
|
404
359
|
});
|
|
405
|
-
this.mapJsonService = new _mapJson.MapJsonService({
|
|
406
|
-
mediaUrl
|
|
407
|
-
});
|
|
408
360
|
const {
|
|
409
361
|
statistics: _statistics,
|
|
410
362
|
selectedDashboardIdx: _selectedDashboardIdx
|
|
@@ -439,8 +391,7 @@ class DashBoard extends _react.Component {
|
|
|
439
391
|
const {
|
|
440
392
|
statistics,
|
|
441
393
|
selectedDashboardIdx,
|
|
442
|
-
dtableChangedTime
|
|
443
|
-
editingChart
|
|
394
|
+
dtableChangedTime
|
|
444
395
|
} = this.state;
|
|
445
396
|
const isTableReadOnly = this.isTableReadOnly();
|
|
446
397
|
const colorThemeName = this.dashboardService.getColorThemeName();
|
|
@@ -450,7 +401,6 @@ class DashBoard extends _react.Component {
|
|
|
450
401
|
dtableChangedTime: dtableChangedTime,
|
|
451
402
|
statistics: statistics,
|
|
452
403
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
453
|
-
labelColorConfigs: this.labelColorConfigs,
|
|
454
404
|
eventBus: eventBus,
|
|
455
405
|
onCloseDashboard: this.props.onCloseStatistic,
|
|
456
406
|
getViewRows: this.props.getViewRows,
|
|
@@ -459,16 +409,13 @@ class DashBoard extends _react.Component {
|
|
|
459
409
|
addDashboard: this.addDashboard,
|
|
460
410
|
renameDashboard: this.renameDashboard,
|
|
461
411
|
deleteDashboard: this.deleteDashboard,
|
|
462
|
-
getTableById: this.getTableById
|
|
463
|
-
queryMapJson: this.queryMapJson
|
|
412
|
+
getTableById: this.getTableById
|
|
464
413
|
}) : /*#__PURE__*/_react.default.createElement(_desktopDashboard.default, {
|
|
465
414
|
isTableReadOnly: isTableReadOnly,
|
|
466
415
|
colorThemeName: colorThemeName,
|
|
467
416
|
dtableChangedTime: dtableChangedTime,
|
|
468
417
|
statistics: statistics,
|
|
469
|
-
editingChart: editingChart,
|
|
470
418
|
selectedDashboardIdx: selectedDashboardIdx,
|
|
471
|
-
labelColorConfigs: this.labelColorConfigs,
|
|
472
419
|
eventBus: eventBus,
|
|
473
420
|
getActiveTable: this.getActiveTable,
|
|
474
421
|
getActiveView: this.getActiveView,
|
|
@@ -483,11 +430,8 @@ class DashBoard extends _react.Component {
|
|
|
483
430
|
moveDashboard: this.moveDashboard,
|
|
484
431
|
getTableById: this.getTableById,
|
|
485
432
|
getTables: this.getTables,
|
|
486
|
-
getViews: this.getViews,
|
|
487
433
|
getValue: this.getValue,
|
|
488
|
-
queryMapJson: this.queryMapJson,
|
|
489
434
|
getInitChart: this.getInitChart,
|
|
490
|
-
getConvertedChart: this.getConvertedChart,
|
|
491
435
|
copyChart: this.copyChart,
|
|
492
436
|
moveChartToView: this.moveChartToView,
|
|
493
437
|
deleteChart: this.deleteChart,
|
package/es/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _dtableStore = require("dtable-store");
|
|
5
6
|
var _dashboard = _interopRequireDefault(require("./dashboard"));
|
|
7
|
+
var _converStatItem = require("./model/conver-statItem");
|
|
6
8
|
class Statistic {
|
|
7
9
|
static getInitProps() {
|
|
8
10
|
if (!window || !window.app) {
|
|
@@ -17,15 +19,68 @@ class Statistic {
|
|
|
17
19
|
selectedTableIdx,
|
|
18
20
|
selectedViewId
|
|
19
21
|
} = state;
|
|
22
|
+
const convertedValue = this.convertStatistics(value);
|
|
20
23
|
return {
|
|
21
|
-
value,
|
|
24
|
+
value: convertedValue,
|
|
22
25
|
eventBus: dtableStore.eventBus,
|
|
23
26
|
activeTableIdx: selectedTableIdx,
|
|
24
27
|
activeViewId: selectedViewId,
|
|
28
|
+
getViewRows: this.getViewRows,
|
|
29
|
+
getTableFormulaResults: this.getTableFormulaResults,
|
|
25
30
|
updateStatistics: this.updateStatistics.bind(this, dtableStore),
|
|
26
31
|
deletePluginSettings: this.deletePluginSettings.bind(this, dtableStore)
|
|
27
32
|
};
|
|
28
33
|
}
|
|
34
|
+
|
|
35
|
+
// Compatible with old statistics
|
|
36
|
+
static convertStatistics(value) {
|
|
37
|
+
value.statistics.forEach(dashboard => {
|
|
38
|
+
const new_stat_items = dashboard.stat_items.map(item => {
|
|
39
|
+
if (!item.config) {
|
|
40
|
+
const newItem = {
|
|
41
|
+
config: {
|
|
42
|
+
...item,
|
|
43
|
+
...(0, _converStatItem.convertByType)(item)
|
|
44
|
+
},
|
|
45
|
+
layout: item.layout,
|
|
46
|
+
style_config: {
|
|
47
|
+
border: {},
|
|
48
|
+
title: {
|
|
49
|
+
text: item.name
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return newItem;
|
|
54
|
+
}
|
|
55
|
+
return item;
|
|
56
|
+
});
|
|
57
|
+
dashboard.stat_items = new_stat_items;
|
|
58
|
+
});
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
static getViewRows(view, table) {
|
|
62
|
+
const dtableStore = window.app.dtableStore || {};
|
|
63
|
+
const {
|
|
64
|
+
username = null,
|
|
65
|
+
userId = null,
|
|
66
|
+
userDepartmentIdsMap = null
|
|
67
|
+
} = dtableStore.dtableSettings;
|
|
68
|
+
return _dtableStore.Views.getViewRows(view, table, dtableStore.value, username, userId, userDepartmentIdsMap);
|
|
69
|
+
}
|
|
70
|
+
static getTableFormulaResults(table, rows) {
|
|
71
|
+
const dtableStore = window.app.dtableStore || {};
|
|
72
|
+
const {
|
|
73
|
+
username = null,
|
|
74
|
+
userId = null,
|
|
75
|
+
userDepartmentIdsMap = null
|
|
76
|
+
} = dtableStore.dtableSettings;
|
|
77
|
+
const formulaColumns = _dtableStore.Views.getFormulaColumnsContainLinks(table);
|
|
78
|
+
return _dtableStore.Views.getTableFormulaResults(table, rows, dtableStore.value, formulaColumns, {
|
|
79
|
+
username,
|
|
80
|
+
userId,
|
|
81
|
+
userDepartmentIdsMap
|
|
82
|
+
});
|
|
83
|
+
}
|
|
29
84
|
static updateStatistics(dtableStore, statistics) {
|
|
30
85
|
dtableStore.updateStatisticsList(statistics);
|
|
31
86
|
}
|
|
@@ -58,17 +58,5 @@ class ChartService {
|
|
|
58
58
|
newStatItem.layout = null;
|
|
59
59
|
return newStatItem;
|
|
60
60
|
}
|
|
61
|
-
getConvertedChart(_ref4) {
|
|
62
|
-
let {
|
|
63
|
-
originalStatistic,
|
|
64
|
-
targetStatisticType,
|
|
65
|
-
activeTable
|
|
66
|
-
} = _ref4;
|
|
67
|
-
if (targetStatisticType === originalStatistic.type) return originalStatistic;
|
|
68
|
-
return this.generatorChart({
|
|
69
|
-
...originalStatistic,
|
|
70
|
-
type: targetStatisticType
|
|
71
|
-
}, activeTable);
|
|
72
|
-
}
|
|
73
61
|
}
|
|
74
62
|
var _default = exports.default = ChartService;
|
package/es/stat-list/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal")
|
|
|
12
12
|
var _toaster = _interopRequireDefault(require("dtable-ui-component/lib/toaster"));
|
|
13
13
|
var _seaChart = require("sea-chart");
|
|
14
14
|
var _chartPreview = _interopRequireDefault(require("./chart-preview"));
|
|
15
|
-
var
|
|
15
|
+
var _newTableDialog = _interopRequireDefault(require("../components/dialog/new-table-dialog"));
|
|
16
16
|
var _enlargedChartDialog = _interopRequireDefault(require("../components/dialog/enlarged-chart-dialog"));
|
|
17
17
|
var _tableSelectDialog = _interopRequireDefault(require("../components/dialog/table-select-dialog"));
|
|
18
18
|
var _exportTableUtils = require("../utils/export-table-utils");
|
|
@@ -236,7 +236,7 @@ class StatList extends _react.Component {
|
|
|
236
236
|
getTableById: this.props.getTableById,
|
|
237
237
|
onEnlargeToggle: this.closeEnlargedChart,
|
|
238
238
|
toggleStatisticRecordsDialog: this.props.toggleStatisticRecordsDialog
|
|
239
|
-
}), chartExport2Table && /*#__PURE__*/_react.default.createElement(
|
|
239
|
+
}), chartExport2Table && /*#__PURE__*/_react.default.createElement(_newTableDialog.default, {
|
|
240
240
|
getTables: this.props.getTables,
|
|
241
241
|
tableName: chartExport2Table.name,
|
|
242
242
|
onNewTableConfirm: tableName => this.exportChart2Table(tableName, chartExport2Table),
|
package/es/stat-view/index.js
CHANGED
package/es/tabs/tab.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
|
|
11
|
-
var
|
|
11
|
+
var _ModalPortal = _interopRequireDefault(require("dtable-ui-component/lib/ModalPortal"));
|
|
12
12
|
var _utils = require("../utils");
|
|
13
13
|
var _constants = require("../constants");
|
|
14
14
|
var _statisticTabsModule = _interopRequireDefault(require("./statistic-tabs.module.css"));
|
|
@@ -23,19 +23,22 @@ class DashBoardTab extends _react.Component {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
this.onDropdownToggle = evt => {
|
|
26
|
+
var _this$btnViewDropdown;
|
|
26
27
|
evt.nativeEvent.stopImmediatePropagation();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
if ((_this$btnViewDropdown = this.btnViewDropdown) !== null && _this$btnViewDropdown !== void 0 && _this$btnViewDropdown.parentNode) {
|
|
29
|
+
const {
|
|
30
|
+
top,
|
|
31
|
+
left,
|
|
32
|
+
height
|
|
33
|
+
} = this.btnViewDropdown.parentNode.getBoundingClientRect();
|
|
34
|
+
this.setState({
|
|
35
|
+
isShowViewDropdown: !this.state.isShowViewDropdown,
|
|
36
|
+
dropdownMenuPosition: {
|
|
37
|
+
top: top + height - 3,
|
|
38
|
+
left
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
39
42
|
};
|
|
40
43
|
this.onDragStart = event => {
|
|
41
44
|
event.stopPropagation();
|
|
@@ -135,7 +138,7 @@ class DashBoardTab extends _react.Component {
|
|
|
135
138
|
className: "".concat(_statisticTabsModule.default['btn-view-dropdown'])
|
|
136
139
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
137
140
|
className: "".concat(_statisticTabsModule.default['icon'], " dtable-font dtable-icon-drop-down")
|
|
138
|
-
}), isShowViewDropdown && /*#__PURE__*/_react.default.createElement(
|
|
141
|
+
}), isShowViewDropdown && /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
139
142
|
className: "".concat(theme === _constants.THEME_NAME_MAP.DARK ? 'statistic-tabs-dropdown-dark' : 'statistic-tabs-dropdown-light', " statistic-dropdown-menu dropdown-menu large show"),
|
|
140
143
|
style: {
|
|
141
144
|
...dropdownMenuPosition,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-statistic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.0",
|
|
4
4
|
"description": "statistics",
|
|
5
5
|
"main": "dist/dtable-statistic.js",
|
|
6
6
|
"author": "seafile",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"react-grid-layout": "^1.2.5",
|
|
19
19
|
"react-intl-universal": "^2.4.8",
|
|
20
20
|
"reactstrap": "8.9.0",
|
|
21
|
-
"sea-chart": "0.0.
|
|
21
|
+
"sea-chart": "^0.0.47-alpha.2"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"dtable-ui-component": "~4.4.*",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dotenv": "^10.0.0",
|
|
55
55
|
"dotenv-expand": "^5.1.0",
|
|
56
56
|
"dtable-store": "4.3.6",
|
|
57
|
-
"dtable-ui-component": "4.4.34",
|
|
57
|
+
"dtable-ui-component": "~4.4.34",
|
|
58
58
|
"dtable-utils": "4.4.0",
|
|
59
59
|
"eslint": "^8.3.0",
|
|
60
60
|
"eslint-config-react-app": "^7.0.1",
|
|
@@ -1,97 +0,0 @@
|
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactstrap = require("reactstrap");
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var _constants = require("../constants");
|
|
12
|
-
class DTablePopover extends _react.default.Component {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.dtablePopoverRef = null;
|
|
16
|
-
this.isSelectOpen = false;
|
|
17
|
-
this.onHistoryState = e => {
|
|
18
|
-
e.preventDefault();
|
|
19
|
-
this.props.hideDTablePopover(e);
|
|
20
|
-
};
|
|
21
|
-
this.onKeyDown = e => {
|
|
22
|
-
const {
|
|
23
|
-
canHideDTablePopover,
|
|
24
|
-
hideDTablePopoverWithEsc
|
|
25
|
-
} = this.props;
|
|
26
|
-
if (e.keyCode === _constants.KeyCodes.Escape && typeof hideDTablePopoverWithEsc === 'function' && !this.isSelectOpen) {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
hideDTablePopoverWithEsc();
|
|
29
|
-
} else if (e.keyCode === _constants.KeyCodes.Enter) {
|
|
30
|
-
// Resolve the default behavior of the enter key when entering formulas is blocked
|
|
31
|
-
if (canHideDTablePopover) return;
|
|
32
|
-
e.stopImmediatePropagation();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
this.setSelectStatus = status => {
|
|
36
|
-
this.isSelectOpen = status;
|
|
37
|
-
};
|
|
38
|
-
this.onMouseDown = e => {
|
|
39
|
-
const {
|
|
40
|
-
canHideDTablePopover
|
|
41
|
-
} = this.props;
|
|
42
|
-
if (!canHideDTablePopover) return;
|
|
43
|
-
if (this.dtablePopoverRef && e && (0, _utils.getEventClassName)(e).indexOf('popover') === -1 && !this.dtablePopoverRef.contains(e.target)) {
|
|
44
|
-
this.props.hideDTablePopover(e);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
this.onPopoverInsideClick = e => {
|
|
48
|
-
e.stopPropagation();
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
componentDidMount() {
|
|
52
|
-
document.addEventListener('mousedown', this.onMouseDown);
|
|
53
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
54
|
-
window.addEventListener('popstate', this.onHistoryState);
|
|
55
|
-
this.unsubscribeOpenSelect = window.app.eventBus.subscribe(_constants.CommonEventTypes.OPEN_SELECT, this.setSelectStatus);
|
|
56
|
-
}
|
|
57
|
-
componentWillUnmount() {
|
|
58
|
-
document.removeEventListener('mousedown', this.onMouseDown);
|
|
59
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
60
|
-
window.removeEventListener('popstate', this.onHistoryState);
|
|
61
|
-
this.unsubscribeOpenSelect();
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
const {
|
|
65
|
-
target,
|
|
66
|
-
boundariesElement,
|
|
67
|
-
innerClassName,
|
|
68
|
-
popoverClassName,
|
|
69
|
-
hideArrow,
|
|
70
|
-
modifiers,
|
|
71
|
-
placement
|
|
72
|
-
} = this.props;
|
|
73
|
-
let additionalProps = {};
|
|
74
|
-
if (boundariesElement) {
|
|
75
|
-
additionalProps.boundariesElement = boundariesElement;
|
|
76
|
-
}
|
|
77
|
-
return /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, Object.assign({
|
|
78
|
-
placement: placement,
|
|
79
|
-
isOpen: true,
|
|
80
|
-
target: target,
|
|
81
|
-
fade: false,
|
|
82
|
-
hideArrow: hideArrow,
|
|
83
|
-
innerClassName: innerClassName,
|
|
84
|
-
className: popoverClassName,
|
|
85
|
-
modifiers: modifiers
|
|
86
|
-
}, additionalProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
87
|
-
ref: ref => this.dtablePopoverRef = ref,
|
|
88
|
-
onClick: this.onPopoverInsideClick
|
|
89
|
-
}, this.props.children));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
DTablePopover.defaultProps = {
|
|
93
|
-
placement: 'bottom-start',
|
|
94
|
-
hideArrow: true,
|
|
95
|
-
canHideDTablePopover: true
|
|
96
|
-
};
|
|
97
|
-
var _default = exports.default = DTablePopover;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
class DtableSearchInput extends _react.Component {
|
|
13
|
-
constructor(props) {
|
|
14
|
-
super(props);
|
|
15
|
-
this.onCompositionStart = () => {
|
|
16
|
-
this.isInputtingChinese = true;
|
|
17
|
-
};
|
|
18
|
-
this.onChange = e => {
|
|
19
|
-
this.timer && clearTimeout(this.timer);
|
|
20
|
-
const {
|
|
21
|
-
onChange,
|
|
22
|
-
wait
|
|
23
|
-
} = this.props;
|
|
24
|
-
let text = e.target.value;
|
|
25
|
-
this.setState({
|
|
26
|
-
searchValue: text || ''
|
|
27
|
-
}, () => {
|
|
28
|
-
if (this.isInputtingChinese) return;
|
|
29
|
-
this.timer = setTimeout(() => {
|
|
30
|
-
onChange && onChange(this.state.searchValue.trim());
|
|
31
|
-
}, wait);
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
this.onCompositionEnd = e => {
|
|
35
|
-
this.isInputtingChinese = false;
|
|
36
|
-
this.onChange(e);
|
|
37
|
-
};
|
|
38
|
-
this.clearSearch = () => {
|
|
39
|
-
const {
|
|
40
|
-
clearValue
|
|
41
|
-
} = this.props;
|
|
42
|
-
this.setState({
|
|
43
|
-
searchValue: ''
|
|
44
|
-
}, () => {
|
|
45
|
-
clearValue && clearValue();
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
this.setFocus = isSelectAllText => {
|
|
49
|
-
if (this.inputRef === document.activeElement) return;
|
|
50
|
-
this.inputRef.focus();
|
|
51
|
-
if (isSelectAllText) {
|
|
52
|
-
const txtLength = this.state.searchValue.length;
|
|
53
|
-
this.inputRef.setSelectionRange(0, txtLength);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
this.renderClear = () => {
|
|
57
|
-
const {
|
|
58
|
-
isClearable,
|
|
59
|
-
clearClassName,
|
|
60
|
-
components = {}
|
|
61
|
-
} = this.props;
|
|
62
|
-
const {
|
|
63
|
-
searchValue
|
|
64
|
-
} = this.state;
|
|
65
|
-
if (!isClearable || !searchValue) return null;
|
|
66
|
-
const {
|
|
67
|
-
ClearIndicator
|
|
68
|
-
} = components;
|
|
69
|
-
if ( /*#__PURE__*/_react.default.isValidElement(ClearIndicator)) {
|
|
70
|
-
return /*#__PURE__*/_react.default.cloneElement(ClearIndicator, {
|
|
71
|
-
clearValue: this.clearSearch
|
|
72
|
-
});
|
|
73
|
-
} else if ((0, _utils.isFunction)(ClearIndicator)) {
|
|
74
|
-
return /*#__PURE__*/_react.default.createElement(ClearIndicator, {
|
|
75
|
-
clearValue: this.clearSearch
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return /*#__PURE__*/_react.default.createElement("i", {
|
|
79
|
-
className: (0, _classnames.default)('search-text-clear input-icon-addon', clearClassName),
|
|
80
|
-
onClick: this.clearSearch
|
|
81
|
-
}, "\xD7");
|
|
82
|
-
};
|
|
83
|
-
this.state = {
|
|
84
|
-
searchValue: props.value
|
|
85
|
-
};
|
|
86
|
-
this.isInputtingChinese = false;
|
|
87
|
-
this.timer = null;
|
|
88
|
-
this.inputRef = null;
|
|
89
|
-
}
|
|
90
|
-
componentWillReceiveProps(nextProps) {
|
|
91
|
-
if (nextProps.value !== this.props.value) {
|
|
92
|
-
this.setState({
|
|
93
|
-
searchValue: nextProps.value
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
componentWillUnmount() {
|
|
98
|
-
this.timer && clearTimeout(this.timer);
|
|
99
|
-
this.timer = null;
|
|
100
|
-
this.inputRef = null;
|
|
101
|
-
}
|
|
102
|
-
render() {
|
|
103
|
-
const {
|
|
104
|
-
placeholder,
|
|
105
|
-
autoFocus,
|
|
106
|
-
className,
|
|
107
|
-
onKeyDown,
|
|
108
|
-
disabled,
|
|
109
|
-
style
|
|
110
|
-
} = this.props;
|
|
111
|
-
const {
|
|
112
|
-
searchValue
|
|
113
|
-
} = this.state;
|
|
114
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
115
|
-
type: "text",
|
|
116
|
-
value: searchValue,
|
|
117
|
-
className: (0, _classnames.default)('form-control', className),
|
|
118
|
-
onChange: this.onChange,
|
|
119
|
-
autoFocus: autoFocus,
|
|
120
|
-
placeholder: placeholder,
|
|
121
|
-
onCompositionStart: this.onCompositionStart,
|
|
122
|
-
onCompositionEnd: this.onCompositionEnd,
|
|
123
|
-
onKeyDown: onKeyDown,
|
|
124
|
-
disabled: disabled,
|
|
125
|
-
style: style,
|
|
126
|
-
ref: ref => this.inputRef = ref
|
|
127
|
-
}), this.renderClear());
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
DtableSearchInput.defaultProps = {
|
|
131
|
-
wait: 100,
|
|
132
|
-
disabled: false,
|
|
133
|
-
value: ''
|
|
134
|
-
};
|
|
135
|
-
var _default = exports.default = DtableSearchInput;
|
package/es/components/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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, "DTablePopover", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _dtablePopover.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "DtableSearchInput", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _dtableSearchInput.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "Loading", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _loading.default;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "ModalPortal", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _modalPortal.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "NewTableDialog", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _newTableDialog.default;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
var _dtablePopover = _interopRequireDefault(require("./dtable-popover"));
|
|
38
|
-
var _dtableSearchInput = _interopRequireDefault(require("./dtable-search-input"));
|
|
39
|
-
var _loading = _interopRequireDefault(require("./loading"));
|
|
40
|
-
var _modalPortal = _interopRequireDefault(require("./modal-portal"));
|
|
41
|
-
var _newTableDialog = _interopRequireDefault(require("./dialog/new-table-dialog"));
|
package/es/components/loading.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
9
|
-
function Loading() {
|
|
10
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
-
return /*#__PURE__*/_react.default.createElement("span", Object.assign({}, props, {
|
|
12
|
-
className: "loading-icon loading-tip"
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
var _default = exports.default = Loading;
|
|
@@ -1,26 +0,0 @@
|
|
|
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 _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
|
-
const modalRoot = document.getElementById('modal-wrapper');
|
|
11
|
-
class ModalPortal extends _react.default.Component {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
super(props);
|
|
14
|
-
this.el = document.createElement('div');
|
|
15
|
-
}
|
|
16
|
-
componentDidMount() {
|
|
17
|
-
modalRoot.appendChild(this.el);
|
|
18
|
-
}
|
|
19
|
-
componentWillUnmount() {
|
|
20
|
-
modalRoot.removeChild(this.el);
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
return /*#__PURE__*/_reactDom.default.createPortal(this.props.children, this.el);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
var _default = exports.default = ModalPortal;
|