dtable-ui-component 4.3.7 → 4.3.8
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.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.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 +73 -88
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +75 -102
- package/lib/toaster/toastManager.js +55 -91
- package/lib/toaster/toaster.js +58 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- package/package.json +4 -4
package/lib/toaster/toaster.js
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
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
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* The Toaster manages the interactionsb between
|
|
11
8
|
* the ToasterManger and the toast API.
|
|
12
9
|
*/
|
|
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
|
-
|
|
10
|
+
export default class Toaster {
|
|
11
|
+
constructor() {
|
|
12
|
+
var _this = this;
|
|
13
|
+
this._bindNotify = handler => {
|
|
14
|
+
this.notifyHandler = handler;
|
|
15
|
+
};
|
|
16
|
+
this._bindGetToasts = handler => {
|
|
17
|
+
this.getToastsHandler = handler;
|
|
18
|
+
};
|
|
19
|
+
this._bindCloseAll = handler => {
|
|
20
|
+
this.closeAllHandler = handler;
|
|
21
|
+
};
|
|
22
|
+
this.getToasts = () => {
|
|
23
|
+
return this.getToastsHandler();
|
|
24
|
+
};
|
|
25
|
+
this.closeAll = () => {
|
|
26
|
+
return this.closeAllHandler();
|
|
27
|
+
};
|
|
28
|
+
this.notify = function (title) {
|
|
29
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
30
|
+
return _this.notifyHandler(title, {
|
|
31
|
+
...settings,
|
|
32
|
+
intent: 'none'
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
this.success = function (title) {
|
|
36
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
37
|
+
return _this.notifyHandler(title, {
|
|
38
|
+
...settings,
|
|
39
|
+
intent: 'success'
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
this.warning = function (title) {
|
|
43
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
|
+
return _this.notifyHandler(title, {
|
|
45
|
+
...settings,
|
|
46
|
+
intent: 'warning'
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
this.danger = function (title) {
|
|
50
|
+
let settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
51
|
+
return _this.notifyHandler(title, {
|
|
52
|
+
...settings,
|
|
53
|
+
intent: 'danger'
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
if (!isBrowser) return;
|
|
57
|
+
const container = document.createElement('div');
|
|
58
|
+
container.setAttribute('data-evergreen-toaster-container', '');
|
|
59
|
+
document.body.appendChild(container);
|
|
60
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(ToastManager, {
|
|
61
|
+
bindNotify: this._bindNotify,
|
|
62
|
+
bindGetToasts: this._bindGetToasts,
|
|
63
|
+
bindCloseAll: this._bindCloseAll
|
|
64
|
+
}), container);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -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,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.8",
|
|
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.145",
|
|
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",
|
|
14
|
+
"dtable-utils": "~4.3.5",
|
|
15
15
|
"glamor": "^2.20.40",
|
|
16
16
|
"hast-util-sanitize": "^1.1.2",
|
|
17
17
|
"hast-util-to-html": "3.1.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"react": "17.0.2",
|
|
20
20
|
"react-app-polyfill": "^1.0.6",
|
|
21
21
|
"react-dom": "17.0.2",
|
|
22
|
-
"react-responsive": "
|
|
22
|
+
"react-responsive": "9.0.2",
|
|
23
23
|
"react-select": "5.7.0",
|
|
24
24
|
"react-transition-group": "^4.4.1",
|
|
25
25
|
"reactstrap": "8.9.0",
|