dtable-ui-component 6.0.48 → 6.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ActionSheet/index.js +94 -68
- package/lib/ActivityIndicator/index.js +36 -28
- package/lib/AsyncUserSelect/index.css +122 -0
- package/lib/AsyncUserSelect/index.js +260 -0
- package/lib/AsyncUserSelect/user-item.js +55 -0
- package/lib/AutoNumberFormatter/index.js +5 -3
- package/lib/Badge/index.js +12 -8
- package/lib/ButtonFormatter/index.js +15 -10
- package/lib/CTimeFormatter/index.js +5 -3
- package/lib/CheckboxEditor/index.js +22 -13
- package/lib/CheckboxEditor/mb-editor.js +7 -5
- package/lib/CheckboxEditor/pc-editor.js +7 -5
- package/lib/CheckboxFormatter/index.js +7 -5
- package/lib/CollaboratorEditor/index.js +24 -15
- package/lib/CollaboratorEditor/mb-editor/index.js +19 -13
- package/lib/CollaboratorEditor/pc-editor/index.js +50 -42
- package/lib/CollaboratorFormatter/index.js +8 -7
- package/lib/CollaboratorItem/index.js +21 -16
- package/lib/CollapsibleSettingLayout/index.css +0 -5
- package/lib/CollapsibleSettingLayout/index.js +17 -12
- package/lib/Comment/body/comment.js +78 -62
- package/lib/Comment/body/index.js +14 -11
- package/lib/Comment/footer/btns/index.js +68 -53
- package/lib/Comment/footer/index.js +29 -27
- package/lib/Comment/footer/input/index.js +44 -39
- package/lib/Comment/footer/input/participant/index.js +18 -13
- package/lib/Comment/footer/participants/index.js +31 -28
- package/lib/Comment/footer/participants/participant/index.js +18 -15
- package/lib/Comment/footer/participants/participant-select/index.js +66 -55
- package/lib/Comment/index.js +33 -28
- package/lib/CreatorFormatter/index.js +8 -7
- package/lib/DTableColorPicker/ColorPickerPortal/index.js +5 -3
- package/lib/DTableColorPicker/index.js +135 -99
- package/lib/DTableCommonAddTool/index.js +10 -7
- package/lib/DTableCustomFooter/index.js +5 -3
- package/lib/DTableCustomizeCollaboratorSelect/index.js +38 -32
- package/lib/DTableCustomizeSelect/index.js +51 -44
- package/lib/DTableEmptyTip/index.js +20 -16
- package/lib/DTableFiltersPopover/index.js +71 -61
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +74 -57
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +64 -49
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +49 -41
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +57 -47
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +35 -31
- package/lib/DTableFiltersPopover/widgets/filter-group.js +38 -32
- package/lib/DTableFiltersPopover/widgets/filter-item.js +125 -106
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +18 -17
- package/lib/DTableFiltersPopover/widgets/rate-item.js +12 -9
- package/lib/DTableGroupSelect/index.js +52 -44
- package/lib/DTableGroupSelect/option.js +5 -3
- package/lib/DTableGroupSelect/select-option-group.js +31 -25
- package/lib/DTableModalHeader/index.css +0 -1
- package/lib/DTableModalHeader/index.js +13 -9
- package/lib/DTablePopover/index.js +9 -6
- package/lib/DTableRadio/index.js +20 -17
- package/lib/DTableRadioGroup/index.js +21 -18
- package/lib/DTableSearchInput/index.js +22 -18
- package/lib/DTableSelect/dtable-select-label.js +12 -7
- package/lib/DTableSelect/index.js +2 -1
- package/lib/DTableSelect/utils.js +34 -20
- package/lib/DTableSwitch/index.js +25 -17
- package/lib/DateEditor/index.js +25 -16
- package/lib/DateEditor/mb-editor/index.js +90 -68
- package/lib/DateEditor/pc-editor.js +38 -34
- package/lib/DateFormatter/index.js +5 -3
- package/lib/DeleteTip/index.js +29 -20
- package/lib/DepartmentMultipleSelectEditor/index.js +57 -49
- package/lib/DepartmentSelectFilter/index.js +8 -1
- package/lib/DepartmentSingleSelectEditor/index.js +22 -13
- package/lib/DepartmentSingleSelectEditor/mb-editor/index.js +75 -55
- package/lib/DepartmentSingleSelectEditor/pc-editor/department-single-select.js +78 -61
- package/lib/DepartmentSingleSelectEditor/pc-editor/index.js +14 -11
- package/lib/DepartmentSingleSelectFormatter/index.js +13 -9
- package/lib/DigitalSignEditor/index.js +22 -13
- package/lib/DigitalSignEditor/mb-editor/index.js +39 -24
- package/lib/DigitalSignEditor/pc-editor/index.js +44 -30
- package/lib/DigitalSignEditor/signature-board/index.js +19 -15
- package/lib/DigitalSignFormatter/index.js +23 -19
- package/lib/Drawer/index.js +4 -1
- package/lib/DurationEditor/index.js +2 -1
- package/lib/DurationFormatter/index.js +5 -3
- package/lib/EditEditorButton/index.js +5 -3
- package/lib/EmailEditor/index.js +2 -1
- package/lib/EmailFormatter/index.js +5 -3
- package/lib/FieldDisplaySetting/field-item.js +25 -19
- package/lib/FieldDisplaySetting/index.css +6 -7
- package/lib/FieldDisplaySetting/index.js +47 -38
- package/lib/FileEditor/files-previewer/index.js +22 -13
- package/lib/FileEditor/files-previewer/mb-previewer/file-previewer/index.js +43 -28
- package/lib/FileEditor/files-previewer/mb-previewer/index.js +24 -21
- package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/dropdown-menu.js +30 -24
- package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/file-name-editor/index.js +13 -11
- package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/index.js +81 -63
- package/lib/FileEditor/files-previewer/pc-previewer/index.js +81 -65
- package/lib/FileEditor/index.js +22 -13
- package/lib/FileEditor/mb-editor/index.js +43 -31
- package/lib/FileEditor/pc-editor/addition-previewer/index.js +27 -20
- package/lib/FileEditor/pc-editor/addition-previewer/local-file-addition/index.js +107 -81
- package/lib/FileEditor/pc-editor/index.js +46 -36
- package/lib/FileFormatter/index.js +40 -36
- package/lib/FileItemFormatter/index.js +2 -1
- package/lib/FileUploader/index.js +22 -20
- package/lib/FormulaFormatter/index.js +21 -14
- package/lib/GeolocationEditor/index.js +28 -19
- package/lib/GeolocationEditor/mb-editor/country-editor.js +42 -27
- package/lib/GeolocationEditor/mb-editor/index.js +22 -14
- package/lib/GeolocationEditor/mb-editor/location-editor.js +54 -34
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +102 -74
- package/lib/GeolocationEditor/mb-editor/map-selection-editor/index.js +144 -110
- package/lib/GeolocationEditor/mb-editor/province-city-editor.js +42 -27
- package/lib/GeolocationEditor/mb-editor/province-editor.js +42 -27
- package/lib/GeolocationEditor/pc-editor/country-editor.js +37 -30
- package/lib/GeolocationEditor/pc-editor/index.js +26 -17
- package/lib/GeolocationEditor/pc-editor/location-editor.js +121 -95
- package/lib/GeolocationEditor/pc-editor/map-editor/index.js +100 -75
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.js +99 -76
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/index.js +119 -91
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/large-editor/index.js +102 -82
- package/lib/GeolocationEditor/pc-editor/province-city-editor.js +89 -69
- package/lib/GeolocationEditor/pc-editor/province-editor.js +30 -25
- package/lib/GeolocationEditor/pc-editor/selector-header-item.js +9 -5
- package/lib/GeolocationEditor/pc-editor/selector-list.js +15 -13
- package/lib/GeolocationFormatter/index.js +5 -3
- package/lib/HtmlLongTextFormatter/index.js +2 -1
- package/lib/Icon/index.js +8 -5
- package/lib/IconButton/index.js +9 -6
- package/lib/ImageEditor/images-previewer/image-preview/index.js +52 -44
- package/lib/ImageEditor/images-previewer/index.js +35 -32
- package/lib/ImageEditor/index.js +22 -13
- package/lib/ImageEditor/mb-editor/index.js +43 -31
- package/lib/ImageEditor/pc-editor/addition-previewer/image-link/index.js +19 -15
- package/lib/ImageEditor/pc-editor/addition-previewer/index.js +32 -24
- package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +101 -76
- package/lib/ImageEditor/pc-editor/images-previewer/index.js +33 -30
- package/lib/ImageEditor/pc-editor/index.js +44 -32
- package/lib/ImageFormatter/images-lazy-load.js +12 -10
- package/lib/ImageFormatter/index.js +40 -34
- package/lib/ImagePreviewerLightbox/index.js +12 -8
- package/lib/ImageThumbnail/index.js +46 -38
- package/lib/InputItem/custom-input.js +23 -18
- package/lib/InputItem/custom-keyboard.js +65 -44
- package/lib/InputItem/index.js +66 -56
- package/lib/InputItem/input.js +5 -3
- package/lib/LastModifierFormatter/index.js +8 -7
- package/lib/LinkEditor/index.js +38 -32
- package/lib/LinkEditor/link-editor-option.js +25 -20
- package/lib/LinkEditor/mb-popover/index.js +53 -41
- package/lib/LinkEditor/pc-popover/index.js +41 -33
- package/lib/LinkFormatter/index.js +13 -10
- package/lib/List/index.js +15 -9
- package/lib/List/list-item.js +32 -23
- package/lib/Loading/index.js +2 -1
- package/lib/LongTextFormatter/index.js +3 -2
- package/lib/MBEditorHeader/index.js +19 -14
- package/lib/MTimeFormatter/index.js +5 -3
- package/lib/MobileFullScreenPage/body/index.js +5 -3
- package/lib/MobileFullScreenPage/header/index.js +21 -16
- package/lib/MobileFullScreenPage/index.js +11 -8
- package/lib/MobileModal/index.js +6 -3
- package/lib/MobileOperationSheet/index.js +28 -18
- package/lib/MobileSelector/empty/index.js +5 -3
- package/lib/MobileSelector/index.js +18 -12
- package/lib/MobileSelector/option/index.js +17 -12
- package/lib/MobileSelector/options/index.js +5 -3
- package/lib/MobileSelector/search/index.js +10 -8
- package/lib/MobileUpload/index.js +87 -67
- package/lib/Modal/alert.js +8 -5
- package/lib/Modal/modal.js +19 -15
- package/lib/Modal/operation.js +2 -1
- package/lib/Modal/prompt.js +74 -54
- package/lib/MultipleSelectEditor/index.js +4 -2
- package/lib/MultipleSelectFormatter/index.js +8 -7
- package/lib/NotificationPopover/index.js +43 -32
- package/lib/NumberEditor/index.js +2 -1
- package/lib/NumberFormatter/index.js +5 -3
- package/lib/Picker/AbstractPicker.js +26 -22
- package/lib/Picker/index.js +2 -1
- package/lib/Popover/index.js +8 -5
- package/lib/Popover/item.js +22 -15
- package/lib/Progress/index.js +12 -10
- package/lib/Radio/Radio.js +11 -7
- package/lib/Radio/RadioItem.js +9 -3
- package/lib/RateFormatter/index.js +7 -6
- package/lib/RoleStatusEditor/index.js +36 -31
- package/lib/RowExpand/index.js +16 -9
- package/lib/RowExpandDialog/body/index.js +52 -41
- package/lib/RowExpandDialog/column-content/index.js +34 -25
- package/lib/RowExpandDialog/header/index.js +28 -21
- package/lib/RowExpandDialog/index.js +40 -27
- package/lib/RowExpandEditor/add-btn/index.js +16 -9
- package/lib/RowExpandEditor/add-btn/mb-add-btn/index.js +5 -3
- package/lib/RowExpandEditor/add-btn/pc-add-btn/index.js +8 -5
- package/lib/RowExpandEditor/checkbox-editor/index.js +16 -9
- package/lib/RowExpandEditor/checkbox-editor/mb-editor/index.js +10 -8
- package/lib/RowExpandEditor/checkbox-editor/pc-editor.js +2 -1
- package/lib/RowExpandEditor/collaborator-editor/index.js +16 -9
- package/lib/RowExpandEditor/collaborator-editor/mb-editor/index.js +19 -17
- package/lib/RowExpandEditor/collaborator-editor/pc-editor/index.js +52 -47
- package/lib/RowExpandEditor/date-editor/index.js +16 -9
- package/lib/RowExpandEditor/date-editor/mb-editor.js +20 -15
- package/lib/RowExpandEditor/date-editor/pc-editor.js +24 -21
- package/lib/RowExpandEditor/department-editor/index.js +16 -9
- package/lib/RowExpandEditor/department-editor/mb-editor.js +27 -22
- package/lib/RowExpandEditor/department-editor/pc-editor.js +35 -29
- package/lib/RowExpandEditor/digital-sign-editor/index.js +16 -9
- package/lib/RowExpandEditor/digital-sign-editor/mb-editor/index.js +19 -16
- package/lib/RowExpandEditor/digital-sign-editor/pc-editor/index.js +34 -32
- package/lib/RowExpandEditor/duration-editor/index.js +16 -9
- package/lib/RowExpandEditor/duration-editor/mb-editor.js +15 -12
- package/lib/RowExpandEditor/duration-editor/pc-editor.js +17 -13
- package/lib/RowExpandEditor/email-editor/index.js +16 -9
- package/lib/RowExpandEditor/email-editor/mb-editor/index.js +19 -17
- package/lib/RowExpandEditor/email-editor/pc-editor/index.js +20 -18
- package/lib/RowExpandEditor/file-editor/index.js +16 -9
- package/lib/RowExpandEditor/file-editor/mb-editor/index.js +21 -16
- package/lib/RowExpandEditor/file-editor/pc-editor/index.js +22 -20
- package/lib/RowExpandEditor/geolocation-editor/index.js +16 -9
- package/lib/RowExpandEditor/geolocation-editor/mb-editor/index.js +12 -9
- package/lib/RowExpandEditor/geolocation-editor/pc-editor/index.js +20 -17
- package/lib/RowExpandEditor/image-editor/index.js +16 -9
- package/lib/RowExpandEditor/image-editor/mb-editor/index.js +21 -16
- package/lib/RowExpandEditor/image-editor/pc-editor/index.js +29 -25
- package/lib/RowExpandEditor/index.js +4 -2
- package/lib/RowExpandEditor/long-text-editor/index.js +16 -9
- package/lib/RowExpandEditor/long-text-editor/mb-editor/editor/index.js +27 -16
- package/lib/RowExpandEditor/long-text-editor/mb-editor/index.js +19 -16
- package/lib/RowExpandEditor/long-text-editor/pc-editor/index.js +22 -18
- package/lib/RowExpandEditor/multiple-select-editor/index.js +16 -9
- package/lib/RowExpandEditor/multiple-select-editor/mb-editor/index.js +26 -23
- package/lib/RowExpandEditor/multiple-select-editor/pc-editor/index.js +81 -67
- package/lib/RowExpandEditor/number-editor/index.js +16 -9
- package/lib/RowExpandEditor/number-editor/mb-editor/index.js +10 -7
- package/lib/RowExpandEditor/number-editor/pc-editor.js +6 -4
- package/lib/RowExpandEditor/rate-editor/index.js +16 -9
- package/lib/RowExpandEditor/rate-editor/mb-editor.js +10 -8
- package/lib/RowExpandEditor/rate-editor/pc-editor.js +11 -9
- package/lib/RowExpandEditor/right-angle/index.js +8 -6
- package/lib/RowExpandEditor/single-select-editor/index.js +16 -9
- package/lib/RowExpandEditor/single-select-editor/mb-editor/index.js +30 -23
- package/lib/RowExpandEditor/single-select-editor/pc-editor/index.js +42 -34
- package/lib/RowExpandEditor/text-editor/index.js +16 -9
- package/lib/RowExpandEditor/text-editor/mb-editor/index.js +11 -9
- package/lib/RowExpandEditor/text-editor/pc-editor/index.js +16 -12
- package/lib/RowExpandEditor/url-editor/index.js +16 -9
- package/lib/RowExpandEditor/url-editor/mb-editor/index.js +19 -17
- package/lib/RowExpandEditor/url-editor/pc-editor/index.js +20 -18
- package/lib/RowExpandFormatter/department-formatter/index.js +14 -5
- package/lib/RowExpandFormatter/department-formatter/mb-formatter.js +2 -1
- package/lib/RowExpandFormatter/department-formatter/pc-formatter.js +15 -11
- package/lib/RowExpandFormatter/email-formatter/index.js +11 -8
- package/lib/RowExpandFormatter/file-formatter/index.js +15 -14
- package/lib/RowExpandFormatter/file-formatter/row-expand-file-item-formatter.js +43 -36
- package/lib/RowExpandFormatter/formula-formatter/index.js +51 -32
- package/lib/RowExpandFormatter/image-formatter/index.js +30 -27
- package/lib/RowExpandFormatter/image-formatter/row-expand-image-item-formatter.js +47 -39
- package/lib/RowExpandFormatter/index.js +133 -115
- package/lib/RowExpandFormatter/link-formatter/collaborator-item-formatter.js +2 -1
- package/lib/RowExpandFormatter/link-formatter/index.js +70 -67
- package/lib/RowExpandFormatter/rate-formatter/index.js +7 -6
- package/lib/RowExpandFormatter/url-formatter/index.js +11 -8
- package/lib/RowExpandView/body/index.js +38 -32
- package/lib/RowExpandView/column-content/index.js +10 -5
- package/lib/RowExpandView/index.js +27 -16
- package/lib/SelectItem/index.js +16 -12
- package/lib/SelectOptionGroup/index.js +39 -32
- package/lib/SelectOptionGroup/option.js +5 -3
- package/lib/SelectedDepartments/index.js +54 -44
- package/lib/SimpleLongTextFormatter/index.js +39 -30
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +11 -8
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +3 -2
- package/lib/SingleSelectEditor/index.js +4 -2
- package/lib/SingleSelectFormatter/index.js +6 -4
- package/lib/SvgIcon/index.js +4 -1
- package/lib/TabBar/Tab.js +27 -20
- package/lib/TabBar/index.js +25 -21
- package/lib/Tabs/index.js +8 -5
- package/lib/TextEditor/index.js +21 -18
- package/lib/TextFormatter/index.js +5 -3
- package/lib/TextareaItem/index.js +35 -26
- package/lib/Toast/index.js +16 -10
- package/lib/UploadProgress/index.js +2 -1
- package/lib/UrlEditor/index.js +2 -1
- package/lib/UrlFormatter/index.js +5 -3
- package/lib/formatterConfig/base-formatter-config.js +25 -22
- package/lib/formatterConfig/index.js +3 -2
- package/lib/index.js +7 -0
- package/lib/locales/de.json +5 -1
- package/lib/locales/en.json +5 -1
- package/lib/locales/es.json +6 -2
- package/lib/locales/fr.json +5 -1
- package/lib/locales/pt.json +5 -1
- package/lib/locales/ru.json +5 -1
- package/lib/locales/zh-CN.json +5 -1
- package/lib/select-editor/index.js +22 -13
- package/lib/select-editor/mb-editor/index.js +22 -16
- package/lib/select-editor/pc-editor/index.js +74 -60
- package/lib/toaster/alert.js +25 -16
- package/lib/toaster/toast.js +27 -23
- package/lib/toaster/toastManager.js +16 -13
- package/lib/toaster/toaster.js +2 -1
- package/package.json +2 -2
package/lib/ActionSheet/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var _rmcFeedback = _interopRequireDefault(require("rmc-feedback"));
|
|
|
14
14
|
var _getDataAttr = _interopRequireDefault(require("../utils/getDataAttr"));
|
|
15
15
|
var _Badge = _interopRequireDefault(require("../Badge"));
|
|
16
16
|
require("./style/index.css");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
/* tslint:disable:jsx-no-multiline-js */
|
|
18
19
|
|
|
19
20
|
const NORMAL = 'NORMAL';
|
|
@@ -70,13 +71,13 @@ function createActionSheet(flag, config, callback) {
|
|
|
70
71
|
cancelButtonText,
|
|
71
72
|
badges = []
|
|
72
73
|
} = props;
|
|
73
|
-
const titleMsg = [title ? /*#__PURE__*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
74
|
+
const titleMsg = [title ? /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
75
|
+
className: "".concat(prefixCls, "-title"),
|
|
76
|
+
children: title
|
|
77
|
+
}, "0") : null, message ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
78
|
+
className: "".concat(prefixCls, "-message"),
|
|
79
|
+
children: message
|
|
80
|
+
}, "1") : null];
|
|
80
81
|
let children = null;
|
|
81
82
|
let mode = 'normal';
|
|
82
83
|
switch (flag) {
|
|
@@ -87,82 +88,106 @@ function createActionSheet(flag, config, callback) {
|
|
|
87
88
|
if (badges && badges.length > 0) {
|
|
88
89
|
badges.forEach(element => {
|
|
89
90
|
if (element.index >= 0) {
|
|
90
|
-
badgesMap[element.index] = /*#__PURE__*/
|
|
91
|
+
badgesMap[element.index] = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.default, {
|
|
92
|
+
...element
|
|
93
|
+
});
|
|
91
94
|
}
|
|
92
95
|
});
|
|
93
96
|
}
|
|
94
|
-
children = /*#__PURE__*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
97
|
+
children = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
98
|
+
...(0, _getDataAttr.default)(props),
|
|
99
|
+
children: [titleMsg, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
100
|
+
className: "".concat(prefixCls, "-button-list"),
|
|
101
|
+
role: "group",
|
|
102
|
+
children: normalOptions.map((item, index) => {
|
|
103
|
+
const itemProps = {
|
|
104
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-button-list-item"), {
|
|
105
|
+
["".concat(prefixCls, "-destructive-button")]: destructiveButtonIndex === index,
|
|
106
|
+
["".concat(prefixCls, "-cancel-button")]: cancelButtonIndex === index
|
|
107
|
+
}),
|
|
108
|
+
onClick: () => cb(index),
|
|
109
|
+
role: 'button'
|
|
110
|
+
};
|
|
111
|
+
let bContent = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
112
|
+
...itemProps,
|
|
113
|
+
children: item
|
|
114
|
+
});
|
|
115
|
+
// 仅在设置徽标的情况下修改dom结构
|
|
116
|
+
if (badgesMap[index]) {
|
|
117
|
+
bContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
118
|
+
...itemProps,
|
|
119
|
+
className: "".concat(itemProps.className, " ").concat(prefixCls, "-button-list-badge"),
|
|
120
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
121
|
+
className: "".concat(prefixCls, "-button-list-item-content"),
|
|
122
|
+
children: item
|
|
123
|
+
}), badgesMap[index]]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
let bItem = /*#__PURE__*/(0, _jsxRuntime.jsx)(_rmcFeedback.default, {
|
|
127
|
+
activeClassName: "".concat(prefixCls, "-button-list-item-active"),
|
|
128
|
+
children: bContent
|
|
129
|
+
}, index);
|
|
130
|
+
if (cancelButtonIndex === index || destructiveButtonIndex === index) {
|
|
131
|
+
bItem = /*#__PURE__*/(0, _jsxRuntime.jsx)(_rmcFeedback.default, {
|
|
132
|
+
activeClassName: "".concat(prefixCls, "-button-list-item-active"),
|
|
133
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
134
|
+
...itemProps,
|
|
135
|
+
children: [item, cancelButtonIndex === index ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
136
|
+
className: "".concat(prefixCls, "-cancel-button-mask")
|
|
137
|
+
}) : null]
|
|
138
|
+
})
|
|
139
|
+
}, index);
|
|
140
|
+
}
|
|
141
|
+
return bItem;
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
144
|
+
});
|
|
129
145
|
break;
|
|
130
146
|
case SHARE:
|
|
131
147
|
mode = 'share';
|
|
132
148
|
const multipleLine = options.length && Array.isArray(options[0]) || false;
|
|
133
149
|
const createList = function (item, index) {
|
|
134
150
|
let rowIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
135
|
-
return /*#__PURE__*/
|
|
151
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
136
152
|
className: "".concat(prefixCls, "-share-list-item"),
|
|
137
153
|
role: "button",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
154
|
+
onClick: () => cb(index, rowIndex),
|
|
155
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
156
|
+
className: "".concat(prefixCls, "-share-list-item-icon"),
|
|
157
|
+
children: item.icon
|
|
158
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
159
|
+
className: "".concat(prefixCls, "-share-list-item-title"),
|
|
160
|
+
children: item.title
|
|
161
|
+
})]
|
|
162
|
+
}, index);
|
|
145
163
|
};
|
|
146
|
-
children = /*#__PURE__*/
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
164
|
+
children = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
165
|
+
...(0, _getDataAttr.default)(props),
|
|
166
|
+
children: [titleMsg, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
167
|
+
className: "".concat(prefixCls, "-share"),
|
|
168
|
+
children: [multipleLine ? options.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
169
|
+
className: "".concat(prefixCls, "-share-list"),
|
|
170
|
+
children: item.map((ii, ind) => createList(ii, ind, index))
|
|
171
|
+
}, index)) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
172
|
+
className: "".concat(prefixCls, "-share-list"),
|
|
173
|
+
children: options.map((item, index) => createList(item, index))
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_rmcFeedback.default, {
|
|
175
|
+
activeClassName: "".concat(prefixCls, "-share-cancel-button-active"),
|
|
176
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
177
|
+
className: "".concat(prefixCls, "-share-cancel-button"),
|
|
178
|
+
role: "button",
|
|
179
|
+
onClick: () => cb(-1),
|
|
180
|
+
children: cancelButtonText
|
|
181
|
+
})
|
|
182
|
+
})]
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
160
185
|
break;
|
|
161
186
|
default:
|
|
162
187
|
break;
|
|
163
188
|
}
|
|
164
189
|
const rootCls = (0, _classnames.default)("".concat(prefixCls, "-").concat(mode), className);
|
|
165
|
-
root.render( /*#__PURE__*/
|
|
190
|
+
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_rmcDialog.default, {
|
|
166
191
|
visible: true,
|
|
167
192
|
title: "",
|
|
168
193
|
footer: "",
|
|
@@ -172,8 +197,9 @@ function createActionSheet(flag, config, callback) {
|
|
|
172
197
|
maskTransitionName: maskTransitionName || 'am-fade',
|
|
173
198
|
onClose: () => cb(cancelButtonIndex || -1),
|
|
174
199
|
maskClosable: maskClosable,
|
|
175
|
-
wrapProps: props.wrapProps || {}
|
|
176
|
-
|
|
200
|
+
wrapProps: props.wrapProps || {},
|
|
201
|
+
children: children
|
|
202
|
+
}));
|
|
177
203
|
return {
|
|
178
204
|
close
|
|
179
205
|
};
|
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
require("./index.css");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
/* tslint:disable:jsx-no-multiline-js */
|
|
13
14
|
|
|
14
15
|
class ActivityIndicator extends React.Component {
|
|
@@ -31,35 +32,42 @@ class ActivityIndicator extends React.Component {
|
|
|
31
32
|
});
|
|
32
33
|
if (animating) {
|
|
33
34
|
if (toast) {
|
|
34
|
-
return /*#__PURE__*/
|
|
35
|
-
className: wrapClass
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
36
|
+
className: wrapClass,
|
|
37
|
+
children: text ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
38
|
+
className: "".concat(prefixCls, "-content"),
|
|
39
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
40
|
+
className: spinnerClass,
|
|
41
|
+
"aria-hidden": "true"
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
43
|
+
className: "".concat(prefixCls, "-toast"),
|
|
44
|
+
children: text
|
|
45
|
+
})]
|
|
46
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
47
|
+
className: "".concat(prefixCls, "-content"),
|
|
48
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
49
|
+
className: spinnerClass,
|
|
50
|
+
"aria-label": "Loading"
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
});
|
|
49
54
|
} else {
|
|
50
|
-
return text ? /*#__PURE__*/
|
|
51
|
-
className: wrapClass
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
className:
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
return text ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
56
|
+
className: wrapClass,
|
|
57
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
58
|
+
className: spinnerClass,
|
|
59
|
+
"aria-hidden": "true"
|
|
60
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
61
|
+
className: "".concat(prefixCls, "-tip"),
|
|
62
|
+
children: text
|
|
63
|
+
})]
|
|
64
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
|
+
className: wrapClass,
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
67
|
+
className: spinnerClass,
|
|
68
|
+
"aria-label": "loading"
|
|
69
|
+
})
|
|
70
|
+
});
|
|
63
71
|
}
|
|
64
72
|
} else {
|
|
65
73
|
return null;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
.dtable-ui-selected-users-container {
|
|
2
|
+
flex-wrap: wrap;
|
|
3
|
+
height: auto !important;
|
|
4
|
+
min-height: 38px;
|
|
5
|
+
max-width: calc(100% - 10px);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dtable-ui-selected-users-container .dtable-ui-user-select-placeholder {
|
|
9
|
+
color: #808080;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dtable-ui-user-select-popover .popover {
|
|
13
|
+
width: 385px;
|
|
14
|
+
max-width: 385px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dtable-ui-user-select-container {
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dtable-ui-user-select-container .dtable-ui-user-search-container {
|
|
22
|
+
padding: 10px 10px 0 10px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dtable-ui-user-select-container .dtable-ui-user-search-container input {
|
|
26
|
+
height: 28px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dtable-ui-user-select-container .dtable-ui-user-list-container {
|
|
30
|
+
min-height: 160px;
|
|
31
|
+
max-height: 200px;
|
|
32
|
+
margin: 10px 0;
|
|
33
|
+
overflow: auto;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
height: 30px;
|
|
41
|
+
padding: 0 10px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container:hover,
|
|
47
|
+
.dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container-highlight {
|
|
48
|
+
background: #f5f5f5;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.no-user-search-result {
|
|
53
|
+
color: #666666;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
padding-left: 10px;
|
|
56
|
+
padding: 10px;
|
|
57
|
+
overflow: auto;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dtable-ui-user-select-popover .popover .dtable-ui-user-item {
|
|
61
|
+
background: transparent;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dtable-ui-user-list-container .dtable-ui-collaborator-check-icon .dtable-icon-check-mark {
|
|
65
|
+
color: #798d99;
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* user-item */
|
|
70
|
+
.dtable-ui-user-item {
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
margin: 2px 10px 2px 0;
|
|
74
|
+
padding: 0 8px 0 2px;
|
|
75
|
+
height: 20px;
|
|
76
|
+
font-size: 13px;
|
|
77
|
+
border-radius: 10px;
|
|
78
|
+
background: #eaeaea;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dtable-ui-user-item .user-item .user-avatar img {
|
|
83
|
+
width: 16px;
|
|
84
|
+
height: 16px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.dtable-ui-user-item .user-avatar {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
transform: translateY(0);
|
|
92
|
+
flex-shrink: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dtable-ui-user-item .user-name {
|
|
96
|
+
margin-left: 5px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dtable-ui-user-item .user-avatar img {
|
|
100
|
+
width: 16px;
|
|
101
|
+
height: 16px;
|
|
102
|
+
border-radius: 50%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.dtable-ui-user-item .user-remove {
|
|
106
|
+
display: inline-block;
|
|
107
|
+
width: 14px;
|
|
108
|
+
margin: 0 -2px 0 2px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dtable-ui-user-item .user-remove .dtable-font {
|
|
112
|
+
display: inline-block;
|
|
113
|
+
font-size: 16px;
|
|
114
|
+
color: #909090;
|
|
115
|
+
transform: scale(.8);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.dtable-ui-user-item .user-remove .dtable-font:hover {
|
|
120
|
+
color: #666666;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
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 = require("react");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
12
|
+
var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
|
|
13
|
+
var _userItem = _interopRequireDefault(require("./user-item"));
|
|
14
|
+
var _lang = require("../lang");
|
|
15
|
+
var _keyCodes = _interopRequireDefault(require("../constants/key-codes"));
|
|
16
|
+
require("./index.css");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const AsyncUserSelect = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
className,
|
|
21
|
+
emptyPlaceholder = '',
|
|
22
|
+
searchPlaceholder = '',
|
|
23
|
+
isMulti = true,
|
|
24
|
+
enableShowIDInOrgWhenSearchUser = false,
|
|
25
|
+
selectedUsers = [],
|
|
26
|
+
loadOptions,
|
|
27
|
+
modifySelectedUsers
|
|
28
|
+
} = _ref;
|
|
29
|
+
const [isPopoverOpen, setIsPopoverOpen] = (0, _react.useState)(false);
|
|
30
|
+
const [searchValue, setSearchValue] = (0, _react.useState)('');
|
|
31
|
+
const [searchedUsers, setSearchedUsers] = (0, _react.useState)([]);
|
|
32
|
+
const [highlightIndex, setHighlightIndex] = (0, _react.useState)(-1);
|
|
33
|
+
const [maxItemNum, setMaxItemNum] = (0, _react.useState)(0);
|
|
34
|
+
const [itemHeight, setItemHeight] = (0, _react.useState)(0);
|
|
35
|
+
const selectorRef = (0, _react.useRef)(null);
|
|
36
|
+
const userSelectContainerRef = (0, _react.useRef)(null);
|
|
37
|
+
const userListContainerRef = (0, _react.useRef)(null);
|
|
38
|
+
const userItemContainerRef = (0, _react.useRef)(null);
|
|
39
|
+
const clearStatus = (0, _react.useCallback)(() => {
|
|
40
|
+
setSearchedUsers([]);
|
|
41
|
+
setSearchValue('');
|
|
42
|
+
setHighlightIndex(-1);
|
|
43
|
+
}, []);
|
|
44
|
+
const onClickOutside = (0, _react.useCallback)(e => {
|
|
45
|
+
if (isPopoverOpen && (!selectorRef.current || !selectorRef.current.contains(e.target))) {
|
|
46
|
+
setIsPopoverOpen(false);
|
|
47
|
+
clearStatus();
|
|
48
|
+
}
|
|
49
|
+
}, [isPopoverOpen, clearStatus]);
|
|
50
|
+
const searchUsers = (0, _react.useCallback)(function () {
|
|
51
|
+
let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
52
|
+
const trimmedSearchValue = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim()) || '';
|
|
53
|
+
if (!trimmedSearchValue) {
|
|
54
|
+
setSearchedUsers([]);
|
|
55
|
+
setHighlightIndex(-1);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
loadOptions && loadOptions(searchValue, function () {
|
|
59
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
60
|
+
// [{ email, name, avatar_url }, ...]
|
|
61
|
+
setSearchedUsers(options);
|
|
62
|
+
setHighlightIndex(options.length > 0 ? 0 : -1);
|
|
63
|
+
});
|
|
64
|
+
}, [loadOptions]);
|
|
65
|
+
const onSearchValueChanged = (0, _react.useCallback)(newSearchValue => {
|
|
66
|
+
setSearchValue(newSearchValue);
|
|
67
|
+
searchUsers(newSearchValue);
|
|
68
|
+
}, [searchUsers]);
|
|
69
|
+
const onTogglePopover = (0, _react.useCallback)(() => {
|
|
70
|
+
const isOpen = !isPopoverOpen;
|
|
71
|
+
setIsPopoverOpen(isOpen);
|
|
72
|
+
if (!isOpen) {
|
|
73
|
+
clearStatus();
|
|
74
|
+
} else {
|
|
75
|
+
searchUsers('');
|
|
76
|
+
}
|
|
77
|
+
}, [isPopoverOpen, clearStatus, searchUsers]);
|
|
78
|
+
const deselectUser = (0, _react.useCallback)(user => {
|
|
79
|
+
const newSelectedUsers = selectedUsers.filter(item => item.email !== user.email);
|
|
80
|
+
modifySelectedUsers(newSelectedUsers);
|
|
81
|
+
}, [selectedUsers, modifySelectedUsers]);
|
|
82
|
+
const onKeyDown = (0, _react.useCallback)(e => {
|
|
83
|
+
if (e.keyCode === _keyCodes.default.LeftArrow || e.keyCode === _keyCodes.default.RightArrow) {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
87
|
+
const selectUser = (0, _react.useCallback)(user => {
|
|
88
|
+
const index = selectedUsers.findIndex(item => item.email === user.email);
|
|
89
|
+
let newSelectedUsers = selectedUsers.slice(0);
|
|
90
|
+
if (isMulti) {
|
|
91
|
+
if (index > -1) {
|
|
92
|
+
newSelectedUsers.splice(index, 1);
|
|
93
|
+
} else {
|
|
94
|
+
newSelectedUsers.push(user);
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
if (index > -1) {
|
|
98
|
+
newSelectedUsers = [];
|
|
99
|
+
} else {
|
|
100
|
+
newSelectedUsers = [user];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
modifySelectedUsers(newSelectedUsers);
|
|
104
|
+
}, [selectedUsers, isMulti, modifySelectedUsers]);
|
|
105
|
+
const onUserClick = (0, _react.useCallback)(user => {
|
|
106
|
+
selectUser(user);
|
|
107
|
+
}, [selectUser]);
|
|
108
|
+
const onEnter = (0, _react.useCallback)(e => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
let user;
|
|
111
|
+
if (searchedUsers.length === 1) {
|
|
112
|
+
user = searchedUsers[0];
|
|
113
|
+
} else if (highlightIndex > -1) {
|
|
114
|
+
user = searchedUsers[highlightIndex];
|
|
115
|
+
}
|
|
116
|
+
if (user) {
|
|
117
|
+
selectUser(user);
|
|
118
|
+
}
|
|
119
|
+
}, [highlightIndex, searchedUsers, selectUser]);
|
|
120
|
+
const onUpArrow = (0, _react.useCallback)(e => {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
if (highlightIndex > 0) {
|
|
124
|
+
const newHighlightIndex = highlightIndex - 1;
|
|
125
|
+
setHighlightIndex(newHighlightIndex);
|
|
126
|
+
if (newHighlightIndex < searchedUsers.length - maxItemNum) {
|
|
127
|
+
userListContainerRef.current.scrollTop -= itemHeight;
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
const newHighlightIndex = searchedUsers.length - 1;
|
|
131
|
+
setHighlightIndex(newHighlightIndex);
|
|
132
|
+
userListContainerRef.current.scrollTop = userListContainerRef.current.scrollHeight;
|
|
133
|
+
}
|
|
134
|
+
}, [highlightIndex, maxItemNum, itemHeight, searchedUsers]);
|
|
135
|
+
const onDownArrow = (0, _react.useCallback)(e => {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
e.stopPropagation();
|
|
138
|
+
if (highlightIndex < searchedUsers.length - 1) {
|
|
139
|
+
const newHighlightIndex = highlightIndex + 1;
|
|
140
|
+
setHighlightIndex(newHighlightIndex);
|
|
141
|
+
if (newHighlightIndex >= maxItemNum) {
|
|
142
|
+
userListContainerRef.current.scrollTop += itemHeight;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
setHighlightIndex(0);
|
|
146
|
+
userListContainerRef.current.scrollTop = 0;
|
|
147
|
+
}
|
|
148
|
+
}, [highlightIndex, maxItemNum, itemHeight, searchedUsers]);
|
|
149
|
+
const onEsc = (0, _react.useCallback)(e => {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
e.stopPropagation();
|
|
152
|
+
setIsPopoverOpen(false);
|
|
153
|
+
clearStatus();
|
|
154
|
+
}, [clearStatus]);
|
|
155
|
+
const onHotKey = (0, _react.useCallback)(e => {
|
|
156
|
+
if (e.keyCode === _keyCodes.default.Enter) {
|
|
157
|
+
onEnter(e);
|
|
158
|
+
} else if (e.keyCode === _keyCodes.default.UpArrow) {
|
|
159
|
+
onUpArrow(e);
|
|
160
|
+
} else if (e.keyCode === _keyCodes.default.DownArrow) {
|
|
161
|
+
onDownArrow(e);
|
|
162
|
+
} else if (e.keyCode === _keyCodes.default.Escape) {
|
|
163
|
+
onEsc(e);
|
|
164
|
+
}
|
|
165
|
+
}, [onEnter, onUpArrow, onDownArrow, onEsc]);
|
|
166
|
+
(0, _react.useEffect)(() => {
|
|
167
|
+
if (userSelectContainerRef.current) {
|
|
168
|
+
const {
|
|
169
|
+
bottom
|
|
170
|
+
} = userSelectContainerRef.current.getBoundingClientRect();
|
|
171
|
+
if (bottom > window.innerHeight) {
|
|
172
|
+
userSelectContainerRef.current.style.top = "".concat(window.innerHeight - bottom, "px");
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (userListContainerRef.current && userItemContainerRef.current) {
|
|
176
|
+
const userContainerStyle = getComputedStyle(userListContainerRef.current, null);
|
|
177
|
+
const userItemStyle = getComputedStyle(userItemContainerRef.current, null);
|
|
178
|
+
const userItemHeight = parseInt(userItemStyle.height);
|
|
179
|
+
const maxContainerItemNum = Math.floor(parseInt(userContainerStyle.maxHeight) / userItemHeight);
|
|
180
|
+
setMaxItemNum(maxContainerItemNum);
|
|
181
|
+
setItemHeight(userItemHeight);
|
|
182
|
+
}
|
|
183
|
+
}, []);
|
|
184
|
+
(0, _react.useEffect)(() => {
|
|
185
|
+
document.addEventListener('keydown', onHotKey, true);
|
|
186
|
+
return () => {
|
|
187
|
+
document.removeEventListener('keydown', onHotKey, true);
|
|
188
|
+
};
|
|
189
|
+
}, [onHotKey]);
|
|
190
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
191
|
+
onClickOutside: onClickOutside,
|
|
192
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
193
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
194
|
+
className: (0, _classnames.default)('dtable-ui-selected-users-container form-control d-flex align-items-center', className, {
|
|
195
|
+
'focus': isPopoverOpen
|
|
196
|
+
}),
|
|
197
|
+
onClick: onTogglePopover,
|
|
198
|
+
ref: selectorRef,
|
|
199
|
+
children: [selectedUsers.map((user, index) => {
|
|
200
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
201
|
+
user: user,
|
|
202
|
+
deleteUser: deselectUser
|
|
203
|
+
}, "dtable-ui-user-selector-selected-user-".concat(index));
|
|
204
|
+
}), selectedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
205
|
+
className: "dtable-ui-user-select-placeholder",
|
|
206
|
+
children: emptyPlaceholder || (0, _lang.getLocale)('Search_users')
|
|
207
|
+
})]
|
|
208
|
+
}), selectorRef.current && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Popover, {
|
|
209
|
+
placement: "bottom-start",
|
|
210
|
+
isOpen: isPopoverOpen,
|
|
211
|
+
target: selectorRef.current,
|
|
212
|
+
hideArrow: true,
|
|
213
|
+
fade: false,
|
|
214
|
+
className: "dtable-ui-user-select-popover",
|
|
215
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
216
|
+
className: "dtable-ui-user-select-container",
|
|
217
|
+
ref: userSelectContainerRef,
|
|
218
|
+
onMouseDown: e => e.stopPropagation(),
|
|
219
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
220
|
+
className: "dtable-ui-user-search-container",
|
|
221
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableSearchInput.default, {
|
|
222
|
+
autoFocus: true,
|
|
223
|
+
placeholder: searchPlaceholder || (0, _lang.getLocale)('Search_users'),
|
|
224
|
+
value: searchValue,
|
|
225
|
+
wait: 200,
|
|
226
|
+
onChange: onSearchValueChanged,
|
|
227
|
+
onKeyDown: onKeyDown
|
|
228
|
+
})
|
|
229
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
230
|
+
className: "dtable-ui-user-list-container",
|
|
231
|
+
ref: userListContainerRef,
|
|
232
|
+
children: [searchedUsers.length > 0 && searchedUsers.map((user, index) => {
|
|
233
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
234
|
+
className: (0, _classnames.default)('dtable-ui-user-item-container', {
|
|
235
|
+
'dtable-ui-user-item-container-highlight': index === highlightIndex
|
|
236
|
+
}),
|
|
237
|
+
ref: userItemContainerRef,
|
|
238
|
+
onClick: () => onUserClick(user),
|
|
239
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
240
|
+
user: user,
|
|
241
|
+
enableShowIDInOrgWhenSearchUser: enableShowIDInOrgWhenSearchUser
|
|
242
|
+
}, "dtable-ui-user-selector-searched-user-".concat(index)), selectedUsers.find(u => u.email === user.email) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
243
|
+
className: "dtable-ui-collaborator-check-icon",
|
|
244
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
245
|
+
className: "dtable-font dtable-icon-check-mark",
|
|
246
|
+
"aria-hidden": "true"
|
|
247
|
+
})
|
|
248
|
+
})]
|
|
249
|
+
}, user.email);
|
|
250
|
+
}), searchedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
251
|
+
className: "no-user-search-result",
|
|
252
|
+
children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
|
|
253
|
+
})]
|
|
254
|
+
})]
|
|
255
|
+
})
|
|
256
|
+
})]
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
var _default = exports.default = AsyncUserSelect;
|