dtable-statistic 4.0.2-test-2

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.
Files changed (210) hide show
  1. package/README.md +3 -0
  2. package/es/api/dtable-db-api.js +43 -0
  3. package/es/assets/css/color-picker.css +53 -0
  4. package/es/assets/css/color-rules-popover.css +144 -0
  5. package/es/assets/css/color-theme-dialog.css +40 -0
  6. package/es/assets/css/dashboard.css +562 -0
  7. package/es/assets/css/dialog.css +415 -0
  8. package/es/assets/css/mobile-dashboard.module.css +91 -0
  9. package/es/assets/css/slider.css +77 -0
  10. package/es/assets/css/statistic-chart.module.css +11 -0
  11. package/es/assets/css/statistic-custom-title.module.css +3 -0
  12. package/es/assets/css/statistic-custom.module.css +4 -0
  13. package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
  14. package/es/assets/css/statistic-time-picker.module.css +21 -0
  15. package/es/assets/css/theme.css +61 -0
  16. package/es/assets/images/icon.png +0 -0
  17. package/es/calculator/base-calculator.js +111 -0
  18. package/es/calculator/basic-chart-calculator.js +571 -0
  19. package/es/calculator/combination-calculator.js +296 -0
  20. package/es/calculator/compare-bar-calculator.js +291 -0
  21. package/es/calculator/completeness-calculator.js +307 -0
  22. package/es/calculator/copy-value.js +47 -0
  23. package/es/calculator/dashboard-calculator.js +146 -0
  24. package/es/calculator/heat-map-calculator.js +225 -0
  25. package/es/calculator/horizontal-bar-calculator.js +100 -0
  26. package/es/calculator/index.js +88 -0
  27. package/es/calculator/map-calculator.js +169 -0
  28. package/es/calculator/mirror-calculator.js +217 -0
  29. package/es/calculator/number-card-calculator.js +135 -0
  30. package/es/calculator/pivot-table-calculator.js +810 -0
  31. package/es/calculator/scatter-calculator.js +150 -0
  32. package/es/calculator/thread-manager.js +70 -0
  33. package/es/calculator/trend-calculator.js +204 -0
  34. package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
  35. package/es/calculator/workers/calculator.worker.js +22 -0
  36. package/es/calculator/workers/card-calculator-worker.js +28 -0
  37. package/es/calculator/workers/combination-calculator-worker.js +257 -0
  38. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
  39. package/es/calculator/workers/completeness-calculator-worker.js +153 -0
  40. package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
  41. package/es/calculator/workers/mirror-calculator-worker.js +132 -0
  42. package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
  43. package/es/calculator/workers/scatter-calculator-worker.js +67 -0
  44. package/es/calculator/workers/trend-calculator-worker.js +93 -0
  45. package/es/calculator/world-map-calculator.js +193 -0
  46. package/es/components/common-add-tool.js +19 -0
  47. package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
  48. package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
  49. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
  50. package/es/components/dialog/color-theme-dialog.js +71 -0
  51. package/es/components/dialog/enlarged-chart-dialog.js +73 -0
  52. package/es/components/dialog/new-table-dialog.js +113 -0
  53. package/es/components/dialog/new-view-dialog.js +87 -0
  54. package/es/components/dialog/rename-view-dialog.js +87 -0
  55. package/es/components/dialog/statistic-record-dialog/index.css +114 -0
  56. package/es/components/dialog/statistic-record-dialog/index.js +174 -0
  57. package/es/components/dialog/table-select-dialog.js +93 -0
  58. package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
  59. package/es/components/dtable-popover.js +109 -0
  60. package/es/components/dtable-search-input.js +137 -0
  61. package/es/components/dtable-select.js +104 -0
  62. package/es/components/index.js +11 -0
  63. package/es/components/loading.js +8 -0
  64. package/es/components/modal-portal.js +36 -0
  65. package/es/components/popover/color-rules/color-rule.js +179 -0
  66. package/es/components/popover/color-rules/index.js +87 -0
  67. package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
  68. package/es/components/popover/color-rules/rule-filters/index.css +214 -0
  69. package/es/components/popover/color-rules/rule-filters/index.js +97 -0
  70. package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
  71. package/es/components/popover/color-rules-popover.js +213 -0
  72. package/es/components/popover/color-selector-popover.js +85 -0
  73. package/es/components/seatable-radio/index.css +51 -0
  74. package/es/components/seatable-radio/index.js +28 -0
  75. package/es/components/select/index.js +2 -0
  76. package/es/components/select/option-group.css +104 -0
  77. package/es/components/select/option-group.js +225 -0
  78. package/es/components/select/option.js +51 -0
  79. package/es/components/select/select.css +211 -0
  80. package/es/components/select/select.js +157 -0
  81. package/es/components/toast/alert.js +130 -0
  82. package/es/components/toast/index.js +3 -0
  83. package/es/components/toast/toast.js +164 -0
  84. package/es/components/toast/toastManager.js +150 -0
  85. package/es/components/toast/toaster.js +64 -0
  86. package/es/constants/color-rules.js +8 -0
  87. package/es/constants/dtable-select-style.js +61 -0
  88. package/es/constants/event-types.js +1 -0
  89. package/es/constants/index.js +501 -0
  90. package/es/constants/key-codes.js +102 -0
  91. package/es/constants/zIndexes.js +1 -0
  92. package/es/custom-g2.js +614 -0
  93. package/es/dashboard.js +408 -0
  94. package/es/desktop-dashboard.js +299 -0
  95. package/es/index.js +33 -0
  96. package/es/locale/index.js +17 -0
  97. package/es/locale/lang/de.js +237 -0
  98. package/es/locale/lang/en.js +237 -0
  99. package/es/locale/lang/fr.js +237 -0
  100. package/es/locale/lang/zh_CN.js +237 -0
  101. package/es/mobile-dashboard.js +103 -0
  102. package/es/model/collaborators.js +11 -0
  103. package/es/model/stat-item.js +340 -0
  104. package/es/model/statistic-dashboard.js +8 -0
  105. package/es/service/chart-service.js +192 -0
  106. package/es/service/dashboard-service.js +415 -0
  107. package/es/stat-editor/chart-name-editor.js +75 -0
  108. package/es/stat-editor/index.js +74 -0
  109. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
  110. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
  111. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
  112. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
  113. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
  114. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
  115. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
  116. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
  117. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
  118. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
  119. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
  120. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
  121. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
  122. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
  123. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
  124. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
  125. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
  126. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
  127. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
  128. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
  129. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
  130. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
  131. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
  132. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
  133. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
  134. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
  135. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
  136. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
  137. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
  138. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
  139. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
  140. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
  141. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
  143. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
  144. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
  145. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
  146. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
  147. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
  148. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
  149. package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
  150. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
  151. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
  152. package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
  153. package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
  154. package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
  155. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
  156. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
  157. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
  158. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
  159. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
  160. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
  161. package/es/stat-list/chart-preview.js +139 -0
  162. package/es/stat-list/index.js +275 -0
  163. package/es/stat-view/area-chart.js +521 -0
  164. package/es/stat-view/bar-chart.js +568 -0
  165. package/es/stat-view/base-chart.js +44 -0
  166. package/es/stat-view/basic-number-card.js +255 -0
  167. package/es/stat-view/combination-chart.js +558 -0
  168. package/es/stat-view/compare-chart.js +485 -0
  169. package/es/stat-view/completeness-chart.js +389 -0
  170. package/es/stat-view/custom-bar.js +433 -0
  171. package/es/stat-view/dashboard-chart.js +317 -0
  172. package/es/stat-view/heat-map.js +501 -0
  173. package/es/stat-view/horizontal-bar-chart.js +569 -0
  174. package/es/stat-view/index.js +183 -0
  175. package/es/stat-view/line-chart.js +505 -0
  176. package/es/stat-view/map.js +428 -0
  177. package/es/stat-view/mirror.js +285 -0
  178. package/es/stat-view/pie-chart.js +326 -0
  179. package/es/stat-view/pivot-table/index.js +206 -0
  180. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
  181. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
  182. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
  183. package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
  184. package/es/stat-view/ring-chart.js +416 -0
  185. package/es/stat-view/scatter-chart.js +367 -0
  186. package/es/stat-view/treemap-chart.js +318 -0
  187. package/es/stat-view/trend-chart.js +299 -0
  188. package/es/stat-view/world-map.js +443 -0
  189. package/es/tabs/index.js +252 -0
  190. package/es/tabs/statistic-tabs.module.css +154 -0
  191. package/es/tabs/tab.js +167 -0
  192. package/es/utils/basic-chart-utils.js +24 -0
  193. package/es/utils/cell-format.js +110 -0
  194. package/es/utils/cell-value.js +27 -0
  195. package/es/utils/collaborator.js +31 -0
  196. package/es/utils/color-utils.js +112 -0
  197. package/es/utils/column-utils.js +18 -0
  198. package/es/utils/column.js +13 -0
  199. package/es/utils/common-utils.js +303 -0
  200. package/es/utils/date-format.js +65 -0
  201. package/es/utils/export-table-utils.js +632 -0
  202. package/es/utils/index.js +26 -0
  203. package/es/utils/object.js +26 -0
  204. package/es/utils/row-utils.js +115 -0
  205. package/es/utils/search.js +67 -0
  206. package/es/utils/sql-utils.js +293 -0
  207. package/es/utils/stat-utils.js +353 -0
  208. package/es/utils/trend-utils.js +136 -0
  209. package/index.js +1 -0
  210. package/package.json +188 -0
@@ -0,0 +1,51 @@
1
+ .seatable-radio {
2
+ user-select: none;
3
+ cursor: default;
4
+ display: inline-flex;
5
+ align-items: center;
6
+ margin: 0;
7
+ font-size: 14px;
8
+ }
9
+
10
+ .seatable-radio .seatable-radio-input {
11
+ position: absolute;
12
+ z-index: -1;
13
+ opacity: 0;
14
+ }
15
+
16
+ .seatable-radio .seatable-radio-indicator {
17
+ display: inline-block;
18
+ width: 16px;
19
+ height: 16px;
20
+ border-radius: 50%;
21
+ background-color: #ffffff;
22
+ border: 1px solid #bdbdbd;
23
+ position: relative;
24
+ }
25
+
26
+ .seatable-radio .seatable-radio-selected-indicator {
27
+ background-color: #FF8000;
28
+ border: unset !important;
29
+ }
30
+
31
+ .seatable-radio .seatable-radio-selected-indicator::before {
32
+ display: inline-block;
33
+ content: '';
34
+ width: 6px;
35
+ height: 6px;
36
+ background-color: #ffffff;
37
+ position: absolute;
38
+ left: 5px;
39
+ top: 5px;
40
+ border-radius: 50%;
41
+ }
42
+
43
+ .seatable-radio .seatable-radio-disable {
44
+ background-color: #f5f5f5;
45
+ }
46
+
47
+ .seatable-radio .seatable-radio-description {
48
+ margin-left: .5rem;
49
+ color: inherit;
50
+ transition: .3s color;
51
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import './index.css';
4
+ function SeaTableRadio(props) {
5
+ return /*#__PURE__*/React.createElement("label", {
6
+ className: "seatable-radio"
7
+ }, /*#__PURE__*/React.createElement("input", {
8
+ type: "radio",
9
+ className: "seatable-radio-input",
10
+ checked: props.isChecked,
11
+ onChange: props.disabled ? function () {} : props.onCheckedChange,
12
+ name: props.name,
13
+ value: props.value
14
+ }), /*#__PURE__*/React.createElement("span", {
15
+ className: classnames('seatable-radio-indicator', {
16
+ 'seatable-radio-selected-indicator': props.isChecked,
17
+ 'seatable-radio-disable': props.disabled
18
+ })
19
+ }), /*#__PURE__*/React.createElement("span", {
20
+ className: "seatable-radio-description text-truncate"
21
+ }, props.label));
22
+ }
23
+ SeaTableRadio.defaultProps = {
24
+ disabled: false,
25
+ name: 'seatable-radio-input',
26
+ onCheckedChange: function onCheckedChange() {}
27
+ };
28
+ export default SeaTableRadio;
@@ -0,0 +1,2 @@
1
+ import Select from './select';
2
+ export default Select;
@@ -0,0 +1,104 @@
1
+ .option-group {
2
+ position: absolute;
3
+ left: 0;
4
+ min-height: 60px;
5
+ max-height: 300px;
6
+ min-width: 100%;
7
+ max-width: 15rem;
8
+ padding: .5rem 0;
9
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
10
+ background: #fff;
11
+ border: 1px solid rgba(0, 40, 100, 0.12);
12
+ border-radius: 3px;
13
+ z-index: 10001;
14
+ }
15
+
16
+ .option-group .option-group-search {
17
+ width: 100%;
18
+ padding: 0 10px 6px 10px;
19
+ min-width: 170px;
20
+ }
21
+
22
+ .option-group-search .form-control {
23
+ height: 31px;
24
+ }
25
+
26
+ .option-group .none-search-result {
27
+ height: 100px;
28
+ width: 100%;
29
+ padding: 10px;
30
+ opacity: .5;
31
+ }
32
+
33
+ .option-group .option-group-content {
34
+ max-height: 252px;
35
+ overflow-y: auto;
36
+ }
37
+
38
+ .option {
39
+ display: block;
40
+ width: 100%;
41
+ line-height: 24px;
42
+ padding: .25rem 10px;
43
+ clear: both;
44
+ font-weight: 400;
45
+ color: #212529;
46
+ text-align: inherit;
47
+ background-color: transparent;
48
+ border: 0;
49
+ overflow: hidden;
50
+ text-overflow: ellipsis;
51
+ white-space: nowrap;
52
+ }
53
+
54
+ .option.option-active {
55
+ background-color: #20a0ff;
56
+ color: #fff;
57
+ cursor: pointer;
58
+ }
59
+
60
+ .option:hover .header-icon .dtable-font,
61
+ .option.option-active .select-option-name {
62
+ color: #fff;
63
+ }
64
+
65
+ .option.option-active .header-icon .dtable-font {
66
+ color: #fff;
67
+ }
68
+
69
+ .option:not(.option-active):hover .header-icon .dtable-font {
70
+ color: #aaa;
71
+ }
72
+
73
+ .option .select-option-name .single-select-option {
74
+ margin: 0 0 0 12px;
75
+ }
76
+
77
+ .option .select-option-name .multiple-select-option {
78
+ margin: 0;
79
+ }
80
+
81
+ .option-group-selector-single-select .select-option-name,
82
+ .option-group-selector-multiple-select .multiple-option-name {
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: space-between;
86
+ }
87
+
88
+ .option-group-selector-multiple-select .multiple-check-icon {
89
+ display: inline-flex;
90
+ width: 20px;
91
+ text-align: center;
92
+ }
93
+
94
+ .option-group-selector-multiple-select .multiple-check-icon .dtable-icon-check-mark {
95
+ font-size: 12px;
96
+ color: #798d99;
97
+ }
98
+
99
+ .option-group-selector-single-select .option:hover,
100
+ .option-group-selector-single-select .option.option-active,
101
+ .option-group-selector-multiple-select .option:hover,
102
+ .option-group-selector-multiple-select .option.option-active {
103
+ background-color: #f7f7f7;
104
+ }
@@ -0,0 +1,225 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Component } from 'react';
6
+ import DtableSearchInput from '../dtable-search-input';
7
+ import Option from './option';
8
+ import { CommonEventTypes, KeyCodes } from '../../constants';
9
+ import './option-group.css';
10
+ var OPTION_HEIGHT = 32;
11
+ var OptGroup = /*#__PURE__*/function (_Component) {
12
+ _inherits(OptGroup, _Component);
13
+ var _super = _createSuper(OptGroup);
14
+ function OptGroup(props) {
15
+ var _this;
16
+ _classCallCheck(this, OptGroup);
17
+ _this = _super.call(this, props);
18
+ _this.resetMenuStyle = function () {
19
+ var _this$props = _this.props,
20
+ isInModal = _this$props.isInModal,
21
+ position = _this$props.position;
22
+ var _this$optionGroupRef$ = _this.optionGroupRef.getBoundingClientRect(),
23
+ top = _this$optionGroupRef$.top,
24
+ height = _this$optionGroupRef$.height;
25
+ if (isInModal) {
26
+ if (position.y + position.height + height > window.innerHeight) {
27
+ _this.optionGroupRef.style.top = position.y - height + 'px';
28
+ }
29
+ _this.optionGroupRef.style.opacity = 1;
30
+ } else {
31
+ if (height + top > window.innerHeight) {
32
+ var borderWidth = 2;
33
+ _this.optionGroupRef.style.top = -1 * (height + borderWidth) + 'px';
34
+ }
35
+ }
36
+ };
37
+ _this.onHotKey = function (event) {
38
+ var keyCode = event.keyCode;
39
+ if (keyCode === KeyCodes.UpArrow) {
40
+ _this.onPressUp();
41
+ } else if (keyCode === KeyCodes.DownArrow) {
42
+ _this.onPressDown();
43
+ } else if (keyCode === KeyCodes.Enter) {
44
+ var option = _this.filterOptions && _this.filterOptions[_this.state.activeIndex];
45
+ if (option) {
46
+ _this.props.onSelectOption(option.value);
47
+ if (!_this.props.supportMultipleSelect) {
48
+ _this.props.closeSelect();
49
+ }
50
+ }
51
+ } else if (keyCode === KeyCodes.Tab || keyCode === KeyCodes.Escape) {
52
+ _this.props.closeSelect();
53
+ window.app.eventBus.dispatch(CommonEventTypes.OPEN_SELECT, false);
54
+ }
55
+ };
56
+ _this.onPressUp = function () {
57
+ if (_this.state.activeIndex > 0) {
58
+ _this.setState({
59
+ activeIndex: _this.state.activeIndex - 1
60
+ }, function () {
61
+ _this.scrollContent();
62
+ });
63
+ }
64
+ };
65
+ _this.onPressDown = function () {
66
+ if (_this.filterOptions && _this.state.activeIndex < _this.filterOptions.length - 1) {
67
+ _this.setState({
68
+ activeIndex: _this.state.activeIndex + 1
69
+ }, function () {
70
+ _this.scrollContent();
71
+ });
72
+ }
73
+ };
74
+ _this.scrollContent = function () {
75
+ var _this$optionGroupCont = _this.optionGroupContentRef,
76
+ offsetHeight = _this$optionGroupCont.offsetHeight,
77
+ scrollTop = _this$optionGroupCont.scrollTop;
78
+ _this.setState({
79
+ disableHover: true
80
+ });
81
+ _this.timer = setTimeout(function () {
82
+ _this.setState({
83
+ disableHover: false
84
+ });
85
+ }, 500);
86
+ if (_this.state.activeIndex * OPTION_HEIGHT === 0) {
87
+ _this.optionGroupContentRef.scrollTop = 0;
88
+ return;
89
+ }
90
+ if (_this.state.activeIndex * OPTION_HEIGHT < scrollTop) {
91
+ _this.optionGroupContentRef.scrollTop = scrollTop - OPTION_HEIGHT;
92
+ } else if (_this.state.activeIndex * OPTION_HEIGHT > offsetHeight + scrollTop) {
93
+ _this.optionGroupContentRef.scrollTop = scrollTop + OPTION_HEIGHT;
94
+ }
95
+ };
96
+ _this.changeIndex = function (index) {
97
+ _this.setState({
98
+ activeIndex: index
99
+ });
100
+ };
101
+ _this.onChangeSearch = function (searchVal) {
102
+ var value = searchVal || '';
103
+ if (value !== _this.state.searchVal) {
104
+ _this.setState({
105
+ searchVal: value,
106
+ activeIndex: -1
107
+ });
108
+ }
109
+ };
110
+ _this.renderOptGroup = function (searchVal) {
111
+ var _this$props2 = _this.props,
112
+ noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
113
+ onSelectOption = _this$props2.onSelectOption;
114
+ _this.filterOptions = _this.props.getFilterOptions(searchVal);
115
+ if (_this.filterOptions.length === 0) {
116
+ return /*#__PURE__*/React.createElement("div", {
117
+ className: "none-search-result"
118
+ }, noOptionsPlaceholder);
119
+ }
120
+ return _this.filterOptions.map(function (opt, i) {
121
+ var key = opt.value.column ? opt.value.column.key : i;
122
+ var isActive = _this.state.activeIndex === i;
123
+ return /*#__PURE__*/React.createElement(Option, {
124
+ key: key,
125
+ index: i,
126
+ isActive: isActive,
127
+ value: opt.value,
128
+ onSelectOption: onSelectOption,
129
+ changeIndex: _this.changeIndex,
130
+ supportMultipleSelect: _this.props.supportMultipleSelect,
131
+ disableHover: _this.state.disableHover
132
+ }, opt.label);
133
+ });
134
+ };
135
+ _this.state = {
136
+ searchVal: '',
137
+ activeIndex: -1,
138
+ disableHover: false
139
+ };
140
+ _this.filterOptions = null;
141
+ _this.timer = null;
142
+ return _this;
143
+ }
144
+ _createClass(OptGroup, [{
145
+ key: "componentDidMount",
146
+ value: function componentDidMount() {
147
+ var _this2 = this;
148
+ window.addEventListener('keydown', this.onHotKey);
149
+ // Make sure child component is rendered, so current component can be stretched out, then get the correct size
150
+ setTimeout(function () {
151
+ _this2.resetMenuStyle();
152
+ }, 1);
153
+ }
154
+ }, {
155
+ key: "componentWillUnmount",
156
+ value: function componentWillUnmount() {
157
+ this.filterOptions = null;
158
+ this.timer && clearTimeout(this.timer);
159
+ window.removeEventListener('keydown', this.onHotKey);
160
+ }
161
+ }, {
162
+ key: "render",
163
+ value: function render() {
164
+ var _this3 = this;
165
+ var _this$props3 = this.props,
166
+ searchable = _this$props3.searchable,
167
+ searchPlaceholder = _this$props3.searchPlaceholder,
168
+ top = _this$props3.top,
169
+ left = _this$props3.left,
170
+ minWidth = _this$props3.minWidth,
171
+ value = _this$props3.value,
172
+ isShowSelected = _this$props3.isShowSelected,
173
+ isInModal = _this$props3.isInModal,
174
+ position = _this$props3.position,
175
+ className = _this$props3.className;
176
+ var searchVal = this.state.searchVal;
177
+ var style = {
178
+ top: top || 0,
179
+ left: left || 0
180
+ };
181
+ if (minWidth) {
182
+ style = {
183
+ top: top || 0,
184
+ left: left || 0,
185
+ minWidth: minWidth
186
+ };
187
+ }
188
+ if (isInModal) {
189
+ style = {
190
+ position: 'fixed',
191
+ left: position.x,
192
+ top: position.y + position.height,
193
+ minWidth: position.width,
194
+ opacity: 0
195
+ };
196
+ }
197
+ return /*#__PURE__*/React.createElement("div", {
198
+ className: "option-group ".concat(isShowSelected ? 'pt-0' : '', " ").concat(className ? 'option-group-' + className : ''),
199
+ ref: function ref(_ref2) {
200
+ return _this3.optionGroupRef = _ref2;
201
+ },
202
+ style: style
203
+ }, isShowSelected && /*#__PURE__*/React.createElement("div", {
204
+ className: "editor-list-delete mb-2",
205
+ onClick: function onClick(e) {
206
+ return e.stopPropagation();
207
+ }
208
+ }, value.label || ''), searchable && /*#__PURE__*/React.createElement("div", {
209
+ className: "option-group-search"
210
+ }, /*#__PURE__*/React.createElement(DtableSearchInput, {
211
+ className: "option-search-control",
212
+ placeholder: searchPlaceholder,
213
+ onChange: this.onChangeSearch,
214
+ autoFocus: true
215
+ })), /*#__PURE__*/React.createElement("div", {
216
+ className: "option-group-content",
217
+ ref: function ref(_ref) {
218
+ return _this3.optionGroupContentRef = _ref;
219
+ }
220
+ }, this.renderOptGroup(searchVal)));
221
+ }
222
+ }]);
223
+ return OptGroup;
224
+ }(Component);
225
+ export default OptGroup;
@@ -0,0 +1,51 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React, { Component } from 'react';
6
+ import classnames from 'classnames';
7
+ var Option = /*#__PURE__*/function (_Component) {
8
+ _inherits(Option, _Component);
9
+ var _super = _createSuper(Option);
10
+ function Option() {
11
+ var _this;
12
+ _classCallCheck(this, Option);
13
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
14
+ args[_key] = arguments[_key];
15
+ }
16
+ _this = _super.call.apply(_super, [this].concat(args));
17
+ _this.onSelectOption = function (value, event) {
18
+ if (_this.props.supportMultipleSelect) {
19
+ event.stopPropagation();
20
+ }
21
+ _this.props.onSelectOption(value, event);
22
+ };
23
+ _this.onMouseEnter = function () {
24
+ if (!_this.props.disableHover) {
25
+ _this.props.changeIndex(_this.props.index);
26
+ }
27
+ };
28
+ _this.onMouseLeave = function () {
29
+ if (!_this.props.disableHover) {
30
+ _this.props.changeIndex(-1);
31
+ }
32
+ };
33
+ return _this;
34
+ }
35
+ _createClass(Option, [{
36
+ key: "render",
37
+ value: function render() {
38
+ var isActive = this.props.isActive;
39
+ return /*#__PURE__*/React.createElement("div", {
40
+ className: classnames('option', {
41
+ 'option-active': isActive
42
+ }),
43
+ onClick: this.onSelectOption.bind(this, this.props.value),
44
+ onMouseEnter: this.onMouseEnter,
45
+ onMouseLeave: this.onMouseLeave
46
+ }, this.props.children);
47
+ }
48
+ }]);
49
+ return Option;
50
+ }(Component);
51
+ export default Option;
@@ -0,0 +1,211 @@
1
+ .dtable-select {
2
+ position: relative;
3
+ }
4
+
5
+ .dtable-select.custom-select {
6
+ display: flex;
7
+ padding: 0 10px;
8
+ border-radius: 3px;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ max-width: 900px;
12
+ user-select: none;
13
+ -webkit-user-select: none;
14
+ -moz-user-select: none;
15
+ -o-user-select: none;
16
+ -ms-user-select: none;
17
+ text-align: left;
18
+ }
19
+
20
+ .dtable-select.custom-select:focus,
21
+ .dtable-select.custom-select.focus {
22
+ border-color: #1991eb !important;
23
+ box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
24
+ }
25
+
26
+ .dtable-select.custom-select.disabled:focus,
27
+ .dtable-select.custom-select.focus.disabled,
28
+ .dtable-select.custom-select.disabled:hover {
29
+ border-color: rgba(0, 40, 100, 0.12) !important;
30
+ box-shadow: unset;
31
+ cursor: default;
32
+ }
33
+
34
+ .dtable-select.custom-select:hover {
35
+ cursor: pointer;
36
+ border-color: rgb(179, 179, 179);
37
+ }
38
+
39
+ .dtable-select .select-option-name {
40
+ color: #212529;
41
+ }
42
+
43
+ .dtable-select .dtable-icon-drop-down {
44
+ display: inline-block;
45
+ font-size: 12px;
46
+ color: #949494;
47
+ transform: scale(.8) translateY(2px);
48
+ transition: all .1s;
49
+ }
50
+
51
+ .dtable-select .dtable-icon-drop-down:hover {
52
+ color: #000;
53
+ }
54
+
55
+ .dtable-select .selected-option {
56
+ display: flex;
57
+ flex: 1;
58
+ overflow: hidden;
59
+ flex-wrap: nowrap;
60
+ align-items: center;
61
+ justify-content: space-between;
62
+ background: #fff;
63
+ }
64
+
65
+ .dtable-select.selector-collaborator .option-group .option-group-content {
66
+ padding: 10px;
67
+ }
68
+
69
+ .dtable-select.selector-collaborator .option {
70
+ padding: 5px 0 5px 10px !important;
71
+ line-height: 20px;
72
+ }
73
+
74
+ .dtable-select .selected-option-show {
75
+ overflow: hidden;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ }
79
+
80
+ .dtable-select .select-placeholder {
81
+ line-height: 1;
82
+ font-size: 14px;
83
+ color: #949494;
84
+ white-space: nowrap;
85
+ }
86
+
87
+ /* collaborator select */
88
+ .collaborator-select-popover.dtable-select {
89
+ position: unset;
90
+ }
91
+
92
+ .collaborator-select-popover .collaborator-avatar {
93
+ width: 16px;
94
+ height: 16px;
95
+ transform: translateY(-1px);
96
+ }
97
+
98
+ .collaborator-select-popover .option-group {
99
+ position: absolute;
100
+ left: 0px;
101
+ min-height: 60px;
102
+ max-height: unset;
103
+ min-width: 100%;
104
+ max-width: 15rem;
105
+ padding: 0.5rem 0;
106
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 5%);
107
+ background: #fff;
108
+ border: 1px solid rgba(0,40,100,.12);
109
+ border-radius: 3px;
110
+ z-index: 10001;
111
+ }
112
+
113
+ .collaborator-select-popover .option-group .option-group-search {
114
+ width: 100%;
115
+ padding: 0 10px;
116
+ min-width: 170px;
117
+ }
118
+
119
+ .collaborator-select-popover .option-group-search .form-control {
120
+ height: 31px;
121
+ }
122
+
123
+ .collaborator-select-popover .option-group .none-search-result {
124
+ height: 100px;
125
+ width: 100%;
126
+ padding: 10px;
127
+ opacity: .5;
128
+ }
129
+
130
+ .collaborator-select-popover .option-group .option-group-content {
131
+ max-height: 252px;
132
+ overflow-y: auto;
133
+ padding: 10px;
134
+ }
135
+
136
+ .collaborator-select-popover .selected-option-show {
137
+ width: calc(100% - 20px);
138
+ height: 20px;
139
+ }
140
+
141
+ .collaborator-select-popover .selected-option {
142
+ width: auto;
143
+ overflow-x: auto;
144
+ }
145
+
146
+ .collaborator-select-popover .dtable-icon-drop-down {
147
+ margin-left: .5rem;
148
+ }
149
+
150
+ .collaborator-select-popover .option-collaborator {
151
+ display: flex;
152
+ }
153
+
154
+ .collaborator-select-popover .collaborator-container {
155
+ flex: 1 1;
156
+ }
157
+
158
+ .collaborator-select-popover .editor-list-delete .collaborator-container {
159
+ flex: 1 1;
160
+ display: inline;
161
+ }
162
+
163
+ .collaborator-select-popover .multiple-check-icon {
164
+ display: inline-flex;
165
+ width: 20px;
166
+ text-align: center;
167
+ }
168
+
169
+ .collaborator-select-popover .collaborator-check-icon .dtable-icon-check-mark,
170
+ .collaborator-select-popover .multiple-check-icon .dtable-icon-check-mark {
171
+ font-size: 12px;
172
+ color: #798d99;
173
+ }
174
+
175
+ .collaborator-select-popover.dtable-select .option-active,
176
+ .collaborator-select-popover.dtable-select .option:hover {
177
+ color: #212529;
178
+ background-color: #f7f7f7;
179
+ }
180
+
181
+ .collaborator-select-popover.dtable-select .option.option-active .select-option-name {
182
+ color: #212529;
183
+ }
184
+
185
+ .collaborator-select .option-group-content .collaborator,
186
+ .collaborator-select-popover .option-group .option-group-content .collaborator {
187
+ background: none;
188
+ }
189
+
190
+ .collaborator-select-popover .collaborator-avatar-container {
191
+ width: 16px;
192
+ }
193
+
194
+ .collaborator-select-popover .option-group-content .remove-container {
195
+ display: none;
196
+ }
197
+
198
+ .collaborator-select-popover .collaborator-container {
199
+ display: flex;
200
+ justify-content: space-between;
201
+ }
202
+
203
+ .collaborator-container .collaborator-name {
204
+ margin-left: 5px;
205
+ max-width: 200px;
206
+ color: #212529;
207
+ }
208
+
209
+ .collaborator-select .option-group {
210
+ max-height: fit-content;
211
+ }