dtable-ui-component 6.0.126-beta.s1 → 6.0.126
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 +14 -16
- package/lib/ActivityIndicator/index.js +7 -8
- package/lib/AsyncUserSelect/index.css +19 -46
- package/lib/AsyncUserSelect/index.js +58 -41
- package/lib/AsyncUserSelect/user-item.js +5 -6
- package/lib/AutoNumberFormatter/index.js +3 -4
- package/lib/Badge/index.js +9 -11
- package/lib/ButtonFormatter/index.js +6 -8
- package/lib/CTimeFormatter/index.js +3 -4
- package/lib/CheckboxEditor/index.js +1 -3
- package/lib/CheckboxEditor/mb-editor.js +9 -20
- package/lib/CheckboxEditor/pc-editor.js +12 -24
- package/lib/CheckboxFormatter/index.js +4 -5
- package/lib/CollaboratorEditor/index.js +2 -4
- package/lib/CollaboratorEditor/mb-editor/index.js +11 -19
- package/lib/CollaboratorEditor/pc-editor/index.js +25 -34
- package/lib/CollaboratorFormatter/index.js +8 -10
- package/lib/CollaboratorItem/index.js +4 -5
- package/lib/CollapsibleSettingLayout/index.js +9 -7
- package/lib/Comment/body/comment.js +10 -18
- package/lib/Comment/body/index.js +2 -4
- package/lib/Comment/footer/btns/index.js +4 -7
- package/lib/Comment/footer/index.js +9 -20
- package/lib/Comment/footer/input/index.js +29 -50
- package/lib/Comment/footer/input/participant/index.js +4 -5
- package/lib/Comment/footer/participants/index.js +4 -5
- package/lib/Comment/footer/participants/participant/index.js +1 -3
- package/lib/Comment/footer/participants/participant-select/index.js +8 -24
- package/lib/Comment/index.js +39 -57
- package/lib/Comment/utils/utilities.js +15 -21
- package/lib/CreatorFormatter/index.js +6 -8
- package/lib/DTableColorPicker/ColorPickerPortal/index.js +23 -19
- package/lib/DTableColorPicker/index.css +0 -2
- package/lib/DTableColorPicker/index.js +56 -41
- package/lib/DTableColorPicker/utils.js +4 -6
- package/lib/DTableColumnIcon/index.js +6 -7
- package/lib/DTableCommonAddTool/index.css +1 -3
- package/lib/DTableCommonAddTool/index.js +6 -8
- package/lib/DTableCustomFooter/index.css +1 -3
- package/lib/DTableCustomFooter/index.js +1 -3
- package/lib/DTableCustomizeCollaboratorSelect/index.js +17 -20
- package/lib/DTableCustomizeSelect/index.css +43 -67
- package/lib/DTableCustomizeSelect/index.js +29 -40
- package/lib/DTableDropdownItem/index.js +16 -18
- package/lib/DTableDropdownMenu/index.js +8 -10
- package/lib/DTableEmptyTip/index.js +4 -5
- package/lib/DTableFiltersPopover/index.css +0 -2
- package/lib/DTableFiltersPopover/index.js +26 -41
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +3 -5
- package/lib/DTableFiltersPopover/utils/index.js +63 -113
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +9 -10
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +16 -13
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +18 -15
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +8 -14
- package/lib/DTableFiltersPopover/widgets/filter-group.js +34 -55
- package/lib/DTableFiltersPopover/widgets/filter-item.js +107 -170
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +5 -5
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +136 -161
- package/lib/DTableFiltersPopover/widgets/rate-item.js +15 -20
- package/lib/DTableGroupSelect/index.css +5 -31
- package/lib/DTableGroupSelect/index.js +13 -17
- package/lib/DTableGroupSelect/select-option-group.css +15 -11
- package/lib/DTableGroupSelect/select-option-group.js +31 -43
- package/lib/DTableIcon/index.js +6 -7
- package/lib/DTableIcon/svg-icon.js +5 -7
- package/lib/DTableModalHeader/index.js +1 -3
- package/lib/DTablePopover/index.js +13 -16
- package/lib/DTableRadio/index.js +10 -9
- package/lib/DTableRadioGroup/index.js +8 -17
- package/lib/DTableSearchInput/index.js +19 -29
- package/lib/DTableSelect/dtable-select-label.css +4 -4
- package/lib/DTableSelect/dtable-select-label.js +7 -6
- package/lib/DTableSelect/index.js +24 -25
- package/lib/DTableSelect/user-select.css +46 -7
- package/lib/DTableSelect/utils.js +82 -179
- package/lib/DTableSubDropdownMenu/index.js +8 -10
- package/lib/DTableSubDropdownToggle/index.js +12 -12
- package/lib/DTableSwitch/index.css +0 -1
- package/lib/DTableSwitch/index.js +12 -11
- package/lib/DTableToolTip/index.js +7 -8
- package/lib/DateEditor/index.js +20 -15
- package/lib/DateEditor/mb-editor/index.js +18 -31
- package/lib/DateEditor/pc-editor.js +26 -45
- package/lib/DateFormatter/index.js +4 -5
- package/lib/DatePicker/index.js +9 -15
- package/lib/DatePicker/utils.js +1 -3
- package/lib/DeleteTip/index.js +5 -6
- package/lib/DepartmentMultipleSelectEditor/index.js +25 -23
- package/lib/DepartmentSelectFilter/index.js +6 -8
- package/lib/DepartmentSingleSelectEditor/index.js +1 -3
- package/lib/DepartmentSingleSelectEditor/mb-editor/index.js +48 -47
- package/lib/DepartmentSingleSelectEditor/pc-editor/department-single-select.js +36 -58
- package/lib/DepartmentSingleSelectEditor/pc-editor/index.js +13 -19
- package/lib/DepartmentSingleSelectFormatter/index.js +4 -6
- package/lib/DigitalSignEditor/index.js +1 -3
- package/lib/DigitalSignEditor/mb-editor/index.js +12 -20
- package/lib/DigitalSignEditor/pc-editor/index.js +17 -24
- package/lib/DigitalSignEditor/service.js +2 -4
- package/lib/DigitalSignEditor/signature-board/index.js +5 -8
- package/lib/DigitalSignEditor/utils.js +2 -4
- package/lib/DigitalSignFormatter/index.js +12 -15
- package/lib/DigitalSignFormatter/utils.js +4 -5
- package/lib/DurationEditor/index.js +21 -31
- package/lib/DurationFormatter/index.js +4 -5
- package/lib/EditEditorButton/index.js +1 -3
- package/lib/EmailFormatter/index.js +3 -4
- package/lib/FieldDisplaySetting/field-item.js +12 -12
- package/lib/FieldDisplaySetting/index.js +11 -9
- package/lib/FileEditor/files-previewer/index.js +1 -3
- package/lib/FileEditor/files-previewer/mb-previewer/file-previewer/index.js +10 -18
- package/lib/FileEditor/files-previewer/mb-previewer/index.js +7 -8
- package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/dropdown-menu.js +3 -4
- package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/file-name-editor/index.js +5 -6
- package/lib/FileEditor/files-previewer/pc-previewer/file-previewer/index.js +14 -21
- package/lib/FileEditor/files-previewer/pc-previewer/index.js +29 -57
- package/lib/FileEditor/index.js +1 -3
- package/lib/FileEditor/mb-editor/index.js +28 -20
- package/lib/FileEditor/pc-editor/addition-previewer/index.js +1 -3
- package/lib/FileEditor/pc-editor/addition-previewer/local-file-addition/index.js +11 -25
- package/lib/FileEditor/pc-editor/index.js +19 -27
- package/lib/FileFormatter/index.js +26 -19
- package/lib/FileItemFormatter/index.js +6 -9
- package/lib/FileUploader/index.js +28 -45
- package/lib/FormulaFormatter/index.js +15 -29
- package/lib/GeolocationEditor/index.js +11 -12
- package/lib/GeolocationEditor/map-editor-utils.js +17 -15
- package/lib/GeolocationEditor/mb-editor/country-editor.js +17 -14
- package/lib/GeolocationEditor/mb-editor/index.js +4 -6
- package/lib/GeolocationEditor/mb-editor/location-editor.js +18 -15
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +41 -68
- package/lib/GeolocationEditor/mb-editor/map-selection-editor/index.js +50 -89
- package/lib/GeolocationEditor/mb-editor/province-city-editor.js +17 -14
- package/lib/GeolocationEditor/mb-editor/province-editor.js +17 -14
- package/lib/GeolocationEditor/pc-editor/country-editor.js +10 -23
- package/lib/GeolocationEditor/pc-editor/index.js +12 -20
- package/lib/GeolocationEditor/pc-editor/location-editor.js +26 -31
- package/lib/GeolocationEditor/pc-editor/map-editor/index.js +34 -54
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.js +36 -60
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/index.js +35 -62
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/large-editor/index.js +36 -65
- package/lib/GeolocationEditor/pc-editor/province-city-editor.js +19 -25
- package/lib/GeolocationEditor/pc-editor/province-editor.js +6 -13
- package/lib/GeolocationEditor/pc-editor/selector-header-item.js +5 -6
- package/lib/GeolocationEditor/pc-editor/selector-list.js +6 -7
- package/lib/GeolocationFormatter/index.js +4 -5
- package/lib/HtmlLongTextFormatter/index.js +4 -12
- package/lib/Icon/index.js +3 -5
- package/lib/IconButton/index.js +4 -6
- package/lib/ImageEditor/images-previewer/image-preview/index.js +12 -21
- package/lib/ImageEditor/images-previewer/index.js +3 -9
- package/lib/ImageEditor/index.js +1 -3
- package/lib/ImageEditor/mb-editor/index.js +28 -20
- package/lib/ImageEditor/pc-editor/addition-previewer/image-link/index.js +2 -6
- package/lib/ImageEditor/pc-editor/addition-previewer/index.js +1 -3
- package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +7 -21
- package/lib/ImageEditor/pc-editor/images-previewer/index.js +3 -9
- package/lib/ImageEditor/pc-editor/index.js +11 -16
- package/lib/ImageFormatter/images-lazy-load.js +19 -11
- package/lib/ImageFormatter/index.js +11 -13
- package/lib/ImagePreviewerLightbox/index.js +15 -13
- package/lib/ImageThumbnail/index.js +10 -13
- package/lib/InputItem/custom-input.js +26 -46
- package/lib/InputItem/custom-keyboard.js +15 -18
- package/lib/InputItem/index.js +34 -50
- package/lib/InputItem/input.js +2 -4
- package/lib/LastModifierFormatter/index.js +6 -8
- package/lib/LinkEditor/index.js +33 -53
- package/lib/LinkEditor/link-editor-option.js +3 -4
- package/lib/LinkEditor/mb-popover/index.js +9 -22
- package/lib/LinkEditor/pc-popover/index.js +5 -10
- package/lib/LinkFormatter/index.js +21 -37
- package/lib/List/index.js +6 -8
- package/lib/List/list-item.js +22 -28
- package/lib/LongTextFormatter/index.js +4 -5
- package/lib/MBEditorHeader/index.js +7 -8
- package/lib/MTimeFormatter/index.js +3 -4
- package/lib/MobileFullScreenPage/body/index.js +3 -5
- package/lib/MobileFullScreenPage/header/index.js +4 -6
- package/lib/MobileFullScreenPage/index.js +13 -11
- package/lib/MobileModal/index.js +1 -3
- package/lib/MobileOperationSheet/index.js +7 -8
- package/lib/MobileSelector/empty/index.js +1 -3
- package/lib/MobileSelector/index.js +5 -7
- package/lib/MobileSelector/option/index.js +3 -5
- package/lib/MobileSelector/options/index.js +1 -3
- package/lib/MobileSelector/search/index.js +3 -5
- package/lib/MobileUpload/index.js +4 -5
- package/lib/Modal/modal.js +14 -15
- package/lib/Modal/prompt.js +4 -4
- package/lib/MultipleSelectEditor/index.js +1 -3
- package/lib/MultipleSelectFormatter/index.js +6 -8
- package/lib/NotificationPopover/index.css +1 -6
- package/lib/NotificationPopover/index.js +6 -7
- package/lib/NumberEditor/index.js +12 -21
- package/lib/NumberFormatter/index.js +4 -5
- package/lib/PhoneNumberLink/index.js +2 -4
- package/lib/Picker/AbstractPicker.js +23 -27
- package/lib/Popover/index.js +3 -4
- package/lib/Popover/item.js +7 -9
- package/lib/Progress/index.js +9 -8
- package/lib/Radio/Radio.js +4 -8
- package/lib/Radio/RadioItem.js +8 -12
- package/lib/RateFormatter/index.js +13 -13
- package/lib/RoleStatusEditor/index.js +18 -17
- package/lib/RowExpandDialog/body/index.js +32 -49
- package/lib/RowExpandDialog/column-content/index.js +5 -9
- package/lib/RowExpandDialog/header/index.js +6 -8
- package/lib/RowExpandDialog/index.js +49 -34
- package/lib/RowExpandEditor/checkbox-editor/mb-editor/index.js +4 -5
- package/lib/RowExpandEditor/checkbox-editor/pc-editor.js +8 -10
- package/lib/RowExpandEditor/collaborator-editor/mb-editor/index.js +22 -33
- package/lib/RowExpandEditor/collaborator-editor/pc-editor/index.js +26 -40
- package/lib/RowExpandEditor/date-editor/mb-editor.js +12 -18
- package/lib/RowExpandEditor/date-editor/pc-editor.js +15 -20
- package/lib/RowExpandEditor/department-editor/mb-editor.js +16 -11
- package/lib/RowExpandEditor/department-editor/pc-editor.js +19 -14
- package/lib/RowExpandEditor/digital-sign-editor/mb-editor/index.js +20 -34
- package/lib/RowExpandEditor/digital-sign-editor/pc-editor/index.js +21 -35
- package/lib/RowExpandEditor/duration-editor/mb-editor.js +10 -17
- package/lib/RowExpandEditor/duration-editor/pc-editor.js +13 -19
- package/lib/RowExpandEditor/email-editor/mb-editor/index.js +9 -19
- package/lib/RowExpandEditor/email-editor/pc-editor/index.js +13 -24
- package/lib/RowExpandEditor/file-editor/mb-editor/index.js +18 -31
- package/lib/RowExpandEditor/file-editor/pc-editor/index.js +16 -23
- package/lib/RowExpandEditor/geolocation-editor/mb-editor/index.js +17 -29
- package/lib/RowExpandEditor/geolocation-editor/pc-editor/index.js +13 -26
- package/lib/RowExpandEditor/image-editor/mb-editor/index.js +15 -25
- package/lib/RowExpandEditor/image-editor/pc-editor/index.js +13 -23
- package/lib/RowExpandEditor/index.js +4 -8
- package/lib/RowExpandEditor/long-text-editor/mb-editor/editor/index.js +17 -18
- package/lib/RowExpandEditor/long-text-editor/mb-editor/index.js +10 -16
- package/lib/RowExpandEditor/long-text-editor/pc-editor/index.js +16 -23
- package/lib/RowExpandEditor/multiple-select-editor/mb-editor/index.js +11 -19
- package/lib/RowExpandEditor/multiple-select-editor/pc-editor/index.js +22 -33
- package/lib/RowExpandEditor/number-editor/mb-editor/index.js +8 -14
- package/lib/RowExpandEditor/number-editor/pc-editor.js +13 -20
- package/lib/RowExpandEditor/rate-editor/mb-editor.js +12 -25
- package/lib/RowExpandEditor/rate-editor/pc-editor.js +20 -36
- package/lib/RowExpandEditor/single-select-editor/mb-editor/index.js +17 -28
- package/lib/RowExpandEditor/single-select-editor/pc-editor/index.js +22 -34
- package/lib/RowExpandEditor/text-editor/mb-editor/index.js +4 -5
- package/lib/RowExpandEditor/text-editor/pc-editor/index.js +15 -26
- package/lib/RowExpandEditor/url-editor/mb-editor/index.js +5 -13
- package/lib/RowExpandEditor/url-editor/pc-editor/index.js +9 -18
- package/lib/RowExpandFormatter/department-formatter/mb-formatter.js +2 -4
- package/lib/RowExpandFormatter/department-formatter/pc-formatter.js +2 -4
- package/lib/RowExpandFormatter/email-formatter/index.js +4 -7
- package/lib/RowExpandFormatter/file-formatter/index.js +8 -9
- package/lib/RowExpandFormatter/file-formatter/row-expand-file-item-formatter.js +10 -12
- package/lib/RowExpandFormatter/formula-formatter/index.js +19 -34
- package/lib/RowExpandFormatter/image-formatter/index.js +9 -11
- package/lib/RowExpandFormatter/image-formatter/row-expand-image-item-formatter.js +7 -8
- package/lib/RowExpandFormatter/index.js +27 -41
- package/lib/RowExpandFormatter/link-formatter/collaborator-item-formatter.js +8 -14
- package/lib/RowExpandFormatter/link-formatter/index.js +11 -19
- package/lib/RowExpandFormatter/link-formatter/value-display-utils.js +3 -5
- package/lib/RowExpandFormatter/rate-formatter/index.js +11 -12
- package/lib/RowExpandFormatter/text/index.js +4 -5
- package/lib/RowExpandFormatter/url-formatter/index.js +4 -7
- package/lib/RowExpandView/body/index.js +22 -35
- package/lib/RowExpandView/column-content/index.js +3 -7
- package/lib/RowExpandView/index.js +42 -30
- package/lib/SelectItem/index.js +5 -7
- package/lib/SelectOptionGroup/index.css +25 -53
- package/lib/SelectOptionGroup/index.js +36 -84
- package/lib/SelectedDepartments/index.js +7 -9
- package/lib/SimpleLongTextFormatter/index.js +10 -16
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +3 -4
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +12 -21
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +3 -4
- package/lib/SingleSelectEditor/index.js +1 -3
- package/lib/SingleSelectFormatter/index.js +8 -9
- package/lib/TabBar/Tab.js +14 -16
- package/lib/TabBar/index.js +18 -21
- package/lib/Tabs/index.js +1 -3
- package/lib/TextEditor/index.js +14 -23
- package/lib/TextFormatter/index.js +3 -4
- package/lib/TextareaItem/index.js +19 -26
- package/lib/Toast/index.js +3 -4
- package/lib/UrlFormatter/index.js +3 -4
- package/lib/common/editor-base.js +7 -12
- package/lib/hooks/common-hooks.js +2 -4
- package/lib/index.js +0 -7
- package/lib/select-editor/index.js +1 -3
- package/lib/select-editor/mb-editor/index.js +17 -28
- package/lib/select-editor/pc-editor/index.js +27 -42
- package/lib/toaster/alert.js +6 -7
- package/lib/toaster/toast.js +2 -3
- package/lib/toaster/toastManager.js +2 -4
- package/lib/utils/cell.js +8 -11
- package/lib/utils/column-utils.js +8 -14
- package/lib/utils/departments.js +1 -3
- package/lib/utils/url.js +24 -31
- package/lib/utils/utils.js +2 -6
- package/package.json +8 -8
- package/lib/DTableCustomizeSearchInput/index.css +0 -81
- package/lib/DTableCustomizeSearchInput/index.js +0 -141
- package/lib/DTableCustomizeSelect/select-option-group/KeyCodes.js +0 -109
- package/lib/DTableCustomizeSelect/select-option-group/index.css +0 -134
- package/lib/DTableCustomizeSelect/select-option-group/index.js +0 -260
- package/lib/DTableCustomizeSelect/select-option-group/option.js +0 -48
- package/lib/DTableCustomizeSelect/util.js +0 -12
- package/lib/DTableSelect/select-dropdown-indicator/index.css +0 -16
- package/lib/DTableSelect/select-dropdown-indicator/index.js +0 -26
- package/lib/DTableSelect/select-style.js +0 -133
- package/lib/assets/icons/close.svg +0 -1
- package/lib/assets/icons/down.svg +0 -3
|
@@ -22,9 +22,7 @@ class PCDateEditor extends _react.default.Component {
|
|
|
22
22
|
// event trigger sequence: onOpenChange --> onChange
|
|
23
23
|
this.onChange = value => {
|
|
24
24
|
if (!value) return;
|
|
25
|
-
let
|
|
26
|
-
dateFormat
|
|
27
|
-
} = this.props;
|
|
25
|
+
let dateFormat = this.props.dateFormat;
|
|
28
26
|
this.setState({
|
|
29
27
|
value: value,
|
|
30
28
|
open: true // if value changed, don't close datePicker
|
|
@@ -35,9 +33,7 @@ class PCDateEditor extends _react.default.Component {
|
|
|
35
33
|
this.props.onCommit(this.getValue());
|
|
36
34
|
};
|
|
37
35
|
this.getValue = () => {
|
|
38
|
-
let
|
|
39
|
-
dateFormat
|
|
40
|
-
} = this.props;
|
|
36
|
+
let dateFormat = this.props.dateFormat;
|
|
41
37
|
let value = this.state.value ? this.state.value.format(dateFormat) : null;
|
|
42
38
|
return value;
|
|
43
39
|
};
|
|
@@ -49,9 +45,7 @@ class PCDateEditor extends _react.default.Component {
|
|
|
49
45
|
return this.datePickerRef.querySelector('input:not([type=hidden])');
|
|
50
46
|
};
|
|
51
47
|
this.onOpenChange = open => {
|
|
52
|
-
const
|
|
53
|
-
isInModal
|
|
54
|
-
} = this.props;
|
|
48
|
+
const isInModal = this.props.isInModal;
|
|
55
49
|
if (open) {
|
|
56
50
|
this.toggleCalendar(open);
|
|
57
51
|
}
|
|
@@ -80,9 +74,7 @@ class PCDateEditor extends _react.default.Component {
|
|
|
80
74
|
event.stopPropagation();
|
|
81
75
|
};
|
|
82
76
|
this.getCalendarContainer = () => {
|
|
83
|
-
const
|
|
84
|
-
isInModal
|
|
85
|
-
} = this.props;
|
|
77
|
+
const isInModal = this.props.isInModal;
|
|
86
78
|
return isInModal ? this.calendarContainerRef.current : document.body;
|
|
87
79
|
};
|
|
88
80
|
this.handleKeyDown = e => {
|
|
@@ -110,9 +102,7 @@ class PCDateEditor extends _react.default.Component {
|
|
|
110
102
|
this.toggleCalendar(true);
|
|
111
103
|
};
|
|
112
104
|
this.onClickRightPanelTime = () => {
|
|
113
|
-
const
|
|
114
|
-
isInModal
|
|
115
|
-
} = this.props;
|
|
105
|
+
const isInModal = this.props.isInModal;
|
|
116
106
|
let onClickRightPanelTime = isInModal ? this.props.onClose : this.closeEditor;
|
|
117
107
|
// we should change value and save it(async function), then close Editor.
|
|
118
108
|
setTimeout(() => {
|
|
@@ -128,20 +118,17 @@ class PCDateEditor extends _react.default.Component {
|
|
|
128
118
|
}
|
|
129
119
|
};
|
|
130
120
|
this.getDefaultTime = () => {
|
|
131
|
-
const
|
|
132
|
-
value
|
|
133
|
-
} = this.props;
|
|
121
|
+
const value = this.props.value;
|
|
134
122
|
if (value) return (0, _dayjs.default)(value).format('HH:mm');
|
|
135
123
|
return '';
|
|
136
124
|
};
|
|
137
125
|
this.getCalender = () => {
|
|
138
|
-
let
|
|
139
|
-
dateFormat,
|
|
140
|
-
showHourAndMinute,
|
|
141
|
-
lang,
|
|
142
|
-
className,
|
|
143
|
-
firstDayOfWeek
|
|
144
|
-
} = this.props;
|
|
126
|
+
let _this$props = this.props,
|
|
127
|
+
dateFormat = _this$props.dateFormat,
|
|
128
|
+
showHourAndMinute = _this$props.showHourAndMinute,
|
|
129
|
+
lang = _this$props.lang,
|
|
130
|
+
className = _this$props.className,
|
|
131
|
+
firstDayOfWeek = _this$props.firstDayOfWeek;
|
|
145
132
|
let defaultValue = (0, _dayjs.default)().clone();
|
|
146
133
|
const defaultTime = this.getDefaultTime();
|
|
147
134
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_seafileCalendar.default, {
|
|
@@ -160,10 +147,9 @@ class PCDateEditor extends _react.default.Component {
|
|
|
160
147
|
firstDayOfWeek: firstDayOfWeek
|
|
161
148
|
});
|
|
162
149
|
};
|
|
163
|
-
const
|
|
164
|
-
dateFormat
|
|
165
|
-
value
|
|
166
|
-
} = this.props;
|
|
150
|
+
const _this$props2 = this.props,
|
|
151
|
+
_dateFormat = _this$props2.dateFormat,
|
|
152
|
+
_value = _this$props2.value;
|
|
167
153
|
this.state = {
|
|
168
154
|
value: _value ? (0, _dayjs.default)(_value) : null,
|
|
169
155
|
open: false
|
|
@@ -173,11 +159,10 @@ class PCDateEditor extends _react.default.Component {
|
|
|
173
159
|
this.showHourAndMinute = !!(_dateFormat.indexOf('HH:mm') > -1);
|
|
174
160
|
}
|
|
175
161
|
componentDidMount() {
|
|
176
|
-
const
|
|
177
|
-
value,
|
|
178
|
-
lang,
|
|
179
|
-
isInModal
|
|
180
|
-
} = this.props;
|
|
162
|
+
const _this$props3 = this.props,
|
|
163
|
+
value = _this$props3.value,
|
|
164
|
+
lang = _this$props3.lang,
|
|
165
|
+
isInModal = _this$props3.isInModal;
|
|
181
166
|
const iszhcn = lang === 'zh-cn';
|
|
182
167
|
if (iszhcn) {
|
|
183
168
|
now = now.locale('zh-cn');
|
|
@@ -214,14 +199,12 @@ class PCDateEditor extends _react.default.Component {
|
|
|
214
199
|
}
|
|
215
200
|
}
|
|
216
201
|
render() {
|
|
217
|
-
let
|
|
218
|
-
dateFormat,
|
|
219
|
-
isInModal
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
value
|
|
224
|
-
} = this.state;
|
|
202
|
+
let _this$props4 = this.props,
|
|
203
|
+
dateFormat = _this$props4.dateFormat,
|
|
204
|
+
isInModal = _this$props4.isInModal;
|
|
205
|
+
let _this$state = this.state,
|
|
206
|
+
open = _this$state.open,
|
|
207
|
+
value = _this$state.value;
|
|
225
208
|
const calendar = this.getCalender();
|
|
226
209
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
227
210
|
className: "date-picker-container ".concat(isInModal ? 'modal-date-picker-container' : ''),
|
|
@@ -240,9 +223,7 @@ class PCDateEditor extends _react.default.Component {
|
|
|
240
223
|
onChange: this.onChange,
|
|
241
224
|
onOpenChange: this.onOpenChange,
|
|
242
225
|
children: _ref => {
|
|
243
|
-
let
|
|
244
|
-
value
|
|
245
|
-
} = _ref;
|
|
226
|
+
let value = _ref.value;
|
|
246
227
|
value = value && value.format(dateFormat);
|
|
247
228
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
248
229
|
className: "dtable-ui-date-editor-container",
|
|
@@ -12,11 +12,10 @@ require("./index.css");
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
class DateFormatter extends _react.default.Component {
|
|
14
14
|
render() {
|
|
15
|
-
let
|
|
16
|
-
value
|
|
17
|
-
format,
|
|
18
|
-
containerClassName
|
|
19
|
-
} = this.props;
|
|
15
|
+
let _this$props = this.props,
|
|
16
|
+
date = _this$props.value,
|
|
17
|
+
format = _this$props.format,
|
|
18
|
+
containerClassName = _this$props.containerClassName;
|
|
20
19
|
let classname = (0, _classnames.default)('dtable-ui cell-formatter-container date-formatter', containerClassName);
|
|
21
20
|
if (date !== '') {
|
|
22
21
|
date = (0, _dtableUtils.getDateDisplayString)(date, format);
|
package/lib/DatePicker/index.js
CHANGED
|
@@ -46,22 +46,16 @@ class DatePicker extends React.Component {
|
|
|
46
46
|
}
|
|
47
47
|
render() {
|
|
48
48
|
// tslint:disable-next-line:no-this-assignment
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
children,
|
|
55
|
-
value,
|
|
56
|
-
popupPrefixCls
|
|
57
|
-
} = props;
|
|
49
|
+
const props = this.props,
|
|
50
|
+
context = this.context;
|
|
51
|
+
const children = props.children,
|
|
52
|
+
value = props.value,
|
|
53
|
+
popupPrefixCls = props.popupPrefixCls;
|
|
58
54
|
const locale = (0, _getLocale.getComponentLocale)(props, context, 'DatePicker', () => require('./locale/zh_CN'));
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
DatePickerLocale
|
|
64
|
-
} = locale;
|
|
55
|
+
const okText = locale.okText,
|
|
56
|
+
dismissText = locale.dismissText,
|
|
57
|
+
extra = locale.extra,
|
|
58
|
+
DatePickerLocale = locale.DatePickerLocale;
|
|
65
59
|
/**
|
|
66
60
|
* 注意:
|
|
67
61
|
* 受控 表示 通过设置 value 属性、组件的最终状态跟 value 设置值一致。
|
package/lib/DatePicker/utils.js
CHANGED
|
@@ -22,9 +22,7 @@ function formatFn(instance, value) {
|
|
|
22
22
|
time: 'HH:mm',
|
|
23
23
|
datetime: 'YYYY-MM-DD HH:mm'
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
format
|
|
27
|
-
} = instance.props;
|
|
25
|
+
const format = instance.props.format;
|
|
28
26
|
const type = typeof format;
|
|
29
27
|
if (type === 'string') {
|
|
30
28
|
return formatIt(value, format);
|
package/lib/DeleteTip/index.js
CHANGED
|
@@ -21,12 +21,11 @@ class DeleteTip extends _react.default.Component {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
const
|
|
25
|
-
toggle,
|
|
26
|
-
handleDelete,
|
|
27
|
-
position,
|
|
28
|
-
deleteTip
|
|
29
|
-
} = this.props;
|
|
24
|
+
const _this$props = this.props,
|
|
25
|
+
toggle = _this$props.toggle,
|
|
26
|
+
handleDelete = _this$props.handleDelete,
|
|
27
|
+
position = _this$props.position,
|
|
28
|
+
deleteTip = _this$props.deleteTip;
|
|
30
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
|
|
31
30
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
32
31
|
onClickOutside: this.handleOutsideClick,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _departments = require("../utils/departments");
|
|
11
12
|
var _SelectedDepartments = _interopRequireDefault(require("../SelectedDepartments"));
|
|
@@ -13,18 +14,22 @@ var _lang = require("../lang");
|
|
|
13
14
|
require("./index.css");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function DepartmentMultipleSelect(props) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const value = props.value,
|
|
18
|
+
onCommit = props.onCommit,
|
|
19
|
+
classNamePrefix = props.classNamePrefix,
|
|
20
|
+
isShowSelectedDepartments = props.isShowSelectedDepartments,
|
|
21
|
+
renderUserDepartmentOptions = props.renderUserDepartmentOptions,
|
|
22
|
+
initialDepartments = props.departments,
|
|
23
|
+
isInModal = props.isInModal,
|
|
24
|
+
position = props.position;
|
|
25
|
+
const _useState = (0, _react.useState)(''),
|
|
26
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
27
|
+
searchVal = _useState2[0],
|
|
28
|
+
setSearchVal = _useState2[1];
|
|
29
|
+
const _useState3 = (0, _react.useState)((0, _departments.getNormalizedDepartments)(initialDepartments)),
|
|
30
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
31
|
+
departments = _useState4[0],
|
|
32
|
+
setDepartments = _useState4[1];
|
|
28
33
|
const departmentContainerRef = (0, _react.useRef)(null);
|
|
29
34
|
const validDepartmentsRef = (0, _react.useRef)([]);
|
|
30
35
|
(0, _react.useEffect)(() => {
|
|
@@ -34,10 +39,9 @@ function DepartmentMultipleSelect(props) {
|
|
|
34
39
|
// eslint-disable-next-line
|
|
35
40
|
}, []);
|
|
36
41
|
function resetContainerPosition() {
|
|
37
|
-
const
|
|
38
|
-
top,
|
|
39
|
-
height
|
|
40
|
-
} = departmentContainerRef.current.getBoundingClientRect();
|
|
42
|
+
const _departmentContainerR = departmentContainerRef.current.getBoundingClientRect(),
|
|
43
|
+
top = _departmentContainerR.top,
|
|
44
|
+
height = _departmentContainerR.height;
|
|
41
45
|
if (isInModal) {
|
|
42
46
|
if (position.y + position.height + height > window.innerHeight) {
|
|
43
47
|
departmentContainerRef.current.style.top = position.y - height + 'px';
|
|
@@ -93,12 +97,10 @@ function DepartmentMultipleSelect(props) {
|
|
|
93
97
|
e.nativeEvent.stopImmediatePropagation();
|
|
94
98
|
}
|
|
95
99
|
function renderDepartment(department, subDepartments, level) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
id
|
|
101
|
-
} = department;
|
|
100
|
+
const hasChild = department.hasChild,
|
|
101
|
+
isExpanded = department.isExpanded,
|
|
102
|
+
name = department.name,
|
|
103
|
+
id = department.id;
|
|
102
104
|
const newLevel = level + 1;
|
|
103
105
|
const inputChecked = value.includes(id);
|
|
104
106
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
@@ -11,14 +11,12 @@ var _departmentSingleSelectFilter = _interopRequireDefault(require("../DTableFil
|
|
|
11
11
|
var _departmentMultipleSelectFilter = _interopRequireDefault(require("../DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function DepartmentSelectFilter(props) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onCommit
|
|
21
|
-
} = props;
|
|
14
|
+
const isMultiple = props.isMultiple,
|
|
15
|
+
value = props.value,
|
|
16
|
+
column = props.column,
|
|
17
|
+
userDepartmentIdsMap = props.userDepartmentIdsMap,
|
|
18
|
+
departments = props.departments,
|
|
19
|
+
onCommit = props.onCommit;
|
|
22
20
|
const filterProps = {
|
|
23
21
|
column,
|
|
24
22
|
value,
|
|
@@ -15,9 +15,7 @@ var _mbEditor = _interopRequireDefault(require("./mb-editor"));
|
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
const _excluded = ["isMobile"];
|
|
17
17
|
const DepartmentSingleSelectEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
18
|
-
let
|
|
19
|
-
isMobile
|
|
20
|
-
} = _ref,
|
|
18
|
+
let isMobile = _ref.isMobile,
|
|
21
19
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
22
20
|
if (isMobile === false) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_pcEditor.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
23
21
|
ref: ref
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _dtableUtils = require("dtable-utils");
|
|
11
12
|
var _List = _interopRequireDefault(require("../../List"));
|
|
@@ -17,25 +18,37 @@ var _lang = require("../../lang");
|
|
|
17
18
|
require("./index.css");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
const Item = _List.default.Item;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
Body
|
|
23
|
-
} = _MobileFullScreenPage.default;
|
|
21
|
+
const Header = _MobileFullScreenPage.default.Header,
|
|
22
|
+
Body = _MobileFullScreenPage.default.Body;
|
|
24
23
|
const MBDepartmentSingleSelectEditor = _ref => {
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
isSupportMultiple = false,
|
|
29
|
-
isFilterEditor =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
24
|
+
let oldValue = _ref.value,
|
|
25
|
+
column = _ref.column,
|
|
26
|
+
_ref$isSupportMultipl = _ref.isSupportMultiple,
|
|
27
|
+
isSupportMultiple = _ref$isSupportMultipl === void 0 ? false : _ref$isSupportMultipl,
|
|
28
|
+
_ref$isFilterEditor = _ref.isFilterEditor,
|
|
29
|
+
isFilterEditor = _ref$isFilterEditor === void 0 ? false : _ref$isFilterEditor,
|
|
30
|
+
_ref$userDepartmentId = _ref.userDepartmentIdsMap,
|
|
31
|
+
userDepartmentIdsMap = _ref$userDepartmentId === void 0 ? {} : _ref$userDepartmentId,
|
|
32
|
+
_ref$departments = _ref.departments,
|
|
33
|
+
initialDepartments = _ref$departments === void 0 ? [] : _ref$departments,
|
|
34
|
+
onCommit = _ref.onCommit,
|
|
35
|
+
onClose = _ref.onClose;
|
|
36
|
+
const _useState = (0, _react.useState)(oldValue ? oldValue : isSupportMultiple ? [] : ''),
|
|
37
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
38
|
+
value = _useState2[0],
|
|
39
|
+
setValue = _useState2[1];
|
|
40
|
+
const _useState3 = (0, _react.useState)([]),
|
|
41
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
42
|
+
departments = _useState4[0],
|
|
43
|
+
setDepartments = _useState4[1];
|
|
44
|
+
const _useState5 = (0, _react.useState)(''),
|
|
45
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
46
|
+
parentId = _useState6[0],
|
|
47
|
+
setParentId = _useState6[1];
|
|
48
|
+
const _useState7 = (0, _react.useState)([]),
|
|
49
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
50
|
+
topParentIds = _useState8[0],
|
|
51
|
+
setTopParentIds = _useState8[1];
|
|
39
52
|
const initColumnData = (0, _react.useMemo)(() => {
|
|
40
53
|
const data = column.data || {};
|
|
41
54
|
const enableSelectRange = data.enable_select_range || false;
|
|
@@ -53,10 +66,8 @@ const MBDepartmentSingleSelectEditor = _ref => {
|
|
|
53
66
|
}, [isFilterEditor, value, onCommit, onClose]);
|
|
54
67
|
const onDepartmentClick = (0, _react.useCallback)((event, department) => {
|
|
55
68
|
event.preventDefault();
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
hasChild
|
|
59
|
-
} = department;
|
|
69
|
+
const id = department.id,
|
|
70
|
+
hasChild = department.hasChild;
|
|
60
71
|
if (event.target && event.target.className.indexOf('am-list-arrow') > -1) {
|
|
61
72
|
if (!hasChild) return;
|
|
62
73
|
setParentId(id);
|
|
@@ -100,9 +111,7 @@ const MBDepartmentSingleSelectEditor = _ref => {
|
|
|
100
111
|
onClose && onClose();
|
|
101
112
|
return;
|
|
102
113
|
}
|
|
103
|
-
const
|
|
104
|
-
enableSelectRange
|
|
105
|
-
} = initColumnData;
|
|
114
|
+
const enableSelectRange = initColumnData.enableSelectRange;
|
|
106
115
|
if (topParentIds.includes(parentId) && enableSelectRange) {
|
|
107
116
|
setParentId('');
|
|
108
117
|
return;
|
|
@@ -119,9 +128,7 @@ const MBDepartmentSingleSelectEditor = _ref => {
|
|
|
119
128
|
});
|
|
120
129
|
}, [isFilterEditor, departments, parentId]);
|
|
121
130
|
const renderDepartments = (0, _react.useCallback)(() => {
|
|
122
|
-
const
|
|
123
|
-
enableSelectRange
|
|
124
|
-
} = initColumnData;
|
|
131
|
+
const enableSelectRange = initColumnData.enableSelectRange;
|
|
125
132
|
let currentDepartments = [];
|
|
126
133
|
if (enableSelectRange && !parentId && !isFilterEditor) {
|
|
127
134
|
currentDepartments = departments.filter(department => topParentIds.includes(department.id));
|
|
@@ -141,10 +148,8 @@ const MBDepartmentSingleSelectEditor = _ref => {
|
|
|
141
148
|
renderHeader: () => (0, _lang.getLocale)('Select_department'),
|
|
142
149
|
children: [isFilterEditor && parentId === -1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
143
150
|
children: _departments2.DEPARTMENT_SELECT_RANGE_OPTIONS.slice(0, 2).map((option, index) => {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
name
|
|
147
|
-
} = option;
|
|
151
|
+
const type = option.type,
|
|
152
|
+
name = option.name;
|
|
148
153
|
const isChecked = isSupportMultiple ? value.includes(type) : value === type;
|
|
149
154
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Item, {
|
|
150
155
|
multipleLine: true,
|
|
@@ -161,11 +166,9 @@ const MBDepartmentSingleSelectEditor = _ref => {
|
|
|
161
166
|
}, "department-range-item-".concat(index));
|
|
162
167
|
})
|
|
163
168
|
}), currentDepartments.map((department, index) => {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
id
|
|
168
|
-
} = department;
|
|
169
|
+
const hasChild = department.hasChild,
|
|
170
|
+
name = department.name,
|
|
171
|
+
id = department.id;
|
|
169
172
|
const isChecked = isSupportMultiple ? value.includes(id) : value === id;
|
|
170
173
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Item, {
|
|
171
174
|
arrow: hasChild ? 'horizontal' : '',
|
|
@@ -185,16 +188,14 @@ const MBDepartmentSingleSelectEditor = _ref => {
|
|
|
185
188
|
});
|
|
186
189
|
}, [initColumnData, parentId, isFilterEditor, isSupportMultiple, departments, value, topParentIds, onParentDepartmentClick, onDepartmentClick]);
|
|
187
190
|
(0, _react.useEffect)(() => {
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
specificDepartments
|
|
192
|
-
} = initColumnData;
|
|
191
|
+
const enableSelectRange = initColumnData.enableSelectRange,
|
|
192
|
+
selectedRange = initColumnData.selectedRange,
|
|
193
|
+
specificDepartments = initColumnData.specificDepartments;
|
|
193
194
|
if (enableSelectRange && !isFilterEditor) {
|
|
194
|
-
const
|
|
195
|
-
current_user_department_ids = [],
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
const _userDepartmentIdsMap = userDepartmentIdsMap.current_user_department_ids,
|
|
196
|
+
current_user_department_ids = _userDepartmentIdsMap === void 0 ? [] : _userDepartmentIdsMap,
|
|
197
|
+
_userDepartmentIdsMap2 = userDepartmentIdsMap.current_user_department_and_sub_ids,
|
|
198
|
+
current_user_department_and_sub_ids = _userDepartmentIdsMap2 === void 0 ? [] : _userDepartmentIdsMap2;
|
|
198
199
|
let targetDepartments = [];
|
|
199
200
|
let topParentIds = [];
|
|
200
201
|
let canExpand = true;
|
|
@@ -21,9 +21,8 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
21
21
|
_this = this;
|
|
22
22
|
this.resetMenuStyle = () => {
|
|
23
23
|
if (!this.departmentsRef) return;
|
|
24
|
-
const
|
|
25
|
-
bottom
|
|
26
|
-
} = this.departmentsRef.getBoundingClientRect();
|
|
24
|
+
const _this$departmentsRef$ = this.departmentsRef.getBoundingClientRect(),
|
|
25
|
+
bottom = _this$departmentsRef$.bottom;
|
|
27
26
|
if (bottom > window.innerHeight) {
|
|
28
27
|
const currentTop = this.departmentsRef.style.top || 0;
|
|
29
28
|
this.departmentsRef.style.top = parseInt(currentTop) - bottom + window.innerHeight + 'px';
|
|
@@ -38,14 +37,14 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
38
37
|
};
|
|
39
38
|
this.initRangeDepartments = function (userDepartmentIdsMap) {
|
|
40
39
|
let departments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
41
|
-
const
|
|
42
|
-
selectedRange,
|
|
43
|
-
specificDepartments
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
current_user_department_ids = [],
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const _this$getSelectedRang = _this.getSelectedRange(),
|
|
41
|
+
selectedRange = _this$getSelectedRang.selectedRange,
|
|
42
|
+
specificDepartments = _this$getSelectedRang.specificDepartments;
|
|
43
|
+
const _ref = userDepartmentIdsMap || {},
|
|
44
|
+
_ref$current_user_dep = _ref.current_user_department_ids,
|
|
45
|
+
current_user_department_ids = _ref$current_user_dep === void 0 ? [] : _ref$current_user_dep,
|
|
46
|
+
_ref$current_user_dep2 = _ref.current_user_department_and_sub_ids,
|
|
47
|
+
current_user_department_and_sub_ids = _ref$current_user_dep2 === void 0 ? [] : _ref$current_user_dep2;
|
|
49
48
|
let targetDepartments = [];
|
|
50
49
|
let topParentIds = [];
|
|
51
50
|
if (selectedRange === _dtableUtils.DEPARTMENT_SELECT_RANGE_MAP.CURRENT_USER_DEPARTMENT) {
|
|
@@ -66,9 +65,7 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
66
65
|
});
|
|
67
66
|
};
|
|
68
67
|
this.getSelectedRange = () => {
|
|
69
|
-
const
|
|
70
|
-
column
|
|
71
|
-
} = this.props;
|
|
68
|
+
const column = this.props.column;
|
|
72
69
|
const data = column.data || {};
|
|
73
70
|
const selectedRange = data.selected_range || '';
|
|
74
71
|
const specificDepartments = data.specific_departments || [];
|
|
@@ -89,13 +86,9 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
89
86
|
};
|
|
90
87
|
this.onChangeSearch = event => {
|
|
91
88
|
const newSearchValue = event.target.value;
|
|
92
|
-
const
|
|
93
|
-
searchVal
|
|
94
|
-
} = this.state;
|
|
89
|
+
const searchVal = this.state.searchVal;
|
|
95
90
|
if (searchVal === newSearchValue) return;
|
|
96
|
-
const
|
|
97
|
-
departments
|
|
98
|
-
} = this.state;
|
|
91
|
+
const departments = this.state.departments;
|
|
99
92
|
this.validDepartments = (0, _departments.searchDepartments)(departments, newSearchValue);
|
|
100
93
|
this.setState({
|
|
101
94
|
searchVal: newSearchValue
|
|
@@ -104,10 +97,9 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
104
97
|
this.onSelectDepartment = (event, selectedValue) => {
|
|
105
98
|
event.stopPropagation();
|
|
106
99
|
event.nativeEvent.stopImmediatePropagation();
|
|
107
|
-
const
|
|
108
|
-
onCommit,
|
|
109
|
-
value
|
|
110
|
-
} = this.props;
|
|
100
|
+
const _this$props = this.props,
|
|
101
|
+
onCommit = _this$props.onCommit,
|
|
102
|
+
value = _this$props.value;
|
|
111
103
|
const newValue = selectedValue === value ? '' : selectedValue;
|
|
112
104
|
onCommit(newValue);
|
|
113
105
|
};
|
|
@@ -127,16 +119,12 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
127
119
|
});
|
|
128
120
|
};
|
|
129
121
|
this.renderDepartment = (department, subDepartments, level, hasNextLevel) => {
|
|
130
|
-
const
|
|
131
|
-
value
|
|
132
|
-
} = this.props;
|
|
122
|
+
const value = this.props.value;
|
|
133
123
|
const newLevel = level + 1;
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
id
|
|
139
|
-
} = department;
|
|
124
|
+
const hasChild = department.hasChild,
|
|
125
|
+
isExpanded = department.isExpanded,
|
|
126
|
+
name = department.name,
|
|
127
|
+
id = department.id;
|
|
140
128
|
const isChecked = value === id;
|
|
141
129
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
142
130
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -172,9 +160,7 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
172
160
|
}, id);
|
|
173
161
|
};
|
|
174
162
|
this.renderAllDepartments = () => {
|
|
175
|
-
const
|
|
176
|
-
departments
|
|
177
|
-
} = this.state;
|
|
163
|
+
const departments = this.state.departments;
|
|
178
164
|
const topDepartment = departments.find(department => department.parent_id === -1);
|
|
179
165
|
const subDepartments = departments.filter(department => department.parent_id !== -1);
|
|
180
166
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -182,9 +168,7 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
182
168
|
});
|
|
183
169
|
};
|
|
184
170
|
this.renderSpecificDepartments = () => {
|
|
185
|
-
const
|
|
186
|
-
departments
|
|
187
|
-
} = this.state;
|
|
171
|
+
const departments = this.state.departments;
|
|
188
172
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
189
173
|
children: [this.validDepartments.length === 0 && this.renderEmptyTip(), this.validDepartments.length > 0 && this.validDepartments.map(department => {
|
|
190
174
|
const value = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, department), {}, {
|
|
@@ -195,10 +179,9 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
195
179
|
});
|
|
196
180
|
};
|
|
197
181
|
this.renderCurrentDepartmentsAndSub = () => {
|
|
198
|
-
const
|
|
199
|
-
departments,
|
|
200
|
-
topParentIds
|
|
201
|
-
} = this.state;
|
|
182
|
+
const _this$state = this.state,
|
|
183
|
+
departments = _this$state.departments,
|
|
184
|
+
topParentIds = _this$state.topParentIds;
|
|
202
185
|
const nextLevelDepartment = this.validDepartments.find(department => topParentIds.includes(department.parent_id));
|
|
203
186
|
const hasNextLevel = !!nextLevelDepartment;
|
|
204
187
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -216,16 +199,12 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
216
199
|
});
|
|
217
200
|
};
|
|
218
201
|
this.renderMenuContent = () => {
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
} = this.props;
|
|
226
|
-
const {
|
|
227
|
-
selectedRange
|
|
228
|
-
} = this.getSelectedRange();
|
|
202
|
+
const searchVal = this.state.searchVal;
|
|
203
|
+
const _this$props2 = this.props,
|
|
204
|
+
enableSelectRange = _this$props2.enableSelectRange,
|
|
205
|
+
renderUserDepartmentOptions = _this$props2.renderUserDepartmentOptions;
|
|
206
|
+
const _this$getSelectedRang2 = this.getSelectedRange(),
|
|
207
|
+
selectedRange = _this$getSelectedRang2.selectedRange;
|
|
229
208
|
let menuContent = this.renderAllDepartments();
|
|
230
209
|
if (enableSelectRange && [_dtableUtils.DEPARTMENT_SELECT_RANGE_MAP.CURRENT_USER_DEPARTMENT, _dtableUtils.DEPARTMENT_SELECT_RANGE_MAP.SPECIFIC_DEPARTMENTS].includes(selectedRange) || searchVal) {
|
|
231
210
|
menuContent = this.renderSpecificDepartments();
|
|
@@ -251,11 +230,10 @@ class DepartmentSingleSelect extends _react.Component {
|
|
|
251
230
|
setTimeout(() => {
|
|
252
231
|
this.resetMenuStyle();
|
|
253
232
|
}, 1);
|
|
254
|
-
const
|
|
255
|
-
enableSelectRange,
|
|
256
|
-
userDepartmentIdsMap,
|
|
257
|
-
departments
|
|
258
|
-
} = this.props;
|
|
233
|
+
const _this$props3 = this.props,
|
|
234
|
+
enableSelectRange = _this$props3.enableSelectRange,
|
|
235
|
+
userDepartmentIdsMap = _this$props3.userDepartmentIdsMap,
|
|
236
|
+
departments = _this$props3.departments;
|
|
259
237
|
if (enableSelectRange) {
|
|
260
238
|
this.initRangeDepartments(userDepartmentIdsMap, departments);
|
|
261
239
|
} else {
|