dtable-ui-component 0.1.74 → 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 (238) hide show
  1. package/es/AutoNumberFormatter/index.css +1 -0
  2. package/es/{components/cell-formatter/auto-number-formatter.js → AutoNumberFormatter/index.js} +1 -0
  3. package/es/ButtonFormatter/index.css +13 -0
  4. package/es/{components/cell-formatter/button-formatter.js → ButtonFormatter/index.js} +1 -0
  5. package/es/CTimeFormatter/index.css +1 -0
  6. package/es/{components/cell-formatter/ctime-formatter.js → CTimeFormatter/index.js} +1 -0
  7. package/es/CheckboxFormatter/index.css +1 -0
  8. package/es/{components/cell-formatter/checkbox-formatter.js → CheckboxFormatter/index.js} +1 -0
  9. package/es/CollaboratorFormatter/index.css +1 -0
  10. package/es/{components/cell-formatter/collaborator-formatter.js → CollaboratorFormatter/index.js} +3 -2
  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/{components/cell-formatter/creator-formatter.js → CreatorFormatter/index.js} +3 -2
  15. package/es/DateFormatter/index.css +1 -0
  16. package/es/{components/cell-formatter/date-formatter.js → DateFormatter/index.js} +2 -1
  17. package/es/DurationFormatter/index.css +1 -0
  18. package/es/{components/cell-formatter/duration-formatter.js → DurationFormatter/index.js} +2 -1
  19. package/es/EmailFormatter/index.css +5 -0
  20. package/es/{components/cell-formatter/email-formatter.js → EmailFormatter/index.js} +1 -0
  21. package/es/FileFormatter/index.css +29 -0
  22. package/es/{components/cell-formatter/file-formatter.js → FileFormatter/index.js} +2 -1
  23. package/es/{components/cell-formatter/widgets/file-item-formatter.js → FileItemFormatter/index.js} +2 -2
  24. package/es/{components/file-uploader → FileUploader}/index.js +0 -0
  25. package/es/FormulaFormatter/index.css +19 -0
  26. package/es/{components/cell-formatter/formula-formatter.js → FormulaFormatter/index.js} +8 -8
  27. package/es/GeolocationFormatter/index.css +1 -0
  28. package/es/{components/cell-formatter/geolocation-formatter.js → GeolocationFormatter/index.js} +2 -1
  29. package/es/{components/common → ImageFormatter}/images-lazy-load.js +2 -2
  30. package/es/ImageFormatter/index.css +34 -0
  31. package/es/{components/cell-formatter/image-formatter.js → ImageFormatter/index.js} +4 -3
  32. package/es/{css/image-previewer-ligntbox.css → ImagePreviewerLightbox/index.css} +0 -0
  33. package/es/{components/cell-formatter/widgets/image-previewer-lightbox.js → ImagePreviewerLightbox/index.js} +3 -3
  34. package/es/LastModifierFormatter/index.css +1 -0
  35. package/es/{components/cell-formatter/last-modifier-formatter.js → LastModifierFormatter/index.js} +5 -4
  36. package/es/LinkFormatter/index.css +27 -0
  37. package/es/{components/cell-formatter/link-formatter.js → LinkFormatter/index.js} +2 -2
  38. package/es/{css/loading.css → Loading/index.css} +0 -0
  39. package/es/{components/loading.js → Loading/index.js} +1 -1
  40. package/es/{components/cell-formatter/widgets/long-text-formatter → LongTextFormatter}/html-long-text-formatter.js +1 -1
  41. package/es/LongTextFormatter/index.css +63 -0
  42. package/es/{components/cell-formatter/long-text-formatter.js → LongTextFormatter/index.js} +3 -2
  43. package/es/{components/cell-formatter/widgets/long-text-formatter → LongTextFormatter}/simple-long-text-formatter.js +1 -1
  44. package/es/MTimeFormatter/index.css +1 -0
  45. package/es/{components/cell-formatter/mtime-formatter.js → MTimeFormatter/index.js} +1 -0
  46. package/es/{components/common/modal-portal.js → ModalPortal/index.js} +0 -0
  47. package/es/MultipleSelectFormatter/index.css +1 -0
  48. package/es/{components/cell-formatter/multiple-select-formatter.js → MultipleSelectFormatter/index.js} +2 -1
  49. package/es/NumberFormatter/index.css +1 -0
  50. package/es/{components/cell-formatter/number-formatter.js → NumberFormatter/index.js} +2 -1
  51. package/es/RateFormatter/index.css +1 -0
  52. package/es/{components/cell-formatter/rate-formatter.js → RateFormatter/index.js} +1 -0
  53. package/es/{components/common/select-item.js → SelectItem/index.js} +0 -0
  54. package/es/SingleSelectFormatter/index.css +1 -0
  55. package/es/{components/cell-formatter/single-select-formatter.js → SingleSelectFormatter/index.js} +2 -1
  56. package/es/TextFormatter/index.css +1 -0
  57. package/es/{components/cell-formatter/text-formatter.js → TextFormatter/index.js} +1 -0
  58. package/es/UrlFormatter/index.css +5 -0
  59. package/es/{components/cell-formatter/url-formatter.js → UrlFormatter/index.js} +1 -0
  60. package/es/app.js +1 -1
  61. package/es/{components/cell-factory/cell-formatter-factory.js → cellFormatterFactory/index.js} +3 -3
  62. package/es/components/cell-editor/checkbox-editor.js +104 -0
  63. package/es/components/cell-editor/collaborator-editor.js +236 -0
  64. package/es/components/cell-editor/date-editor.js +151 -0
  65. package/es/components/cell-editor/index.js +9 -0
  66. package/es/components/cell-editor/link-editor.js +303 -0
  67. package/es/components/cell-editor/multiple-select-editor.js +237 -0
  68. package/es/components/cell-editor/number-editor.js +154 -0
  69. package/es/components/cell-editor/single-select-editor.js +202 -0
  70. package/es/components/cell-editor/text-editor.js +122 -0
  71. package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +46 -0
  72. package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
  73. package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
  74. package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
  75. package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
  76. package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +177 -0
  77. package/es/components/cell-editor-popover/mb-date-editor-popover.js +245 -0
  78. package/es/components/cell-editor-popover/mb-link-editor-popover.js +170 -0
  79. package/es/components/cell-editor-popover/mb-select-editor-popover.js +230 -0
  80. package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +109 -0
  81. package/es/components/cell-editor-popover/pc-date-editor-popover.js +142 -0
  82. package/es/components/cell-editor-popover/pc-link-editor-popover.js +114 -0
  83. package/es/components/cell-editor-popover/pc-select-editor-popover.js +143 -0
  84. package/es/constants/index.js +15 -14
  85. package/es/css/cell-formatter.css +0 -243
  86. package/es/formatterConfig/index.js +31 -0
  87. package/es/index.js +29 -3
  88. package/es/{components/toast → toaster}/alert.js +0 -0
  89. package/es/{components/toast → toaster}/index.js +0 -0
  90. package/es/{components/toast → toaster}/toast.js +0 -0
  91. package/es/{components/toast → toaster}/toastManager.js +0 -0
  92. package/es/{components/toast → toaster}/toaster.js +0 -0
  93. package/es/utils/cell-value-validator.js +1 -2
  94. package/es/utils/editor-utils.js +71 -0
  95. package/es/utils/normalize-long-text-value.js +2 -2
  96. package/es/utils/number-precision.js +1 -0
  97. package/es/utils/value-format-utils.js +2 -0
  98. package/lib/AutoNumberFormatter/index.css +1 -0
  99. package/lib/AutoNumberFormatter/index.js +47 -0
  100. package/lib/ButtonFormatter/index.css +13 -0
  101. package/lib/ButtonFormatter/index.js +68 -0
  102. package/lib/CTimeFormatter/index.css +1 -0
  103. package/lib/CTimeFormatter/index.js +72 -0
  104. package/lib/CheckboxFormatter/index.css +1 -0
  105. package/lib/CheckboxFormatter/index.js +58 -0
  106. package/lib/CollaboratorFormatter/index.css +1 -0
  107. package/lib/CollaboratorFormatter/index.js +113 -0
  108. package/lib/CollaboratorItem/index.css +49 -0
  109. package/lib/CollaboratorItem/index.js +81 -0
  110. package/lib/CreatorFormatter/index.css +1 -0
  111. package/lib/CreatorFormatter/index.js +107 -0
  112. package/lib/DateFormatter/index.css +1 -0
  113. package/lib/DateFormatter/index.js +75 -0
  114. package/lib/DurationFormatter/index.css +1 -0
  115. package/lib/DurationFormatter/index.js +51 -0
  116. package/lib/EmailFormatter/index.css +5 -0
  117. package/lib/EmailFormatter/index.js +47 -0
  118. package/lib/FileFormatter/index.css +29 -0
  119. package/lib/FileFormatter/index.js +79 -0
  120. package/lib/FileItemFormatter/index.js +63 -0
  121. package/lib/FileUploader/index.js +63 -0
  122. package/lib/FormulaFormatter/index.css +19 -0
  123. package/lib/FormulaFormatter/index.js +185 -0
  124. package/lib/GeolocationFormatter/index.css +1 -0
  125. package/lib/GeolocationFormatter/index.js +68 -0
  126. package/lib/ImageFormatter/images-lazy-load.js +158 -0
  127. package/lib/ImageFormatter/index.css +34 -0
  128. package/lib/ImageFormatter/index.js +173 -0
  129. package/lib/ImagePreviewerLightbox/index.css +87 -0
  130. package/lib/ImagePreviewerLightbox/index.js +152 -0
  131. package/lib/LastModifierFormatter/index.css +1 -0
  132. package/lib/LastModifierFormatter/index.js +107 -0
  133. package/lib/LinkFormatter/index.css +27 -0
  134. package/lib/LinkFormatter/index.js +165 -0
  135. package/lib/Loading/index.css +54 -0
  136. package/lib/Loading/index.js +16 -0
  137. package/lib/LongTextFormatter/html-long-text-formatter.js +107 -0
  138. package/lib/LongTextFormatter/index.css +63 -0
  139. package/lib/LongTextFormatter/index.js +48 -0
  140. package/lib/LongTextFormatter/simple-long-text-formatter.js +110 -0
  141. package/lib/MTimeFormatter/index.css +1 -0
  142. package/lib/MTimeFormatter/index.js +72 -0
  143. package/lib/ModalPortal/index.js +51 -0
  144. package/lib/MultipleSelectFormatter/index.css +1 -0
  145. package/lib/MultipleSelectFormatter/index.js +86 -0
  146. package/lib/NumberFormatter/index.css +1 -0
  147. package/lib/NumberFormatter/index.js +62 -0
  148. package/lib/RateFormatter/index.css +1 -0
  149. package/lib/RateFormatter/index.js +95 -0
  150. package/lib/SelectItem/index.js +73 -0
  151. package/lib/SingleSelectFormatter/index.css +1 -0
  152. package/lib/SingleSelectFormatter/index.js +86 -0
  153. package/lib/TextFormatter/index.css +1 -0
  154. package/lib/TextFormatter/index.js +69 -0
  155. package/lib/UrlFormatter/index.css +5 -0
  156. package/lib/UrlFormatter/index.js +47 -0
  157. package/lib/app.css +20 -0
  158. package/lib/app.js +96 -0
  159. package/lib/assets/images/avatar/default_avatar.png +0 -0
  160. package/lib/assets/images/file/192/excel.png +0 -0
  161. package/lib/assets/images/file/192/file.png +0 -0
  162. package/lib/assets/images/file/192/music.png +0 -0
  163. package/lib/assets/images/file/192/pdf.png +0 -0
  164. package/lib/assets/images/file/192/pic.png +0 -0
  165. package/lib/assets/images/file/192/ppt.png +0 -0
  166. package/lib/assets/images/file/192/txt.png +0 -0
  167. package/lib/assets/images/file/192/video.png +0 -0
  168. package/lib/assets/images/file/192/word.png +0 -0
  169. package/lib/assets/images/file/24/excel.png +0 -0
  170. package/lib/assets/images/file/24/file.png +0 -0
  171. package/lib/assets/images/file/24/music.png +0 -0
  172. package/lib/assets/images/file/24/pdf.png +0 -0
  173. package/lib/assets/images/file/24/pic.png +0 -0
  174. package/lib/assets/images/file/24/ppt.png +0 -0
  175. package/lib/assets/images/file/24/txt.png +0 -0
  176. package/lib/assets/images/file/24/video.png +0 -0
  177. package/lib/assets/images/file/24/word.png +0 -0
  178. package/lib/assets/images/folder/folder-192.png +0 -0
  179. package/lib/assets/images/folder/folder-24.png +0 -0
  180. package/lib/cellFormatterFactory/index.js +28 -0
  181. package/lib/components/cell-editor/checkbox-editor.js +111 -0
  182. package/lib/components/cell-editor/collaborator-editor.js +249 -0
  183. package/lib/components/cell-editor/date-editor.js +171 -0
  184. package/lib/components/cell-editor/index.js +40 -0
  185. package/lib/components/cell-editor/link-editor.js +321 -0
  186. package/lib/components/cell-editor/multiple-select-editor.js +250 -0
  187. package/lib/components/cell-editor/number-editor.js +162 -0
  188. package/lib/components/cell-editor/single-select-editor.js +216 -0
  189. package/lib/components/cell-editor/text-editor.js +129 -0
  190. package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +66 -0
  191. package/lib/components/cell-editor-dialog/pc-files-addition/index.js +1 -0
  192. package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +1 -0
  193. package/lib/components/cell-editor-dialog/pc-files-preview/index.js +1 -0
  194. package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +1 -0
  195. package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +183 -0
  196. package/lib/components/cell-editor-popover/mb-date-editor-popover.js +262 -0
  197. package/lib/components/cell-editor-popover/mb-link-editor-popover.js +176 -0
  198. package/lib/components/cell-editor-popover/mb-select-editor-popover.js +243 -0
  199. package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +124 -0
  200. package/lib/components/cell-editor-popover/pc-date-editor-popover.js +156 -0
  201. package/lib/components/cell-editor-popover/pc-link-editor-popover.js +128 -0
  202. package/lib/components/cell-editor-popover/pc-select-editor-popover.js +157 -0
  203. package/lib/components/common/collaborator-item.js +79 -0
  204. package/lib/components/common/edit-editor-button.js +67 -0
  205. package/lib/components/common/link-editor-option.js +121 -0
  206. package/lib/components/common/mobile/mb-editor-header.js +61 -0
  207. package/lib/components/common/select-editor-option.js +122 -0
  208. package/lib/constants/cell-types.js +54 -0
  209. package/lib/constants/index.js +72 -0
  210. package/lib/css/cell-editor.css +614 -0
  211. package/lib/css/cell-formatter.css +4 -0
  212. package/lib/css/custom-rc-calendar.css +118 -0
  213. package/lib/formatterConfig/index.js +62 -0
  214. package/lib/index.js +139 -0
  215. package/lib/lang/index.js +66 -0
  216. package/lib/locals/de.js +7 -0
  217. package/lib/locals/en.js +22 -0
  218. package/lib/locals/fr.js +7 -0
  219. package/lib/locals/zh-CN.js +22 -0
  220. package/lib/toaster/alert.js +164 -0
  221. package/lib/toaster/index.js +12 -0
  222. package/lib/toaster/toast.js +223 -0
  223. package/lib/toaster/toastManager.js +189 -0
  224. package/lib/toaster/toaster.js +92 -0
  225. package/lib/utils/cell-value-validator.js +35 -0
  226. package/lib/utils/column-utils.js +15 -0
  227. package/lib/utils/editor-utils.js +81 -0
  228. package/lib/utils/markdown2html.js +68 -0
  229. package/lib/utils/normalize-long-text-value.js +74 -0
  230. package/lib/utils/number-precision.js +182 -0
  231. package/lib/utils/unified/index.js +470 -0
  232. package/lib/utils/utils.js +141 -0
  233. package/lib/utils/value-format-utils.js +547 -0
  234. package/lib/utils/vfile/core.js +172 -0
  235. package/lib/utils/vfile/index.js +48 -0
  236. package/package.json +5 -3
  237. package/es/components/cell-formatter/formatter-config.js +0 -31
  238. package/es/components/cell-formatter/index.js +0 -27
@@ -0,0 +1,223 @@
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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
9
+
10
+ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _glamor = require("glamor");
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _Transition = _interopRequireDefault(require("react-transition-group/Transition"));
21
+
22
+ var _alert = _interopRequireDefault(require("./alert"));
23
+
24
+ var animationEasing = {
25
+ deceleration: 'cubic-bezier(0.0, 0.0, 0.2, 1)',
26
+ acceleration: 'cubic-bezier(0.4, 0.0, 1, 1)',
27
+ spring: 'cubic-bezier(0.175, 0.885, 0.320, 1.175)'
28
+ };
29
+ var ANIMATION_DURATION = 240;
30
+
31
+ var openAnimation = _glamor.css.keyframes('openAnimation', {
32
+ from: {
33
+ opacity: 0,
34
+ transform: 'translateY(-120%)'
35
+ },
36
+ to: {
37
+ transform: 'translateY(0)'
38
+ }
39
+ });
40
+
41
+ var closeAnimation = _glamor.css.keyframes('closeAnimation', {
42
+ from: {
43
+ transform: 'scale(1)',
44
+ opacity: 1
45
+ },
46
+ to: {
47
+ transform: 'scale(0.9)',
48
+ opacity: 0
49
+ }
50
+ });
51
+
52
+ var animationStyles = (0, _glamor.css)({
53
+ display: 'flex',
54
+ flexDirection: 'column',
55
+ alignItems: 'center',
56
+ height: 0,
57
+ transition: "all " + ANIMATION_DURATION + "ms " + animationEasing.deceleration,
58
+ '&[data-state="entering"], &[data-state="entered"]': {
59
+ animation: openAnimation + " " + ANIMATION_DURATION + "ms " + animationEasing.spring + " both"
60
+ },
61
+ '&[data-state="exiting"]': {
62
+ animation: closeAnimation + " 120ms " + animationEasing.acceleration + " both"
63
+ }
64
+ });
65
+
66
+ var Toast = /*#__PURE__*/function (_React$PureComponent) {
67
+ (0, _inheritsLoose2.default)(Toast, _React$PureComponent);
68
+
69
+ function Toast() {
70
+ var _this;
71
+
72
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
73
+ args[_key] = arguments[_key];
74
+ }
75
+
76
+ _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
77
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
78
+ isShown: true,
79
+ height: 0
80
+ });
81
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "close", function () {
82
+ _this.clearCloseTimer();
83
+
84
+ _this.setState({
85
+ isShown: false
86
+ });
87
+ });
88
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startCloseTimer", function () {
89
+ if (_this.props.duration) {
90
+ _this.closeTimer = setTimeout(function () {
91
+ _this.close();
92
+ }, _this.props.duration * 1000);
93
+ }
94
+ });
95
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearCloseTimer", function () {
96
+ if (_this.closeTimer) {
97
+ clearTimeout(_this.closeTimer);
98
+ _this.closeTimer = null;
99
+ }
100
+ });
101
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseEnter", function () {
102
+ _this.clearCloseTimer();
103
+ });
104
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMouseLeave", function () {
105
+ _this.startCloseTimer();
106
+ });
107
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRef", function (ref) {
108
+ if (ref === null) return;
109
+
110
+ var _ref$getBoundingClien = ref.getBoundingClientRect(),
111
+ height = _ref$getBoundingClien.height;
112
+
113
+ _this.setState({
114
+ height: height
115
+ });
116
+ });
117
+ return _this;
118
+ }
119
+
120
+ var _proto = Toast.prototype;
121
+
122
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
123
+ if (prevProps.isShown !== this.props.isShown) {
124
+ // eslint-disable-next-line react/no-did-update-set-state
125
+ this.setState({
126
+ isShown: this.props.isShown
127
+ });
128
+ }
129
+ };
130
+
131
+ _proto.componentDidMount = function componentDidMount() {
132
+ this.startCloseTimer();
133
+ };
134
+
135
+ _proto.componentWillUnmount = function componentWillUnmount() {
136
+ this.clearCloseTimer();
137
+ };
138
+
139
+ _proto.render = function render() {
140
+ var _this2 = this;
141
+
142
+ return /*#__PURE__*/_react.default.createElement(_Transition.default, {
143
+ appear: true,
144
+ unmountOnExit: true,
145
+ timeout: ANIMATION_DURATION,
146
+ in: this.state.isShown,
147
+ onExited: this.props.onRemove
148
+ }, function (state) {
149
+ return /*#__PURE__*/_react.default.createElement("div", {
150
+ "data-state": state,
151
+ className: animationStyles,
152
+ onMouseEnter: _this2.handleMouseEnter,
153
+ onMouseLeave: _this2.handleMouseLeave,
154
+ style: {
155
+ height: _this2.state.height,
156
+ zIndex: _this2.props.zIndex,
157
+ marginBottom: _this2.state.isShown ? 0 : -_this2.state.height
158
+ }
159
+ }, /*#__PURE__*/_react.default.createElement("div", {
160
+ ref: _this2.onRef,
161
+ style: {
162
+ padding: 8
163
+ }
164
+ }, /*#__PURE__*/_react.default.createElement(_alert.default, {
165
+ intent: _this2.props.intent,
166
+ title: _this2.props.title,
167
+ children: _this2.props.children || '',
168
+ isRemoveable: _this2.props.hasCloseButton,
169
+ onRemove: function onRemove() {
170
+ return _this2.close();
171
+ }
172
+ })));
173
+ });
174
+ };
175
+
176
+ return Toast;
177
+ }(_react.default.PureComponent);
178
+
179
+ exports.default = Toast;
180
+ (0, _defineProperty2.default)(Toast, "propTypes", {
181
+ /**
182
+ * The z-index of the toast.
183
+ */
184
+ zIndex: _propTypes.default.number,
185
+
186
+ /**
187
+ * Duration of the toast.
188
+ */
189
+ duration: _propTypes.default.number,
190
+
191
+ /**
192
+ * Function called when the toast is all the way closed.
193
+ */
194
+ onRemove: _propTypes.default.func,
195
+
196
+ /**
197
+ * The type of the alert.
198
+ */
199
+ intent: _propTypes.default.oneOf(['none', 'success', 'warning', 'danger']).isRequired,
200
+
201
+ /**
202
+ * The title of the alert.
203
+ */
204
+ title: _propTypes.default.node,
205
+
206
+ /**
207
+ * Description of the alert.
208
+ */
209
+ children: _propTypes.default.node,
210
+
211
+ /**
212
+ * When true, show a close icon button inside of the toast.
213
+ */
214
+ hasCloseButton: _propTypes.default.bool,
215
+
216
+ /**
217
+ * When false, will close the Toast and call onRemove when finished.
218
+ */
219
+ isShown: _propTypes.default.bool
220
+ });
221
+ (0, _defineProperty2.default)(Toast, "defaultProps", {
222
+ intent: 'none'
223
+ });
@@ -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;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _constants = require("../constants");
7
+
8
+ var _validators;
9
+
10
+ var numberValidator = function numberValidator(value) {
11
+ return (value || value === 0) && Object.prototype.toString.call(value) === '[object Number]';
12
+ };
13
+
14
+ var textValidator = function textValidator(value) {
15
+ return !!value;
16
+ };
17
+
18
+ var checkboxValidator = function checkboxValidator(value) {
19
+ return typeof value === 'boolean';
20
+ };
21
+
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);
23
+
24
+ var cellValueValidator = function cellValueValidator(cellValue, type) {
25
+ var validator = validators[type];
26
+
27
+ if (validator) {
28
+ return validator(cellValue);
29
+ }
30
+
31
+ return true;
32
+ };
33
+
34
+ var _default = cellValueValidator;
35
+ exports.default = _default;
@@ -0,0 +1,15 @@
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);
11
+ }
12
+
13
+ function isArrayFormalColumn(columnType) {
14
+ return _constants.ARRAY_FORMAL_COLUMNS.includes(columnType);
15
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.initDateEditorLanguage = exports.getSelectOptionItem = void 0;
5
+
6
+ var zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
7
+
8
+ var zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
9
+
10
+ var enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
11
+
12
+ var frFR = require('@seafile/seafile-calendar/lib/locale/fr_FR');
13
+
14
+ var deDE = require('@seafile/seafile-calendar/lib/locale/de_DE');
15
+
16
+ var esES = require('@seafile/seafile-calendar/lib/locale/es_ES');
17
+
18
+ var plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
19
+
20
+ var csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
21
+
22
+ var initDateEditorLanguage = function initDateEditorLanguage(lang) {
23
+ var language;
24
+
25
+ switch (lang) {
26
+ case 'zh-cn':
27
+ language = zhCN;
28
+ break;
29
+
30
+ case 'zh-tw':
31
+ language = zhTW;
32
+ break;
33
+
34
+ case 'en':
35
+ language = enUS;
36
+ break;
37
+
38
+ case 'fr':
39
+ language = frFR;
40
+ break;
41
+
42
+ case 'de':
43
+ language = deDE;
44
+ break;
45
+
46
+ case 'es':
47
+ language = esES;
48
+ break;
49
+
50
+ case 'es-ar':
51
+ language = esES;
52
+ break;
53
+
54
+ case 'es-mx':
55
+ language = esES;
56
+ break;
57
+
58
+ case 'pl':
59
+ language = plPL;
60
+ break;
61
+
62
+ case 'cs':
63
+ language = csCZ;
64
+ break;
65
+
66
+ default:
67
+ language = zhCN;
68
+ }
69
+
70
+ return language;
71
+ };
72
+
73
+ exports.initDateEditorLanguage = initDateEditorLanguage;
74
+
75
+ var getSelectOptionItem = function getSelectOptionItem(options, optionId) {
76
+ return options.find(function (option) {
77
+ return option.id === optionId;
78
+ });
79
+ };
80
+
81
+ exports.getSelectOptionItem = getSelectOptionItem;