dtable-ui-component 0.1.75-beta2 → 0.1.75-beta3
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/es/AutoNumberFormatter/index.css +1 -0
- package/es/AutoNumberFormatter/index.js +36 -0
- package/es/ButtonFormatter/index.css +13 -0
- package/es/ButtonFormatter/index.js +56 -0
- package/es/CTimeFormatter/index.css +1 -0
- package/es/CTimeFormatter/index.js +58 -0
- package/es/CheckboxFormatter/index.css +1 -0
- package/es/CheckboxFormatter/index.js +45 -0
- package/es/CollaboratorFormatter/index.css +1 -0
- package/es/CollaboratorFormatter/index.js +91 -0
- package/es/CollaboratorItem/index.css +49 -0
- package/es/CollaboratorItem/index.js +64 -0
- package/es/CreatorFormatter/index.css +1 -0
- package/es/CreatorFormatter/index.js +87 -0
- package/es/DateFormatter/index.css +1 -0
- package/es/DateFormatter/index.js +60 -0
- package/es/DurationFormatter/index.css +1 -0
- package/es/DurationFormatter/index.js +38 -0
- package/es/EmailFormatter/index.css +5 -0
- package/es/EmailFormatter/index.js +36 -0
- package/es/FileFormatter/index.css +29 -0
- package/es/FileFormatter/index.js +64 -0
- package/es/FileItemFormatter/index.js +50 -0
- package/es/FileUploader/index.js +53 -0
- package/es/FormulaFormatter/index.css +19 -0
- package/es/FormulaFormatter/index.js +164 -0
- package/es/GeolocationFormatter/index.css +1 -0
- package/es/GeolocationFormatter/index.js +53 -0
- package/es/ImageFormatter/images-lazy-load.js +150 -0
- package/es/ImageFormatter/index.css +34 -0
- package/es/ImageFormatter/index.js +154 -0
- package/es/ImagePreviewerLightbox/index.css +87 -0
- package/es/ImagePreviewerLightbox/index.js +119 -0
- package/es/LastModifierFormatter/index.css +1 -0
- package/es/LastModifierFormatter/index.js +87 -0
- package/es/LinkFormatter/index.css +27 -0
- package/es/LinkFormatter/index.js +144 -0
- package/es/Loading/index.css +54 -0
- package/es/Loading/index.js +7 -0
- package/es/LongTextFormatter/html-long-text-formatter.js +96 -0
- package/es/LongTextFormatter/index.css +63 -0
- package/es/LongTextFormatter/index.js +29 -0
- package/es/LongTextFormatter/simple-long-text-formatter.js +104 -0
- package/es/MTimeFormatter/index.css +1 -0
- package/es/MTimeFormatter/index.js +58 -0
- package/es/ModalPortal/index.js +44 -0
- package/es/MultipleSelectFormatter/index.css +1 -0
- package/es/MultipleSelectFormatter/index.js +70 -0
- package/es/NumberFormatter/index.css +1 -0
- package/es/NumberFormatter/index.js +47 -0
- package/es/RateFormatter/index.css +1 -0
- package/es/RateFormatter/index.js +80 -0
- package/es/SelectItem/index.js +58 -0
- package/es/SingleSelectFormatter/index.css +1 -0
- package/es/SingleSelectFormatter/index.js +70 -0
- package/es/TextFormatter/index.css +1 -0
- package/es/TextFormatter/index.js +56 -0
- package/es/UrlFormatter/index.css +5 -0
- package/es/UrlFormatter/index.js +36 -0
- package/es/app.css +20 -0
- package/es/app.js +91 -0
- 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 +25 -0
- package/es/components/cell-editor/checkbox-editor.js +104 -0
- package/es/components/cell-editor/collaborator-editor.js +236 -0
- package/es/components/cell-editor/date-editor.js +151 -0
- package/es/components/cell-editor/index.js +9 -0
- package/es/components/cell-editor/link-editor.js +303 -0
- package/es/components/cell-editor/multiple-select-editor.js +237 -0
- package/es/components/cell-editor/number-editor.js +154 -0
- package/es/components/cell-editor/single-select-editor.js +202 -0
- package/es/components/cell-editor/text-editor.js +122 -0
- package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
- 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 +177 -0
- package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
- package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
- package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
- package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
- package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
- package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
- package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
- package/es/components/common/collaborator-item.js +63 -0
- package/es/components/common/edit-editor-button.js +56 -0
- package/es/components/common/link-editor-option.js +113 -0
- package/es/components/common/mobile/mb-editor-header.js +48 -0
- package/es/components/common/select-editor-option.js +106 -0
- package/es/constants/cell-types.js +25 -0
- package/es/constants/index.js +49 -0
- package/es/css/cell-editor.css +614 -0
- package/es/css/cell-formatter.css +4 -0
- package/es/css/custom-rc-calendar.css +118 -0
- package/es/formatterConfig/index.js +31 -0
- package/es/index.js +31 -0
- package/es/lang/index.js +50 -0
- package/es/locals/de.js +2 -0
- package/es/locals/en.js +17 -0
- package/es/locals/fr.js +2 -0
- package/es/locals/zh-CN.js +17 -0
- package/{lib/toast → es/toaster}/alert.js +0 -0
- package/{lib/toast → es/toaster}/index.js +0 -0
- package/{lib/toast → es/toaster}/toast.js +0 -0
- package/{lib/toast → es/toaster}/toastManager.js +0 -0
- package/{lib/toast → es/toaster}/toaster.js +0 -0
- package/es/utils/cell-value-validator.js +31 -0
- package/es/utils/column-utils.js +7 -0
- package/es/utils/editor-utils.js +71 -0
- package/es/utils/markdown2html.js +62 -0
- package/es/utils/normalize-long-text-value.js +69 -0
- package/es/utils/number-precision.js +164 -0
- package/es/utils/unified/index.js +470 -0
- package/es/utils/utils.js +116 -0
- package/es/utils/value-format-utils.js +497 -0
- package/es/utils/vfile/core.js +172 -0
- package/es/utils/vfile/index.js +48 -0
- package/lib/AutoNumberFormatter/index.js +38 -27
- package/lib/ButtonFormatter/index.js +59 -47
- package/lib/CTimeFormatter/index.js +53 -39
- package/lib/CheckboxFormatter/index.js +48 -35
- package/lib/CollaboratorFormatter/index.js +64 -42
- package/lib/CollaboratorItem/index.js +61 -44
- package/lib/CreatorFormatter/index.js +62 -42
- package/lib/DateFormatter/index.js +55 -40
- package/lib/DurationFormatter/index.js +42 -29
- package/lib/EmailFormatter/index.js +38 -27
- package/lib/FileFormatter/index.js +65 -50
- package/lib/FileItemFormatter/index.js +44 -31
- package/lib/FileUploader/index.js +44 -34
- package/lib/FormulaFormatter/index.js +102 -81
- package/lib/GeolocationFormatter/index.js +50 -35
- package/lib/ImageFormatter/images-lazy-load.js +81 -73
- package/lib/ImageFormatter/index.js +109 -90
- package/lib/ImagePreviewerLightbox/index.js +60 -27
- package/lib/LastModifierFormatter/index.js +62 -42
- package/lib/LinkFormatter/index.js +80 -59
- package/lib/Loading/index.js +13 -4
- package/lib/LongTextFormatter/html-long-text-formatter.js +60 -49
- package/lib/LongTextFormatter/index.js +28 -9
- package/lib/LongTextFormatter/simple-long-text-formatter.js +58 -52
- package/lib/MTimeFormatter/index.js +53 -39
- package/lib/ModalPortal/index.js +37 -30
- package/lib/MultipleSelectFormatter/index.js +55 -39
- package/lib/NumberFormatter/index.js +50 -35
- package/lib/RateFormatter/index.js +52 -37
- package/lib/SelectItem/index.js +46 -31
- package/lib/SingleSelectFormatter/index.js +54 -38
- package/lib/TextFormatter/index.js +44 -31
- package/lib/UrlFormatter/index.js +38 -27
- package/lib/app.js +80 -75
- package/lib/cellFormatterFactory/index.js +20 -17
- package/lib/components/cell-editor/checkbox-editor.js +66 -59
- package/lib/components/cell-editor/collaborator-editor.js +126 -113
- package/lib/components/cell-editor/date-editor.js +119 -99
- package/lib/components/cell-editor/index.js +40 -9
- package/lib/components/cell-editor/link-editor.js +140 -122
- package/lib/components/cell-editor/multiple-select-editor.js +127 -114
- package/lib/components/cell-editor/number-editor.js +86 -78
- package/lib/components/cell-editor/single-select-editor.js +120 -106
- package/lib/components/cell-editor/text-editor.js +72 -65
- package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +51 -31
- package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
- package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
- package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +111 -105
- package/lib/components/cell-editor-popover/mb-date-editor-popover.js +157 -140
- package/lib/components/cell-editor-popover/mb-link-editor-popover.js +109 -103
- package/lib/components/cell-editor-popover/mb-select-editor-popover.js +155 -142
- package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +89 -74
- package/lib/components/cell-editor-popover/pc-date-editor-popover.js +102 -88
- package/lib/components/cell-editor-popover/pc-link-editor-popover.js +91 -77
- package/lib/components/cell-editor-popover/pc-select-editor-popover.js +105 -91
- package/lib/components/common/collaborator-item.js +59 -43
- package/lib/components/common/edit-editor-button.js +39 -28
- package/lib/components/common/link-editor-option.js +71 -63
- package/lib/components/common/mobile/mb-editor-header.js +52 -39
- package/lib/components/common/select-editor-option.js +74 -58
- package/lib/constants/cell-types.js +54 -25
- package/lib/constants/index.js +28 -5
- package/lib/formatterConfig/index.js +59 -28
- package/lib/index.js +139 -31
- package/lib/lang/index.js +27 -11
- package/lib/locals/de.js +6 -1
- package/lib/locals/en.js +6 -1
- package/lib/locals/fr.js +6 -1
- package/lib/locals/zh-CN.js +6 -1
- package/lib/toaster/alert.js +164 -0
- package/lib/toaster/index.js +12 -0
- package/lib/toaster/toast.js +223 -0
- package/lib/toaster/toastManager.js +189 -0
- package/lib/toaster/toaster.js +92 -0
- package/lib/utils/cell-value-validator.js +9 -5
- package/lib/utils/column-utils.js +13 -5
- package/lib/utils/editor-utils.js +13 -3
- package/lib/utils/markdown2html.js +7 -1
- package/lib/utils/normalize-long-text-value.js +6 -1
- package/lib/utils/number-precision.js +32 -13
- package/lib/utils/utils.js +33 -8
- package/lib/utils/value-format-utils.js +110 -58
- package/package.json +5 -5
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
|
|
12
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
+
|
|
14
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
15
|
+
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
|
|
20
|
+
var _glamor = require("glamor");
|
|
21
|
+
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
+
|
|
24
|
+
var _toast = _interopRequireDefault(require("./toast"));
|
|
25
|
+
|
|
26
|
+
var _excluded = ["id", "description"];
|
|
27
|
+
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
|
|
32
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
33
|
+
|
|
34
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
+
|
|
36
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
+
|
|
38
|
+
var wrapperClass = (0, _glamor.css)({
|
|
39
|
+
maxWidth: 560,
|
|
40
|
+
margin: '0 auto',
|
|
41
|
+
top: 0,
|
|
42
|
+
left: 0,
|
|
43
|
+
right: 0,
|
|
44
|
+
position: 'fixed',
|
|
45
|
+
zIndex: 999999
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
var hasCustomId = function hasCustomId(settings) {
|
|
49
|
+
return Object.hasOwnProperty.call(settings, 'id');
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var ToastManager = /*#__PURE__*/function (_React$PureComponent) {
|
|
53
|
+
(0, _inheritsLoose2.default)(ToastManager, _React$PureComponent);
|
|
54
|
+
|
|
55
|
+
function ToastManager(props, context) {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
_this = _React$PureComponent.call(this, props, context) || this;
|
|
59
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getToasts", function () {
|
|
60
|
+
return _this.state.toasts;
|
|
61
|
+
});
|
|
62
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeAll", function () {
|
|
63
|
+
_this.getToasts().forEach(function (toast) {
|
|
64
|
+
return toast.close();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "notify", function (title, settings) {
|
|
68
|
+
// If there's a custom toast ID passed, close existing toasts with the same custom ID
|
|
69
|
+
if (hasCustomId(settings)) {
|
|
70
|
+
for (var _iterator = _createForOfIteratorHelperLoose(_this.state.toasts), _step; !(_step = _iterator()).done;) {
|
|
71
|
+
var toast = _step.value;
|
|
72
|
+
|
|
73
|
+
// Since unique ID is still appended to a custom ID, skip the unique ID and check only prefix
|
|
74
|
+
if (String(toast.id).startsWith(settings.id)) {
|
|
75
|
+
_this.closeToast(toast.id);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var instance = _this.createToastInstance(title, settings);
|
|
81
|
+
|
|
82
|
+
_this.setState(function (previousState) {
|
|
83
|
+
return {
|
|
84
|
+
toasts: [instance].concat(previousState.toasts)
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return instance;
|
|
89
|
+
});
|
|
90
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createToastInstance", function (title, settings) {
|
|
91
|
+
var uniqueId = ++ToastManager.idCounter;
|
|
92
|
+
var id = hasCustomId(settings) ? settings.id + "-" + uniqueId : uniqueId;
|
|
93
|
+
var hasCloseButton = settings.hasCloseButton || true;
|
|
94
|
+
var duration = settings.duration || 2;
|
|
95
|
+
|
|
96
|
+
if (settings.hasCloseButton !== undefined) {
|
|
97
|
+
hasCloseButton = settings.hasCloseButton;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (settings.duration !== undefined) {
|
|
101
|
+
duration = settings.duration;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
id: id,
|
|
106
|
+
title: title,
|
|
107
|
+
description: settings.description,
|
|
108
|
+
hasCloseButton: hasCloseButton,
|
|
109
|
+
duration: duration,
|
|
110
|
+
close: function close() {
|
|
111
|
+
return _this.closeToast(id);
|
|
112
|
+
},
|
|
113
|
+
intent: settings.intent
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeToast", function (id) {
|
|
117
|
+
_this.setState(function (previousState) {
|
|
118
|
+
return {
|
|
119
|
+
toasts: previousState.toasts.map(function (toast) {
|
|
120
|
+
if (toast.id === id) {
|
|
121
|
+
return _objectSpread(_objectSpread({}, toast), {}, {
|
|
122
|
+
isShown: false
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return toast;
|
|
127
|
+
})
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "removeToast", function (id) {
|
|
132
|
+
_this.setState(function (previousState) {
|
|
133
|
+
return {
|
|
134
|
+
toasts: previousState.toasts.filter(function (toast) {
|
|
135
|
+
return toast.id !== id;
|
|
136
|
+
})
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
props.bindNotify(_this.notify);
|
|
141
|
+
props.bindGetToasts(_this.getToasts);
|
|
142
|
+
props.bindCloseAll(_this.closeAll);
|
|
143
|
+
_this.state = {
|
|
144
|
+
toasts: []
|
|
145
|
+
};
|
|
146
|
+
return _this;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var _proto = ToastManager.prototype;
|
|
150
|
+
|
|
151
|
+
_proto.render = function render() {
|
|
152
|
+
var _this2 = this;
|
|
153
|
+
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
155
|
+
className: wrapperClass
|
|
156
|
+
}, this.state.toasts.map(function (_ref) {
|
|
157
|
+
var id = _ref.id,
|
|
158
|
+
description = _ref.description,
|
|
159
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_toast.default, (0, _extends2.default)({
|
|
161
|
+
key: id,
|
|
162
|
+
onRemove: function onRemove() {
|
|
163
|
+
return _this2.removeToast(id);
|
|
164
|
+
}
|
|
165
|
+
}, props), description);
|
|
166
|
+
}));
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return ToastManager;
|
|
170
|
+
}(_react.default.PureComponent);
|
|
171
|
+
|
|
172
|
+
exports.default = ToastManager;
|
|
173
|
+
(0, _defineProperty2.default)(ToastManager, "propTypes", {
|
|
174
|
+
/**
|
|
175
|
+
* Function called with the `this.notify` function.
|
|
176
|
+
*/
|
|
177
|
+
bindNotify: _propTypes.default.func.isRequired,
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Function called with the `this.getToasts` function.
|
|
181
|
+
*/
|
|
182
|
+
bindGetToasts: _propTypes.default.func.isRequired,
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Function called with the `this.closeAll` function.
|
|
186
|
+
*/
|
|
187
|
+
bindCloseAll: _propTypes.default.func.isRequired
|
|
188
|
+
});
|
|
189
|
+
(0, _defineProperty2.default)(ToastManager, "idCounter", 0);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
+
|
|
14
|
+
var _toastManager = _interopRequireDefault(require("./toastManager"));
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
20
|
+
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
21
|
+
/**
|
|
22
|
+
* The Toaster manages the interactionsb between
|
|
23
|
+
* the ToasterManger and the toast API.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var Toaster = function Toaster() {
|
|
27
|
+
var _this = this;
|
|
28
|
+
|
|
29
|
+
(0, _defineProperty2.default)(this, "_bindNotify", function (handler) {
|
|
30
|
+
_this.notifyHandler = handler;
|
|
31
|
+
});
|
|
32
|
+
(0, _defineProperty2.default)(this, "_bindGetToasts", function (handler) {
|
|
33
|
+
_this.getToastsHandler = handler;
|
|
34
|
+
});
|
|
35
|
+
(0, _defineProperty2.default)(this, "_bindCloseAll", function (handler) {
|
|
36
|
+
_this.closeAllHandler = handler;
|
|
37
|
+
});
|
|
38
|
+
(0, _defineProperty2.default)(this, "getToasts", function () {
|
|
39
|
+
return _this.getToastsHandler();
|
|
40
|
+
});
|
|
41
|
+
(0, _defineProperty2.default)(this, "closeAll", function () {
|
|
42
|
+
return _this.closeAllHandler();
|
|
43
|
+
});
|
|
44
|
+
(0, _defineProperty2.default)(this, "notify", function (title, settings) {
|
|
45
|
+
if (settings === void 0) {
|
|
46
|
+
settings = {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
50
|
+
intent: 'none'
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
(0, _defineProperty2.default)(this, "success", function (title, settings) {
|
|
54
|
+
if (settings === void 0) {
|
|
55
|
+
settings = {};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
59
|
+
intent: 'success'
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
(0, _defineProperty2.default)(this, "warning", function (title, settings) {
|
|
63
|
+
if (settings === void 0) {
|
|
64
|
+
settings = {};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
68
|
+
intent: 'warning'
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
71
|
+
(0, _defineProperty2.default)(this, "danger", function (title, settings) {
|
|
72
|
+
if (settings === void 0) {
|
|
73
|
+
settings = {};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return _this.notifyHandler(title, _objectSpread(_objectSpread({}, settings), {}, {
|
|
77
|
+
intent: 'danger'
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
if (!isBrowser) return;
|
|
81
|
+
var container = document.createElement('div');
|
|
82
|
+
container.setAttribute('data-evergreen-toaster-container', '');
|
|
83
|
+
document.body.appendChild(container);
|
|
84
|
+
|
|
85
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_toastManager.default, {
|
|
86
|
+
bindNotify: this._bindNotify,
|
|
87
|
+
bindGetToasts: this._bindGetToasts,
|
|
88
|
+
bindCloseAll: this._bindCloseAll
|
|
89
|
+
}), container);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.default = Toaster;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _constants = require("../constants");
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
var _validators;
|
|
6
9
|
|
|
7
10
|
var numberValidator = function numberValidator(value) {
|
|
8
11
|
return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
|
|
@@ -16,7 +19,7 @@ var checkboxValidator = function checkboxValidator(value) {
|
|
|
16
19
|
return typeof value === 'boolean';
|
|
17
20
|
};
|
|
18
21
|
|
|
19
|
-
var validators = (_validators = {},
|
|
22
|
+
var validators = (_validators = {}, _validators[_constants.CellType.NUMBER] = numberValidator, _validators[_constants.CellType.RATE] = numberValidator, _validators[_constants.CellType.DURATION] = numberValidator, _validators[_constants.CellType.CHECKBOX] = checkboxValidator, _validators[_constants.CellType.TEXT] = textValidator, _validators[_constants.CellType.DATE] = textValidator, _validators[_constants.CellType.CTIME] = textValidator, _validators[_constants.CellType.MTIME] = textValidator, _validators[_constants.CellType.GEOLOCATION] = textValidator, _validators[_constants.CellType.AUTO_NUMBER] = textValidator, _validators[_constants.CellType.URL] = textValidator, _validators[_constants.CellType.EMAIL] = textValidator, _validators[_constants.FORMULA_RESULT_TYPE.DATE] = textValidator, _validators[_constants.FORMULA_RESULT_TYPE.STRING] = textValidator, _validators[_constants.FORMULA_RESULT_TYPE.NUMBER] = numberValidator, _validators[_constants.FORMULA_RESULT_TYPE.BOOL] = checkboxValidator, _validators);
|
|
20
23
|
|
|
21
24
|
var cellValueValidator = function cellValueValidator(cellValue, type) {
|
|
22
25
|
var validator = validators[type];
|
|
@@ -28,4 +31,5 @@ var cellValueValidator = function cellValueValidator(cellValue, type) {
|
|
|
28
31
|
return true;
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
var _default = cellValueValidator;
|
|
35
|
+
exports.default = _default;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.isArrayFormalColumn = isArrayFormalColumn;
|
|
5
|
+
exports.isSimpleCellFormatter = isSimpleCellFormatter;
|
|
6
|
+
|
|
7
|
+
var _constants = require("../constants");
|
|
8
|
+
|
|
9
|
+
function isSimpleCellFormatter(type) {
|
|
10
|
+
return _constants.SIMPLE_CELL_COLUMNS.includes(type) || _constants.SIMPLE_CELL_FORMULA_RESULTS.includes(type);
|
|
4
11
|
}
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
|
|
13
|
+
function isArrayFormalColumn(columnType) {
|
|
14
|
+
return _constants.ARRAY_FORMAL_COLUMNS.includes(columnType);
|
|
7
15
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.initDateEditorLanguage = exports.getSelectOptionItem = void 0;
|
|
5
|
+
|
|
1
6
|
var zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
|
|
2
7
|
|
|
3
8
|
var zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
|
|
@@ -14,7 +19,7 @@ var plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
|
|
|
14
19
|
|
|
15
20
|
var csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
var initDateEditorLanguage = function initDateEditorLanguage(lang) {
|
|
18
23
|
var language;
|
|
19
24
|
|
|
20
25
|
switch (lang) {
|
|
@@ -64,8 +69,13 @@ export var initDateEditorLanguage = function initDateEditorLanguage(lang) {
|
|
|
64
69
|
|
|
65
70
|
return language;
|
|
66
71
|
};
|
|
67
|
-
|
|
72
|
+
|
|
73
|
+
exports.initDateEditorLanguage = initDateEditorLanguage;
|
|
74
|
+
|
|
75
|
+
var getSelectOptionItem = function getSelectOptionItem(options, optionId) {
|
|
68
76
|
return options.find(function (option) {
|
|
69
77
|
return option.id === optionId;
|
|
70
78
|
});
|
|
71
|
-
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.getSelectOptionItem = getSelectOptionItem;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.processorGetAST = exports.processor = void 0;
|
|
5
|
+
|
|
1
6
|
var unified = require('./unified');
|
|
2
7
|
|
|
3
8
|
var markdown = require('remark-parse');
|
|
@@ -56,7 +61,8 @@ var processor = unified().use(markdown, {
|
|
|
56
61
|
}).use(mathjax, {
|
|
57
62
|
displayMath: ['$$', '$$']
|
|
58
63
|
}).use(raw).use(format).use(stringify);
|
|
64
|
+
exports.processor = processor;
|
|
59
65
|
var processorGetAST = unified().use(markdown, {
|
|
60
66
|
commonmark: true
|
|
61
67
|
}).use(slug);
|
|
62
|
-
|
|
68
|
+
exports.processorGetAST = processorGetAST;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
1
5
|
var hrefReg = /\[.+\]\(\S+\)|<img src=(\S+).+\/>|!\[\]\(\S+\)|<\S+>/g;
|
|
2
6
|
var imageReg1 = /^<img( width=[\\|/|"](\d)+[\\|/|"])? src="(\S+)" .?\/>/;
|
|
3
7
|
var imageReg2 = /^!\[\]\((\S+)\)/;
|
|
@@ -66,4 +70,5 @@ var getPreviewContent = function getPreviewContent(markdownContent) {
|
|
|
66
70
|
};
|
|
67
71
|
};
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
var _default = getPreviewContent;
|
|
74
|
+
exports.default = _default;
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
exports.digitLength = digitLength;
|
|
6
|
+
exports.divide = divide;
|
|
7
|
+
exports.enableBoundaryChecking = enableBoundaryChecking;
|
|
8
|
+
exports.float2Fixed = float2Fixed;
|
|
9
|
+
exports.minus = minus;
|
|
10
|
+
exports.plus = plus;
|
|
11
|
+
exports.round = round;
|
|
12
|
+
exports.strip = strip;
|
|
13
|
+
exports.times = times;
|
|
2
14
|
|
|
3
15
|
/**
|
|
4
16
|
* @desc Solve the problem of floating calculation, avoid multiple digits after the decimal point and loss of calculation accuracy.
|
|
@@ -9,8 +21,11 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
9
21
|
* Correct wrong data
|
|
10
22
|
* strip(0.09999999999999998)=0.1
|
|
11
23
|
*/
|
|
12
|
-
function strip(num) {
|
|
13
|
-
|
|
24
|
+
function strip(num, precision) {
|
|
25
|
+
if (precision === void 0) {
|
|
26
|
+
precision = 12;
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
return +parseFloat(num.toPrecision(precision));
|
|
15
30
|
}
|
|
16
31
|
/**
|
|
@@ -48,7 +63,8 @@ function float2Fixed(num) {
|
|
|
48
63
|
function checkBoundary(num) {
|
|
49
64
|
if (_boundaryCheckingState) {
|
|
50
65
|
if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
|
|
51
|
-
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
console.warn(num + " is beyond boundary when transfer to integer, the results may not be accurate");
|
|
52
68
|
}
|
|
53
69
|
}
|
|
54
70
|
}
|
|
@@ -63,7 +79,7 @@ function times(num1, num2) {
|
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
if (others.length > 0) {
|
|
66
|
-
return times.apply(void 0, [times(num1, num2), others[0]].concat(
|
|
82
|
+
return times.apply(void 0, [times(num1, num2), others[0]].concat(others.slice(1)));
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
var num1Changed = float2Fixed(num1);
|
|
@@ -84,7 +100,7 @@ function plus(num1, num2) {
|
|
|
84
100
|
}
|
|
85
101
|
|
|
86
102
|
if (others.length > 0) {
|
|
87
|
-
return plus.apply(void 0, [plus(num1, num2), others[0]].concat(
|
|
103
|
+
return plus.apply(void 0, [plus(num1, num2), others[0]].concat(others.slice(1)));
|
|
88
104
|
}
|
|
89
105
|
|
|
90
106
|
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
@@ -101,7 +117,7 @@ function minus(num1, num2) {
|
|
|
101
117
|
}
|
|
102
118
|
|
|
103
119
|
if (others.length > 0) {
|
|
104
|
-
return minus.apply(void 0, [minus(num1, num2), others[0]].concat(
|
|
120
|
+
return minus.apply(void 0, [minus(num1, num2), others[0]].concat(others.slice(1)));
|
|
105
121
|
}
|
|
106
122
|
|
|
107
123
|
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
@@ -118,7 +134,7 @@ function divide(num1, num2) {
|
|
|
118
134
|
}
|
|
119
135
|
|
|
120
136
|
if (others.length > 0) {
|
|
121
|
-
return divide.apply(void 0, [divide(num1, num2), others[0]].concat(
|
|
137
|
+
return divide.apply(void 0, [divide(num1, num2), others[0]].concat(others.slice(1)));
|
|
122
138
|
}
|
|
123
139
|
|
|
124
140
|
var num1Changed = float2Fixed(num1);
|
|
@@ -144,13 +160,15 @@ var _boundaryCheckingState = true;
|
|
|
144
160
|
* @param flag Mark switch, true is on, false is off, default is true
|
|
145
161
|
*/
|
|
146
162
|
|
|
147
|
-
function enableBoundaryChecking() {
|
|
148
|
-
|
|
163
|
+
function enableBoundaryChecking(flag) {
|
|
164
|
+
if (flag === void 0) {
|
|
165
|
+
flag = true;
|
|
166
|
+
}
|
|
167
|
+
|
|
149
168
|
_boundaryCheckingState = flag;
|
|
150
169
|
}
|
|
151
170
|
|
|
152
|
-
|
|
153
|
-
export default {
|
|
171
|
+
var _default = {
|
|
154
172
|
strip: strip,
|
|
155
173
|
plus: plus,
|
|
156
174
|
minus: minus,
|
|
@@ -160,4 +178,5 @@ export default {
|
|
|
160
178
|
digitLength: digitLength,
|
|
161
179
|
float2Fixed: float2Fixed,
|
|
162
180
|
enableBoundaryChecking: enableBoundaryChecking
|
|
163
|
-
};
|
|
181
|
+
};
|
|
182
|
+
exports.default = _default;
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.throttle = exports.isInternalImg = exports.isFunction = exports.getImageThumbnailUrl = exports.getFileIconUrl = exports.debounce = exports.checkSVGImage = void 0;
|
|
1
5
|
var FILEEXT_ICON_MAP = {
|
|
2
6
|
// text file
|
|
3
7
|
md: "txt.png",
|
|
@@ -46,7 +50,8 @@ var FILEEXT_ICON_MAP = {
|
|
|
46
50
|
// default
|
|
47
51
|
default: "file.png"
|
|
48
52
|
};
|
|
49
|
-
|
|
53
|
+
|
|
54
|
+
var getFileIconUrl = function getFileIconUrl(filename, direntType) {
|
|
50
55
|
if (direntType === "dir") {
|
|
51
56
|
var _iconUrl = "assets/images/folder/" + FILEEXT_ICON_MAP["folder"];
|
|
52
57
|
|
|
@@ -70,21 +75,30 @@ export var getFileIconUrl = function getFileIconUrl(filename, direntType) {
|
|
|
70
75
|
|
|
71
76
|
return iconUrl;
|
|
72
77
|
};
|
|
73
|
-
|
|
78
|
+
|
|
79
|
+
exports.getFileIconUrl = getFileIconUrl;
|
|
80
|
+
|
|
81
|
+
var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
|
|
74
82
|
if (server && url.indexOf(server) > -1) {
|
|
75
83
|
return url.replace("/workspace", "/thumbnail/workspace") + "?size=256";
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
return url;
|
|
79
87
|
};
|
|
80
|
-
|
|
88
|
+
|
|
89
|
+
exports.getImageThumbnailUrl = getImageThumbnailUrl;
|
|
90
|
+
|
|
91
|
+
var debounce = function debounce(fn, wait) {
|
|
81
92
|
var timeout = null;
|
|
82
93
|
return function () {
|
|
83
94
|
if (timeout !== null) clearTimeout(timeout);
|
|
84
95
|
timeout = setTimeout(fn, wait);
|
|
85
96
|
};
|
|
86
97
|
};
|
|
87
|
-
|
|
98
|
+
|
|
99
|
+
exports.debounce = debounce;
|
|
100
|
+
|
|
101
|
+
var throttle = function throttle(func, delay) {
|
|
88
102
|
var timer = null;
|
|
89
103
|
var startTime = Date.now();
|
|
90
104
|
return function () {
|
|
@@ -102,15 +116,26 @@ export var throttle = function throttle(func, delay) {
|
|
|
102
116
|
}
|
|
103
117
|
};
|
|
104
118
|
};
|
|
105
|
-
|
|
119
|
+
|
|
120
|
+
exports.throttle = throttle;
|
|
121
|
+
|
|
122
|
+
var isFunction = function isFunction(functionToCheck) {
|
|
106
123
|
var getType = {};
|
|
107
124
|
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
108
125
|
};
|
|
109
|
-
|
|
126
|
+
|
|
127
|
+
exports.isFunction = isFunction;
|
|
128
|
+
|
|
129
|
+
var isInternalImg = function isInternalImg(url) {
|
|
110
130
|
if (!url) return;
|
|
111
131
|
return url.indexOf(window.dtable.server) > -1;
|
|
112
132
|
};
|
|
113
|
-
|
|
133
|
+
|
|
134
|
+
exports.isInternalImg = isInternalImg;
|
|
135
|
+
|
|
136
|
+
var checkSVGImage = function checkSVGImage(url) {
|
|
114
137
|
if (!url) return false;
|
|
115
138
|
return url.substr(-4).toLowerCase() === '.svg';
|
|
116
|
-
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
exports.checkSVGImage = checkSVGImage;
|