dtable-ui-component 7.0.13 → 7.0.15
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 +58 -49
- package/lib/ActivityIndicator/index.js +17 -16
- package/lib/AsyncUserSelect/index.js +20 -46
- package/lib/AsyncUserSelect/user-item.js +6 -5
- package/lib/AutoNumberFormatter/index.js +4 -3
- package/lib/Badge/index.js +27 -29
- package/lib/ButtonFormatter/index.js +8 -6
- package/lib/CTimeFormatter/index.js +4 -3
- package/lib/CheckboxEditor/index.js +16 -13
- 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 +17 -14
- package/lib/CollaboratorEditor/mb-editor/index.js +19 -11
- package/lib/CollaboratorEditor/pc-editor/index.js +35 -26
- package/lib/CollaboratorFormatter/index.js +10 -8
- package/lib/CollaboratorItem/index.js +5 -4
- package/lib/CollapsibleSettingLayout/index.js +8 -10
- package/lib/Comment/body/comment.js +19 -11
- package/lib/Comment/body/index.js +8 -8
- package/lib/Comment/footer/btns/index.js +7 -4
- package/lib/Comment/footer/index.js +21 -10
- package/lib/Comment/footer/input/index.js +55 -34
- package/lib/Comment/footer/input/participant/index.js +6 -5
- 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 +26 -10
- package/lib/Comment/index.js +57 -39
- package/lib/Comment/utils/utilities.js +22 -16
- package/lib/CreatorFormatter/index.js +8 -6
- package/lib/DTableColorPicker/ColorPickerPortal/index.js +26 -28
- package/lib/DTableColorPicker/index.js +53 -67
- package/lib/DTableColorPicker/utils.js +7 -5
- package/lib/DTableColumnIcon/index.js +7 -6
- package/lib/DTableCommonAddTool/index.js +10 -8
- package/lib/DTableCustomFooter/index.js +3 -1
- package/lib/DTableCustomizeSearchInput/index.js +41 -26
- package/lib/DTableCustomizeSelect/index.js +24 -19
- package/lib/DTableDropdownItem/index.js +28 -24
- package/lib/DTableDropdownMenu/index.js +17 -14
- package/lib/DTableEmptyTip/index.js +5 -4
- package/lib/DTableFiltersPopover/index.js +42 -27
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +3 -1
- package/lib/DTableFiltersPopover/utils/index.js +114 -64
- 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 +57 -36
- package/lib/DTableFiltersPopover/widgets/filter-item.js +165 -106
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +162 -137
- package/lib/DTableFiltersPopover/widgets/rate-item.js +25 -20
- package/lib/DTableIcon/index.js +11 -10
- package/lib/DTableIcon/svg-icon.js +11 -9
- package/lib/DTableModalHeader/index.js +7 -7
- package/lib/DTablePopover/index.js +16 -12
- package/lib/DTableRadio/index.js +9 -10
- package/lib/DTableRadioGroup/index.js +20 -11
- package/lib/DTableSearchInput/index.js +29 -19
- package/lib/DTableSelect/dtable-select-label.js +6 -7
- package/lib/DTableSelect/index.js +26 -25
- package/lib/DTableSelect/select-dropdown-indicator/index.js +3 -1
- package/lib/DTableSelect/utils.js +83 -47
- package/lib/DTableSubDropdownMenu/index.js +16 -12
- package/lib/DTableSubDropdownToggle/index.js +16 -17
- package/lib/DTableSwitch/index.js +11 -12
- package/lib/DTableToolTip/index.js +12 -11
- package/lib/DateEditor/index.js +28 -30
- package/lib/DateEditor/mb-editor/index.js +31 -18
- package/lib/DateEditor/pc-editor.js +46 -27
- package/lib/DateFormatter/index.js +5 -4
- package/lib/DatePicker/index.js +15 -9
- package/lib/DatePicker/utils.js +7 -5
- package/lib/DeleteTip/index.js +6 -5
- package/lib/DepartmentMultipleSelectEditor/index.js +26 -28
- package/lib/DepartmentSelectFilter/index.js +13 -8
- package/lib/DepartmentSingleSelectEditor/index.js +16 -13
- package/lib/DepartmentSingleSelectEditor/mb-editor/index.js +49 -50
- package/lib/DepartmentSingleSelectEditor/pc-editor/department-single-select.js +64 -42
- package/lib/DepartmentSingleSelectEditor/pc-editor/index.js +19 -13
- package/lib/DepartmentSingleSelectFormatter/index.js +6 -4
- package/lib/DigitalSignEditor/index.js +16 -13
- package/lib/DigitalSignEditor/mb-editor/index.js +24 -16
- package/lib/DigitalSignEditor/pc-editor/index.js +31 -23
- package/lib/DigitalSignEditor/service.js +5 -3
- package/lib/DigitalSignEditor/signature-board/index.js +10 -7
- package/lib/DigitalSignEditor/utils.js +4 -2
- package/lib/DigitalSignFormatter/index.js +15 -12
- package/lib/DigitalSignFormatter/utils.js +6 -5
- package/lib/Drawer/index.js +3 -2
- 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 +13 -13
- package/lib/FieldDisplaySetting/index.js +20 -20
- package/lib/FileEditor/files-previewer/index.js +16 -13
- package/lib/FileEditor/files-previewer/mb-previewer/file-previewer/index.js +20 -12
- 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 +24 -17
- package/lib/FileEditor/files-previewer/pc-previewer/index.js +57 -29
- package/lib/FileEditor/index.js +16 -13
- package/lib/FileEditor/mb-editor/index.js +20 -28
- package/lib/FileEditor/pc-editor/addition-previewer/index.js +4 -2
- package/lib/FileEditor/pc-editor/addition-previewer/local-file-addition/index.js +31 -17
- package/lib/FileEditor/pc-editor/index.js +30 -22
- package/lib/FileFormatter/index.js +20 -27
- package/lib/FileItemFormatter/index.js +10 -7
- package/lib/FileUploader/index.js +46 -29
- package/lib/FormulaFormatter/index.js +44 -24
- package/lib/GeolocationEditor/index.js +32 -27
- package/lib/GeolocationEditor/map-editor-utils.js +23 -21
- package/lib/GeolocationEditor/mb-editor/country-editor.js +14 -17
- package/lib/GeolocationEditor/mb-editor/index.js +28 -22
- package/lib/GeolocationEditor/mb-editor/location-editor.js +15 -18
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +77 -47
- 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 +25 -12
- package/lib/GeolocationEditor/pc-editor/index.js +41 -27
- package/lib/GeolocationEditor/pc-editor/location-editor.js +33 -28
- package/lib/GeolocationEditor/pc-editor/map-editor/index.js +67 -43
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.js +69 -42
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/index.js +86 -42
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/large-editor/index.js +85 -39
- package/lib/GeolocationEditor/pc-editor/province-city-editor.js +26 -20
- package/lib/GeolocationEditor/pc-editor/province-editor.js +15 -8
- package/lib/GeolocationEditor/pc-editor/selector-header-item.js +6 -5
- package/lib/GeolocationEditor/pc-editor/selector-list.js +8 -7
- package/lib/GeolocationFormatter/index.js +5 -4
- package/lib/HtmlLongTextFormatter/index.js +13 -5
- package/lib/Icon/index.js +13 -15
- package/lib/Icon/load-sprite.js +13 -2
- package/lib/IconButton/index.js +12 -13
- package/lib/ImageEditor/images-previewer/image-preview/index.js +22 -13
- package/lib/ImageEditor/images-previewer/index.js +9 -3
- package/lib/ImageEditor/index.js +16 -13
- 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 +5 -3
- package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +26 -12
- package/lib/ImageEditor/pc-editor/images-previewer/index.js +10 -4
- package/lib/ImageEditor/pc-editor/index.js +16 -11
- package/lib/ImageFormatter/images-lazy-load.js +11 -19
- package/lib/ImageFormatter/index.js +14 -12
- package/lib/ImagePreviewerLightbox/index.js +15 -19
- package/lib/ImageThumbnail/index.js +15 -12
- package/lib/InputItem/custom-input.js +55 -35
- package/lib/InputItem/custom-keyboard.js +42 -42
- package/lib/InputItem/index.js +82 -63
- package/lib/InputItem/input.js +9 -11
- 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 +13 -7
- package/lib/LinkFormatter/index.js +37 -21
- package/lib/List/index.js +17 -19
- package/lib/List/list-item.js +59 -55
- package/lib/LongTextFormatter/index.js +5 -4
- package/lib/MBEditorHeader/index.js +9 -8
- package/lib/MTimeFormatter/index.js +4 -3
- package/lib/MobileFullScreenPage/body/index.js +6 -4
- package/lib/MobileFullScreenPage/header/index.js +10 -8
- package/lib/MobileFullScreenPage/index.js +12 -14
- package/lib/MobileModal/index.js +7 -8
- 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.css +0 -4
- 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/alert.js +2 -2
- package/lib/Modal/modal.js +28 -30
- package/lib/Modal/prompt.js +14 -14
- package/lib/MultipleSelectEditor/index.js +7 -7
- package/lib/MultipleSelectFormatter/index.js +9 -7
- 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 +5 -3
- package/lib/Picker/AbstractPicker.js +35 -33
- package/lib/Popover/index.js +9 -11
- package/lib/Popover/item.js +22 -24
- package/lib/Progress/index.js +18 -17
- package/lib/Radio/Radio.js +17 -15
- package/lib/Radio/RadioItem.js +23 -19
- package/lib/RateFormatter/index.js +15 -15
- package/lib/RoleStatusEditor/index.js +18 -19
- package/lib/RowExpand/index.js +7 -6
- package/lib/RowExpandDialog/body/index.js +57 -40
- package/lib/RowExpandDialog/column-content/index.js +10 -6
- package/lib/RowExpandDialog/header/index.js +12 -9
- package/lib/RowExpandDialog/index.js +59 -63
- package/lib/RowExpandEditor/add-btn/index.js +7 -6
- package/lib/RowExpandEditor/checkbox-editor/index.js +7 -6
- 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/index.js +7 -6
- 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/index.js +7 -6
- 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/index.js +7 -6
- 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/index.js +7 -6
- package/lib/RowExpandEditor/digital-sign-editor/mb-editor/index.js +38 -24
- package/lib/RowExpandEditor/digital-sign-editor/pc-editor/index.js +39 -25
- package/lib/RowExpandEditor/duration-editor/index.js +7 -6
- 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/index.js +7 -6
- package/lib/RowExpandEditor/email-editor/mb-editor/index.js +20 -10
- package/lib/RowExpandEditor/email-editor/pc-editor/index.js +25 -14
- package/lib/RowExpandEditor/file-editor/index.js +7 -6
- 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/index.js +7 -6
- 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/index.js +7 -6
- package/lib/RowExpandEditor/image-editor/mb-editor/index.js +26 -16
- package/lib/RowExpandEditor/image-editor/pc-editor/index.js +24 -14
- package/lib/RowExpandEditor/index.js +16 -11
- package/lib/RowExpandEditor/long-text-editor/index.js +7 -6
- 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/index.js +7 -6
- package/lib/RowExpandEditor/multiple-select-editor/mb-editor/index.js +20 -12
- package/lib/RowExpandEditor/multiple-select-editor/pc-editor/index.js +38 -27
- package/lib/RowExpandEditor/number-editor/index.js +7 -6
- 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/index.js +7 -6
- package/lib/RowExpandEditor/rate-editor/mb-editor.js +26 -13
- package/lib/RowExpandEditor/rate-editor/pc-editor.js +41 -25
- package/lib/RowExpandEditor/single-select-editor/index.js +7 -6
- package/lib/RowExpandEditor/single-select-editor/mb-editor/index.js +32 -21
- package/lib/RowExpandEditor/single-select-editor/pc-editor/index.js +37 -25
- package/lib/RowExpandEditor/text-editor/index.js +7 -6
- 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/index.js +7 -6
- package/lib/RowExpandEditor/url-editor/mb-editor/index.js +15 -7
- package/lib/RowExpandEditor/url-editor/pc-editor/index.js +20 -11
- package/lib/RowExpandFormatter/department-formatter/index.js +6 -3
- 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 +8 -5
- package/lib/RowExpandFormatter/file-formatter/index.js +9 -8
- package/lib/RowExpandFormatter/file-formatter/row-expand-file-item-formatter.js +14 -12
- package/lib/RowExpandFormatter/formula-formatter/index.js +51 -30
- package/lib/RowExpandFormatter/image-formatter/index.js +11 -9
- package/lib/RowExpandFormatter/image-formatter/row-expand-image-item-formatter.js +10 -9
- package/lib/RowExpandFormatter/index.js +52 -34
- package/lib/RowExpandFormatter/link-formatter/collaborator-item-formatter.js +15 -9
- package/lib/RowExpandFormatter/link-formatter/index.js +25 -17
- package/lib/RowExpandFormatter/link-formatter/value-display-utils.js +5 -3
- package/lib/RowExpandFormatter/rate-formatter/index.js +14 -13
- package/lib/RowExpandFormatter/text/index.js +5 -4
- package/lib/RowExpandFormatter/url-formatter/index.js +9 -6
- package/lib/RowExpandView/body/index.js +43 -32
- package/lib/RowExpandView/column-content/index.js +7 -3
- package/lib/RowExpandView/index.js +52 -53
- package/lib/SelectItem/index.js +7 -5
- package/lib/SelectOptionGroup/index.js +40 -30
- package/lib/SelectedDepartments/index.js +12 -10
- package/lib/SimpleLongTextFormatter/index.js +18 -12
- 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 +7 -7
- package/lib/SingleSelectFormatter/index.js +9 -8
- package/lib/TabBar/Tab.js +26 -24
- package/lib/TabBar/index.js +28 -24
- package/lib/Tabs/index.js +13 -10
- package/lib/TextEditor/index.js +23 -14
- package/lib/TextFormatter/index.js +4 -3
- package/lib/TextareaItem/index.js +53 -48
- package/lib/Toast/index.js +9 -8
- package/lib/UrlFormatter/index.js +4 -3
- package/lib/common/editor-base.js +12 -7
- package/lib/formatterConfig/index.js +3 -3
- package/lib/hooks/common-hooks.js +4 -2
- package/lib/select-editor/index.js +16 -13
- package/lib/select-editor/mb-editor/index.js +28 -17
- package/lib/select-editor/pc-editor/index.js +47 -32
- package/lib/toaster/alert.js +8 -7
- package/lib/toaster/toast.js +4 -3
- package/lib/toaster/toastManager.js +13 -13
- package/lib/toaster/toaster.js +12 -9
- package/lib/utils/cell.js +11 -8
- package/lib/utils/class.js +3 -3
- package/lib/utils/column-utils.js +14 -8
- package/lib/utils/departments.js +6 -5
- package/lib/utils/getLocale.js +11 -5
- package/lib/utils/object-utils.js +5 -4
- package/lib/utils/url.js +29 -22
- package/lib/utils/utils.js +6 -2
- package/package.json +2 -2
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
10
|
var _reactstrap = require("reactstrap");
|
|
@@ -38,7 +37,9 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
38
37
|
this.onEnter = e => {
|
|
39
38
|
e.preventDefault();
|
|
40
39
|
let option;
|
|
41
|
-
const
|
|
40
|
+
const {
|
|
41
|
+
isSupportNewOption
|
|
42
|
+
} = this.props;
|
|
42
43
|
if (this.filteredOptions.length === 1) {
|
|
43
44
|
option = this.filteredOptions[0];
|
|
44
45
|
} else if (this.state.highlightIndex > -1) {
|
|
@@ -47,7 +48,9 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
47
48
|
if (option) {
|
|
48
49
|
this.onChange(option);
|
|
49
50
|
} else {
|
|
50
|
-
const
|
|
51
|
+
const {
|
|
52
|
+
searchValue
|
|
53
|
+
} = this.state;
|
|
51
54
|
if (searchValue && isSupportNewOption && this.filteredOptions.length === 0) {
|
|
52
55
|
e.stopPropagation();
|
|
53
56
|
this.onAddNewOption();
|
|
@@ -57,10 +60,11 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
57
60
|
this.onUpArrow = e => {
|
|
58
61
|
e.preventDefault();
|
|
59
62
|
e.stopPropagation();
|
|
60
|
-
let
|
|
61
|
-
highlightIndex
|
|
62
|
-
maxItemNum
|
|
63
|
-
itemHeight
|
|
63
|
+
let {
|
|
64
|
+
highlightIndex,
|
|
65
|
+
maxItemNum,
|
|
66
|
+
itemHeight
|
|
67
|
+
} = this.state;
|
|
64
68
|
if (highlightIndex > 0) {
|
|
65
69
|
this.setState({
|
|
66
70
|
highlightIndex: highlightIndex - 1
|
|
@@ -74,10 +78,11 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
74
78
|
this.onDownArrow = e => {
|
|
75
79
|
e.preventDefault();
|
|
76
80
|
e.stopPropagation();
|
|
77
|
-
let
|
|
78
|
-
highlightIndex
|
|
79
|
-
maxItemNum
|
|
80
|
-
itemHeight
|
|
81
|
+
let {
|
|
82
|
+
highlightIndex,
|
|
83
|
+
maxItemNum,
|
|
84
|
+
itemHeight
|
|
85
|
+
} = this.state;
|
|
81
86
|
if (highlightIndex < this.filteredOptions.length - 1) {
|
|
82
87
|
this.setState({
|
|
83
88
|
highlightIndex: highlightIndex + 1
|
|
@@ -89,8 +94,12 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
89
94
|
}
|
|
90
95
|
};
|
|
91
96
|
this.onValueChanged = searchValue => {
|
|
92
|
-
const
|
|
93
|
-
|
|
97
|
+
const {
|
|
98
|
+
searchValue: oldSearchVal
|
|
99
|
+
} = this.state;
|
|
100
|
+
const {
|
|
101
|
+
options
|
|
102
|
+
} = this.props;
|
|
94
103
|
if (oldSearchVal === searchValue) return;
|
|
95
104
|
this.setState({
|
|
96
105
|
searchValue
|
|
@@ -123,7 +132,9 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
123
132
|
}, 300);
|
|
124
133
|
};
|
|
125
134
|
this.getOptionStyle = option => {
|
|
126
|
-
const
|
|
135
|
+
const {
|
|
136
|
+
optionWidth
|
|
137
|
+
} = this.props;
|
|
127
138
|
const textColor = option.textColor || null;
|
|
128
139
|
return {
|
|
129
140
|
display: 'inline-block',
|
|
@@ -167,8 +178,9 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
167
178
|
this.ref.style.top = '-200px';
|
|
168
179
|
}
|
|
169
180
|
}
|
|
170
|
-
const
|
|
171
|
-
bottom
|
|
181
|
+
const {
|
|
182
|
+
bottom
|
|
183
|
+
} = this.ref.getBoundingClientRect();
|
|
172
184
|
if (bottom > window.innerHeight) {
|
|
173
185
|
this.ref.style.top = parseInt(this.ref.style.top) - bottom + window.innerHeight + 'px';
|
|
174
186
|
}
|
|
@@ -188,18 +200,20 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
188
200
|
}
|
|
189
201
|
}
|
|
190
202
|
render() {
|
|
191
|
-
const
|
|
192
|
-
isInModal
|
|
193
|
-
className
|
|
194
|
-
value
|
|
195
|
-
column
|
|
196
|
-
valueKey
|
|
197
|
-
isSupportNewOption
|
|
198
|
-
target
|
|
199
|
-
classNamePrefix
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
+
const {
|
|
204
|
+
isInModal,
|
|
205
|
+
className,
|
|
206
|
+
value,
|
|
207
|
+
column,
|
|
208
|
+
valueKey,
|
|
209
|
+
isSupportNewOption,
|
|
210
|
+
target,
|
|
211
|
+
classNamePrefix
|
|
212
|
+
} = this.props;
|
|
213
|
+
const {
|
|
214
|
+
searchValue,
|
|
215
|
+
highlightIndex
|
|
216
|
+
} = this.state;
|
|
203
217
|
|
|
204
218
|
// maxWidth = single-selects-container's width - single-selects-container's padding-left and padding-right - single-select-container's padding-left - single-select-check-icon's width - The gap between the single-select-check-icon and single-select-name or scroll's width
|
|
205
219
|
// maxWidth = column.width > 200 ? column.width - 20 - 12 - 20 - 10 : 200 - 20 - 12 - 20 - 10
|
|
@@ -207,7 +221,7 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
207
221
|
let maxWidth = isInModal ? 250 : (column === null || column === void 0 ? void 0 : column.width) > 200 ? column.width - 62 : 138;
|
|
208
222
|
const dom = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
209
223
|
className: (0, _classnames.default)('dtable-ui-editor-container dtable-ui-select-editor-container', className, {
|
|
210
|
-
[
|
|
224
|
+
[`${classNamePrefix}-select-editor-container`]: classNamePrefix
|
|
211
225
|
}),
|
|
212
226
|
ref: ref => this.ref = ref,
|
|
213
227
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -223,9 +237,10 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
223
237
|
ref: ref => this.container = ref,
|
|
224
238
|
children: [this.filteredOptions.length > 0 && this.filteredOptions.map((option, index) => {
|
|
225
239
|
let optionStyle = this.getOptionStyle(option);
|
|
226
|
-
optionStyle =
|
|
240
|
+
optionStyle = {
|
|
241
|
+
...optionStyle,
|
|
227
242
|
maxWidth
|
|
228
|
-
}
|
|
243
|
+
};
|
|
229
244
|
let isSelected = value.includes(option[valueKey]);
|
|
230
245
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
231
246
|
className: "select-option-item",
|
|
@@ -277,7 +292,7 @@ class PCSelectEditor extends _react.default.Component {
|
|
|
277
292
|
hideArrow: true,
|
|
278
293
|
fade: false,
|
|
279
294
|
className: (0, _classnames.default)('dtable-ui dtable-ui-row-expand-select-editor-popover', {
|
|
280
|
-
[
|
|
295
|
+
[`${classNamePrefix}-select-editor-popover`]: classNamePrefix
|
|
281
296
|
}),
|
|
282
297
|
children: dom
|
|
283
298
|
})
|
package/lib/toaster/alert.js
CHANGED
|
@@ -23,15 +23,16 @@ class Alert extends _react.default.PureComponent {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
render() {
|
|
26
|
-
const
|
|
27
|
-
intent
|
|
28
|
-
title
|
|
29
|
-
children
|
|
30
|
-
isRemovable
|
|
31
|
-
onRemove
|
|
26
|
+
const {
|
|
27
|
+
intent,
|
|
28
|
+
title,
|
|
29
|
+
children,
|
|
30
|
+
isRemovable,
|
|
31
|
+
onRemove
|
|
32
|
+
} = this.props;
|
|
32
33
|
const iconClass = this.getIconClass(intent);
|
|
33
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
34
|
-
className:
|
|
35
|
+
className: `dtable-toast-alert-container ${intent || 'success'}`,
|
|
35
36
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
36
37
|
className: "toast-alert-icon",
|
|
37
38
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
package/lib/toaster/toast.js
CHANGED
|
@@ -52,8 +52,9 @@ class Toast extends _react.default.PureComponent {
|
|
|
52
52
|
this.onRef = ref => {
|
|
53
53
|
if (ref === null) return;
|
|
54
54
|
setTimeout(() => {
|
|
55
|
-
const
|
|
56
|
-
height
|
|
55
|
+
const {
|
|
56
|
+
height
|
|
57
|
+
} = ref.getBoundingClientRect();
|
|
57
58
|
this.containerRef.current.style.height = height + 'px';
|
|
58
59
|
}, 1);
|
|
59
60
|
};
|
|
@@ -83,7 +84,7 @@ class Toast extends _react.default.PureComponent {
|
|
|
83
84
|
onExited: this.props.onRemove,
|
|
84
85
|
children: state => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
85
86
|
"data-state": state,
|
|
86
|
-
className:
|
|
87
|
+
className: `dtable-toast-container ${state}`,
|
|
87
88
|
onMouseEnter: this.handleMouseEnter,
|
|
88
89
|
onMouseLeave: this.handleMouseLeave,
|
|
89
90
|
style: {
|
|
@@ -5,12 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
var _toast = _interopRequireDefault(require("./toast"));
|
|
12
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
const _excluded = ["id", "description"];
|
|
14
11
|
const hasCustomId = settings => Object.hasOwnProperty.call(settings, 'id');
|
|
15
12
|
class ToastManager extends _react.default.PureComponent {
|
|
16
13
|
constructor(props, context) {
|
|
@@ -42,7 +39,7 @@ class ToastManager extends _react.default.PureComponent {
|
|
|
42
39
|
};
|
|
43
40
|
this.createToastInstance = (title, settings) => {
|
|
44
41
|
const uniqueId = ++ToastManager.idCounter;
|
|
45
|
-
const id = hasCustomId(settings) ?
|
|
42
|
+
const id = hasCustomId(settings) ? `${settings.id}-${uniqueId}` : uniqueId;
|
|
46
43
|
let hasCloseButton = settings.hasCloseButton || true;
|
|
47
44
|
let duration = settings.duration || 2;
|
|
48
45
|
if (settings.hasCloseButton !== undefined) {
|
|
@@ -70,9 +67,10 @@ class ToastManager extends _react.default.PureComponent {
|
|
|
70
67
|
return {
|
|
71
68
|
toasts: previousState.toasts.map(toast => {
|
|
72
69
|
if (toast.id === id) {
|
|
73
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
...toast,
|
|
74
72
|
isShown: false
|
|
75
|
-
}
|
|
73
|
+
};
|
|
76
74
|
}
|
|
77
75
|
return toast;
|
|
78
76
|
})
|
|
@@ -97,14 +95,16 @@ class ToastManager extends _react.default.PureComponent {
|
|
|
97
95
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
96
|
className: "dtable-toast-manager",
|
|
99
97
|
children: this.state.toasts.map(_ref => {
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
let {
|
|
99
|
+
id,
|
|
100
|
+
description,
|
|
101
|
+
...props
|
|
102
|
+
} = _ref;
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_toast.default, {
|
|
104
|
+
onRemove: () => this.removeToast(id),
|
|
105
|
+
...props,
|
|
106
106
|
children: description
|
|
107
|
-
}
|
|
107
|
+
}, id);
|
|
108
108
|
})
|
|
109
109
|
});
|
|
110
110
|
}
|
package/lib/toaster/toaster.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _client = require("react-dom/client");
|
|
11
10
|
var _toastManager = _interopRequireDefault(require("./toastManager"));
|
|
@@ -37,27 +36,31 @@ class Toaster {
|
|
|
37
36
|
};
|
|
38
37
|
this.notify = function (title) {
|
|
39
38
|
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
|
-
return _this.notifyHandler(title,
|
|
39
|
+
return _this.notifyHandler(title, {
|
|
40
|
+
...settings,
|
|
41
41
|
intent: 'none'
|
|
42
|
-
})
|
|
42
|
+
});
|
|
43
43
|
};
|
|
44
44
|
this.success = function (title) {
|
|
45
45
|
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46
|
-
return _this.notifyHandler(title,
|
|
46
|
+
return _this.notifyHandler(title, {
|
|
47
|
+
...settings,
|
|
47
48
|
intent: 'success'
|
|
48
|
-
})
|
|
49
|
+
});
|
|
49
50
|
};
|
|
50
51
|
this.warning = function (title) {
|
|
51
52
|
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52
|
-
return _this.notifyHandler(title,
|
|
53
|
+
return _this.notifyHandler(title, {
|
|
54
|
+
...settings,
|
|
53
55
|
intent: 'warning'
|
|
54
|
-
})
|
|
56
|
+
});
|
|
55
57
|
};
|
|
56
58
|
this.danger = function (title) {
|
|
57
59
|
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
58
|
-
return _this.notifyHandler(title,
|
|
60
|
+
return _this.notifyHandler(title, {
|
|
61
|
+
...settings,
|
|
59
62
|
intent: 'danger'
|
|
60
|
-
})
|
|
63
|
+
});
|
|
61
64
|
};
|
|
62
65
|
if (!isBrowser) return;
|
|
63
66
|
const container = document.createElement('div');
|
package/lib/utils/cell.js
CHANGED
|
@@ -7,9 +7,10 @@ exports.isValidPosition = exports.isLongTextValueExceedLimit = exports.checkValu
|
|
|
7
7
|
var _constants = require("../constants");
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
const checkValueConformityFormat = (columnData, value) => {
|
|
10
|
-
const
|
|
11
|
-
format_specification_value
|
|
12
|
-
format_check_type
|
|
10
|
+
const {
|
|
11
|
+
format_specification_value,
|
|
12
|
+
format_check_type
|
|
13
|
+
} = columnData || {};
|
|
13
14
|
let isMatched = false;
|
|
14
15
|
if (format_check_type !== 'custom_format') {
|
|
15
16
|
const reg = _constants.FORMAT_REG_EXP_LIST[format_check_type];
|
|
@@ -22,9 +23,10 @@ const checkValueConformityFormat = (columnData, value) => {
|
|
|
22
23
|
};
|
|
23
24
|
exports.checkValueConformityFormat = checkValueConformityFormat;
|
|
24
25
|
const checkNumberValidation = (columnData, value) => {
|
|
25
|
-
const
|
|
26
|
-
format_max_value
|
|
27
|
-
format_min_value
|
|
26
|
+
const {
|
|
27
|
+
format_max_value,
|
|
28
|
+
format_min_value
|
|
29
|
+
} = columnData || {};
|
|
28
30
|
const num = parseFloat(value);
|
|
29
31
|
if (isNaN(num) || !num && num !== 0) {
|
|
30
32
|
return false;
|
|
@@ -41,8 +43,9 @@ exports.checkNumberValidation = checkNumberValidation;
|
|
|
41
43
|
const isLongTextValueExceedLimit = value => {
|
|
42
44
|
if (!value) return false;
|
|
43
45
|
if (typeof value === 'string') return value.length >= _constants.LONG_TEXT_LENGTH_LIMIT;
|
|
44
|
-
const
|
|
45
|
-
text
|
|
46
|
+
const {
|
|
47
|
+
text
|
|
48
|
+
} = value || {};
|
|
46
49
|
return text ? text.length >= _constants.LONG_TEXT_LENGTH_LIMIT : false;
|
|
47
50
|
};
|
|
48
51
|
exports.isLongTextValueExceedLimit = isLongTextValueExceedLimit;
|
package/lib/utils/class.js
CHANGED
|
@@ -11,14 +11,14 @@ function hasClass(node, className) {
|
|
|
11
11
|
return node.classList.contains(className);
|
|
12
12
|
}
|
|
13
13
|
const originClass = node.className;
|
|
14
|
-
return
|
|
14
|
+
return ` ${originClass} `.indexOf(` ${className} `) > -1;
|
|
15
15
|
}
|
|
16
16
|
function addClass(node, className) {
|
|
17
17
|
if (node.classList) {
|
|
18
18
|
node.classList.add(className);
|
|
19
19
|
} else {
|
|
20
20
|
if (!hasClass(node, className)) {
|
|
21
|
-
node.className =
|
|
21
|
+
node.className = `${node.className} ${className}`;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -28,7 +28,7 @@ function removeClass(node, className) {
|
|
|
28
28
|
} else {
|
|
29
29
|
if (hasClass(node, className)) {
|
|
30
30
|
const originClass = node.className;
|
|
31
|
-
node.className =
|
|
31
|
+
node.className = ` ${originClass} `.replace(` ${className} `, '');
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -9,9 +9,12 @@ exports.isEnableCheckFormat = void 0;
|
|
|
9
9
|
var _dtableUtils = require("dtable-utils");
|
|
10
10
|
const isEnableCheckFormat = column => {
|
|
11
11
|
if (!column) return false;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const {
|
|
13
|
+
data
|
|
14
|
+
} = column;
|
|
15
|
+
const {
|
|
16
|
+
enable_check_format
|
|
17
|
+
} = data || {};
|
|
15
18
|
if (enable_check_format) return true;
|
|
16
19
|
return false;
|
|
17
20
|
};
|
|
@@ -23,12 +26,15 @@ const getDateColumnFormat = column => {
|
|
|
23
26
|
};
|
|
24
27
|
exports.getDateColumnFormat = getDateColumnFormat;
|
|
25
28
|
function isCheckboxColumn(column) {
|
|
26
|
-
let
|
|
27
|
-
|
|
29
|
+
let {
|
|
30
|
+
type,
|
|
31
|
+
data
|
|
32
|
+
} = column;
|
|
28
33
|
if (_dtableUtils.FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
29
|
-
const
|
|
30
|
-
result_type
|
|
31
|
-
array_type
|
|
34
|
+
const {
|
|
35
|
+
result_type,
|
|
36
|
+
array_type
|
|
37
|
+
} = data || {};
|
|
32
38
|
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
|
|
33
39
|
return array_type === _dtableUtils.CellType.CHECKBOX;
|
|
34
40
|
}
|
package/lib/utils/departments.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.searchDepartments = exports.getNormalizedDepartments = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
7
|
const searchDepartments = (departments, searchValue) => {
|
|
10
8
|
const validSearchValue = searchValue ? searchValue.trim().toLowerCase() : '';
|
|
11
9
|
const validDepartments = Array.isArray(departments) ? departments : [];
|
|
12
10
|
if (!validSearchValue) return validDepartments;
|
|
13
11
|
return validDepartments.filter(department => {
|
|
14
|
-
const
|
|
12
|
+
const {
|
|
13
|
+
name
|
|
14
|
+
} = department;
|
|
15
15
|
if (!name) return false;
|
|
16
16
|
return name.toString().toLowerCase().indexOf(validSearchValue) > -1;
|
|
17
17
|
});
|
|
@@ -27,10 +27,11 @@ const getNormalizedDepartments = function (departments) {
|
|
|
27
27
|
return departments.map(depart => {
|
|
28
28
|
const hasChild = canExpand && !!parentIdMap[depart.id];
|
|
29
29
|
const isExpanded = depart.parent_id === -1 ? true : false;
|
|
30
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
...depart,
|
|
31
32
|
hasChild,
|
|
32
33
|
isExpanded
|
|
33
|
-
}
|
|
34
|
+
};
|
|
34
35
|
});
|
|
35
36
|
};
|
|
36
37
|
exports.getNormalizedDepartments = getNormalizedDepartments;
|
package/lib/utils/getLocale.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.getComponentLocale = getComponentLocale;
|
|
8
7
|
exports.getLocaleCode = getLocaleCode;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
8
|
function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
|
11
9
|
let locale = {};
|
|
12
10
|
if (context && context.antLocale && context.antLocale[componentName]) {
|
|
@@ -17,11 +15,19 @@ function getComponentLocale(props, context, componentName, getDefaultLocale) {
|
|
|
17
15
|
// https://github.com/ant-design/ant-design/issues/6334
|
|
18
16
|
locale = defaultLocale.default || defaultLocale;
|
|
19
17
|
}
|
|
20
|
-
let result =
|
|
18
|
+
let result = {
|
|
19
|
+
...locale
|
|
20
|
+
};
|
|
21
21
|
if (props.locale) {
|
|
22
|
-
result =
|
|
22
|
+
result = {
|
|
23
|
+
...result,
|
|
24
|
+
...props.locale
|
|
25
|
+
};
|
|
23
26
|
if (props.locale.lang) {
|
|
24
|
-
result.lang =
|
|
27
|
+
result.lang = {
|
|
28
|
+
...locale.lang,
|
|
29
|
+
...props.locale.lang
|
|
30
|
+
};
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
return result;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.shallowCloneObject = exports.hasOwnProperty = exports.default = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
7
|
class ObjectUtils {
|
|
10
8
|
static getDataType(data) {
|
|
11
9
|
let type = typeof data;
|
|
@@ -19,13 +17,16 @@ class ObjectUtils {
|
|
|
19
17
|
}
|
|
20
18
|
static isObjectChanged(source, comparison) {
|
|
21
19
|
if (!this.iterable(source)) {
|
|
22
|
-
throw new Error(
|
|
20
|
+
throw new Error(`source should be a Object or Array , but got ${this.getDataType(source)}`);
|
|
23
21
|
}
|
|
24
22
|
if (this.getDataType(source) !== this.getDataType(comparison)) {
|
|
25
23
|
return true;
|
|
26
24
|
}
|
|
27
25
|
const sourceKeys = Object.keys(source);
|
|
28
|
-
const comparisonKeys = Object.keys(
|
|
26
|
+
const comparisonKeys = Object.keys({
|
|
27
|
+
...source,
|
|
28
|
+
...comparison
|
|
29
|
+
});
|
|
29
30
|
if (sourceKeys.length !== comparisonKeys.length) {
|
|
30
31
|
return true;
|
|
31
32
|
}
|
package/lib/utils/url.js
CHANGED
|
@@ -72,28 +72,32 @@ const needUseThumbnailImage = url => {
|
|
|
72
72
|
exports.needUseThumbnailImage = needUseThumbnailImage;
|
|
73
73
|
const generateCurrentBaseImageThumbnailUrl = _ref => {
|
|
74
74
|
var _window2;
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
let {
|
|
76
|
+
server,
|
|
77
|
+
workspaceID,
|
|
78
|
+
dtableUuid,
|
|
79
|
+
partUrl,
|
|
80
|
+
size
|
|
81
|
+
} = _ref;
|
|
80
82
|
const validServer = server || ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.dtable) && window.dtable.server || '';
|
|
81
83
|
if (!partUrl || typeof partUrl !== 'string') return '';
|
|
82
|
-
let url =
|
|
83
|
-
if (url.indexOf('?') > -1) return
|
|
84
|
-
return
|
|
84
|
+
let url = `${validServer}/thumbnail/workspace/${workspaceID}/asset/${dtableUuid}${partUrl}`;
|
|
85
|
+
if (url.indexOf('?') > -1) return `${url}&size=${size}`;
|
|
86
|
+
return `${url}?size=${size}`;
|
|
85
87
|
};
|
|
86
88
|
exports.generateCurrentBaseImageThumbnailUrl = generateCurrentBaseImageThumbnailUrl;
|
|
87
89
|
const generateCurrentBaseImageUrl = _ref2 => {
|
|
88
90
|
var _window3;
|
|
89
|
-
let
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
let {
|
|
92
|
+
server,
|
|
93
|
+
workspaceID,
|
|
94
|
+
dtableUuid,
|
|
95
|
+
partUrl
|
|
96
|
+
} = _ref2;
|
|
93
97
|
if (!partUrl || typeof partUrl !== 'string') return '';
|
|
94
98
|
if (partUrl.startsWith('http')) return partUrl;
|
|
95
99
|
const validServer = server || ((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.dtable) && window.dtable.server || '';
|
|
96
|
-
return
|
|
100
|
+
return `${validServer}/workspace/${workspaceID}/asset/${dtableUuid}${partUrl}`;
|
|
97
101
|
};
|
|
98
102
|
exports.generateCurrentBaseImageUrl = generateCurrentBaseImageUrl;
|
|
99
103
|
const getFileName = url => {
|
|
@@ -120,9 +124,9 @@ const imageCheck = filename => {
|
|
|
120
124
|
};
|
|
121
125
|
exports.imageCheck = imageCheck;
|
|
122
126
|
const isInternalURL = function (url) {
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
let {
|
|
128
|
+
server = ''
|
|
129
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
126
130
|
if (!url || typeof url !== 'string') return false;
|
|
127
131
|
return server && url.indexOf(server) > -1;
|
|
128
132
|
};
|
|
@@ -131,8 +135,10 @@ const getValidFileImageUrls = files => {
|
|
|
131
135
|
if (!Array.isArray(files)) return [];
|
|
132
136
|
return files.map(file => {
|
|
133
137
|
if (typeof file !== 'object') return null;
|
|
134
|
-
const
|
|
135
|
-
|
|
138
|
+
const {
|
|
139
|
+
url,
|
|
140
|
+
name
|
|
141
|
+
} = file;
|
|
136
142
|
if (!url || url.indexOf('/asset') < 0) return null;
|
|
137
143
|
return imageCheck(name) ? url : null;
|
|
138
144
|
}).filter(Boolean);
|
|
@@ -157,10 +163,11 @@ const getFileIconUrl = (filename, direntType) => {
|
|
|
157
163
|
};
|
|
158
164
|
exports.getFileIconUrl = getFileIconUrl;
|
|
159
165
|
const getFileThumbnailInfo = function (file) {
|
|
160
|
-
let
|
|
161
|
-
server
|
|
162
|
-
dtableUuid
|
|
163
|
-
workspaceID
|
|
166
|
+
let {
|
|
167
|
+
server,
|
|
168
|
+
dtableUuid,
|
|
169
|
+
workspaceID
|
|
170
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
164
171
|
const defaultIcon = _file.FILEEXT_ICON_MAP['default'];
|
|
165
172
|
const defaultIconUrl = _file.FILEEXT_ICON_URL_MAP[defaultIcon];
|
|
166
173
|
if (!file || !file.name) return {
|
package/lib/utils/utils.js
CHANGED
|
@@ -163,12 +163,16 @@ const getFormulaArrayValue = value => {
|
|
|
163
163
|
return item;
|
|
164
164
|
}
|
|
165
165
|
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
166
|
-
const
|
|
166
|
+
const {
|
|
167
|
+
display_value
|
|
168
|
+
} = item;
|
|
167
169
|
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
168
170
|
return display_value.map(i => {
|
|
169
171
|
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
170
172
|
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
171
|
-
const
|
|
173
|
+
const {
|
|
174
|
+
display_value
|
|
175
|
+
} = i;
|
|
172
176
|
return display_value;
|
|
173
177
|
}
|
|
174
178
|
return i;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.15",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "5.0.9",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"babel-plugin-import": "^1.13.6",
|
|
88
88
|
"babel-plugin-named-asset-import": "^0.3.6",
|
|
89
89
|
"babel-preset-react-app": "^10.0.1",
|
|
90
|
-
"browserslist": "^4.
|
|
90
|
+
"browserslist": "^4.28.8",
|
|
91
91
|
"camelcase": "^6.2.1",
|
|
92
92
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
93
93
|
"circular-dependency-plugin": "^5.2.2",
|