dtable-ui-component 0.1.75-beta3 → 0.1.75-beta7
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 +27 -38
- package/lib/ButtonFormatter/index.js +47 -59
- package/lib/CTimeFormatter/index.js +39 -53
- package/lib/CheckboxFormatter/index.js +35 -48
- package/lib/CollaboratorFormatter/index.js +42 -64
- package/lib/CollaboratorItem/index.js +44 -61
- package/lib/CreatorFormatter/index.js +42 -62
- package/lib/DateFormatter/index.js +40 -55
- package/lib/DurationFormatter/index.js +29 -42
- package/lib/EmailFormatter/index.js +27 -38
- package/lib/FileFormatter/index.js +50 -65
- package/lib/FileItemFormatter/index.js +31 -44
- package/lib/FileUploader/index.js +34 -44
- package/lib/FormulaFormatter/index.js +81 -102
- package/lib/GeolocationFormatter/index.js +35 -50
- package/lib/ImageFormatter/images-lazy-load.js +73 -81
- package/lib/ImageFormatter/index.js +90 -109
- package/lib/ImagePreviewerLightbox/index.js +27 -60
- package/lib/LastModifierFormatter/index.js +42 -62
- package/lib/LinkFormatter/index.js +59 -80
- package/lib/Loading/index.js +4 -13
- package/lib/LongTextFormatter/html-long-text-formatter.js +49 -60
- package/lib/LongTextFormatter/index.js +9 -28
- package/lib/LongTextFormatter/simple-long-text-formatter.js +52 -58
- package/lib/MTimeFormatter/index.js +39 -53
- package/lib/ModalPortal/index.js +30 -37
- package/lib/MultipleSelectFormatter/index.js +39 -55
- package/lib/NumberFormatter/index.js +35 -50
- package/lib/RateFormatter/index.js +37 -52
- package/lib/SelectItem/index.js +31 -46
- package/lib/SingleSelectFormatter/index.js +38 -54
- package/lib/TextFormatter/index.js +31 -44
- package/lib/UrlFormatter/index.js +27 -38
- package/lib/app.js +75 -80
- package/lib/cellFormatterFactory/index.js +17 -20
- package/lib/components/cell-editor/checkbox-editor.js +59 -66
- package/lib/components/cell-editor/collaborator-editor.js +113 -126
- package/lib/components/cell-editor/date-editor.js +99 -119
- package/lib/components/cell-editor/index.js +9 -40
- package/lib/components/cell-editor/link-editor.js +122 -140
- package/lib/components/cell-editor/multiple-select-editor.js +114 -127
- package/lib/components/cell-editor/number-editor.js +78 -86
- package/lib/components/cell-editor/single-select-editor.js +106 -120
- package/lib/components/cell-editor/text-editor.js +65 -72
- package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +31 -51
- package/lib/components/cell-editor-dialog/pc-files-addition/index.js +0 -1
- package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -1
- package/lib/components/cell-editor-dialog/pc-files-preview/index.js +0 -1
- package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -1
- package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +105 -111
- package/lib/components/cell-editor-popover/mb-date-editor-popover.js +140 -157
- package/lib/components/cell-editor-popover/mb-link-editor-popover.js +103 -109
- package/lib/components/cell-editor-popover/mb-select-editor-popover.js +142 -155
- package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +74 -89
- package/lib/components/cell-editor-popover/pc-date-editor-popover.js +88 -102
- package/lib/components/cell-editor-popover/pc-link-editor-popover.js +77 -91
- package/lib/components/cell-editor-popover/pc-select-editor-popover.js +91 -105
- package/lib/components/common/collaborator-item.js +43 -59
- package/lib/components/common/edit-editor-button.js +28 -39
- package/lib/components/common/link-editor-option.js +63 -71
- package/lib/components/common/mobile/mb-editor-header.js +39 -52
- package/lib/components/common/select-editor-option.js +58 -74
- package/lib/constants/cell-types.js +25 -54
- package/lib/constants/index.js +5 -28
- package/lib/formatterConfig/index.js +28 -59
- package/lib/index.js +31 -139
- package/lib/lang/index.js +11 -27
- package/lib/locals/de.js +1 -6
- package/lib/locals/en.js +1 -6
- package/lib/locals/fr.js +1 -6
- package/lib/locals/zh-CN.js +1 -6
- package/lib/toaster/alert.js +92 -106
- package/lib/toaster/index.js +3 -12
- package/lib/toaster/toast.js +103 -147
- package/lib/toaster/toastManager.js +78 -97
- package/lib/toaster/toaster.js +36 -52
- package/lib/utils/cell-value-validator.js +5 -9
- package/lib/utils/column-utils.js +5 -13
- package/lib/utils/editor-utils.js +3 -13
- package/lib/utils/markdown2html.js +1 -7
- package/lib/utils/normalize-long-text-value.js +3 -8
- package/lib/utils/number-precision.js +13 -31
- package/lib/utils/utils.js +8 -33
- package/lib/utils/value-format-utils.js +58 -108
- package/package.json +5 -5
- package/es/AutoNumberFormatter/index.css +0 -1
- package/es/AutoNumberFormatter/index.js +0 -36
- package/es/ButtonFormatter/index.css +0 -13
- package/es/ButtonFormatter/index.js +0 -56
- package/es/CTimeFormatter/index.css +0 -1
- package/es/CTimeFormatter/index.js +0 -58
- package/es/CheckboxFormatter/index.css +0 -1
- package/es/CheckboxFormatter/index.js +0 -45
- package/es/CollaboratorFormatter/index.css +0 -1
- package/es/CollaboratorFormatter/index.js +0 -91
- package/es/CollaboratorItem/index.css +0 -49
- package/es/CollaboratorItem/index.js +0 -64
- package/es/CreatorFormatter/index.css +0 -1
- package/es/CreatorFormatter/index.js +0 -87
- package/es/DateFormatter/index.css +0 -1
- package/es/DateFormatter/index.js +0 -60
- package/es/DurationFormatter/index.css +0 -1
- package/es/DurationFormatter/index.js +0 -38
- package/es/EmailFormatter/index.css +0 -5
- package/es/EmailFormatter/index.js +0 -36
- package/es/FileFormatter/index.css +0 -29
- package/es/FileFormatter/index.js +0 -64
- package/es/FileItemFormatter/index.js +0 -50
- package/es/FileUploader/index.js +0 -53
- package/es/FormulaFormatter/index.css +0 -19
- package/es/FormulaFormatter/index.js +0 -164
- package/es/GeolocationFormatter/index.css +0 -1
- package/es/GeolocationFormatter/index.js +0 -53
- package/es/ImageFormatter/images-lazy-load.js +0 -150
- package/es/ImageFormatter/index.css +0 -34
- package/es/ImageFormatter/index.js +0 -154
- package/es/ImagePreviewerLightbox/index.css +0 -87
- package/es/ImagePreviewerLightbox/index.js +0 -119
- package/es/LastModifierFormatter/index.css +0 -1
- package/es/LastModifierFormatter/index.js +0 -87
- package/es/LinkFormatter/index.css +0 -27
- package/es/LinkFormatter/index.js +0 -144
- package/es/Loading/index.css +0 -54
- package/es/Loading/index.js +0 -7
- package/es/LongTextFormatter/html-long-text-formatter.js +0 -96
- package/es/LongTextFormatter/index.css +0 -63
- package/es/LongTextFormatter/index.js +0 -29
- package/es/LongTextFormatter/simple-long-text-formatter.js +0 -104
- package/es/MTimeFormatter/index.css +0 -1
- package/es/MTimeFormatter/index.js +0 -58
- package/es/ModalPortal/index.js +0 -44
- package/es/MultipleSelectFormatter/index.css +0 -1
- package/es/MultipleSelectFormatter/index.js +0 -70
- package/es/NumberFormatter/index.css +0 -1
- package/es/NumberFormatter/index.js +0 -47
- package/es/RateFormatter/index.css +0 -1
- package/es/RateFormatter/index.js +0 -80
- package/es/SelectItem/index.js +0 -58
- package/es/SingleSelectFormatter/index.css +0 -1
- package/es/SingleSelectFormatter/index.js +0 -70
- package/es/TextFormatter/index.css +0 -1
- package/es/TextFormatter/index.js +0 -56
- package/es/UrlFormatter/index.css +0 -5
- package/es/UrlFormatter/index.js +0 -36
- package/es/app.css +0 -20
- package/es/app.js +0 -91
- package/es/assets/images/avatar/default_avatar.png +0 -0
- package/es/assets/images/file/192/excel.png +0 -0
- package/es/assets/images/file/192/file.png +0 -0
- package/es/assets/images/file/192/music.png +0 -0
- package/es/assets/images/file/192/pdf.png +0 -0
- package/es/assets/images/file/192/pic.png +0 -0
- package/es/assets/images/file/192/ppt.png +0 -0
- package/es/assets/images/file/192/txt.png +0 -0
- package/es/assets/images/file/192/video.png +0 -0
- package/es/assets/images/file/192/word.png +0 -0
- package/es/assets/images/file/24/excel.png +0 -0
- package/es/assets/images/file/24/file.png +0 -0
- package/es/assets/images/file/24/music.png +0 -0
- package/es/assets/images/file/24/pdf.png +0 -0
- package/es/assets/images/file/24/pic.png +0 -0
- package/es/assets/images/file/24/ppt.png +0 -0
- package/es/assets/images/file/24/txt.png +0 -0
- package/es/assets/images/file/24/video.png +0 -0
- package/es/assets/images/file/24/word.png +0 -0
- package/es/assets/images/folder/folder-192.png +0 -0
- package/es/assets/images/folder/folder-24.png +0 -0
- package/es/cellFormatterFactory/index.js +0 -25
- package/es/components/cell-editor/checkbox-editor.js +0 -104
- package/es/components/cell-editor/collaborator-editor.js +0 -236
- package/es/components/cell-editor/date-editor.js +0 -151
- package/es/components/cell-editor/index.js +0 -9
- package/es/components/cell-editor/link-editor.js +0 -303
- package/es/components/cell-editor/multiple-select-editor.js +0 -237
- package/es/components/cell-editor/number-editor.js +0 -154
- package/es/components/cell-editor/single-select-editor.js +0 -202
- package/es/components/cell-editor/text-editor.js +0 -122
- package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +0 -46
- package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
- package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
- package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +0 -177
- package/es/components/cell-editor-popover/mb-date-editor-popover.js +0 -245
- package/es/components/cell-editor-popover/mb-link-editor-popover.js +0 -170
- package/es/components/cell-editor-popover/mb-select-editor-popover.js +0 -230
- package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +0 -109
- package/es/components/cell-editor-popover/pc-date-editor-popover.js +0 -142
- package/es/components/cell-editor-popover/pc-link-editor-popover.js +0 -114
- package/es/components/cell-editor-popover/pc-select-editor-popover.js +0 -143
- package/es/components/common/collaborator-item.js +0 -63
- package/es/components/common/edit-editor-button.js +0 -56
- package/es/components/common/link-editor-option.js +0 -113
- package/es/components/common/mobile/mb-editor-header.js +0 -48
- package/es/components/common/select-editor-option.js +0 -106
- package/es/constants/cell-types.js +0 -25
- package/es/constants/index.js +0 -49
- package/es/css/cell-editor.css +0 -614
- package/es/css/cell-formatter.css +0 -4
- package/es/css/custom-rc-calendar.css +0 -118
- package/es/formatterConfig/index.js +0 -31
- package/es/index.js +0 -31
- package/es/lang/index.js +0 -50
- package/es/locals/de.js +0 -2
- package/es/locals/en.js +0 -17
- package/es/locals/fr.js +0 -2
- package/es/locals/zh-CN.js +0 -17
- package/es/toaster/alert.js +0 -150
- package/es/toaster/index.js +0 -3
- package/es/toaster/toast.js +0 -179
- package/es/toaster/toastManager.js +0 -170
- package/es/toaster/toaster.js +0 -76
- package/es/utils/cell-value-validator.js +0 -31
- package/es/utils/column-utils.js +0 -7
- package/es/utils/editor-utils.js +0 -71
- package/es/utils/markdown2html.js +0 -62
- package/es/utils/normalize-long-text-value.js +0 -69
- package/es/utils/number-precision.js +0 -164
- package/es/utils/unified/index.js +0 -470
- package/es/utils/utils.js +0 -116
- package/es/utils/value-format-utils.js +0 -497
- package/es/utils/vfile/core.js +0 -172
- package/es/utils/vfile/index.js +0 -48
|
@@ -1,170 +0,0 @@
|
|
|
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
|
-
import React from 'react';
|
|
11
|
-
import { css } from 'glamor';
|
|
12
|
-
import Toast from './toast';
|
|
13
|
-
var wrapperClass = css({
|
|
14
|
-
maxWidth: 560,
|
|
15
|
-
margin: '0 auto',
|
|
16
|
-
top: 0,
|
|
17
|
-
left: 0,
|
|
18
|
-
right: 0,
|
|
19
|
-
position: 'fixed',
|
|
20
|
-
zIndex: 999999
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
var hasCustomId = function hasCustomId(settings) {
|
|
24
|
-
return Object.hasOwnProperty.call(settings, 'id');
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var ToastManager = /*#__PURE__*/function (_React$PureComponent) {
|
|
28
|
-
_inherits(ToastManager, _React$PureComponent);
|
|
29
|
-
|
|
30
|
-
var _super = _createSuper(ToastManager);
|
|
31
|
-
|
|
32
|
-
function ToastManager(props, context) {
|
|
33
|
-
var _this;
|
|
34
|
-
|
|
35
|
-
_classCallCheck(this, ToastManager);
|
|
36
|
-
|
|
37
|
-
_this = _super.call(this, props, context);
|
|
38
|
-
|
|
39
|
-
_this.getToasts = function () {
|
|
40
|
-
return _this.state.toasts;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
_this.closeAll = function () {
|
|
44
|
-
_this.getToasts().forEach(function (toast) {
|
|
45
|
-
return toast.close();
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
_this.notify = function (title, settings) {
|
|
50
|
-
// If there's a custom toast ID passed, close existing toasts with the same custom ID
|
|
51
|
-
if (hasCustomId(settings)) {
|
|
52
|
-
var _iterator = _createForOfIteratorHelper(_this.state.toasts),
|
|
53
|
-
_step;
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
57
|
-
var toast = _step.value;
|
|
58
|
-
|
|
59
|
-
// Since unique ID is still appended to a custom ID, skip the unique ID and check only prefix
|
|
60
|
-
if (String(toast.id).startsWith(settings.id)) {
|
|
61
|
-
_this.closeToast(toast.id);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
} catch (err) {
|
|
65
|
-
_iterator.e(err);
|
|
66
|
-
} finally {
|
|
67
|
-
_iterator.f();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var instance = _this.createToastInstance(title, settings);
|
|
72
|
-
|
|
73
|
-
_this.setState(function (previousState) {
|
|
74
|
-
return {
|
|
75
|
-
toasts: [instance].concat(_toConsumableArray(previousState.toasts))
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return instance;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
_this.createToastInstance = function (title, settings) {
|
|
83
|
-
var uniqueId = ++ToastManager.idCounter;
|
|
84
|
-
var id = hasCustomId(settings) ? "".concat(settings.id, "-").concat(uniqueId) : uniqueId;
|
|
85
|
-
var hasCloseButton = settings.hasCloseButton || true;
|
|
86
|
-
var duration = settings.duration || 2;
|
|
87
|
-
|
|
88
|
-
if (settings.hasCloseButton !== undefined) {
|
|
89
|
-
hasCloseButton = settings.hasCloseButton;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (settings.duration !== undefined) {
|
|
93
|
-
duration = settings.duration;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
id: id,
|
|
98
|
-
title: title,
|
|
99
|
-
description: settings.description,
|
|
100
|
-
hasCloseButton: hasCloseButton,
|
|
101
|
-
duration: duration,
|
|
102
|
-
close: function close() {
|
|
103
|
-
return _this.closeToast(id);
|
|
104
|
-
},
|
|
105
|
-
intent: settings.intent
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
_this.closeToast = function (id) {
|
|
110
|
-
_this.setState(function (previousState) {
|
|
111
|
-
return {
|
|
112
|
-
toasts: previousState.toasts.map(function (toast) {
|
|
113
|
-
if (toast.id === id) {
|
|
114
|
-
return _objectSpread(_objectSpread({}, toast), {}, {
|
|
115
|
-
isShown: false
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return toast;
|
|
120
|
-
})
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
_this.removeToast = function (id) {
|
|
126
|
-
_this.setState(function (previousState) {
|
|
127
|
-
return {
|
|
128
|
-
toasts: previousState.toasts.filter(function (toast) {
|
|
129
|
-
return toast.id !== id;
|
|
130
|
-
})
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
props.bindNotify(_this.notify);
|
|
136
|
-
props.bindGetToasts(_this.getToasts);
|
|
137
|
-
props.bindCloseAll(_this.closeAll);
|
|
138
|
-
_this.state = {
|
|
139
|
-
toasts: []
|
|
140
|
-
};
|
|
141
|
-
return _this;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
_createClass(ToastManager, [{
|
|
145
|
-
key: "render",
|
|
146
|
-
value: function render() {
|
|
147
|
-
var _this2 = this;
|
|
148
|
-
|
|
149
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
150
|
-
className: wrapperClass
|
|
151
|
-
}, this.state.toasts.map(function (_ref) {
|
|
152
|
-
var id = _ref.id,
|
|
153
|
-
description = _ref.description,
|
|
154
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
155
|
-
|
|
156
|
-
return /*#__PURE__*/React.createElement(Toast, Object.assign({
|
|
157
|
-
key: id,
|
|
158
|
-
onRemove: function onRemove() {
|
|
159
|
-
return _this2.removeToast(id);
|
|
160
|
-
}
|
|
161
|
-
}, props), description);
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
}]);
|
|
165
|
-
|
|
166
|
-
return ToastManager;
|
|
167
|
-
}(React.PureComponent);
|
|
168
|
-
|
|
169
|
-
ToastManager.idCounter = 0;
|
|
170
|
-
export { ToastManager as default };
|
package/es/toaster/toaster.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
|
-
import ToastManager from './toastManager';
|
|
6
|
-
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
7
|
-
/**
|
|
8
|
-
* The Toaster manages the interactionsb between
|
|
9
|
-
* the ToasterManger and the toast API.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
var Toaster = function Toaster() {
|
|
13
|
-
var _this = this;
|
|
14
|
-
|
|
15
|
-
_classCallCheck(this, Toaster);
|
|
16
|
-
|
|
17
|
-
this._bindNotify = function (handler) {
|
|
18
|
-
_this.notifyHandler = handler;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
this._bindGetToasts = function (handler) {
|
|
22
|
-
_this.getToastsHandler = handler;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
this._bindCloseAll = function (handler) {
|
|
26
|
-
_this.closeAllHandler = handler;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
this.getToasts = function () {
|
|
30
|
-
return _this.getToastsHandler();
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
this.closeAll = function () {
|
|
34
|
-
return _this.closeAllHandler();
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
this.notify = function (title) {
|
|
38
|
-
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
39
|
-
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
40
|
-
intent: 'none'
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
this.success = function (title) {
|
|
45
|
-
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46
|
-
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
47
|
-
intent: 'success'
|
|
48
|
-
}));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
this.warning = function (title) {
|
|
52
|
-
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
53
|
-
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
54
|
-
intent: 'warning'
|
|
55
|
-
}));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
this.danger = function (title) {
|
|
59
|
-
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
60
|
-
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
61
|
-
intent: 'danger'
|
|
62
|
-
}));
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
if (!isBrowser) return;
|
|
66
|
-
var container = document.createElement('div');
|
|
67
|
-
container.setAttribute('data-evergreen-toaster-container', '');
|
|
68
|
-
document.body.appendChild(container);
|
|
69
|
-
ReactDOM.render( /*#__PURE__*/React.createElement(ToastManager, {
|
|
70
|
-
bindNotify: this._bindNotify,
|
|
71
|
-
bindGetToasts: this._bindGetToasts,
|
|
72
|
-
bindCloseAll: this._bindCloseAll
|
|
73
|
-
}), container);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export { Toaster as default };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
|
|
3
|
-
var _validators;
|
|
4
|
-
|
|
5
|
-
import { FORMULA_RESULT_TYPE, CellType } from '../constants';
|
|
6
|
-
|
|
7
|
-
var numberValidator = function numberValidator(value) {
|
|
8
|
-
return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
var textValidator = function textValidator(value) {
|
|
12
|
-
return !!value;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var checkboxValidator = function checkboxValidator(value) {
|
|
16
|
-
return typeof value === 'boolean';
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
var validators = (_validators = {}, _defineProperty(_validators, CellType.NUMBER, numberValidator), _defineProperty(_validators, CellType.RATE, numberValidator), _defineProperty(_validators, CellType.DURATION, numberValidator), _defineProperty(_validators, CellType.CHECKBOX, checkboxValidator), _defineProperty(_validators, CellType.TEXT, textValidator), _defineProperty(_validators, CellType.DATE, textValidator), _defineProperty(_validators, CellType.CTIME, textValidator), _defineProperty(_validators, CellType.MTIME, textValidator), _defineProperty(_validators, CellType.GEOLOCATION, textValidator), _defineProperty(_validators, CellType.AUTO_NUMBER, textValidator), _defineProperty(_validators, CellType.URL, textValidator), _defineProperty(_validators, CellType.EMAIL, textValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.DATE, textValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.STRING, textValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.NUMBER, numberValidator), _defineProperty(_validators, FORMULA_RESULT_TYPE.BOOL, checkboxValidator), _validators);
|
|
20
|
-
|
|
21
|
-
var cellValueValidator = function cellValueValidator(cellValue, type) {
|
|
22
|
-
var validator = validators[type];
|
|
23
|
-
|
|
24
|
-
if (validator) {
|
|
25
|
-
return validator(cellValue);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return true;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default cellValueValidator;
|
package/es/utils/column-utils.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ARRAY_FORMAL_COLUMNS, SIMPLE_CELL_COLUMNS, SIMPLE_CELL_FORMULA_RESULTS } from '../constants';
|
|
2
|
-
export function isSimpleCellFormatter(type) {
|
|
3
|
-
return SIMPLE_CELL_COLUMNS.includes(type) || SIMPLE_CELL_FORMULA_RESULTS.includes(type);
|
|
4
|
-
}
|
|
5
|
-
export function isArrayFormalColumn(columnType) {
|
|
6
|
-
return ARRAY_FORMAL_COLUMNS.includes(columnType);
|
|
7
|
-
}
|
package/es/utils/editor-utils.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
|
|
2
|
-
|
|
3
|
-
var zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
|
|
4
|
-
|
|
5
|
-
var enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
|
|
6
|
-
|
|
7
|
-
var frFR = require('@seafile/seafile-calendar/lib/locale/fr_FR');
|
|
8
|
-
|
|
9
|
-
var deDE = require('@seafile/seafile-calendar/lib/locale/de_DE');
|
|
10
|
-
|
|
11
|
-
var esES = require('@seafile/seafile-calendar/lib/locale/es_ES');
|
|
12
|
-
|
|
13
|
-
var plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
|
|
14
|
-
|
|
15
|
-
var csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
|
|
16
|
-
|
|
17
|
-
export var initDateEditorLanguage = function initDateEditorLanguage(lang) {
|
|
18
|
-
var language;
|
|
19
|
-
|
|
20
|
-
switch (lang) {
|
|
21
|
-
case 'zh-cn':
|
|
22
|
-
language = zhCN;
|
|
23
|
-
break;
|
|
24
|
-
|
|
25
|
-
case 'zh-tw':
|
|
26
|
-
language = zhTW;
|
|
27
|
-
break;
|
|
28
|
-
|
|
29
|
-
case 'en':
|
|
30
|
-
language = enUS;
|
|
31
|
-
break;
|
|
32
|
-
|
|
33
|
-
case 'fr':
|
|
34
|
-
language = frFR;
|
|
35
|
-
break;
|
|
36
|
-
|
|
37
|
-
case 'de':
|
|
38
|
-
language = deDE;
|
|
39
|
-
break;
|
|
40
|
-
|
|
41
|
-
case 'es':
|
|
42
|
-
language = esES;
|
|
43
|
-
break;
|
|
44
|
-
|
|
45
|
-
case 'es-ar':
|
|
46
|
-
language = esES;
|
|
47
|
-
break;
|
|
48
|
-
|
|
49
|
-
case 'es-mx':
|
|
50
|
-
language = esES;
|
|
51
|
-
break;
|
|
52
|
-
|
|
53
|
-
case 'pl':
|
|
54
|
-
language = plPL;
|
|
55
|
-
break;
|
|
56
|
-
|
|
57
|
-
case 'cs':
|
|
58
|
-
language = csCZ;
|
|
59
|
-
break;
|
|
60
|
-
|
|
61
|
-
default:
|
|
62
|
-
language = zhCN;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return language;
|
|
66
|
-
};
|
|
67
|
-
export var getSelectOptionItem = function getSelectOptionItem(options, optionId) {
|
|
68
|
-
return options.find(function (option) {
|
|
69
|
-
return option.id === optionId;
|
|
70
|
-
});
|
|
71
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var unified = require('./unified');
|
|
2
|
-
|
|
3
|
-
var markdown = require('remark-parse');
|
|
4
|
-
|
|
5
|
-
var slug = require('remark-slug');
|
|
6
|
-
|
|
7
|
-
var breaks = require('remark-breaks');
|
|
8
|
-
|
|
9
|
-
var remark2rehype = require('remark-rehype');
|
|
10
|
-
|
|
11
|
-
var format = require('rehype-format');
|
|
12
|
-
|
|
13
|
-
var raw = require('rehype-raw');
|
|
14
|
-
|
|
15
|
-
var xtend = require('xtend');
|
|
16
|
-
|
|
17
|
-
var toHTML = require('hast-util-to-html');
|
|
18
|
-
|
|
19
|
-
var sanitize = require('hast-util-sanitize');
|
|
20
|
-
|
|
21
|
-
var gh = require('hast-util-sanitize/lib/github');
|
|
22
|
-
|
|
23
|
-
var deepmerge = require('deepmerge').default;
|
|
24
|
-
|
|
25
|
-
var mathjax = require('rehype-mathjax/browser');
|
|
26
|
-
|
|
27
|
-
var math = require('remark-math/block');
|
|
28
|
-
|
|
29
|
-
function stringify(config) {
|
|
30
|
-
var settings = xtend(config, this.data('settings'));
|
|
31
|
-
var schema = deepmerge(gh, {
|
|
32
|
-
'attributes': {
|
|
33
|
-
'input': ['type'],
|
|
34
|
-
'li': ['className'],
|
|
35
|
-
'code': ['className'],
|
|
36
|
-
'span': ['className'],
|
|
37
|
-
'div': ['className']
|
|
38
|
-
},
|
|
39
|
-
'tagNames': ['input', 'code', 'span', 'div']
|
|
40
|
-
});
|
|
41
|
-
this.Compiler = compiler;
|
|
42
|
-
|
|
43
|
-
function compiler(tree) {
|
|
44
|
-
// use sanity to remove dangerous html, the default is
|
|
45
|
-
// GitHub style sanitation
|
|
46
|
-
var hast = sanitize(tree, schema);
|
|
47
|
-
return toHTML(hast, settings);
|
|
48
|
-
}
|
|
49
|
-
} // markdown -> mdast -> html AST -> html
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var processor = unified().use(markdown, {
|
|
53
|
-
commonmark: true
|
|
54
|
-
}).use(math).use(breaks).use(slug).use(remark2rehype, {
|
|
55
|
-
allowDangerousHTML: true
|
|
56
|
-
}).use(mathjax, {
|
|
57
|
-
displayMath: ['$$', '$$']
|
|
58
|
-
}).use(raw).use(format).use(stringify);
|
|
59
|
-
var processorGetAST = unified().use(markdown, {
|
|
60
|
-
commonmark: true
|
|
61
|
-
}).use(slug);
|
|
62
|
-
export { processor, processorGetAST };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var hrefReg = /\[.+\]\(\S+\)|<img src=(\S+).+\/>|!\[\]\(\S+\)|<\S+>/g;
|
|
2
|
-
var imageReg1 = /^<img( width=[\\|/|"](\d)+[\\|/|"])? src="(\S+)" .?\/>/;
|
|
3
|
-
var imageReg2 = /^!\[\]\((\S+)\)/;
|
|
4
|
-
var linkReg1 = /^\[.+\]\(\S+\)/;
|
|
5
|
-
var linkReg2 = /^<\S+>$/;
|
|
6
|
-
|
|
7
|
-
var getLinks = function getLinks(hrefList) {
|
|
8
|
-
var hrefObj = {
|
|
9
|
-
links: [],
|
|
10
|
-
images: []
|
|
11
|
-
};
|
|
12
|
-
hrefList.forEach(function (href) {
|
|
13
|
-
if (href.search(linkReg1) >= 0 || href.search(linkReg2) >= 0) {
|
|
14
|
-
hrefObj.links.push(href);
|
|
15
|
-
} else {
|
|
16
|
-
var imageSrcList = href.match(imageReg1);
|
|
17
|
-
var imageSrcList1 = href.match(imageReg2);
|
|
18
|
-
|
|
19
|
-
if (imageSrcList) {
|
|
20
|
-
hrefObj.images.push(imageSrcList[1]);
|
|
21
|
-
} else if (imageSrcList1) {
|
|
22
|
-
hrefObj.images.push(imageSrcList1[1]);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return hrefObj;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
var getPreviewContent = function getPreviewContent(markdownContent) {
|
|
30
|
-
var preview = '';
|
|
31
|
-
var newMarkdownContent = markdownContent.replace(hrefReg, '');
|
|
32
|
-
|
|
33
|
-
for (var index = 0; index < newMarkdownContent.length; index++) {
|
|
34
|
-
if (newMarkdownContent[index] === '#') {
|
|
35
|
-
continue;
|
|
36
|
-
} else if (newMarkdownContent[index] === '\n') {
|
|
37
|
-
preview += ' ';
|
|
38
|
-
} else {
|
|
39
|
-
preview += newMarkdownContent[index];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (preview.length === 150) {
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
var hrefList = markdownContent.match(hrefReg);
|
|
48
|
-
|
|
49
|
-
if (hrefList) {
|
|
50
|
-
var _getLinks = getLinks(hrefList),
|
|
51
|
-
images = _getLinks.images,
|
|
52
|
-
links = _getLinks.links;
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
preview: preview,
|
|
56
|
-
images: images,
|
|
57
|
-
links: links
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
preview: preview,
|
|
63
|
-
images: [],
|
|
64
|
-
links: [],
|
|
65
|
-
text: markdownContent
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default getPreviewContent;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @desc Solve the problem of floating calculation, avoid multiple digits after the decimal point and loss of calculation accuracy.
|
|
5
|
-
* example: 3 + 2.4 = 4.699999999999999,1.0 - 0.9 = 0.09999999999999998
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Correct wrong data
|
|
10
|
-
* strip(0.09999999999999998)=0.1
|
|
11
|
-
*/
|
|
12
|
-
function strip(num) {
|
|
13
|
-
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
|
|
14
|
-
return +parseFloat(num.toPrecision(precision));
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Return digits length of a number
|
|
18
|
-
* @param {*number} num Input number
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function digitLength(num) {
|
|
23
|
-
// Get digit length of e
|
|
24
|
-
var eSplit = num.toString().split(/[eE]/);
|
|
25
|
-
var len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
|
|
26
|
-
return len > 0 ? len : 0;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Convert decimals to integers and support scientific notation. If it is a decimal, it is enlarged to an integer
|
|
30
|
-
* @param {*number} num Number of inputs
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function float2Fixed(num) {
|
|
35
|
-
if (num.toString().indexOf('e') === -1) {
|
|
36
|
-
return Number(num.toString().replace('.', ''));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var dLen = digitLength(num);
|
|
40
|
-
return dLen > 0 ? strip(num * Math.pow(10, dLen)) : num;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Check whether the number is out of range, and give a prompt if it is out of range
|
|
44
|
-
* @param {*number} num Number of inputs
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function checkBoundary(num) {
|
|
49
|
-
if (_boundaryCheckingState) {
|
|
50
|
-
if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
|
|
51
|
-
// eslint-disable-next-line no-console
|
|
52
|
-
console.warn("".concat(num, " is beyond boundary when transfer to integer, the results may not be accurate"));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Exact multiplication
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
function times(num1, num2) {
|
|
62
|
-
for (var _len = arguments.length, others = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
63
|
-
others[_key - 2] = arguments[_key];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (others.length > 0) {
|
|
67
|
-
return times.apply(void 0, [times(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
var num1Changed = float2Fixed(num1);
|
|
71
|
-
var num2Changed = float2Fixed(num2);
|
|
72
|
-
var baseNum = digitLength(num1) + digitLength(num2);
|
|
73
|
-
var leftValue = num1Changed * num2Changed;
|
|
74
|
-
checkBoundary(leftValue);
|
|
75
|
-
return leftValue / Math.pow(10, baseNum);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Exact addition
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
function plus(num1, num2) {
|
|
83
|
-
for (var _len2 = arguments.length, others = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
84
|
-
others[_key2 - 2] = arguments[_key2];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (others.length > 0) {
|
|
88
|
-
return plus.apply(void 0, [plus(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
92
|
-
return (times(num1, baseNum) + times(num2, baseNum)) / baseNum;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Exact subtraction
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function minus(num1, num2) {
|
|
100
|
-
for (var _len3 = arguments.length, others = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
101
|
-
others[_key3 - 2] = arguments[_key3];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (others.length > 0) {
|
|
105
|
-
return minus.apply(void 0, [minus(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
109
|
-
return (times(num1, baseNum) - times(num2, baseNum)) / baseNum;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Exact division
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
function divide(num1, num2) {
|
|
117
|
-
for (var _len4 = arguments.length, others = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
118
|
-
others[_key4 - 2] = arguments[_key4];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (others.length > 0) {
|
|
122
|
-
return divide.apply(void 0, [divide(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
var num1Changed = float2Fixed(num1);
|
|
126
|
-
var num2Changed = float2Fixed(num2);
|
|
127
|
-
checkBoundary(num1Changed);
|
|
128
|
-
checkBoundary(num2Changed); // fix: Similar to 10 ** -4 is 0.00009999999999999999, strip correction
|
|
129
|
-
|
|
130
|
-
return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* rounding
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
function round(num, ratio) {
|
|
138
|
-
var base = Math.pow(10, ratio);
|
|
139
|
-
return divide(Math.round(times(num, base)), base);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
var _boundaryCheckingState = true;
|
|
143
|
-
/**
|
|
144
|
-
* Whether to perform boundary check, default true
|
|
145
|
-
* @param flag Mark switch, true is on, false is off, default is true
|
|
146
|
-
*/
|
|
147
|
-
|
|
148
|
-
function enableBoundaryChecking() {
|
|
149
|
-
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
150
|
-
_boundaryCheckingState = flag;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export { strip, plus, minus, times, divide, round, digitLength, float2Fixed, enableBoundaryChecking };
|
|
154
|
-
export default {
|
|
155
|
-
strip: strip,
|
|
156
|
-
plus: plus,
|
|
157
|
-
minus: minus,
|
|
158
|
-
times: times,
|
|
159
|
-
divide: divide,
|
|
160
|
-
round: round,
|
|
161
|
-
digitLength: digitLength,
|
|
162
|
-
float2Fixed: float2Fixed,
|
|
163
|
-
enableBoundaryChecking: enableBoundaryChecking
|
|
164
|
-
};
|