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.
Files changed (223) hide show
  1. package/es/AutoNumberFormatter/index.css +1 -0
  2. package/es/AutoNumberFormatter/index.js +36 -0
  3. package/es/ButtonFormatter/index.css +13 -0
  4. package/es/ButtonFormatter/index.js +56 -0
  5. package/es/CTimeFormatter/index.css +1 -0
  6. package/es/CTimeFormatter/index.js +58 -0
  7. package/es/CheckboxFormatter/index.css +1 -0
  8. package/es/CheckboxFormatter/index.js +45 -0
  9. package/es/CollaboratorFormatter/index.css +1 -0
  10. package/es/CollaboratorFormatter/index.js +91 -0
  11. package/es/CollaboratorItem/index.css +49 -0
  12. package/es/CollaboratorItem/index.js +64 -0
  13. package/es/CreatorFormatter/index.css +1 -0
  14. package/es/CreatorFormatter/index.js +87 -0
  15. package/es/DateFormatter/index.css +1 -0
  16. package/es/DateFormatter/index.js +60 -0
  17. package/es/DurationFormatter/index.css +1 -0
  18. package/es/DurationFormatter/index.js +38 -0
  19. package/es/EmailFormatter/index.css +5 -0
  20. package/es/EmailFormatter/index.js +36 -0
  21. package/es/FileFormatter/index.css +29 -0
  22. package/es/FileFormatter/index.js +64 -0
  23. package/es/FileItemFormatter/index.js +50 -0
  24. package/es/FileUploader/index.js +53 -0
  25. package/es/FormulaFormatter/index.css +19 -0
  26. package/es/FormulaFormatter/index.js +164 -0
  27. package/es/GeolocationFormatter/index.css +1 -0
  28. package/es/GeolocationFormatter/index.js +53 -0
  29. package/es/ImageFormatter/images-lazy-load.js +150 -0
  30. package/es/ImageFormatter/index.css +34 -0
  31. package/es/ImageFormatter/index.js +154 -0
  32. package/es/ImagePreviewerLightbox/index.css +87 -0
  33. package/es/ImagePreviewerLightbox/index.js +119 -0
  34. package/es/LastModifierFormatter/index.css +1 -0
  35. package/es/LastModifierFormatter/index.js +87 -0
  36. package/es/LinkFormatter/index.css +27 -0
  37. package/es/LinkFormatter/index.js +144 -0
  38. package/es/Loading/index.css +54 -0
  39. package/es/Loading/index.js +7 -0
  40. package/es/LongTextFormatter/html-long-text-formatter.js +96 -0
  41. package/es/LongTextFormatter/index.css +63 -0
  42. package/es/LongTextFormatter/index.js +29 -0
  43. package/es/LongTextFormatter/simple-long-text-formatter.js +104 -0
  44. package/es/MTimeFormatter/index.css +1 -0
  45. package/es/MTimeFormatter/index.js +58 -0
  46. package/es/ModalPortal/index.js +44 -0
  47. package/es/MultipleSelectFormatter/index.css +1 -0
  48. package/es/MultipleSelectFormatter/index.js +70 -0
  49. package/es/NumberFormatter/index.css +1 -0
  50. package/es/NumberFormatter/index.js +47 -0
  51. package/es/RateFormatter/index.css +1 -0
  52. package/es/RateFormatter/index.js +80 -0
  53. package/es/SelectItem/index.js +58 -0
  54. package/es/SingleSelectFormatter/index.css +1 -0
  55. package/es/SingleSelectFormatter/index.js +70 -0
  56. package/es/TextFormatter/index.css +1 -0
  57. package/es/TextFormatter/index.js +56 -0
  58. package/es/UrlFormatter/index.css +5 -0
  59. package/es/UrlFormatter/index.js +36 -0
  60. package/es/app.css +20 -0
  61. package/es/app.js +91 -0
  62. package/es/assets/images/avatar/default_avatar.png +0 -0
  63. package/es/assets/images/file/192/excel.png +0 -0
  64. package/es/assets/images/file/192/file.png +0 -0
  65. package/es/assets/images/file/192/music.png +0 -0
  66. package/es/assets/images/file/192/pdf.png +0 -0
  67. package/es/assets/images/file/192/pic.png +0 -0
  68. package/es/assets/images/file/192/ppt.png +0 -0
  69. package/es/assets/images/file/192/txt.png +0 -0
  70. package/es/assets/images/file/192/video.png +0 -0
  71. package/es/assets/images/file/192/word.png +0 -0
  72. package/es/assets/images/file/24/excel.png +0 -0
  73. package/es/assets/images/file/24/file.png +0 -0
  74. package/es/assets/images/file/24/music.png +0 -0
  75. package/es/assets/images/file/24/pdf.png +0 -0
  76. package/es/assets/images/file/24/pic.png +0 -0
  77. package/es/assets/images/file/24/ppt.png +0 -0
  78. package/es/assets/images/file/24/txt.png +0 -0
  79. package/es/assets/images/file/24/video.png +0 -0
  80. package/es/assets/images/file/24/word.png +0 -0
  81. package/es/assets/images/folder/folder-192.png +0 -0
  82. package/es/assets/images/folder/folder-24.png +0 -0
  83. package/es/cellFormatterFactory/index.js +25 -0
  84. package/es/components/cell-editor/checkbox-editor.js +104 -0
  85. package/es/components/cell-editor/collaborator-editor.js +236 -0
  86. package/es/components/cell-editor/date-editor.js +151 -0
  87. package/es/components/cell-editor/index.js +9 -0
  88. package/es/components/cell-editor/link-editor.js +303 -0
  89. package/es/components/cell-editor/multiple-select-editor.js +237 -0
  90. package/es/components/cell-editor/number-editor.js +154 -0
  91. package/es/components/cell-editor/single-select-editor.js +202 -0
  92. package/es/components/cell-editor/text-editor.js +122 -0
  93. package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
  94. package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
  95. package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
  96. package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
  97. package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
  98. package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +177 -0
  99. package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
  100. package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
  101. package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
  102. package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
  103. package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
  104. package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
  105. package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
  106. package/es/components/common/collaborator-item.js +63 -0
  107. package/es/components/common/edit-editor-button.js +56 -0
  108. package/es/components/common/link-editor-option.js +113 -0
  109. package/es/components/common/mobile/mb-editor-header.js +48 -0
  110. package/es/components/common/select-editor-option.js +106 -0
  111. package/es/constants/cell-types.js +25 -0
  112. package/es/constants/index.js +49 -0
  113. package/es/css/cell-editor.css +614 -0
  114. package/es/css/cell-formatter.css +4 -0
  115. package/es/css/custom-rc-calendar.css +118 -0
  116. package/es/formatterConfig/index.js +31 -0
  117. package/es/index.js +31 -0
  118. package/es/lang/index.js +50 -0
  119. package/es/locals/de.js +2 -0
  120. package/es/locals/en.js +17 -0
  121. package/es/locals/fr.js +2 -0
  122. package/es/locals/zh-CN.js +17 -0
  123. package/{lib/toast → es/toaster}/alert.js +0 -0
  124. package/{lib/toast → es/toaster}/index.js +0 -0
  125. package/{lib/toast → es/toaster}/toast.js +0 -0
  126. package/{lib/toast → es/toaster}/toastManager.js +0 -0
  127. package/{lib/toast → es/toaster}/toaster.js +0 -0
  128. package/es/utils/cell-value-validator.js +31 -0
  129. package/es/utils/column-utils.js +7 -0
  130. package/es/utils/editor-utils.js +71 -0
  131. package/es/utils/markdown2html.js +62 -0
  132. package/es/utils/normalize-long-text-value.js +69 -0
  133. package/es/utils/number-precision.js +164 -0
  134. package/es/utils/unified/index.js +470 -0
  135. package/es/utils/utils.js +116 -0
  136. package/es/utils/value-format-utils.js +497 -0
  137. package/es/utils/vfile/core.js +172 -0
  138. package/es/utils/vfile/index.js +48 -0
  139. package/lib/AutoNumberFormatter/index.js +38 -27
  140. package/lib/ButtonFormatter/index.js +59 -47
  141. package/lib/CTimeFormatter/index.js +53 -39
  142. package/lib/CheckboxFormatter/index.js +48 -35
  143. package/lib/CollaboratorFormatter/index.js +64 -42
  144. package/lib/CollaboratorItem/index.js +61 -44
  145. package/lib/CreatorFormatter/index.js +62 -42
  146. package/lib/DateFormatter/index.js +55 -40
  147. package/lib/DurationFormatter/index.js +42 -29
  148. package/lib/EmailFormatter/index.js +38 -27
  149. package/lib/FileFormatter/index.js +65 -50
  150. package/lib/FileItemFormatter/index.js +44 -31
  151. package/lib/FileUploader/index.js +44 -34
  152. package/lib/FormulaFormatter/index.js +102 -81
  153. package/lib/GeolocationFormatter/index.js +50 -35
  154. package/lib/ImageFormatter/images-lazy-load.js +81 -73
  155. package/lib/ImageFormatter/index.js +109 -90
  156. package/lib/ImagePreviewerLightbox/index.js +60 -27
  157. package/lib/LastModifierFormatter/index.js +62 -42
  158. package/lib/LinkFormatter/index.js +80 -59
  159. package/lib/Loading/index.js +13 -4
  160. package/lib/LongTextFormatter/html-long-text-formatter.js +60 -49
  161. package/lib/LongTextFormatter/index.js +28 -9
  162. package/lib/LongTextFormatter/simple-long-text-formatter.js +58 -52
  163. package/lib/MTimeFormatter/index.js +53 -39
  164. package/lib/ModalPortal/index.js +37 -30
  165. package/lib/MultipleSelectFormatter/index.js +55 -39
  166. package/lib/NumberFormatter/index.js +50 -35
  167. package/lib/RateFormatter/index.js +52 -37
  168. package/lib/SelectItem/index.js +46 -31
  169. package/lib/SingleSelectFormatter/index.js +54 -38
  170. package/lib/TextFormatter/index.js +44 -31
  171. package/lib/UrlFormatter/index.js +38 -27
  172. package/lib/app.js +80 -75
  173. package/lib/cellFormatterFactory/index.js +20 -17
  174. package/lib/components/cell-editor/checkbox-editor.js +66 -59
  175. package/lib/components/cell-editor/collaborator-editor.js +126 -113
  176. package/lib/components/cell-editor/date-editor.js +119 -99
  177. package/lib/components/cell-editor/index.js +40 -9
  178. package/lib/components/cell-editor/link-editor.js +140 -122
  179. package/lib/components/cell-editor/multiple-select-editor.js +127 -114
  180. package/lib/components/cell-editor/number-editor.js +86 -78
  181. package/lib/components/cell-editor/single-select-editor.js +120 -106
  182. package/lib/components/cell-editor/text-editor.js +72 -65
  183. package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +51 -31
  184. package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
  185. package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
  186. package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
  187. package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
  188. package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +111 -105
  189. package/lib/components/cell-editor-popover/mb-date-editor-popover.js +157 -140
  190. package/lib/components/cell-editor-popover/mb-link-editor-popover.js +109 -103
  191. package/lib/components/cell-editor-popover/mb-select-editor-popover.js +155 -142
  192. package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +89 -74
  193. package/lib/components/cell-editor-popover/pc-date-editor-popover.js +102 -88
  194. package/lib/components/cell-editor-popover/pc-link-editor-popover.js +91 -77
  195. package/lib/components/cell-editor-popover/pc-select-editor-popover.js +105 -91
  196. package/lib/components/common/collaborator-item.js +59 -43
  197. package/lib/components/common/edit-editor-button.js +39 -28
  198. package/lib/components/common/link-editor-option.js +71 -63
  199. package/lib/components/common/mobile/mb-editor-header.js +52 -39
  200. package/lib/components/common/select-editor-option.js +74 -58
  201. package/lib/constants/cell-types.js +54 -25
  202. package/lib/constants/index.js +28 -5
  203. package/lib/formatterConfig/index.js +59 -28
  204. package/lib/index.js +139 -31
  205. package/lib/lang/index.js +27 -11
  206. package/lib/locals/de.js +6 -1
  207. package/lib/locals/en.js +6 -1
  208. package/lib/locals/fr.js +6 -1
  209. package/lib/locals/zh-CN.js +6 -1
  210. package/lib/toaster/alert.js +164 -0
  211. package/lib/toaster/index.js +12 -0
  212. package/lib/toaster/toast.js +223 -0
  213. package/lib/toaster/toastManager.js +189 -0
  214. package/lib/toaster/toaster.js +92 -0
  215. package/lib/utils/cell-value-validator.js +9 -5
  216. package/lib/utils/column-utils.js +13 -5
  217. package/lib/utils/editor-utils.js +13 -3
  218. package/lib/utils/markdown2html.js +7 -1
  219. package/lib/utils/normalize-long-text-value.js +6 -1
  220. package/lib/utils/number-precision.js +32 -13
  221. package/lib/utils/utils.js +33 -8
  222. package/lib/utils/value-format-utils.js +110 -58
  223. 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
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ "use strict";
2
2
 
3
- var _validators;
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _constants = require("../constants");
4
7
 
5
- import { FORMULA_RESULT_TYPE, CellType } from '../constants';
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 = {}, _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);
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
- export default cellValueValidator;
34
+ var _default = cellValueValidator;
35
+ exports.default = _default;
@@ -1,7 +1,15 @@
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);
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
- export function isArrayFormalColumn(columnType) {
6
- return ARRAY_FORMAL_COLUMNS.includes(columnType);
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
- export var initDateEditorLanguage = function initDateEditorLanguage(lang) {
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
- export var getSelectOptionItem = function getSelectOptionItem(options, optionId) {
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
- export { processor, processorGetAST };
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
- export default getPreviewContent;
73
+ var _default = getPreviewContent;
74
+ exports.default = _default;
@@ -1,4 +1,16 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
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
- var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
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
- console.warn("".concat(num, " is beyond boundary when transfer to integer, the results may not be accurate"));
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(_toConsumableArray(others.slice(1))));
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(_toConsumableArray(others.slice(1))));
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(_toConsumableArray(others.slice(1))));
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(_toConsumableArray(others.slice(1))));
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
- var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
163
+ function enableBoundaryChecking(flag) {
164
+ if (flag === void 0) {
165
+ flag = true;
166
+ }
167
+
149
168
  _boundaryCheckingState = flag;
150
169
  }
151
170
 
152
- export { strip, plus, minus, times, divide, round, digitLength, float2Fixed, enableBoundaryChecking };
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;
@@ -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
- export var getFileIconUrl = function getFileIconUrl(filename, direntType) {
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
- export var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
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
- export var debounce = function debounce(fn, wait) {
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
- export var throttle = function throttle(func, delay) {
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
- export var isFunction = function isFunction(functionToCheck) {
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
- export var isInternalImg = function isInternalImg(url) {
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
- export var checkSVGImage = function checkSVGImage(url) {
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;