dtable-ui-component 4.3.7 → 4.3.9-alpha1
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/AutoNumberFormatter/index.js +11 -24
- package/lib/ButtonFormatter/index.js +29 -45
- package/lib/CTimeFormatter/index.js +17 -32
- package/lib/CheckboxEditor/index.js +42 -49
- package/lib/CheckboxFormatter/index.js +17 -30
- package/lib/CollaboratorEditor/index.js +118 -135
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
- package/lib/CollaboratorFormatter/index.js +26 -42
- package/lib/CollaboratorItem/index.js +31 -44
- package/lib/CreatorFormatter/index.js +24 -40
- package/lib/DTableCustomizeCollaboratorSelect/index.css +1 -1
- package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
- package/lib/DTableCustomizeSelect/index.js +92 -103
- package/lib/DTablePopover/index.js +52 -71
- package/lib/DTablePopover/utils.js +1 -1
- package/lib/DTableRadio/index.js +9 -7
- package/lib/DTableSearchInput/index.js +89 -99
- package/lib/DTableSearchInput/utils.js +2 -2
- package/lib/DTableSelect/dtable-select-label.js +5 -3
- package/lib/DTableSelect/index.js +50 -64
- package/lib/DTableSelect/utils.js +36 -41
- package/lib/DTableSwitch/index.js +7 -5
- package/lib/DateEditor/index.js +88 -94
- package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
- package/lib/DateEditor/pc-date-editor-popover.js +70 -77
- package/lib/DateFormatter/index.js +15 -28
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
- package/lib/DigitalSignFormatter/index.js +55 -65
- package/lib/DigitalSignFormatter/utils.js +9 -8
- package/lib/DurationFormatter/index.js +14 -27
- package/lib/EditEditorButton/index.js +10 -22
- package/lib/EmailFormatter/index.js +11 -24
- package/lib/FieldDisplaySetting/field-item.js +18 -20
- package/lib/FieldDisplaySetting/index.js +41 -43
- package/lib/FileEditor/index.js +18 -29
- package/lib/FileFormatter/index.js +29 -43
- package/lib/FileItemFormatter/index.js +17 -32
- package/lib/FileItemFormatter/utils.js +5 -5
- package/lib/FileUploader/index.js +20 -33
- package/lib/FormulaFormatter/cell-value-validator.js +23 -8
- package/lib/FormulaFormatter/index.js +77 -83
- package/lib/FormulaFormatter/utils.js +27 -21
- package/lib/GeolocationFormatter/index.js +19 -32
- package/lib/HtmlLongTextFormatter/index.js +43 -52
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
- package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
- package/lib/ImageFormatter/images-lazy-load.js +71 -79
- package/lib/ImageFormatter/index.js +86 -97
- package/lib/ImageFormatter/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +20 -18
- package/lib/ImagePreviewerLightbox/utils.js +3 -3
- package/lib/LastModifierFormatter/index.js +24 -40
- package/lib/LinkEditor/index.js +163 -167
- package/lib/LinkEditor/link-editor-option.js +41 -56
- package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
- package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
- package/lib/LinkFormatter/index.js +75 -77
- package/lib/LongTextFormatter/index.js +5 -3
- package/lib/MBEditorHeader/index.js +25 -38
- package/lib/MTimeFormatter/index.js +17 -32
- package/lib/ModalPortal/index.js +15 -32
- package/lib/MultipleSelectEditor/index.js +118 -136
- package/lib/MultipleSelectFormatter/index.js +24 -40
- package/lib/NotificationPopover/index.js +68 -95
- package/lib/NumberEditor/index.js +75 -82
- package/lib/NumberFormatter/index.js +15 -28
- package/lib/RateFormatter/index.js +29 -45
- package/lib/RoleStatusEditor/index.js +20 -22
- package/lib/RowExpandEmailFormatter/index.js +24 -37
- package/lib/RowExpandFileFormatter/index.js +28 -42
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
- package/lib/RowExpandFormatter/index.js +92 -96
- package/lib/RowExpandFormulaFormatter/index.js +85 -91
- package/lib/RowExpandImageFormatter/index.js +65 -82
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
- package/lib/RowExpandImageFormatter/utils.js +1 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
- package/lib/RowExpandLinkFormatter/index.js +131 -137
- package/lib/RowExpandLinkFormatter/utils.js +23 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
- package/lib/RowExpandRateFormatter/index.js +27 -42
- package/lib/RowExpandUrlFormatter/index.js +27 -40
- package/lib/SelectItem/index.js +17 -33
- package/lib/SelectOptionGroup/index.css +1 -1
- package/lib/SelectOptionGroup/index.js +141 -159
- package/lib/SelectOptionGroup/option.js +24 -40
- package/lib/SimpleLongTextFormatter/index.js +55 -67
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
- package/lib/SingleSelectEditor/index.js +108 -119
- package/lib/SingleSelectFormatter/index.js +21 -37
- package/lib/TextEditor/index.js +45 -51
- package/lib/TextFormatter/index.js +17 -32
- package/lib/UrlFormatter/index.js +11 -24
- package/lib/cellFormatterFactory/index.js +8 -17
- package/lib/common/ClickOutside.js +22 -43
- package/lib/common/delete-tip.js +40 -65
- package/lib/common/modal-portal.js +15 -33
- package/lib/constants/index.js +5 -5
- package/lib/data/dtable-value.js +4 -4
- package/lib/formatterConfig/base-formatter-config.js +24 -3
- package/lib/formatterConfig/index.js +5 -4
- package/lib/lang/index.js +6 -6
- package/lib/locals/de.js +1 -1
- package/lib/locals/en.js +1 -1
- package/lib/locals/fr.js +1 -1
- package/lib/locals/zh-CN.js +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
- package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
- package/lib/select-editor/select-editor-option.js +41 -56
- package/lib/toaster/alert.js +41 -135
- package/lib/toaster/index.css +116 -0
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +71 -136
- package/lib/toaster/toastManager.js +54 -100
- package/lib/toaster/toaster.js +59 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- package/package.json +5 -6
|
@@ -1,74 +1,38 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
5
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
-
var _excluded = ["id", "description"];
|
|
10
1
|
import React from 'react';
|
|
11
|
-
import { css } from 'glamor';
|
|
12
2
|
import Toast from './toast';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
position: 'fixed',
|
|
20
|
-
zIndex: 999999
|
|
21
|
-
});
|
|
22
|
-
var hasCustomId = function hasCustomId(settings) {
|
|
23
|
-
return Object.hasOwnProperty.call(settings, 'id');
|
|
24
|
-
};
|
|
25
|
-
var ToastManager = /*#__PURE__*/function (_React$PureComponent) {
|
|
26
|
-
_inherits(ToastManager, _React$PureComponent);
|
|
27
|
-
var _super = _createSuper(ToastManager);
|
|
28
|
-
function ToastManager(props, context) {
|
|
29
|
-
var _this;
|
|
30
|
-
_classCallCheck(this, ToastManager);
|
|
31
|
-
_this = _super.call(this, props, context);
|
|
32
|
-
_this.getToasts = function () {
|
|
33
|
-
return _this.state.toasts;
|
|
3
|
+
const hasCustomId = settings => Object.hasOwnProperty.call(settings, 'id');
|
|
4
|
+
export default class ToastManager extends React.PureComponent {
|
|
5
|
+
constructor(props, context) {
|
|
6
|
+
super(props, context);
|
|
7
|
+
this.getToasts = () => {
|
|
8
|
+
return this.state.toasts;
|
|
34
9
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return toast.close();
|
|
38
|
-
});
|
|
10
|
+
this.closeAll = () => {
|
|
11
|
+
this.getToasts().forEach(toast => toast.close());
|
|
39
12
|
};
|
|
40
|
-
|
|
13
|
+
this.notify = (title, settings) => {
|
|
41
14
|
// If there's a custom toast ID passed, close existing toasts with the same custom ID
|
|
42
15
|
if (hasCustomId(settings)) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var toast = _step.value;
|
|
48
|
-
// Since unique ID is still appended to a custom ID, skip the unique ID and check only prefix
|
|
49
|
-
if (String(toast.id).startsWith(settings.id)) {
|
|
50
|
-
_this.closeToast(toast.id);
|
|
51
|
-
}
|
|
16
|
+
for (const toast of this.state.toasts) {
|
|
17
|
+
// Since unique ID is still appended to a custom ID, skip the unique ID and check only prefix
|
|
18
|
+
if (String(toast.id).startsWith(settings.id)) {
|
|
19
|
+
this.closeToast(toast.id);
|
|
52
20
|
}
|
|
53
|
-
} catch (err) {
|
|
54
|
-
_iterator.e(err);
|
|
55
|
-
} finally {
|
|
56
|
-
_iterator.f();
|
|
57
21
|
}
|
|
58
22
|
}
|
|
59
|
-
|
|
60
|
-
|
|
23
|
+
const instance = this.createToastInstance(title, settings);
|
|
24
|
+
this.setState(previousState => {
|
|
61
25
|
return {
|
|
62
|
-
toasts: [instance
|
|
26
|
+
toasts: [instance, ...previousState.toasts]
|
|
63
27
|
};
|
|
64
28
|
});
|
|
65
29
|
return instance;
|
|
66
30
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
31
|
+
this.createToastInstance = (title, settings) => {
|
|
32
|
+
const uniqueId = ++ToastManager.idCounter;
|
|
33
|
+
const id = hasCustomId(settings) ? "".concat(settings.id, "-").concat(uniqueId) : uniqueId;
|
|
34
|
+
let hasCloseButton = settings.hasCloseButton || true;
|
|
35
|
+
let duration = settings.duration || 2;
|
|
72
36
|
if (settings.hasCloseButton !== undefined) {
|
|
73
37
|
hasCloseButton = settings.hasCloseButton;
|
|
74
38
|
}
|
|
@@ -76,14 +40,12 @@ var ToastManager = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
76
40
|
duration = settings.duration;
|
|
77
41
|
}
|
|
78
42
|
return {
|
|
79
|
-
id
|
|
80
|
-
title
|
|
43
|
+
id,
|
|
44
|
+
title,
|
|
81
45
|
description: settings.description,
|
|
82
46
|
hasCloseButton: hasCloseButton,
|
|
83
47
|
duration: duration,
|
|
84
|
-
close:
|
|
85
|
-
return _this.closeToast(id);
|
|
86
|
-
},
|
|
48
|
+
close: () => this.closeToast(id),
|
|
87
49
|
intent: settings.intent
|
|
88
50
|
};
|
|
89
51
|
};
|
|
@@ -91,57 +53,49 @@ var ToastManager = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
91
53
|
* This will set isShown on the Toast which will close the toast.
|
|
92
54
|
* It won't remove the toast until onExited triggers onRemove.
|
|
93
55
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
56
|
+
this.closeToast = id => {
|
|
57
|
+
this.setState(previousState => {
|
|
96
58
|
return {
|
|
97
|
-
toasts: previousState.toasts.map(
|
|
59
|
+
toasts: previousState.toasts.map(toast => {
|
|
98
60
|
if (toast.id === id) {
|
|
99
|
-
return
|
|
61
|
+
return {
|
|
62
|
+
...toast,
|
|
100
63
|
isShown: false
|
|
101
|
-
}
|
|
64
|
+
};
|
|
102
65
|
}
|
|
103
66
|
return toast;
|
|
104
67
|
})
|
|
105
68
|
};
|
|
106
69
|
});
|
|
107
70
|
};
|
|
108
|
-
|
|
109
|
-
|
|
71
|
+
this.removeToast = id => {
|
|
72
|
+
this.setState(previousState => {
|
|
110
73
|
return {
|
|
111
|
-
toasts: previousState.toasts.filter(
|
|
112
|
-
return toast.id !== id;
|
|
113
|
-
})
|
|
74
|
+
toasts: previousState.toasts.filter(toast => toast.id !== id)
|
|
114
75
|
};
|
|
115
76
|
});
|
|
116
77
|
};
|
|
117
|
-
props.bindNotify(
|
|
118
|
-
props.bindGetToasts(
|
|
119
|
-
props.bindCloseAll(
|
|
120
|
-
|
|
78
|
+
props.bindNotify(this.notify);
|
|
79
|
+
props.bindGetToasts(this.getToasts);
|
|
80
|
+
props.bindCloseAll(this.closeAll);
|
|
81
|
+
this.state = {
|
|
121
82
|
toasts: []
|
|
122
83
|
};
|
|
123
|
-
return _this;
|
|
124
84
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
}]);
|
|
144
|
-
return ToastManager;
|
|
145
|
-
}(React.PureComponent);
|
|
146
|
-
ToastManager.idCounter = 0;
|
|
147
|
-
export { ToastManager as default };
|
|
85
|
+
render() {
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "dtable-toast-manager"
|
|
88
|
+
}, this.state.toasts.map(_ref => {
|
|
89
|
+
let {
|
|
90
|
+
id,
|
|
91
|
+
description,
|
|
92
|
+
...props
|
|
93
|
+
} = _ref;
|
|
94
|
+
return /*#__PURE__*/React.createElement(Toast, Object.assign({
|
|
95
|
+
key: id,
|
|
96
|
+
onRemove: () => this.removeToast(id)
|
|
97
|
+
}, props), description);
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
ToastManager.idCounter = 0;
|
package/lib/toaster/toaster.js
CHANGED
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
1
|
import React from 'react';
|
|
5
2
|
import ReactDOM from 'react-dom';
|
|
6
3
|
import ToastManager from './toastManager';
|
|
7
|
-
|
|
4
|
+
import './index.css';
|
|
5
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* The Toaster manages the interactionsb between
|
|
11
9
|
* the ToasterManger and the toast API.
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
11
|
+
export default class Toaster {
|
|
12
|
+
constructor() {
|
|
13
|
+
var _this = this;
|
|
14
|
+
this._bindNotify = handler => {
|
|
15
|
+
this.notifyHandler = handler;
|
|
16
|
+
};
|
|
17
|
+
this._bindGetToasts = handler => {
|
|
18
|
+
this.getToastsHandler = handler;
|
|
19
|
+
};
|
|
20
|
+
this._bindCloseAll = handler => {
|
|
21
|
+
this.closeAllHandler = handler;
|
|
22
|
+
};
|
|
23
|
+
this.getToasts = () => {
|
|
24
|
+
return this.getToastsHandler();
|
|
25
|
+
};
|
|
26
|
+
this.closeAll = () => {
|
|
27
|
+
return this.closeAllHandler();
|
|
28
|
+
};
|
|
29
|
+
this.notify = function (title) {
|
|
30
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
|
+
return _this.notifyHandler(title, {
|
|
32
|
+
...settings,
|
|
33
|
+
intent: 'none'
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
this.success = function (title) {
|
|
37
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
38
|
+
return _this.notifyHandler(title, {
|
|
39
|
+
...settings,
|
|
40
|
+
intent: 'success'
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.warning = function (title) {
|
|
44
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
45
|
+
return _this.notifyHandler(title, {
|
|
46
|
+
...settings,
|
|
47
|
+
intent: 'warning'
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
this.danger = function (title) {
|
|
51
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52
|
+
return _this.notifyHandler(title, {
|
|
53
|
+
...settings,
|
|
54
|
+
intent: 'danger'
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
if (!isBrowser) return;
|
|
58
|
+
const container = document.createElement('div');
|
|
59
|
+
container.setAttribute('data-evergreen-toaster-container', '');
|
|
60
|
+
document.body.appendChild(container);
|
|
61
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(ToastManager, {
|
|
62
|
+
bindNotify: this._bindNotify,
|
|
63
|
+
bindGetToasts: this._bindGetToasts,
|
|
64
|
+
bindCloseAll: this._bindCloseAll
|
|
65
|
+
}), container);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
1
|
+
const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
|
|
2
|
+
const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
|
|
3
|
+
const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
|
|
4
|
+
const frFR = require('@seafile/seafile-calendar/lib/locale/fr_FR');
|
|
5
|
+
const deDE = require('@seafile/seafile-calendar/lib/locale/de_DE');
|
|
6
|
+
const esES = require('@seafile/seafile-calendar/lib/locale/es_ES');
|
|
7
|
+
const plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
|
|
8
|
+
const ptBR = require('@seafile/seafile-calendar/lib/locale/pt_BR');
|
|
9
|
+
const csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
|
|
10
|
+
const ruRU = require('@seafile/seafile-calendar/lib/locale/ru_RU');
|
|
11
|
+
export const initDateEditorLanguage = lang => {
|
|
12
|
+
let language;
|
|
13
13
|
switch (lang) {
|
|
14
14
|
case 'zh-cn':
|
|
15
15
|
language = zhCN;
|
|
@@ -52,15 +52,13 @@ export var initDateEditorLanguage = function initDateEditorLanguage(lang) {
|
|
|
52
52
|
}
|
|
53
53
|
return language;
|
|
54
54
|
};
|
|
55
|
-
export
|
|
56
|
-
return options.find(
|
|
57
|
-
return option.id === optionId;
|
|
58
|
-
});
|
|
55
|
+
export const getSelectOptionItem = (options, optionId) => {
|
|
56
|
+
return options.find(option => option.id === optionId);
|
|
59
57
|
};
|
|
60
|
-
export
|
|
61
|
-
|
|
58
|
+
export const isValidUrl = url => {
|
|
59
|
+
const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
|
|
62
60
|
return reg.test(url);
|
|
63
61
|
};
|
|
64
|
-
export
|
|
62
|
+
export const getTrimmedString = value => {
|
|
65
63
|
return typeof value === 'string' ? value.trim() : '';
|
|
66
64
|
};
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export const debounce = (fn, wait) => {
|
|
2
|
+
let timeout = null;
|
|
3
3
|
return function () {
|
|
4
4
|
if (timeout !== null) clearTimeout(timeout);
|
|
5
5
|
timeout = setTimeout(fn, wait);
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export const throttle = (func, delay) => {
|
|
9
|
+
let timer = null;
|
|
10
|
+
let startTime = Date.now();
|
|
11
11
|
return function () {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let curTime = Date.now();
|
|
13
|
+
let remaining = delay - (curTime - startTime);
|
|
14
|
+
let context = this;
|
|
15
|
+
let args = arguments;
|
|
16
16
|
clearTimeout(timer);
|
|
17
17
|
if (remaining <= 0) {
|
|
18
18
|
func.apply(context, args);
|
|
@@ -22,17 +22,17 @@ export var throttle = function throttle(func, delay) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
export
|
|
26
|
-
|
|
25
|
+
export const isMac = () => {
|
|
26
|
+
const platform = navigator.platform;
|
|
27
27
|
// eslint-disable-next-line eqeqeq
|
|
28
28
|
return platform == 'Mac68K' || platform == 'MacPPC' || platform == 'Macintosh' || platform == 'MacIntel';
|
|
29
29
|
};
|
|
30
|
-
export
|
|
31
|
-
|
|
30
|
+
export const downloadFile = downloadUrl => {
|
|
31
|
+
const downloadFrame = document.getElementById('dtableUiComponentDownloadFrame');
|
|
32
32
|
if (downloadFrame != null) {
|
|
33
33
|
document.body.removeChild(downloadFrame);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
let iframe = document.createElement('iframe');
|
|
36
36
|
iframe.setAttribute('id', 'dtableUiComponentDownloadFrame');
|
|
37
37
|
iframe.style.display = 'none';
|
|
38
38
|
iframe.src = downloadUrl;
|
package/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.9-alpha1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "2.0.5",
|
|
7
7
|
"@seafile/seafile-calendar": "0.0.24",
|
|
8
|
-
"@seafile/seafile-editor": "0.3.
|
|
8
|
+
"@seafile/seafile-editor": "0.3.146",
|
|
9
9
|
"antd-mobile": "2.3.1",
|
|
10
10
|
"bail": "1.0.5",
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"dayjs": "1.10.7",
|
|
13
13
|
"deepmerge": "^2.1.0",
|
|
14
|
-
"dtable-utils": "4.3.5",
|
|
15
|
-
"glamor": "^2.20.40",
|
|
14
|
+
"dtable-utils": "~4.3.5",
|
|
16
15
|
"hast-util-sanitize": "^1.1.2",
|
|
17
16
|
"hast-util-to-html": "3.1.0",
|
|
18
17
|
"is-hotkey": "0.2.0",
|
|
19
18
|
"react": "17.0.2",
|
|
20
|
-
"react-app-polyfill": "^
|
|
19
|
+
"react-app-polyfill": "^3.0.0",
|
|
21
20
|
"react-dom": "17.0.2",
|
|
22
|
-
"react-responsive": "
|
|
21
|
+
"react-responsive": "9.0.2",
|
|
23
22
|
"react-select": "5.7.0",
|
|
24
23
|
"react-transition-group": "^4.4.1",
|
|
25
24
|
"reactstrap": "8.9.0",
|