dtable-ui-component 4.4.4 → 4.4.5

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 (146) hide show
  1. package/lib/AutoNumberFormatter/index.js +14 -7
  2. package/lib/ButtonFormatter/index.js +16 -9
  3. package/lib/CTimeFormatter/index.js +16 -9
  4. package/lib/CheckboxEditor/index.js +15 -8
  5. package/lib/CheckboxFormatter/index.js +15 -8
  6. package/lib/CollaboratorEditor/index.js +29 -21
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +32 -25
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +25 -18
  9. package/lib/CollaboratorFormatter/index.js +19 -12
  10. package/lib/CollaboratorItem/index.js +17 -10
  11. package/lib/CreatorFormatter/index.js +19 -12
  12. package/lib/DTableCommonAddTool/index.js +13 -6
  13. package/lib/DTableCustomizeCollaboratorSelect/index.js +26 -18
  14. package/lib/DTableCustomizeSelect/index.js +23 -15
  15. package/lib/DTableFiltersPopover/constants/index.js +38 -33
  16. package/lib/DTableFiltersPopover/index.js +38 -31
  17. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +53 -46
  18. package/lib/DTableFiltersPopover/utils/index.js +128 -99
  19. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +34 -26
  20. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +33 -25
  21. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +34 -26
  22. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +34 -26
  23. package/lib/DTableFiltersPopover/widgets/filter-item.js +128 -120
  24. package/lib/DTableFiltersPopover/widgets/filter-list/index.js +26 -18
  25. package/lib/DTableFiltersPopover/widgets/rate-item.js +15 -8
  26. package/lib/DTablePopover/index.js +15 -8
  27. package/lib/DTablePopover/utils.js +9 -2
  28. package/lib/DTableRadio/index.js +17 -10
  29. package/lib/DTableSearchInput/index.js +21 -13
  30. package/lib/DTableSearchInput/utils.js +9 -2
  31. package/lib/DTableSelect/dtable-select-label.js +13 -6
  32. package/lib/DTableSelect/index.js +18 -10
  33. package/lib/DTableSelect/utils.js +20 -10
  34. package/lib/DTableSwitch/index.js +14 -7
  35. package/lib/DateEditor/index.js +30 -22
  36. package/lib/DateEditor/mb-date-editor-popover/index.js +55 -47
  37. package/lib/DateEditor/pc-date-editor-popover.js +27 -20
  38. package/lib/DateFormatter/index.js +16 -9
  39. package/lib/Department-editor/constants.js +7 -1
  40. package/lib/Department-editor/department-multiple-select/index.js +32 -24
  41. package/lib/Department-editor/department-single-select.js +41 -33
  42. package/lib/Department-editor/index.js +22 -14
  43. package/lib/Department-editor/selected-departments/index.js +32 -25
  44. package/lib/Department-editor/utils.js +11 -3
  45. package/lib/DepartmentSingleSelectFormatter/index.js +16 -9
  46. package/lib/DigitalSignFormatter/index.js +23 -15
  47. package/lib/DigitalSignFormatter/utils.js +11 -3
  48. package/lib/DurationFormatter/index.js +16 -9
  49. package/lib/EditEditorButton/index.js +12 -5
  50. package/lib/EmailFormatter/index.js +14 -7
  51. package/lib/FieldDisplaySetting/field-item.js +21 -14
  52. package/lib/FieldDisplaySetting/index.js +27 -19
  53. package/lib/FileEditor/index.js +15 -8
  54. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  55. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  56. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  57. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  58. package/lib/FileFormatter/index.js +19 -11
  59. package/lib/FileItemFormatter/index.js +14 -6
  60. package/lib/FileItemFormatter/utils.js +9 -2
  61. package/lib/FileUploader/index.js +11 -4
  62. package/lib/FormulaFormatter/cell-value-validator.js +24 -18
  63. package/lib/FormulaFormatter/index.js +39 -32
  64. package/lib/FormulaFormatter/utils.js +29 -13
  65. package/lib/GeolocationFormatter/index.js +16 -9
  66. package/lib/HtmlLongTextFormatter/index.js +17 -9
  67. package/lib/ImageFormatter/images-lazy-load.js +16 -9
  68. package/lib/ImageFormatter/index.js +24 -16
  69. package/lib/ImageFormatter/utils.js +9 -2
  70. package/lib/ImagePreviewerLightbox/index.js +19 -12
  71. package/lib/ImagePreviewerLightbox/utils.js +11 -3
  72. package/lib/LastModifierFormatter/index.js +19 -12
  73. package/lib/LinkEditor/index.js +33 -25
  74. package/lib/LinkEditor/link-editor-option.js +15 -8
  75. package/lib/LinkEditor/mb-link-editor-popover/index.js +30 -23
  76. package/lib/LinkEditor/pc-link-editor-popover/index.js +24 -17
  77. package/lib/LinkFormatter/index.js +20 -13
  78. package/lib/Loading/index.js +11 -4
  79. package/lib/LongTextFormatter/index.js +13 -6
  80. package/lib/MBEditorHeader/index.js +14 -7
  81. package/lib/MTimeFormatter/index.js +16 -9
  82. package/lib/ModalPortal/index.js +12 -5
  83. package/lib/MultipleSelectEditor/index.js +25 -17
  84. package/lib/MultipleSelectFormatter/index.js +17 -10
  85. package/lib/NotificationPopover/index.js +24 -16
  86. package/lib/NumberEditor/index.js +25 -18
  87. package/lib/NumberFormatter/index.js +16 -9
  88. package/lib/RateFormatter/index.js +15 -8
  89. package/lib/RoleStatusEditor/index.js +22 -14
  90. package/lib/RowExpandEmailFormatter/index.js +17 -10
  91. package/lib/RowExpandFileFormatter/index.js +16 -8
  92. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +27 -18
  93. package/lib/RowExpandFormatter/index.js +86 -78
  94. package/lib/RowExpandFormulaFormatter/index.js +42 -34
  95. package/lib/RowExpandImageFormatter/index.js +19 -10
  96. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +27 -18
  97. package/lib/RowExpandImageFormatter/utils.js +9 -2
  98. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +16 -7
  99. package/lib/RowExpandLinkFormatter/index.js +46 -37
  100. package/lib/RowExpandLinkFormatter/utils.js +17 -6
  101. package/lib/RowExpandLinkFormatter/value-display-utils.js +12 -5
  102. package/lib/RowExpandRateFormatter/index.js +15 -8
  103. package/lib/RowExpandUrlFormatter/index.js +21 -14
  104. package/lib/SelectItem/index.js +12 -4
  105. package/lib/SelectOptionGroup/KeyCodes.js +7 -1
  106. package/lib/SelectOptionGroup/index.js +28 -20
  107. package/lib/SelectOptionGroup/option.js +11 -4
  108. package/lib/SimpleLongTextFormatter/index.js +27 -20
  109. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +7 -1
  110. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +15 -8
  111. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +14 -7
  112. package/lib/SingleSelectEditor/index.js +26 -18
  113. package/lib/SingleSelectFormatter/index.js +16 -9
  114. package/lib/TextEditor/index.js +14 -7
  115. package/lib/TextFormatter/index.js +14 -7
  116. package/lib/UrlFormatter/index.js +14 -7
  117. package/lib/cellFormatterFactory/index.js +11 -4
  118. package/lib/common/ClickOutside.js +12 -4
  119. package/lib/common/delete-tip.js +20 -12
  120. package/lib/common/modal-portal.js +13 -5
  121. package/lib/constants/index.js +28 -9
  122. package/lib/css/mb-cell-editor.css +1 -1
  123. package/lib/data/dtable-value.js +11 -6
  124. package/lib/formatterConfig/base-formatter-config.js +53 -46
  125. package/lib/formatterConfig/index.js +16 -9
  126. package/lib/hooks/common-hooks.js +11 -4
  127. package/lib/index.js +432 -75
  128. package/lib/lang/index.js +24 -13
  129. package/lib/locals/de.js +7 -1
  130. package/lib/locals/en.js +7 -1
  131. package/lib/locals/fr.js +7 -1
  132. package/lib/locals/zh-CN.js +7 -1
  133. package/lib/select-editor/index.js +27 -4
  134. package/lib/select-editor/mb-select-editor-popover/index.js +41 -33
  135. package/lib/select-editor/pc-select-editor-popover/index.js +26 -19
  136. package/lib/select-editor/select-editor-option.js +15 -8
  137. package/lib/toaster/alert.js +18 -11
  138. package/lib/toaster/index.js +10 -3
  139. package/lib/toaster/toast.js +16 -8
  140. package/lib/toaster/toastManager.js +13 -5
  141. package/lib/toaster/toaster.js +15 -7
  142. package/lib/utils/dayjs.js +11 -4
  143. package/lib/utils/editor-utils.js +15 -5
  144. package/lib/utils/event-bus.js +7 -1
  145. package/lib/utils/utils.js +17 -6
  146. package/package.json +80 -68
@@ -1,14 +1,21 @@
1
- import React from 'react';
2
- import classnames from 'classnames';
3
- import CollaboratorItem from '../CollaboratorItem';
4
- import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
5
- import './index.css';
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 _classnames = _interopRequireDefault(require("classnames"));
10
+ var _CollaboratorItem = _interopRequireDefault(require("../CollaboratorItem"));
11
+ var _default_avatar = _interopRequireDefault(require("../assets/images/avatar/default_avatar.png"));
12
+ require("./index.css");
6
13
  // there will be there conditions
7
14
  // 1 value is not exist, typeof value is array, but it's length is 0
8
15
  // 2 value is exist, but can't find in collaborators
9
16
  // 3 value is exist, typeof value is a string
10
17
  // 4 value is exist, typeof value is array
11
- class CreatorFormatter extends React.PureComponent {
18
+ class CreatorFormatter extends _react.default.PureComponent {
12
19
  constructor() {
13
20
  super(...arguments);
14
21
  this.getCollaborators = () => {
@@ -25,10 +32,10 @@ class CreatorFormatter extends React.PureComponent {
25
32
  if (!collaborator) {
26
33
  collaborator = {
27
34
  name: item,
28
- avatar_url: DefaultAvatar
35
+ avatar_url: _default_avatar.default
29
36
  };
30
37
  }
31
- return /*#__PURE__*/React.createElement(CollaboratorItem, {
38
+ return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
32
39
  key: index,
33
40
  collaborator: collaborator
34
41
  });
@@ -40,14 +47,14 @@ class CreatorFormatter extends React.PureComponent {
40
47
  containerClassName,
41
48
  value
42
49
  } = this.props;
43
- const classname = classnames('dtable-ui cell-formatter-container creator-formatter', containerClassName);
50
+ const classname = (0, _classnames.default)('dtable-ui cell-formatter-container creator-formatter', containerClassName);
44
51
  if (!value || Array.isArray(value) && value.length === 0) {
45
- return /*#__PURE__*/React.createElement("div", {
52
+ return /*#__PURE__*/_react.default.createElement("div", {
46
53
  className: classname
47
54
  });
48
55
  }
49
56
  const collaborators = this.getCollaborators();
50
- return /*#__PURE__*/React.createElement("div", {
57
+ return /*#__PURE__*/_react.default.createElement("div", {
51
58
  className: classname
52
59
  }, collaborators);
53
60
  }
@@ -55,4 +62,4 @@ class CreatorFormatter extends React.PureComponent {
55
62
  CreatorFormatter.defaultProps = {
56
63
  value: ''
57
64
  };
58
- export default CreatorFormatter;
65
+ var _default = exports.default = CreatorFormatter;
@@ -1,5 +1,12 @@
1
- import React from 'react';
2
- import './index.css';
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
+ require("./index.css");
3
10
  function DTableCommonAddTool(_ref) {
4
11
  let {
5
12
  callBack,
@@ -9,16 +16,16 @@ function DTableCommonAddTool(_ref) {
9
16
  hideIcon,
10
17
  style
11
18
  } = _ref;
12
- return /*#__PURE__*/React.createElement("div", {
19
+ return /*#__PURE__*/_react.default.createElement("div", {
13
20
  className: "dtable-ui add-item-btn ".concat(className ? className : ''),
14
21
  style: style,
15
22
  onClick: e => {
16
23
  callBack(e);
17
24
  }
18
- }, !hideIcon && /*#__PURE__*/React.createElement("span", {
25
+ }, !hideIcon && /*#__PURE__*/_react.default.createElement("span", {
19
26
  className: "dtable-font dtable-icon-add-table ".concat(addIconClassName || '')
20
- }), /*#__PURE__*/React.createElement("span", {
27
+ }), /*#__PURE__*/_react.default.createElement("span", {
21
28
  className: "text-truncate"
22
29
  }, footerName));
23
30
  }
24
- export default DTableCommonAddTool;
31
+ var _default = exports.default = DTableCommonAddTool;
@@ -1,10 +1,18 @@
1
- import React, { Component } from 'react';
2
- import classnames from 'classnames';
3
- import { Popover } from 'reactstrap';
4
- import { searchCollaborators } from 'dtable-utils';
5
- import SelectOptionGroup from '../SelectOptionGroup';
6
- import './index.css';
7
- class CollaboratorSelect extends Component {
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 _reactstrap = require("reactstrap");
12
+ var _dtableUtils = require("dtable-utils");
13
+ var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
14
+ require("./index.css");
15
+ class CollaboratorSelect extends _react.Component {
8
16
  constructor(props) {
9
17
  super(props);
10
18
  this.onSelectToggle = event => {
@@ -43,7 +51,7 @@ class CollaboratorSelect extends Component {
43
51
  searchable
44
52
  } = this.props;
45
53
  if (!searchable) return options || [];
46
- return searchCollaborators(options, searchValue);
54
+ return (0, _dtableUtils.searchCollaborators)(options, searchValue);
47
55
  };
48
56
  this.renderOptionGroup = () => {
49
57
  const {
@@ -57,7 +65,7 @@ class CollaboratorSelect extends Component {
57
65
  isUsePopover
58
66
  } = this.props;
59
67
  if (!isUsePopover) {
60
- return /*#__PURE__*/React.createElement(SelectOptionGroup, {
68
+ return /*#__PURE__*/_react.default.createElement(_SelectOptionGroup.default, {
61
69
  value: value,
62
70
  top: top,
63
71
  left: left,
@@ -75,14 +83,14 @@ class CollaboratorSelect extends Component {
75
83
  isShowSelected: true
76
84
  });
77
85
  }
78
- return /*#__PURE__*/React.createElement(Popover, {
86
+ return /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, {
79
87
  placement: "bottom",
80
88
  isOpen: true,
81
89
  target: this.id,
82
90
  fade: false,
83
91
  hideArrow: true,
84
92
  className: "dtable-customize-collaborator-select dtable-select"
85
- }, /*#__PURE__*/React.createElement(SelectOptionGroup, {
93
+ }, /*#__PURE__*/_react.default.createElement(_SelectOptionGroup.default, {
86
94
  value: value,
87
95
  top: top,
88
96
  left: left,
@@ -119,23 +127,23 @@ class CollaboratorSelect extends Component {
119
127
  placeholder,
120
128
  isLocked
121
129
  } = this.props;
122
- return /*#__PURE__*/React.createElement("button", {
130
+ return /*#__PURE__*/_react.default.createElement("button", {
123
131
  ref: node => this.selector = node,
124
- className: classnames('dtable-select custom-select collaborator-select', {
132
+ className: (0, _classnames.default)('dtable-select custom-select collaborator-select', {
125
133
  'focus': this.state.isShowSelectOptions
126
134
  }, {
127
135
  'disabled': isLocked
128
136
  }, className),
129
137
  id: this.id,
130
138
  onClick: this.onSelectToggle
131
- }, /*#__PURE__*/React.createElement("div", {
139
+ }, /*#__PURE__*/_react.default.createElement("div", {
132
140
  className: "selected-option",
133
141
  ref: node => this.selectedOptionRef = node
134
- }, value.label ? /*#__PURE__*/React.createElement("span", {
142
+ }, value.label ? /*#__PURE__*/_react.default.createElement("span", {
135
143
  className: "selected-option-show"
136
- }, value.label) : /*#__PURE__*/React.createElement("span", {
144
+ }, value.label) : /*#__PURE__*/_react.default.createElement("span", {
137
145
  className: "select-placeholder"
138
- }, placeholder), !isLocked && /*#__PURE__*/React.createElement("i", {
146
+ }, placeholder), !isLocked && /*#__PURE__*/_react.default.createElement("i", {
139
147
  className: "dtable-font dtable-icon-drop-down"
140
148
  })), this.state.isShowSelectOptions && this.renderOptionGroup());
141
149
  }
@@ -144,4 +152,4 @@ CollaboratorSelect.defaultProps = {
144
152
  top: -3,
145
153
  left: -3
146
154
  };
147
- export default CollaboratorSelect;
155
+ var _default = exports.default = CollaboratorSelect;
@@ -1,9 +1,17 @@
1
- import React, { Component } from 'react';
2
- import SelectOptionGroup from '../SelectOptionGroup';
3
- import classnames from 'classnames';
4
- import ModalPortal from '../common/modal-portal';
5
- import './index.css';
6
- class DTableCustomizeSelect extends Component {
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 _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
11
+ var _classnames = _interopRequireDefault(require("classnames"));
12
+ var _modalPortal = _interopRequireDefault(require("../common/modal-portal"));
13
+ require("./index.css");
14
+ class DTableCustomizeSelect extends _react.Component {
7
15
  constructor(props) {
8
16
  super(props);
9
17
  this.onSelectToggle = event => {
@@ -85,23 +93,23 @@ class DTableCustomizeSelect extends Component {
85
93
  isLocked,
86
94
  isInModal
87
95
  } = this.props;
88
- return /*#__PURE__*/React.createElement("div", {
96
+ return /*#__PURE__*/_react.default.createElement("div", {
89
97
  ref: node => this.selector = node,
90
- className: classnames('dtable-select custom-select', {
98
+ className: (0, _classnames.default)('dtable-select custom-select', {
91
99
  'focus': this.state.isShowSelectOptions
92
100
  }, {
93
101
  'disabled': isLocked
94
102
  }, className),
95
103
  onClick: this.onSelectToggle
96
- }, /*#__PURE__*/React.createElement("div", {
104
+ }, /*#__PURE__*/_react.default.createElement("div", {
97
105
  className: "selected-option"
98
- }, value && value.label ? /*#__PURE__*/React.createElement("span", {
106
+ }, value && value.label ? /*#__PURE__*/_react.default.createElement("span", {
99
107
  className: "selected-option-show"
100
- }, value.label) : /*#__PURE__*/React.createElement("span", {
108
+ }, value.label) : /*#__PURE__*/_react.default.createElement("span", {
101
109
  className: "select-placeholder"
102
- }, placeholder), !isLocked && /*#__PURE__*/React.createElement("i", {
110
+ }, placeholder), !isLocked && /*#__PURE__*/_react.default.createElement("i", {
103
111
  className: "dtable-font dtable-icon-drop-down"
104
- })), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/React.createElement(SelectOptionGroup, {
112
+ })), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/_react.default.createElement(_SelectOptionGroup.default, {
105
113
  value: value,
106
114
  isShowSelected: this.props.isShowSelected,
107
115
  top: this.getSelectedOptionTop(),
@@ -114,7 +122,7 @@ class DTableCustomizeSelect extends Component {
114
122
  closeSelect: this.closeSelect,
115
123
  getFilterOptions: this.getFilterOptions,
116
124
  supportMultipleSelect: this.props.supportMultipleSelect
117
- }), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement(SelectOptionGroup, {
125
+ }), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/_react.default.createElement(_modalPortal.default, null, /*#__PURE__*/_react.default.createElement(_SelectOptionGroup.default, {
118
126
  className: className,
119
127
  value: value,
120
128
  isShowSelected: this.props.isShowSelected,
@@ -133,4 +141,4 @@ class DTableCustomizeSelect extends Component {
133
141
  })));
134
142
  }
135
143
  }
136
- export default DTableCustomizeSelect;
144
+ var _default = exports.default = DTableCustomizeSelect;
@@ -1,45 +1,51 @@
1
- import { FILTER_PREDICATE_TYPE, FILTER_TERM_MODIFIER_TYPE, CellType, FORMULA_RESULT_TYPE } from 'dtable-utils';
2
- const FORMULA_COLUMN_TYPES = [CellType.FORMULA, CellType.LINK_FORMULA];
3
- const SPECIAL_TERM_TYPE = {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.STRING_PREDICATE = exports.SPECIAL_TERM_TYPE = exports.SIMPLE_TEXT_INPUT_COLUMNS_MAP = exports.MULTIPLE_SELECTOR_COLUMNS = exports.FORMULA_COLUMN_TYPES = exports.FILTER_TERM_MODIFIER_SHOW = exports.DATE_LABEL_MAP = exports.DATE_EMPTY_LABEL_MAP = exports.ARRAY_PREDICATE = void 0;
7
+ var _dtableUtils = require("dtable-utils");
8
+ const FORMULA_COLUMN_TYPES = exports.FORMULA_COLUMN_TYPES = [_dtableUtils.CellType.FORMULA, _dtableUtils.CellType.LINK_FORMULA];
9
+ const SPECIAL_TERM_TYPE = exports.SPECIAL_TERM_TYPE = {
4
10
  CREATOR: 'creator',
5
11
  SINGLE_SELECT: 'single_select',
6
12
  MULTIPLE_SELECT: 'multiple_select',
7
13
  COLLABORATOR: 'collaborator',
8
14
  RATE: 'rate'
9
15
  };
10
- const SIMPLE_TEXT_INPUT_COLUMNS_MAP = {
11
- [CellType.TEXT]: true,
12
- [CellType.LONG_TEXT]: true,
13
- [CellType.GEOLOCATION]: true,
14
- [CellType.AUTO_NUMBER]: true,
15
- [CellType.EMAIL]: true,
16
- [CellType.URL]: true,
17
- [CellType.IMAGE]: true,
18
- [CellType.FILE]: true,
19
- [FORMULA_RESULT_TYPE.STRING]: true,
20
- [FORMULA_RESULT_TYPE.BOOL]: true
16
+ const SIMPLE_TEXT_INPUT_COLUMNS_MAP = exports.SIMPLE_TEXT_INPUT_COLUMNS_MAP = {
17
+ [_dtableUtils.CellType.TEXT]: true,
18
+ [_dtableUtils.CellType.LONG_TEXT]: true,
19
+ [_dtableUtils.CellType.GEOLOCATION]: true,
20
+ [_dtableUtils.CellType.AUTO_NUMBER]: true,
21
+ [_dtableUtils.CellType.EMAIL]: true,
22
+ [_dtableUtils.CellType.URL]: true,
23
+ [_dtableUtils.CellType.IMAGE]: true,
24
+ [_dtableUtils.CellType.FILE]: true,
25
+ [_dtableUtils.FORMULA_RESULT_TYPE.STRING]: true,
26
+ [_dtableUtils.FORMULA_RESULT_TYPE.BOOL]: true
21
27
  };
22
- const DATE_LABEL_MAP = {
23
- [FILTER_TERM_MODIFIER_TYPE.EXACT_DATE]: true,
24
- [FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_AGO]: true,
25
- [FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_FROM_NOW]: true,
26
- [FILTER_TERM_MODIFIER_TYPE.THE_NEXT_NUMBERS_OF_DAYS]: true,
27
- [FILTER_TERM_MODIFIER_TYPE.THE_PAST_NUMBERS_OF_DAYS]: true
28
+ const DATE_LABEL_MAP = exports.DATE_LABEL_MAP = {
29
+ [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.EXACT_DATE]: true,
30
+ [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_AGO]: true,
31
+ [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_FROM_NOW]: true,
32
+ [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.THE_NEXT_NUMBERS_OF_DAYS]: true,
33
+ [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.THE_PAST_NUMBERS_OF_DAYS]: true
28
34
  };
29
- const ARRAY_PREDICATE = {
30
- [FILTER_PREDICATE_TYPE.IS_ANY_OF]: true,
31
- [FILTER_PREDICATE_TYPE.IS_NONE_OF]: true
35
+ const ARRAY_PREDICATE = exports.ARRAY_PREDICATE = {
36
+ [_dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF]: true,
37
+ [_dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF]: true
32
38
  };
33
- const STRING_PREDICATE = {
34
- [FILTER_PREDICATE_TYPE.IS]: true,
35
- [FILTER_PREDICATE_TYPE.IS_NOT]: true
39
+ const STRING_PREDICATE = exports.STRING_PREDICATE = {
40
+ [_dtableUtils.FILTER_PREDICATE_TYPE.IS]: true,
41
+ [_dtableUtils.FILTER_PREDICATE_TYPE.IS_NOT]: true
36
42
  };
37
- const DATE_EMPTY_LABEL_MAP = {
38
- [FILTER_PREDICATE_TYPE.EMPTY]: true,
39
- [FILTER_PREDICATE_TYPE.NOT_EMPTY]: true
43
+ const DATE_EMPTY_LABEL_MAP = exports.DATE_EMPTY_LABEL_MAP = {
44
+ [_dtableUtils.FILTER_PREDICATE_TYPE.EMPTY]: true,
45
+ [_dtableUtils.FILTER_PREDICATE_TYPE.NOT_EMPTY]: true
40
46
  };
41
- const MULTIPLE_SELECTOR_COLUMNS = [CellType.MULTIPLE_SELECT, CellType.COLLABORATOR, CellType.CREATOR, CellType.LAST_MODIFIER];
42
- const FILTER_TERM_MODIFIER_SHOW = {
47
+ const MULTIPLE_SELECTOR_COLUMNS = exports.MULTIPLE_SELECTOR_COLUMNS = [_dtableUtils.CellType.MULTIPLE_SELECT, _dtableUtils.CellType.COLLABORATOR, _dtableUtils.CellType.CREATOR, _dtableUtils.CellType.LAST_MODIFIER];
48
+ const FILTER_TERM_MODIFIER_SHOW = exports.FILTER_TERM_MODIFIER_SHOW = {
43
49
  'today': 'Today',
44
50
  'tomorrow': 'Tomorrow',
45
51
  'yesterday': 'Yesterday',
@@ -61,5 +67,4 @@ const FILTER_TERM_MODIFIER_SHOW = {
61
67
  'this_week': 'This_week',
62
68
  'this_month': 'This_month',
63
69
  'this_year': 'This_year'
64
- };
65
- export { FORMULA_COLUMN_TYPES, SPECIAL_TERM_TYPE, SIMPLE_TEXT_INPUT_COLUMNS_MAP, DATE_LABEL_MAP, ARRAY_PREDICATE, STRING_PREDICATE, DATE_EMPTY_LABEL_MAP, MULTIPLE_SELECTOR_COLUMNS, FILTER_TERM_MODIFIER_SHOW };
70
+ };
@@ -1,16 +1,23 @@
1
- import React, { Component } from 'react';
2
- import isHotkey from 'is-hotkey';
3
- import { Button, UncontrolledPopover } from 'reactstrap';
4
- import { FILTER_COLUMN_OPTIONS, getValidFilters } from 'dtable-utils';
5
- import CommonAddTool from '../DTableCommonAddTool';
6
- import { getEventClassName } from '../utils/utils';
7
- import { getFilterByColumn } from './utils';
8
- import FiltersList from './widgets/filter-list';
9
- import eventBus from '../utils/event-bus';
10
- import { EVENT_BUS_TYPE } from '../constants';
11
- import { getLocale } from '../lang';
12
- import './index.css';
1
+ "use strict";
13
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 _isHotkey = _interopRequireDefault(require("is-hotkey"));
11
+ var _reactstrap = require("reactstrap");
12
+ var _dtableUtils = require("dtable-utils");
13
+ var _DTableCommonAddTool = _interopRequireDefault(require("../DTableCommonAddTool"));
14
+ var _utils = require("../utils/utils");
15
+ var _utils2 = require("./utils");
16
+ var _filterList = _interopRequireDefault(require("./widgets/filter-list"));
17
+ var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
18
+ var _constants = require("../constants");
19
+ var _lang = require("../lang");
20
+ require("./index.css");
14
21
  /**
15
22
  * filter = {
16
23
  * column_key: '',
@@ -19,11 +26,11 @@ import './index.css';
19
26
  * filter_term_modifier: '',
20
27
  * }
21
28
  */
22
- class DTableFiltersPopover extends Component {
29
+ class DTableFiltersPopover extends _react.Component {
23
30
  constructor(props) {
24
31
  super(props);
25
32
  this.onHotKey = e => {
26
- if (isHotkey('esc', e) && !this.isSelectOpen) {
33
+ if ((0, _isHotkey.default)('esc', e) && !this.isSelectOpen) {
27
34
  e.preventDefault();
28
35
  this.props.hidePopover();
29
36
  }
@@ -32,7 +39,7 @@ class DTableFiltersPopover extends Component {
32
39
  this.isSelectOpen = status;
33
40
  };
34
41
  this.hideDTablePopover = e => {
35
- if (this.dtablePopoverRef && !getEventClassName(e).includes('popover') && !this.dtablePopoverRef.contains(e.target)) {
42
+ if (this.dtablePopoverRef && !(0, _utils.getEventClassName)(e).includes('popover') && !this.dtablePopoverRef.contains(e.target)) {
36
43
  this.props.hidePopover(e);
37
44
  e.preventDefault();
38
45
  e.stopPropagation();
@@ -98,11 +105,11 @@ class DTableFiltersPopover extends Component {
98
105
  columns
99
106
  } = this.props;
100
107
  let defaultColumn = columns[0];
101
- if (!FILTER_COLUMN_OPTIONS[defaultColumn.type]) {
102
- defaultColumn = columns.find(c => FILTER_COLUMN_OPTIONS[c.type]);
108
+ if (!_dtableUtils.FILTER_COLUMN_OPTIONS[defaultColumn.type]) {
109
+ defaultColumn = columns.find(c => _dtableUtils.FILTER_COLUMN_OPTIONS[c.type]);
103
110
  }
104
111
  if (!defaultColumn) return;
105
- let filter = getFilterByColumn(defaultColumn);
112
+ let filter = (0, _utils2.getFilterByColumn)(defaultColumn);
106
113
  const filters = this.state.filters.slice(0);
107
114
  if (filters.length === 0) {
108
115
  scheduleUpdate();
@@ -129,7 +136,7 @@ class DTableFiltersPopover extends Component {
129
136
  e.stopPropagation();
130
137
  };
131
138
  this.state = {
132
- filters: getValidFilters(props.filters, props.columns),
139
+ filters: (0, _dtableUtils.getValidFilters)(props.filters, props.columns),
133
140
  filterConjunction: props.filterConjunction || 'And'
134
141
  };
135
142
  this.isSelectOpen = false;
@@ -137,7 +144,7 @@ class DTableFiltersPopover extends Component {
137
144
  componentDidMount() {
138
145
  document.addEventListener('mousedown', this.hideDTablePopover, true);
139
146
  document.addEventListener('keydown', this.onHotKey);
140
- this.unsubscribeOpenSelect = eventBus.subscribe(EVENT_BUS_TYPE.OPEN_SELECT, this.setSelectStatus);
147
+ this.unsubscribeOpenSelect = _eventBus.default.subscribe(_constants.EVENT_BUS_TYPE.OPEN_SELECT, this.setSelectStatus);
141
148
  }
142
149
  componentWillUnmount() {
143
150
  document.removeEventListener('mousedown', this.hideDTablePopover, true);
@@ -160,7 +167,7 @@ class DTableFiltersPopover extends Component {
160
167
  filterConjunction
161
168
  } = this.state;
162
169
  const canAddFilter = columns.length > 0;
163
- return /*#__PURE__*/React.createElement(UncontrolledPopover, {
170
+ return /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledPopover, {
164
171
  placement: "auto-start",
165
172
  isOpen: true,
166
173
  target: target,
@@ -172,16 +179,16 @@ class DTableFiltersPopover extends Component {
172
179
  let {
173
180
  scheduleUpdate
174
181
  } = _ref;
175
- return /*#__PURE__*/React.createElement("div", {
182
+ return /*#__PURE__*/_react.default.createElement("div", {
176
183
  ref: ref => this.dtablePopoverRef = ref,
177
184
  onClick: this.onPopoverInsideClick,
178
185
  className: className
179
- }, /*#__PURE__*/React.createElement(FiltersList, {
186
+ }, /*#__PURE__*/_react.default.createElement(_filterList.default, {
180
187
  filterConjunction: filterConjunction,
181
188
  filters: filters,
182
189
  roleId: roleId,
183
190
  columns: columns,
184
- emptyPlaceholder: getLocale('No_filters'),
191
+ emptyPlaceholder: (0, _lang.getLocale)('No_filters'),
185
192
  collaborators: this.props.collaborators,
186
193
  readOnly: readOnly,
187
194
  scheduleUpdate: scheduleUpdate,
@@ -191,21 +198,21 @@ class DTableFiltersPopover extends Component {
191
198
  updateFilter: this.updateFilter,
192
199
  deleteFilter: this.deleteFilter,
193
200
  updateFilterConjunction: this.updateFilterConjunction
194
- }), /*#__PURE__*/React.createElement(CommonAddTool, {
201
+ }), /*#__PURE__*/_react.default.createElement(_DTableCommonAddTool.default, {
195
202
  className: "popover-add-tool ".concat(canAddFilter ? '' : 'disabled'),
196
203
  callBack: canAddFilter ? () => this.addFilter(scheduleUpdate) : () => {},
197
- footerName: getLocale('Add_filter'),
204
+ footerName: (0, _lang.getLocale)('Add_filter'),
198
205
  addIconClassName: "popover-add-icon"
199
- }), this.isNeedSubmit() && /*#__PURE__*/React.createElement("div", {
206
+ }), this.isNeedSubmit() && /*#__PURE__*/_react.default.createElement("div", {
200
207
  className: "dtable-filter-popover-footer"
201
- }, /*#__PURE__*/React.createElement(Button, {
208
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
202
209
  className: "mr-2",
203
210
  onClick: this.onClosePopover
204
- }, getLocale('Cancel')), /*#__PURE__*/React.createElement(Button, {
211
+ }, (0, _lang.getLocale)('Cancel')), /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
205
212
  color: "primary",
206
213
  disabled: this.state.isSubmitDisabled,
207
214
  onClick: this.onSubmitFilters
208
- }, getLocale('Submit'))));
215
+ }, (0, _lang.getLocale)('Submit'))));
209
216
  });
210
217
  }
211
218
  }
@@ -213,4 +220,4 @@ DTableFiltersPopover.defaultProps = {
213
220
  className: '',
214
221
  readOnly: false
215
222
  };
216
- export default DTableFiltersPopover;
223
+ var _default = exports.default = DTableFiltersPopover;