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