dtable-ui-component 7.0.1-beta.1 → 7.0.1-beta.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 (39) hide show
  1. package/lib/AsyncUserSelect/index.css +36 -18
  2. package/lib/AsyncUserSelect/index.js +29 -18
  3. package/lib/DTableCustomizeSearchInput/index.css +81 -0
  4. package/lib/DTableCustomizeSearchInput/index.js +136 -0
  5. package/lib/DTableCustomizeSelect/index.css +120 -42
  6. package/lib/DTableCustomizeSelect/index.js +9 -4
  7. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +7 -19
  8. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +5 -9
  9. package/lib/DTableFiltersPopover/widgets/filter-item.js +15 -7
  10. package/lib/DTableFiltersPopover/widgets/filter-list/index.css +3 -3
  11. package/lib/DTableSelect/dtable-select-label.css +4 -4
  12. package/lib/DTableSelect/dtable-select-label.js +1 -1
  13. package/lib/DTableSelect/index.js +3 -3
  14. package/lib/DTableSelect/select-dropdown-indicator/index.css +16 -0
  15. package/lib/DTableSelect/select-dropdown-indicator/index.js +24 -0
  16. package/lib/DTableSelect/user-select.css +7 -46
  17. package/lib/DTableSelect/utils.js +165 -79
  18. package/lib/ImageEditor/images-previewer/image-preview/index.js +1 -2
  19. package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +2 -2
  20. package/lib/ImageFormatter/images-lazy-load.js +2 -2
  21. package/lib/ImageFormatter/index.js +2 -5
  22. package/lib/ImagePreviewerLightbox/index.js +1 -2
  23. package/lib/ImageThumbnail/index.js +1 -2
  24. package/lib/SelectOptionGroup/KeyCodes.js +96 -4
  25. package/lib/SelectOptionGroup/index.css +74 -52
  26. package/lib/SelectOptionGroup/index.js +35 -26
  27. package/lib/SelectOptionGroup/option.js +16 -4
  28. package/lib/assets/icons/close.svg +1 -0
  29. package/lib/assets/icons/down.svg +3 -0
  30. package/lib/index.js +3 -10
  31. package/lib/utils/url.js +35 -10
  32. package/package.json +2 -2
  33. package/lib/DTableCustomizeCollaboratorSelect/index.css +0 -86
  34. package/lib/DTableCustomizeCollaboratorSelect/index.js +0 -158
  35. package/lib/DTableGroupSelect/index.css +0 -96
  36. package/lib/DTableGroupSelect/index.js +0 -131
  37. package/lib/DTableGroupSelect/option.js +0 -42
  38. package/lib/DTableGroupSelect/select-option-group.css +0 -54
  39. package/lib/DTableGroupSelect/select-option-group.js +0 -227
package/lib/utils/url.js CHANGED
@@ -3,8 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.needUseThumbnailImage = exports.isTargetUrl = exports.isInternalURL = exports.isInternalImg = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.isBase64 = exports.isAIUrl = exports.imageCheck = exports.getValidFileImageUrls = exports.getFileThumbnailInfo = exports.getFileSuffix = exports.getFileName = exports.getFileIconUrl = exports.generateCurrentBaseImageUrl = exports.generateCurrentBaseImageThumbnailUrl = exports.checkSVGImage = exports.checkImgExists = void 0;
7
- var _dtableUtils = require("dtable-utils");
6
+ exports.needUseThumbnailImage = exports.isTargetUrl = exports.isInternalURL = exports.isInternalImg = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.isBase64 = exports.isAIUrl = exports.imageCheck = exports.getValidFileImageUrls = exports.getImageThumbnailUrl = exports.getFileThumbnailInfo = exports.getFileSuffix = exports.getFileName = exports.getFileIconUrl = exports.generateCurrentBaseImageUrl = exports.generateCurrentBaseImageThumbnailUrl = exports.checkSVGImage = exports.checkImgExists = void 0;
8
7
  var _file = require("../constants/file");
9
8
  const isTargetUrl = (target, url) => {
10
9
  if (!url || typeof url !== 'string') return false;
@@ -96,6 +95,32 @@ const generateCurrentBaseImageUrl = _ref2 => {
96
95
  return "".concat(validServer, "/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl);
97
96
  };
98
97
  exports.generateCurrentBaseImageUrl = generateCurrentBaseImageUrl;
98
+ const getImageThumbnailUrl = function (url) {
99
+ let _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
100
+ server = _ref3.server,
101
+ dtableUuid = _ref3.dtableUuid,
102
+ workspaceID = _ref3.workspaceID,
103
+ _ref3$size = _ref3.size,
104
+ size = _ref3$size === void 0 ? 256 : _ref3$size;
105
+ if (!url || typeof url !== 'string') return '';
106
+ if (server && dtableUuid && isCustomAssetUrl(url)) {
107
+ const assetUuid = url.slice(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
108
+ return server + '/dtable/' + dtableUuid + '/custom-asset-thumbnail/' + assetUuid + '?size=' + size;
109
+ }
110
+ if (isAIUrl(url) || checkSVGImage(url) || !isInternalImg(url) || isBase64(url)) return url;
111
+ if (server && workspaceID && dtableUuid && isDigitalSignsUrl(url)) {
112
+ return generateCurrentBaseImageThumbnailUrl({
113
+ server,
114
+ workspaceID,
115
+ dtableUuid,
116
+ size,
117
+ partUrl: url
118
+ });
119
+ }
120
+ if (url.includes('/thumbnail/workspace')) return url;
121
+ return url.replace('/workspace', '/thumbnail/workspace') + '?size=' + size;
122
+ };
123
+ exports.getImageThumbnailUrl = getImageThumbnailUrl;
99
124
  const getFileName = url => {
100
125
  if (!url) return null;
101
126
  let validUrl = url;
@@ -120,9 +145,9 @@ const imageCheck = filename => {
120
145
  };
121
146
  exports.imageCheck = imageCheck;
122
147
  const isInternalURL = function (url) {
123
- let _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
124
- _ref3$server = _ref3.server,
125
- server = _ref3$server === void 0 ? '' : _ref3$server;
148
+ let _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
149
+ _ref4$server = _ref4.server,
150
+ server = _ref4$server === void 0 ? '' : _ref4$server;
126
151
  if (!url || typeof url !== 'string') return false;
127
152
  return server && url.indexOf(server) > -1;
128
153
  };
@@ -157,10 +182,10 @@ const getFileIconUrl = (filename, direntType) => {
157
182
  };
158
183
  exports.getFileIconUrl = getFileIconUrl;
159
184
  const getFileThumbnailInfo = function (file) {
160
- let _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
161
- server = _ref4.server,
162
- dtableUuid = _ref4.dtableUuid,
163
- workspaceID = _ref4.workspaceID;
185
+ let _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
186
+ server = _ref5.server,
187
+ dtableUuid = _ref5.dtableUuid,
188
+ workspaceID = _ref5.workspaceID;
164
189
  const defaultIcon = _file.FILEEXT_ICON_MAP['default'];
165
190
  const defaultIconUrl = _file.FILEEXT_ICON_URL_MAP[defaultIcon];
166
191
  if (!file || !file.name) return {
@@ -170,7 +195,7 @@ const getFileThumbnailInfo = function (file) {
170
195
  const isImage = imageCheck(file.name);
171
196
  if (isImage && server) return {
172
197
  isImage,
173
- fileIconUrl: (0, _dtableUtils.getImageThumbnailUrl)(file.url, {
198
+ fileIconUrl: getImageThumbnailUrl(file.url, {
174
199
  server,
175
200
  dtableUuid,
176
201
  workspaceID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "7.0.1-beta.1",
3
+ "version": "7.0.1-beta.2",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",
@@ -8,7 +8,7 @@
8
8
  "@seafile/seafile-editor": "^3.0.34",
9
9
  "classnames": "~2.5.*",
10
10
  "dayjs": "1.10.7",
11
- "dtable-utils": "5.0.32-beta.2",
11
+ "dtable-utils": "~5.0.27",
12
12
  "is-hotkey": "0.2.0",
13
13
  "rc-checkbox": "3.5.0",
14
14
  "react-color": "2.19.3",
@@ -1,86 +0,0 @@
1
- .dtable-customize-collaborator-select.dtable-select {
2
- position: unset;
3
- }
4
-
5
- .dtable-customize-collaborator-select .collaborator-avatar {
6
- width: 16px;
7
- height: 16px;
8
- transform: translateY(-1px);
9
- }
10
-
11
- .dtable-customize-collaborator-select .selected-option-show {
12
- width: calc(100% - 20px);
13
- height: 20px;
14
- }
15
-
16
- .dtable-customize-collaborator-select .selected-option {
17
- width: auto;
18
- overflow-x: auto;
19
- }
20
-
21
- .dtable-customize-collaborator-select .dtable-icon-down3 {
22
- margin-left: .5rem;
23
- }
24
-
25
- .dtable-customize-collaborator-select .option-collaborator {
26
- display: flex;
27
- }
28
-
29
- .dtable-customize-collaborator-select .collaborator-container {
30
- flex: 1 1;
31
- }
32
-
33
- .dtable-customize-collaborator-select .editor-list-delete .collaborator-container {
34
- flex: 1 1;
35
- display: inline;
36
- }
37
-
38
- .dtable-customize-collaborator-select .multiple-check-icon {
39
- display: inline-flex;
40
- width: 20px;
41
- text-align: center;
42
- }
43
-
44
- .dtable-customize-collaborator-select .collaborator-check-icon .dtable-icon-check-mark,
45
- .dtable-customize-collaborator-select .multiple-check-icon .dtable-icon-check-mark {
46
- font-size: 12px;
47
- color: #798d99;
48
- }
49
-
50
- .dtable-customize-collaborator-select.dtable-select .option-active,
51
- .dtable-customize-collaborator-select.dtable-select .option:hover {
52
- color: #212529;
53
- background-color: #f5f5f5;
54
- }
55
-
56
- .dtable-customize-collaborator-select.dtable-select .option.option-active .select-option-name {
57
- color: #212529;
58
- }
59
-
60
- .collaborator-select .option-group-content .collaborator,
61
- .dtable-customize-collaborator-select .option-group .option-group-content .collaborator {
62
- background: none;
63
- }
64
-
65
- .dtable-customize-collaborator-select .collaborator-avatar-container {
66
- width: 16px;
67
- }
68
-
69
- .dtable-customize-collaborator-select .option-group-content .remove-container {
70
- display: none;
71
- }
72
-
73
- .dtable-customize-collaborator-select .collaborator-container {
74
- display: flex;
75
- justify-content: space-between;
76
- }
77
-
78
- .collaborator-container .collaborator-name {
79
- margin-left: 5px;
80
- max-width: 200px;
81
- color: #212529;
82
- }
83
-
84
- .collaborator-select .option-group {
85
- max-height: fit-content;
86
- }
@@ -1,158 +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 _reactstrap = require("reactstrap");
12
- var _dtableUtils = require("dtable-utils");
13
- var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
14
- require("./index.css");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- class CollaboratorSelect extends _react.Component {
17
- constructor(props) {
18
- super(props);
19
- this.onSelectToggle = event => {
20
- event.preventDefault();
21
- /*
22
- if select is showing, click events do not need to be monitored by other click events,
23
- so it can be closed when other select is clicked.
24
- */
25
- if (this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
26
- let eventClassName = event.target.className;
27
- if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
28
- // Prevent closing by pressing the spacebar in the search input
29
- if (event.target.value === '') return;
30
- this.selectedOptionWidth = this.selectedOptionRef.clientWidth;
31
- this.setState({
32
- isShowSelectOptions: !this.state.isShowSelectOptions
33
- });
34
- };
35
- this.onMousedown = event => {
36
- const name = event.target.className;
37
- if (name === 'select-placeholder' || name.includes('icon-fork-number')) {
38
- return;
39
- }
40
- if (!this.selector.contains(event.target)) {
41
- this.closeSelect();
42
- }
43
- };
44
- this.closeSelect = () => {
45
- this.setState({
46
- isShowSelectOptions: false
47
- });
48
- };
49
- this.getFilterOptions = searchValue => {
50
- const _this$props = this.props,
51
- options = _this$props.options,
52
- searchable = _this$props.searchable;
53
- if (!searchable) return options || [];
54
- return (0, _dtableUtils.searchCollaborators)(options, searchValue);
55
- };
56
- this.renderOptionGroup = () => {
57
- const _this$props2 = this.props,
58
- value = _this$props2.value,
59
- options = _this$props2.options,
60
- searchable = _this$props2.searchable,
61
- searchPlaceholder = _this$props2.searchPlaceholder,
62
- noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
63
- top = _this$props2.top,
64
- left = _this$props2.left,
65
- isUsePopover = _this$props2.isUsePopover;
66
- if (!isUsePopover) {
67
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
68
- value: value,
69
- top: top,
70
- left: left,
71
- minWidth: this.btnWidth + 8 // 8px is padding
72
- ,
73
- options: options,
74
- onSelectOption: this.props.onSelectOption,
75
- searchable: searchable,
76
- searchPlaceholder: searchPlaceholder,
77
- noOptionsPlaceholder: noOptionsPlaceholder,
78
- closeSelect: this.closeSelect,
79
- getFilterOptions: this.getFilterOptions,
80
- supportMultipleSelect: this.props.supportMultipleSelect,
81
- stopClickEvent: true,
82
- isShowSelected: true
83
- });
84
- }
85
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Popover, {
86
- placement: "bottom",
87
- isOpen: true,
88
- target: this.id,
89
- fade: false,
90
- hideArrow: true,
91
- className: "dtable-customize-collaborator-select dtable-select",
92
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
93
- value: value,
94
- top: top,
95
- left: left,
96
- minWidth: this.btnWidth + 8 // 8px is padding
97
- ,
98
- options: options,
99
- onSelectOption: this.props.onSelectOption,
100
- searchable: searchable,
101
- searchPlaceholder: searchPlaceholder,
102
- noOptionsPlaceholder: noOptionsPlaceholder,
103
- closeSelect: this.closeSelect,
104
- getFilterOptions: this.getFilterOptions,
105
- supportMultipleSelect: this.props.supportMultipleSelect,
106
- stopClickEvent: true,
107
- isShowSelected: true
108
- })
109
- });
110
- };
111
- this.state = {
112
- isShowSelectOptions: false
113
- };
114
- this.id = 'collaborator-select-' + Math.trunc(Math.random() * 10000);
115
- }
116
- componentDidMount() {
117
- document.addEventListener('mousedown', this.onMousedown);
118
- this.btnWidth = this.selector.clientWidth;
119
- }
120
- componentWillUnmount() {
121
- document.removeEventListener('mousedown', this.onMousedown);
122
- }
123
- render() {
124
- let _this$props3 = this.props,
125
- className = _this$props3.className,
126
- value = _this$props3.value,
127
- placeholder = _this$props3.placeholder,
128
- isLocked = _this$props3.isLocked;
129
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
130
- ref: node => this.selector = node,
131
- className: (0, _classnames.default)('dtable-select custom-select collaborator-select', {
132
- 'focus': this.state.isShowSelectOptions
133
- }, {
134
- 'disabled': isLocked
135
- }, className),
136
- id: this.id,
137
- onClick: this.onSelectToggle,
138
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
139
- className: "selected-option",
140
- ref: node => this.selectedOptionRef = node,
141
- children: [value.label ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
142
- className: "selected-option-show",
143
- children: value.label
144
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
145
- className: "select-placeholder",
146
- children: placeholder
147
- }), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
148
- className: "dtable-font dtable-icon-down3"
149
- })]
150
- }), this.state.isShowSelectOptions && this.renderOptionGroup()]
151
- });
152
- }
153
- }
154
- CollaboratorSelect.defaultProps = {
155
- top: -3,
156
- left: -3
157
- };
158
- var _default = exports.default = CollaboratorSelect;
@@ -1,96 +0,0 @@
1
- .group-select {
2
- position: relative;
3
- }
4
-
5
- .group-select.custom-select {
6
- display: flex;
7
- padding: 5px 10px;
8
- border-radius: 3px;
9
- align-items: center;
10
- justify-content: space-between;
11
- max-width: 900px;
12
- user-select: none;
13
- text-align: left;
14
- border-color: 1px solid rgba(0, 40, 100, 0.12);
15
- height: auto;
16
- min-height: 38px;
17
- cursor: pointer;
18
- }
19
-
20
- .group-select.custom-select:focus,
21
- .group-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
- .group-select.custom-select.disabled:focus,
27
- .group-select.custom-select.focus.disabled,
28
- .group-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
- .group-select .sf3-font-down {
35
- display: inline-block;
36
- color: #999;
37
- transform: translateY(2px);
38
- transition: all 0.1s;
39
- font-size: 14px !important;
40
- }
41
-
42
- .group-select .sf3-font-down:hover {
43
- color: #666;
44
- }
45
-
46
- .group-select .selected-option {
47
- display: flex;
48
- flex: 1;
49
- overflow: hidden;
50
- flex-wrap: nowrap;
51
- align-items: center;
52
- justify-content: space-between;
53
- background: #fff;
54
- }
55
-
56
- .group-select.dtable-ui-collaborator-selector .option-group .option-group-content {
57
- padding: 10px;
58
- }
59
-
60
- .group-select.custom-select.dtable-ui-collaborator-selector .option-group .option-group-content {
61
- padding: 10px 0;
62
- }
63
-
64
- .group-select.custom-select.dtable-ui-collaborator-selector .option {
65
- padding: 5px 0 5px 10px !important;
66
- line-height: 20px;
67
- }
68
-
69
- .group-select .select-placeholder {
70
- line-height: 1;
71
- font-size: 14px;
72
- white-space: nowrap;
73
- }
74
-
75
- .group-select .selected-option-show {
76
- display: flex;
77
- flex-wrap: wrap;
78
- gap: 4px;
79
- }
80
-
81
- .group-select .selected-option-show .selected-option-item {
82
- background-color: rgb(240, 240, 240);
83
- border-radius: 16px;
84
- display: flex;
85
- align-items: center;
86
- }
87
-
88
- .group-select .selected-option-show .selected-option-item .selected-option-item-name {
89
- font-size: 13px;
90
- color: #212529;
91
- }
92
-
93
- .group-select .selected-option-show .selected-option-item .dtable-icon-x {
94
- cursor: pointer;
95
- color: rgb(103, 103, 103);
96
- }
@@ -1,131 +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 _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
12
- var _selectOptionGroup = _interopRequireDefault(require("./select-option-group"));
13
- require("./index.css");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- class DTableGroupSelect extends _react.Component {
16
- constructor(props) {
17
- super(props);
18
- this.onSelectToggle = event => {
19
- event.preventDefault();
20
- if (this.state.isShowSelectOptions) event.stopPropagation();
21
- let eventClassName = event.target.className;
22
- if (eventClassName.indexOf('dtable-icon-x') > -1 || eventClassName === 'option-group-search') return;
23
- if (event.target.value === '') return;
24
- this.setState({
25
- isShowSelectOptions: !this.state.isShowSelectOptions
26
- });
27
- };
28
- this.onClickOutside = event => {
29
- if (this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
30
- return;
31
- }
32
- if (!this.selector.contains(event.target)) {
33
- this.closeSelect();
34
- }
35
- };
36
- this.closeSelect = () => {
37
- this.setState({
38
- isShowSelectOptions: false
39
- });
40
- };
41
- this.getSelectedOptionTop = () => {
42
- if (!this.selector) return 38;
43
- const _this$selector$getBou = this.selector.getBoundingClientRect(),
44
- height = _this$selector$getBou.height;
45
- return height;
46
- };
47
- this.getFilterOptions = searchValue => {
48
- const options = this.props.options;
49
- const validSearchVal = searchValue.trim().toLowerCase();
50
- if (!validSearchVal) return options || [];
51
- return options.filter(option => option.name.toLowerCase().includes(validSearchVal));
52
- };
53
- this.state = {
54
- isShowSelectOptions: false
55
- };
56
- }
57
- UNSAFE_componentWillReceiveProps(nextProps) {
58
- if (nextProps.selectedOptions.length !== this.props.selectedOptions.length) {
59
- // when selectedOptions change and dom rendered, calculate top
60
- setTimeout(() => {
61
- this.forceUpdate();
62
- }, 1);
63
- }
64
- }
65
- render() {
66
- let _this$props = this.props,
67
- className = _this$props.className,
68
- selectedOptions = _this$props.selectedOptions,
69
- options = _this$props.options,
70
- placeholder = _this$props.placeholder,
71
- searchPlaceholder = _this$props.searchPlaceholder,
72
- noOptionsPlaceholder = _this$props.noOptionsPlaceholder,
73
- isInModal = _this$props.isInModal;
74
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
75
- ref: node => this.selector = node,
76
- className: (0, _classnames.default)('group-select custom-select', {
77
- 'focus': this.state.isShowSelectOptions
78
- }, className),
79
- onClick: this.onSelectToggle,
80
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
81
- className: "selected-option",
82
- children: [selectedOptions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
83
- className: "selected-option-show",
84
- children: selectedOptions.map(item => /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
85
- className: "selected-option-item mr-1 pr-1 pl-2",
86
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
87
- className: "selected-option-item-name",
88
- children: item.name
89
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
90
- className: "dtable-font dtable-icon-x ml-1",
91
- onClick: () => {
92
- this.props.onDeleteOption(item);
93
- }
94
- })]
95
- }, item.id))
96
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
97
- className: "select-placeholder",
98
- children: placeholder
99
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
100
- className: "sf3-font-down sf3-font"
101
- })]
102
- }), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectOptionGroup.default, {
103
- selectedOptions: selectedOptions,
104
- top: this.getSelectedOptionTop(),
105
- options: options,
106
- onSelectOption: this.props.onSelectOption,
107
- searchPlaceholder: searchPlaceholder,
108
- noOptionsPlaceholder: noOptionsPlaceholder,
109
- onClickOutside: this.onClickOutside,
110
- closeSelect: this.closeSelect,
111
- getFilterOptions: this.getFilterOptions
112
- }), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
113
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectOptionGroup.default, {
114
- className: className,
115
- selectedOptions: selectedOptions,
116
- position: this.selector.getBoundingClientRect(),
117
- isInModal: isInModal,
118
- top: this.getSelectedOptionTop(),
119
- options: options,
120
- onSelectOption: this.props.onSelectOption,
121
- searchPlaceholder: searchPlaceholder,
122
- noOptionsPlaceholder: noOptionsPlaceholder,
123
- onClickOutside: this.onClickOutside,
124
- closeSelect: this.closeSelect,
125
- getFilterOptions: this.getFilterOptions
126
- })
127
- })]
128
- });
129
- }
130
- }
131
- var _default = exports.default = DTableGroupSelect;
@@ -1,42 +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 _jsxRuntime = require("react/jsx-runtime");
12
- class Option extends _react.Component {
13
- constructor() {
14
- super(...arguments);
15
- this.onSelectOption = e => {
16
- e.stopPropagation();
17
- this.props.onSelectOption(this.props.option);
18
- };
19
- this.onMouseEnter = () => {
20
- if (!this.props.disableHover) {
21
- this.props.changeIndex(this.props.index);
22
- }
23
- };
24
- this.onMouseLeave = () => {
25
- if (!this.props.disableHover) {
26
- this.props.changeIndex(-1);
27
- }
28
- };
29
- }
30
- render() {
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
32
- className: (0, _classnames.default)('d-flex option', {
33
- 'option-active': this.props.isActive
34
- }),
35
- onClick: this.onSelectOption,
36
- onMouseEnter: this.onMouseEnter,
37
- onMouseLeave: this.onMouseLeave,
38
- children: this.props.children
39
- });
40
- }
41
- }
42
- var _default = exports.default = Option;
@@ -1,54 +0,0 @@
1
- .group-selector .option {
2
- display: block;
3
- width: 100%;
4
- line-height: 24px;
5
- padding: 6px 10px;
6
- clear: both;
7
- font-weight: 400;
8
- text-align: inherit;
9
- background-color: transparent;
10
- border: 0;
11
- overflow: hidden;
12
- text-overflow: ellipsis;
13
- white-space: nowrap;
14
- display: flex;
15
- align-items: center;
16
- justify-content: space-between;
17
- }
18
-
19
- .group-selector .option .dtable-icon-check-mark {
20
- font-size: 12px;
21
- color: #798d99;
22
- }
23
-
24
- .group-selector .option.option-active {
25
- background-color: #20a0ff;
26
- color: #fff;
27
- cursor: pointer;
28
- }
29
-
30
- .group-selector .option.option-active .dtable-icon-check-mark,
31
- .group-selector .option.option-active .select-option-name {
32
- color: #fff !important;
33
- }
34
-
35
- .group-selector .option .select-option-name .single-select-option {
36
- margin: 0 0 0 12px;
37
- }
38
-
39
- .group-selector .option .select-option-name .multiple-select-option {
40
- margin: 0;
41
- }
42
-
43
- .group-selector .option-group-dtable-ui-single-select-selector .select-option-name {
44
- display: flex;
45
- align-items: center;
46
- justify-content: space-between;
47
- }
48
-
49
- .group-selector .option-group-dtable-ui-single-select-selector .option:hover,
50
- .group-selector .option-group-dtable-ui-single-select-selector .option.option-active,
51
- .group-selector .option-group-dtable-ui-multiple-select-selector .option:hover,
52
- .group-selector .option-group-dtable-ui-multiple-select-selector .option.option-active {
53
- background-color: #f5f5f5;
54
- }