dtable-ui-component 0.1.75-beta1 → 0.1.75-beta10

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 (272) hide show
  1. package/README.md +15 -2
  2. package/lib/AutoNumberFormatter/index.css +1 -0
  3. package/{es/components/cell-formatter/auto-number-formatter.js → lib/AutoNumberFormatter/index.js} +1 -0
  4. package/lib/ButtonFormatter/index.css +13 -0
  5. package/{es/components/cell-formatter/button-formatter.js → lib/ButtonFormatter/index.js} +1 -0
  6. package/lib/CTimeFormatter/index.css +1 -0
  7. package/{es/components/cell-formatter/ctime-formatter.js → lib/CTimeFormatter/index.js} +1 -0
  8. package/{es/components/cell-editor/checkbox-editor.js → lib/CheckboxEditor/index.js} +0 -0
  9. package/lib/CheckboxFormatter/index.css +1 -0
  10. package/{es/components/cell-formatter/checkbox-formatter.js → lib/CheckboxFormatter/index.js} +1 -0
  11. package/lib/CollaboratorEditor/index.css +48 -0
  12. package/{es/components/cell-editor/collaborator-editor.js → lib/CollaboratorEditor/index.js} +6 -5
  13. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.css +86 -0
  14. package/{es/components/cell-editor-popover/mb-collaborator-editor-popover.js → lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js} +2 -1
  15. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.css +1 -0
  16. package/{es/components/cell-editor-popover/pc-collaborator-editor-popover.js → lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js} +2 -1
  17. package/lib/CollaboratorFormatter/index.css +1 -0
  18. package/{es/components/cell-formatter/collaborator-formatter.js → lib/CollaboratorFormatter/index.js} +3 -2
  19. package/lib/CollaboratorItem/index.css +49 -0
  20. package/{es/components/common/collaborator-item.js → lib/CollaboratorItem/index.js} +1 -0
  21. package/lib/CreatorFormatter/index.css +1 -0
  22. package/{es/components/cell-formatter/creator-formatter.js → lib/CreatorFormatter/index.js} +3 -2
  23. package/lib/DateEditor/index.css +4 -0
  24. package/{es/components/cell-editor/date-editor.js → lib/DateEditor/index.js} +5 -4
  25. package/{es/css → lib/DateEditor/mb-date-editor-popover}/custom-rc-calendar.css +0 -0
  26. package/lib/DateEditor/mb-date-editor-popover/index.css +45 -0
  27. package/{es/components/cell-editor-popover/mb-date-editor-popover.js → lib/DateEditor/mb-date-editor-popover/index.js} +10 -10
  28. package/{es/components/cell-editor-popover → lib/DateEditor}/pc-date-editor-popover.js +2 -2
  29. package/lib/DateFormatter/index.css +1 -0
  30. package/{es/components/cell-formatter/date-formatter.js → lib/DateFormatter/index.js} +2 -1
  31. package/lib/DurationFormatter/index.css +1 -0
  32. package/{es/components/cell-formatter/duration-formatter.js → lib/DurationFormatter/index.js} +2 -1
  33. package/{es/components/common/edit-editor-button.js → lib/EditEditorButton/index.js} +0 -0
  34. package/lib/EmailFormatter/index.css +5 -0
  35. package/{es/components/cell-formatter/email-formatter.js → lib/EmailFormatter/index.js} +1 -0
  36. package/{es/components/cell-editor-dialog/pc-file-editor-dialog.js → lib/FileEditor/index.js} +10 -10
  37. package/{es/components/cell-editor-dialog → lib/FileEditor}/pc-files-addition/index.js +0 -0
  38. package/{es/components/cell-editor-dialog → lib/FileEditor}/pc-files-addition/pc-file-uploaded-item.js +0 -0
  39. package/{es/components/cell-editor-dialog → lib/FileEditor}/pc-files-preview/index.js +0 -0
  40. package/{es/components/cell-editor-dialog → lib/FileEditor}/pc-files-preview/pc-file-item-preview.js +0 -0
  41. package/lib/FileFormatter/index.css +29 -0
  42. package/{es/components/cell-formatter/file-formatter.js → lib/FileFormatter/index.js} +2 -1
  43. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/excel.png +0 -0
  44. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/file.png +0 -0
  45. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/music.png +0 -0
  46. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pdf.png +0 -0
  47. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pic.png +0 -0
  48. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/ppt.png +0 -0
  49. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/txt.png +0 -0
  50. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/video.png +0 -0
  51. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/word.png +0 -0
  52. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/excel.png +0 -0
  53. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/file.png +0 -0
  54. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/music.png +0 -0
  55. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pdf.png +0 -0
  56. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pic.png +0 -0
  57. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/ppt.png +0 -0
  58. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/txt.png +0 -0
  59. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/video.png +0 -0
  60. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/word.png +0 -0
  61. package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-192.png +0 -0
  62. package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-24.png +0 -0
  63. package/{es/components/cell-formatter/widgets/file-item-formatter.js → lib/FileItemFormatter/index.js} +2 -2
  64. package/lib/FileItemFormatter/utils.js +72 -0
  65. package/{es/components/file-uploader → lib/FileUploader}/index.js +0 -0
  66. package/{es/utils → lib/FormulaFormatter}/cell-value-validator.js +1 -2
  67. package/lib/FormulaFormatter/index.css +19 -0
  68. package/{es/components/cell-formatter/formula-formatter.js → lib/FormulaFormatter/index.js} +7 -8
  69. package/{es/utils/column-utils.js → lib/FormulaFormatter/utils.js} +5 -1
  70. package/lib/GeolocationFormatter/index.css +1 -0
  71. package/{es/components/cell-formatter/geolocation-formatter.js → lib/GeolocationFormatter/index.js} +2 -1
  72. package/lib/HtmlLongTextFormatter/index.css +63 -0
  73. package/{es/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js → lib/HtmlLongTextFormatter/index.js} +2 -1
  74. package/{es/utils → lib/HtmlLongTextFormatter}/markdown2html.js +0 -0
  75. package/{es/utils → lib/HtmlLongTextFormatter}/unified/index.js +1 -0
  76. package/{es/utils → lib/HtmlLongTextFormatter}/vfile/core.js +1 -0
  77. package/{es/utils → lib/HtmlLongTextFormatter}/vfile/index.js +0 -0
  78. package/{es/components/common → lib/ImageFormatter}/images-lazy-load.js +2 -2
  79. package/lib/ImageFormatter/index.css +34 -0
  80. package/{es/components/cell-formatter/image-formatter.js → lib/ImageFormatter/index.js} +4 -3
  81. package/lib/ImageFormatter/utils.js +7 -0
  82. package/{es/css/image-previewer-ligntbox.css → lib/ImagePreviewerLightbox/index.css} +0 -0
  83. package/{es/components/cell-formatter/widgets/image-previewer-lightbox.js → lib/ImagePreviewerLightbox/index.js} +3 -3
  84. package/lib/ImagePreviewerLightbox/utils.js +8 -0
  85. package/lib/LastModifierFormatter/index.css +1 -0
  86. package/{es/components/cell-formatter/last-modifier-formatter.js → lib/LastModifierFormatter/index.js} +5 -4
  87. package/lib/LinkEditor/index.css +9 -0
  88. package/{es/components/cell-editor/link-editor.js → lib/LinkEditor/index.js} +10 -9
  89. package/{es/components/common → lib/LinkEditor}/link-editor-option.js +0 -0
  90. package/lib/LinkEditor/mb-link-editor-popover/index.css +85 -0
  91. package/{es/components/cell-editor-popover/mb-link-editor-popover.js → lib/LinkEditor/mb-link-editor-popover/index.js} +2 -1
  92. package/lib/LinkEditor/pc-link-editor-popover/index.css +63 -0
  93. package/{es/components/cell-editor-popover/pc-link-editor-popover.js → lib/LinkEditor/pc-link-editor-popover/index.js} +1 -0
  94. package/lib/LinkFormatter/index.css +27 -0
  95. package/{es/components/cell-formatter/link-formatter.js → lib/LinkFormatter/index.js} +2 -2
  96. package/{es/css/loading.css → lib/Loading/index.css} +0 -0
  97. package/{es/components/loading.js → lib/Loading/index.js} +1 -1
  98. package/{es/components/cell-formatter/long-text-formatter.js → lib/LongTextFormatter/index.js} +2 -2
  99. package/{es/components/common/mobile/mb-editor-header.js → lib/MBEditorHeader/index.js} +0 -0
  100. package/lib/MTimeFormatter/index.css +1 -0
  101. package/{es/components/cell-formatter/mtime-formatter.js → lib/MTimeFormatter/index.js} +1 -0
  102. package/{es/components/common/modal-portal.js → lib/ModalPortal/index.js} +0 -0
  103. package/lib/MultipleSelectEditor/index.css +9 -0
  104. package/{es/components/cell-editor/multiple-select-editor.js → lib/MultipleSelectEditor/index.js} +5 -6
  105. package/lib/MultipleSelectFormatter/index.css +1 -0
  106. package/{es/components/cell-formatter/multiple-select-formatter.js → lib/MultipleSelectFormatter/index.js} +2 -1
  107. package/{es/components/cell-editor/number-editor.js → lib/NumberEditor/index.js} +2 -2
  108. package/lib/NumberFormatter/index.css +1 -0
  109. package/{es/components/cell-formatter/number-formatter.js → lib/NumberFormatter/index.js} +2 -1
  110. package/lib/RateFormatter/index.css +1 -0
  111. package/{es/components/cell-formatter/rate-formatter.js → lib/RateFormatter/index.js} +1 -0
  112. package/{es/components/common/select-item.js → lib/SelectItem/index.js} +0 -0
  113. package/lib/SimpleLongTextFormatter/index.css +63 -0
  114. package/{es/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js → lib/SimpleLongTextFormatter/index.js} +2 -1
  115. package/{es/utils → lib/SimpleLongTextFormatter}/normalize-long-text-value.js +3 -3
  116. package/lib/SingleSelectEditor/index.css +9 -0
  117. package/{es/components/cell-editor/single-select-editor.js → lib/SingleSelectEditor/index.js} +5 -6
  118. package/lib/SingleSelectFormatter/index.css +1 -0
  119. package/{es/components/cell-formatter/single-select-formatter.js → lib/SingleSelectFormatter/index.js} +2 -1
  120. package/{es/components/cell-editor/text-editor.js → lib/TextEditor/index.js} +2 -2
  121. package/lib/TextFormatter/index.css +1 -0
  122. package/{es/components/cell-formatter/text-formatter.js → lib/TextFormatter/index.js} +1 -0
  123. package/lib/UrlFormatter/index.css +5 -0
  124. package/{es/components/cell-formatter/url-formatter.js → lib/UrlFormatter/index.js} +1 -0
  125. package/{es/components/cell-factory/cell-formatter-factory.js → lib/cellFormatterFactory/index.js} +3 -3
  126. package/lib/constants/cell-types.js +25 -54
  127. package/lib/constants/index.js +5 -26
  128. package/lib/css/cell-editor.css +0 -608
  129. package/lib/css/cell-formatter.css +0 -243
  130. package/lib/css/mb-cell-editor.css +55 -0
  131. package/lib/formatterConfig/index.js +31 -0
  132. package/lib/index.js +45 -64
  133. package/lib/lang/index.js +11 -27
  134. package/lib/locals/de.js +1 -6
  135. package/lib/locals/en.js +1 -6
  136. package/lib/locals/fr.js +1 -6
  137. package/lib/locals/zh-CN.js +1 -6
  138. package/lib/select-editor/index.js +4 -0
  139. package/lib/select-editor/mb-select-editor-popover/index.css +127 -0
  140. package/{es/components/cell-editor-popover/mb-select-editor-popover.js → lib/select-editor/mb-select-editor-popover/index.js} +12 -11
  141. package/lib/select-editor/pc-select-editor-popover/index.css +72 -0
  142. package/{es/components/cell-editor-popover/pc-select-editor-popover.js → lib/select-editor/pc-select-editor-popover/index.js} +1 -0
  143. package/{es/components/common → lib/select-editor}/select-editor-option.js +0 -0
  144. package/{es/components/toast → lib/toaster}/alert.js +0 -0
  145. package/{es/components/toast → lib/toaster}/index.js +0 -0
  146. package/{es/components/toast → lib/toaster}/toast.js +0 -0
  147. package/{es/components/toast → lib/toaster}/toastManager.js +0 -0
  148. package/{es/components/toast → lib/toaster}/toaster.js +0 -0
  149. package/lib/utils/editor-utils.js +3 -13
  150. package/lib/utils/number-precision.js +14 -31
  151. package/lib/utils/utils.js +3 -119
  152. package/lib/utils/value-format-utils.js +59 -108
  153. package/package.json +5 -5
  154. package/es/app.css +0 -20
  155. package/es/app.js +0 -91
  156. package/es/assets/images/avatar/default_avatar.png +0 -0
  157. package/es/components/cell-editor/index.js +0 -9
  158. package/es/components/cell-formatter/formatter-config.js +0 -31
  159. package/es/components/cell-formatter/index.js +0 -27
  160. package/es/constants/cell-types.js +0 -25
  161. package/es/constants/index.js +0 -48
  162. package/es/css/cell-editor.css +0 -614
  163. package/es/css/cell-formatter.css +0 -247
  164. package/es/index.js +0 -6
  165. package/es/lang/index.js +0 -50
  166. package/es/locals/de.js +0 -2
  167. package/es/locals/en.js +0 -17
  168. package/es/locals/fr.js +0 -2
  169. package/es/locals/zh-CN.js +0 -17
  170. package/es/utils/editor-utils.js +0 -71
  171. package/es/utils/number-precision.js +0 -163
  172. package/es/utils/utils.js +0 -116
  173. package/es/utils/value-format-utils.js +0 -495
  174. package/lib/app.css +0 -20
  175. package/lib/app.js +0 -96
  176. package/lib/assets/images/file/192/excel.png +0 -0
  177. package/lib/assets/images/file/192/file.png +0 -0
  178. package/lib/assets/images/file/192/music.png +0 -0
  179. package/lib/assets/images/file/192/pdf.png +0 -0
  180. package/lib/assets/images/file/192/pic.png +0 -0
  181. package/lib/assets/images/file/192/ppt.png +0 -0
  182. package/lib/assets/images/file/192/txt.png +0 -0
  183. package/lib/assets/images/file/192/video.png +0 -0
  184. package/lib/assets/images/file/192/word.png +0 -0
  185. package/lib/assets/images/file/24/excel.png +0 -0
  186. package/lib/assets/images/file/24/file.png +0 -0
  187. package/lib/assets/images/file/24/music.png +0 -0
  188. package/lib/assets/images/file/24/pdf.png +0 -0
  189. package/lib/assets/images/file/24/pic.png +0 -0
  190. package/lib/assets/images/file/24/ppt.png +0 -0
  191. package/lib/assets/images/file/24/txt.png +0 -0
  192. package/lib/assets/images/file/24/video.png +0 -0
  193. package/lib/assets/images/file/24/word.png +0 -0
  194. package/lib/assets/images/folder/folder-192.png +0 -0
  195. package/lib/assets/images/folder/folder-24.png +0 -0
  196. package/lib/components/cell-editor/checkbox-editor.js +0 -111
  197. package/lib/components/cell-editor/collaborator-editor.js +0 -249
  198. package/lib/components/cell-editor/date-editor.js +0 -171
  199. package/lib/components/cell-editor/index.js +0 -40
  200. package/lib/components/cell-editor/link-editor.js +0 -321
  201. package/lib/components/cell-editor/multiple-select-editor.js +0 -250
  202. package/lib/components/cell-editor/number-editor.js +0 -162
  203. package/lib/components/cell-editor/single-select-editor.js +0 -216
  204. package/lib/components/cell-editor/text-editor.js +0 -129
  205. package/lib/components/cell-editor-dialog/pc-file-editor-dialog.js +0 -66
  206. package/lib/components/cell-editor-dialog/pc-files-addition/index.js +0 -1
  207. package/lib/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -1
  208. package/lib/components/cell-editor-dialog/pc-files-preview/index.js +0 -1
  209. package/lib/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -1
  210. package/lib/components/cell-editor-popover/mb-collaborator-editor-popover.js +0 -183
  211. package/lib/components/cell-editor-popover/mb-date-editor-popover.js +0 -262
  212. package/lib/components/cell-editor-popover/mb-link-editor-popover.js +0 -176
  213. package/lib/components/cell-editor-popover/mb-select-editor-popover.js +0 -243
  214. package/lib/components/cell-editor-popover/pc-collaborator-editor-popover.js +0 -124
  215. package/lib/components/cell-editor-popover/pc-date-editor-popover.js +0 -156
  216. package/lib/components/cell-editor-popover/pc-link-editor-popover.js +0 -128
  217. package/lib/components/cell-editor-popover/pc-select-editor-popover.js +0 -157
  218. package/lib/components/cell-factory/cell-formatter-factory.js +0 -28
  219. package/lib/components/cell-formatter/auto-number-formatter.js +0 -45
  220. package/lib/components/cell-formatter/button-formatter.js +0 -66
  221. package/lib/components/cell-formatter/checkbox-formatter.js +0 -56
  222. package/lib/components/cell-formatter/collaborator-formatter.js +0 -111
  223. package/lib/components/cell-formatter/creator-formatter.js +0 -105
  224. package/lib/components/cell-formatter/ctime-formatter.js +0 -70
  225. package/lib/components/cell-formatter/date-formatter.js +0 -73
  226. package/lib/components/cell-formatter/duration-formatter.js +0 -49
  227. package/lib/components/cell-formatter/email-formatter.js +0 -45
  228. package/lib/components/cell-formatter/file-formatter.js +0 -77
  229. package/lib/components/cell-formatter/formatter-config.js +0 -66
  230. package/lib/components/cell-formatter/formula-formatter.js +0 -189
  231. package/lib/components/cell-formatter/geolocation-formatter.js +0 -66
  232. package/lib/components/cell-formatter/image-formatter.js +0 -171
  233. package/lib/components/cell-formatter/index.js +0 -112
  234. package/lib/components/cell-formatter/last-modifier-formatter.js +0 -105
  235. package/lib/components/cell-formatter/link-formatter.js +0 -165
  236. package/lib/components/cell-formatter/long-text-formatter.js +0 -46
  237. package/lib/components/cell-formatter/mtime-formatter.js +0 -70
  238. package/lib/components/cell-formatter/multiple-select-formatter.js +0 -84
  239. package/lib/components/cell-formatter/number-formatter.js +0 -60
  240. package/lib/components/cell-formatter/rate-formatter.js +0 -93
  241. package/lib/components/cell-formatter/single-select-formatter.js +0 -84
  242. package/lib/components/cell-formatter/text-formatter.js +0 -67
  243. package/lib/components/cell-formatter/url-formatter.js +0 -45
  244. package/lib/components/cell-formatter/widgets/file-item-formatter.js +0 -63
  245. package/lib/components/cell-formatter/widgets/image-previewer-lightbox.js +0 -152
  246. package/lib/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js +0 -107
  247. package/lib/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js +0 -110
  248. package/lib/components/common/collaborator-item.js +0 -79
  249. package/lib/components/common/edit-editor-button.js +0 -67
  250. package/lib/components/common/images-lazy-load.js +0 -158
  251. package/lib/components/common/link-editor-option.js +0 -121
  252. package/lib/components/common/mobile/mb-editor-header.js +0 -61
  253. package/lib/components/common/modal-portal.js +0 -51
  254. package/lib/components/common/select-editor-option.js +0 -122
  255. package/lib/components/common/select-item.js +0 -73
  256. package/lib/components/file-uploader/index.js +0 -63
  257. package/lib/components/loading.js +0 -16
  258. package/lib/components/toast/alert.js +0 -164
  259. package/lib/components/toast/index.js +0 -12
  260. package/lib/components/toast/toast.js +0 -223
  261. package/lib/components/toast/toastManager.js +0 -189
  262. package/lib/components/toast/toaster.js +0 -92
  263. package/lib/css/custom-rc-calendar.css +0 -118
  264. package/lib/css/image-previewer-ligntbox.css +0 -87
  265. package/lib/css/loading.css +0 -54
  266. package/lib/utils/cell-value-validator.js +0 -41
  267. package/lib/utils/column-utils.js +0 -15
  268. package/lib/utils/markdown2html.js +0 -68
  269. package/lib/utils/normalize-long-text-value.js +0 -74
  270. package/lib/utils/unified/index.js +0 -470
  271. package/lib/utils/vfile/core.js +0 -172
  272. package/lib/utils/vfile/index.js +0 -48
@@ -1,495 +0,0 @@
1
- import moment from 'moment';
2
- import NP from './number-precision';
3
- import { NUMBER_TYPES, DEFAULT_NUMBER_FORMAT, DURATION_FORMATS_MAP, DURATION_FORMATS, DURATION_ZERO_DISPLAY, DURATION_DECIMAL_DIGITS, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES, ARRAY_FORMAL_COLUMNS_TYPES, DEFAULT_DATE_FORMAT } from '../constants';
4
- import * as CellType from '../constants/cell-types';
5
- NP.enableBoundaryChecking(false);
6
- var _separatorMap = {
7
- 'comma': ',',
8
- 'dot': '.',
9
- 'no': '',
10
- 'space': ' '
11
- };
12
-
13
- var _toThousands = function _toThousands(num, isCurrency, formatData) {
14
- var _ref = formatData || {},
15
- _ref$decimal = _ref.decimal,
16
- decimal = _ref$decimal === void 0 ? 'dot' : _ref$decimal,
17
- _ref$thousands = _ref.thousands,
18
- thousands = _ref$thousands === void 0 ? 'no' : _ref$thousands,
19
- _ref$precision = _ref.precision,
20
- precision = _ref$precision === void 0 ? 2 : _ref$precision,
21
- _ref$enable_precision = _ref.enable_precision,
22
- enable_precision = _ref$enable_precision === void 0 ? false : _ref$enable_precision;
23
-
24
- var decimalString = _separatorMap[decimal];
25
- var thousandsString = _separatorMap[thousands];
26
- var decimalDigits = enable_precision ? precision : _getDecimalDigits(num);
27
- var value = parseFloat(num.toFixed(decimalDigits));
28
- var integer = Math.trunc(value);
29
- var decimalValue = String(Math.abs(NP.minus(value, integer)).toFixed(decimalDigits)).slice(1);
30
-
31
- if (isCurrency) {
32
- if (decimalValue.length === 2) {
33
- decimalValue = decimalValue.padEnd(3, '0');
34
- } else {
35
- decimalValue = (decimalValue.substring(0, 3) || '.').padEnd(3, '0');
36
- }
37
-
38
- if (enable_precision) {
39
- decimalValue = precision === 0 ? '' : decimalValue.slice(0, precision + 1);
40
- }
41
- }
42
-
43
- decimalValue = decimalValue.replace(/./, decimalString);
44
- var result = [],
45
- counter = 0;
46
- integer = Object.is(integer, -0) ? ['-', '0'] : integer.toString().split('');
47
-
48
- for (var i = integer.length - 1; i >= 0; i--) {
49
- counter++;
50
- result.unshift(integer[i]);
51
-
52
- if (!(counter % 3) && i !== 0) {
53
- result.unshift(thousandsString);
54
- }
55
- }
56
-
57
- return result.join('') + decimalValue;
58
- };
59
-
60
- var _getDecimalDigits = function _getDecimalDigits(num) {
61
- if (Number.isInteger(num)) {
62
- return 0;
63
- }
64
-
65
- var valueArr = (num + '').split('.');
66
- var digitsLength = valueArr[1] ? valueArr[1].length : 8;
67
- return digitsLength > 8 ? 8 : digitsLength;
68
- };
69
-
70
- export var getNumberDisplayString = function getNumberDisplayString(value, formatData) {
71
- // formatData: old version maybe 'null'
72
- var type = Object.prototype.toString.call(value);
73
-
74
- if (type !== '[object Number]') {
75
- if (type === '[object String]' && value.startsWith('#')) {
76
- return value;
77
- }
78
-
79
- return null;
80
- }
81
-
82
- if (isNaN(value) || value === Infinity || value === -Infinity || (value + '').indexOf('e') > -1) return value + '';
83
-
84
- var _ref2 = formatData || {},
85
- _ref2$format = _ref2.format,
86
- format = _ref2$format === void 0 ? DEFAULT_NUMBER_FORMAT : _ref2$format;
87
-
88
- switch (format) {
89
- case 'number':
90
- return _toThousands(value, false, formatData);
91
-
92
- case 'percent':
93
- {
94
- return "".concat(_toThousands(Number.parseFloat((value * 100).toFixed(8)), false, formatData), "%");
95
- }
96
-
97
- case 'yuan':
98
- return "\uFFE5".concat(_toThousands(value, true, formatData));
99
-
100
- case 'dollar':
101
- return "$".concat(_toThousands(value, true, formatData));
102
-
103
- case 'euro':
104
- return "\u20AC".concat(_toThousands(value, true, formatData));
105
-
106
- case 'duration':
107
- {
108
- return getDurationDisplayString(value, formatData.duration_format);
109
- }
110
-
111
- default:
112
- return '' + value;
113
- }
114
- };
115
- export var formatStringToNumber = function formatStringToNumber(value) {
116
- var isIncludePercent = value.indexOf('%') > -1;
117
- var newData = parseFloat(value.replace(/[^.-\d]/g, ''));
118
-
119
- if (isIncludePercent && !isNaN(newData)) {
120
- return newData / 100;
121
- }
122
-
123
- return isNaN(newData) ? '' : newData;
124
- };
125
- export var formatNumberString = function formatNumberString(value, format) {
126
- var formattedValue = '';
127
-
128
- switch (format) {
129
- case NUMBER_TYPES.NUMBER:
130
- case NUMBER_TYPES.NUMBER_WITH_COMMAS:
131
- formattedValue = value.replace(/[^.-\d,]/g, '');
132
- break;
133
-
134
- case NUMBER_TYPES.PERCENT:
135
- formattedValue = value.replace(/[^.-\d,%]/g, '');
136
- break;
137
-
138
- case NUMBER_TYPES.YUAN:
139
- formattedValue = value.replace(/[^.-\d¥,]/g, '');
140
- break;
141
-
142
- case NUMBER_TYPES.DOLLAR:
143
- formattedValue = value.replace(/[^.-\d$,]/g, '');
144
- break;
145
-
146
- case NUMBER_TYPES.EURO:
147
- formattedValue = value.replace(/[^.-\d€,]/g, '');
148
- break;
149
-
150
- default:
151
- formattedValue = value.replace(/[^.-\d,]/g, '');
152
- }
153
-
154
- return formattedValue;
155
- };
156
- export var getDateDisplayString = function getDateDisplayString(value, format) {
157
- var formattedValue = '';
158
-
159
- if (!value) {
160
- // value === '', value === undefine, value === null
161
- return formattedValue;
162
- }
163
-
164
- var date = moment(value);
165
- if (!date.isValid()) return value;
166
-
167
- switch (format) {
168
- case 'D/M/YYYY':
169
- case 'DD/MM/YYYY':
170
- var formatValue = date.format('YYYY-MM-DD');
171
- var formatValueList = formatValue.split('-');
172
- return "".concat(formatValueList[2], "/").concat(formatValueList[1], "/").concat(formatValueList[0]);
173
-
174
- case 'D/M/YYYY HH:mm':
175
- case 'DD/MM/YYYY HH:mm':
176
- var formatValues = date.format('YYYY-MM-DD HH:mm');
177
- var formatValuesList = formatValues.split(' ');
178
- var formatDateList = formatValuesList[0].split('-');
179
- return "".concat(formatDateList[2], "/").concat(formatDateList[1], "/").concat(formatDateList[0], " ").concat(formatValuesList[1]);
180
-
181
- case 'M/D/YYYY':
182
- return date.format('M/D/YYYY');
183
-
184
- case 'M/D/YYYY HH:mm':
185
- return date.format('M/D/YYYY HH:mm');
186
-
187
- case 'YYYY-MM-DD':
188
- return date.format('YYYY-MM-DD');
189
-
190
- case 'YYYY-MM-DD HH:mm':
191
- return date.format('YYYY-MM-DD HH:mm');
192
-
193
- default:
194
- return value;
195
- }
196
- };
197
- export var getDurationDisplayString = function getDurationDisplayString(value, duration_format) {
198
- if (!value && value !== 0) return '';
199
- duration_format = duration_format || DURATION_FORMATS_MAP.H_MM;
200
-
201
- if (DURATION_FORMATS.findIndex(function (format) {
202
- return format.type === duration_format;
203
- }) < 0) {
204
- return '';
205
- }
206
-
207
- if (value === 0) {
208
- return DURATION_ZERO_DISPLAY[duration_format];
209
- }
210
-
211
- var includeDecimal = duration_format.indexOf('.') > -1;
212
- var positiveValue = Math.abs(value);
213
-
214
- if (!includeDecimal) {
215
- positiveValue = Math.round(positiveValue);
216
- }
217
-
218
- positiveValue = getMathRoundedDuration(positiveValue, duration_format);
219
- var decimalParts = (positiveValue + '').split('.');
220
- var decimalPartsLen = decimalParts.length;
221
- var decimal = 0;
222
-
223
- if (decimalPartsLen > 1) {
224
- decimal = decimalParts[decimalPartsLen - 1];
225
- decimal = decimal ? decimal - 0 : 0;
226
- }
227
-
228
- var decimalDigits = DURATION_DECIMAL_DIGITS[duration_format];
229
- var decimalSuffix = getDurationDecimalSuffix(duration_format, decimal);
230
- var displayString = value < 0 ? '-' : '';
231
- var hours = parseInt(positiveValue / 3600);
232
- var minutes = parseInt((positiveValue - hours * 3600) / 60);
233
-
234
- if (duration_format === DURATION_FORMATS_MAP.H_MM) {
235
- displayString += "".concat(hours, ":").concat(minutes > 9 ? minutes : '0' + minutes);
236
- return displayString;
237
- }
238
-
239
- var seconds = Number.parseFloat((positiveValue - hours * 3600 - minutes * 60).toFixed(decimalDigits));
240
-
241
- if (hours > 0) {
242
- displayString += "".concat(hours, ":");
243
- minutes = minutes > 9 ? minutes : "0".concat(minutes);
244
- }
245
-
246
- seconds = seconds > 9 ? seconds : "0".concat(seconds);
247
- displayString += "".concat(minutes, ":").concat(seconds).concat(decimalSuffix);
248
- return displayString;
249
- };
250
-
251
- var getMathRoundedDuration = function getMathRoundedDuration(num, duration_format) {
252
- var decimalDigits = DURATION_DECIMAL_DIGITS[duration_format];
253
-
254
- if (decimalDigits < 1) {
255
- return num;
256
- }
257
-
258
- var ratio = Math.pow(10, decimalDigits);
259
- return Math.round(num * ratio) / ratio;
260
- };
261
-
262
- var getDurationDecimalSuffix = function getDurationDecimalSuffix(duration_format, decimal) {
263
- if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_S) {
264
- return decimal === 0 ? '.0' : '';
265
- } else if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_SS) {
266
- if (decimal === 0) {
267
- return '.00';
268
- } else if (decimal < 10) {
269
- return '0';
270
- }
271
- } else if (duration_format === DURATION_FORMATS_MAP.H_MM_SS_SSS) {
272
- if (decimal === 0) {
273
- return '.000';
274
- } else if (decimal < 10) {
275
- return '00';
276
- } else if (decimal < 100) {
277
- return '0';
278
- }
279
- }
280
-
281
- return '';
282
- };
283
-
284
- export var getOptionName = function getOptionName(options, targetOptionID) {
285
- if (!targetOptionID || !options || !Array.isArray(options)) return null;
286
- var option = options.find(function (option) {
287
- return option.id === targetOptionID;
288
- });
289
- return option ? option.name : null;
290
- };
291
- export var getMultipleOptionName = function getMultipleOptionName(options, cellVal) {
292
- if (!cellVal || !options || !Array.isArray(options)) return null;
293
- var selectedOptions = options.filter(function (option) {
294
- return cellVal.includes(option.id);
295
- });
296
- if (selectedOptions.length === 0) return null;
297
- return selectedOptions.map(function (option) {
298
- return option.name;
299
- }).join(', ');
300
- };
301
- export var getLongtextDisplayString = function getLongtextDisplayString(value) {
302
- var _ref3 = value || {},
303
- text = _ref3.text;
304
-
305
- if (!text) {
306
- return null;
307
- }
308
-
309
- return text;
310
- };
311
- export var getCollaboratorsName = function getCollaboratorsName(collaborators, cellVal) {
312
- if (cellVal) {
313
- var collaboratorsName = [];
314
- cellVal.forEach(function (v) {
315
- var collaborator = collaborators.find(function (c) {
316
- return c.email === v;
317
- });
318
-
319
- if (collaborator) {
320
- collaboratorsName.push(collaborator.name);
321
- }
322
- });
323
-
324
- if (collaboratorsName.length === 0) {
325
- return null;
326
- }
327
-
328
- return collaboratorsName.join(', ');
329
- }
330
-
331
- return null;
332
- };
333
- export var getGeolocationDisplayString = function getGeolocationDisplayString(value, columnData) {
334
- var _ref4 = columnData || {},
335
- geo_format = _ref4.geo_format;
336
-
337
- var cellValue = value || {};
338
-
339
- if (!value) {
340
- return null;
341
- }
342
-
343
- if (geo_format === 'lng_lat' && value.lng && value.lat) {
344
- return "".concat(cellValue.lng, ", ").concat(cellValue.lat);
345
- }
346
-
347
- if (geo_format === 'country_region' && cellValue.country_region) {
348
- return value.country_region || '';
349
- }
350
-
351
- var province = cellValue.province,
352
- city = cellValue.city,
353
- district = cellValue.district,
354
- detail = cellValue.detail;
355
-
356
- if (geo_format === 'province') {
357
- return "".concat(province || '');
358
- }
359
-
360
- if (geo_format === 'province_city') {
361
- return "".concat(province || '').concat(city || '');
362
- }
363
-
364
- return "".concat(province || '').concat(city || '').concat(district || '').concat(detail || '');
365
- };
366
- export var getFormulaDisplayString = function getFormulaDisplayString(cellValue, columnData) {
367
- var _ref5 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
368
- _ref5$collaborators = _ref5.collaborators,
369
- collaborators = _ref5$collaborators === void 0 ? [] : _ref5$collaborators;
370
-
371
- if (!columnData) {
372
- return null;
373
- }
374
-
375
- var result_type = columnData.result_type;
376
-
377
- if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
378
- return getNumberDisplayString(cellValue, columnData);
379
- }
380
-
381
- if (result_type === FORMULA_RESULT_TYPE.DATE) {
382
- var format = columnData.format;
383
- return getDateDisplayString(cellValue, format);
384
- }
385
-
386
- if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
387
- var array_type = columnData.array_type,
388
- array_data = columnData.array_data;
389
-
390
- if (!array_type) {
391
- return null;
392
- }
393
-
394
- if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
395
- return cellValue;
396
- }
397
-
398
- if (ARRAY_FORMAL_COLUMNS_TYPES.indexOf(array_type) < 0 && Array.isArray(cellValue)) {
399
- return cellValue.map(function (val) {
400
- return getCellValueDisplayString(val, array_type, {
401
- data: array_data,
402
- collaborators: collaborators
403
- });
404
- }).join(', ');
405
- }
406
-
407
- return getCellValueDisplayString(cellValue, array_type, {
408
- data: array_data,
409
- collaborators: collaborators
410
- });
411
- }
412
-
413
- if (Object.prototype.toString.call(cellValue) === '[object Boolean]') {
414
- return cellValue + '';
415
- }
416
-
417
- return cellValue;
418
- };
419
- export function getCellValueDisplayString(cellValue, type) {
420
- var _ref6 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
421
- data = _ref6.data,
422
- _ref6$collaborators = _ref6.collaborators,
423
- collaborators = _ref6$collaborators === void 0 ? [] : _ref6$collaborators;
424
-
425
- var newData = data || {};
426
-
427
- switch (type) {
428
- case CellType.GEOLOCATION:
429
- {
430
- return getGeolocationDisplayString(cellValue, data);
431
- }
432
-
433
- case CellType.SINGLE_SELECT:
434
- {
435
- if (!data) return '';
436
- var options = newData.options;
437
- return getOptionName(options, cellValue);
438
- }
439
-
440
- case CellType.MULTIPLE_SELECT:
441
- {
442
- if (!data) return '';
443
- var _options = newData.options;
444
- return getMultipleOptionName(_options, cellValue);
445
- }
446
-
447
- case CellType.FORMULA:
448
- case CellType.LINK_FORMULA:
449
- {
450
- return getFormulaDisplayString(cellValue, newData, {
451
- collaborators: collaborators
452
- });
453
- }
454
-
455
- case CellType.LONG_TEXT:
456
- {
457
- return getLongtextDisplayString(cellValue);
458
- }
459
-
460
- case CellType.NUMBER:
461
- {
462
- return getNumberDisplayString(cellValue, newData);
463
- }
464
-
465
- case CellType.DATE:
466
- {
467
- var _ref7 = newData || {},
468
- _ref7$format = _ref7.format,
469
- format = _ref7$format === void 0 ? DEFAULT_DATE_FORMAT : _ref7$format;
470
-
471
- return getDateDisplayString(cellValue, format);
472
- }
473
-
474
- case CellType.CREATOR:
475
- case CellType.LAST_MODIFIER:
476
- {
477
- return cellValue === 'anonymous' ? cellValue : getCollaboratorsName(collaborators, [cellValue]);
478
- }
479
-
480
- case CellType.COLLABORATOR:
481
- {
482
- return getCollaboratorsName(collaborators, cellValue);
483
- }
484
-
485
- case CellType.DURATION:
486
- {
487
- return getDurationDisplayString(cellValue, data);
488
- }
489
-
490
- default:
491
- {
492
- return cellValue ? cellValue + '' : '';
493
- }
494
- }
495
- }
package/lib/app.css DELETED
@@ -1,20 +0,0 @@
1
- html, body, #root {
2
- width: 100%;
3
- height: 100%;
4
- }
5
-
6
- .app {
7
- width: 100%;
8
- height: 100%;
9
- display: flex;
10
- flex-direction: column;
11
- }
12
-
13
- .app .app-body {
14
- flex: 1;
15
- }
16
-
17
- .app .app-body .collaborator-container {
18
- padding: 5px;
19
- border: 1px solid;
20
- }
package/lib/app.js DELETED
@@ -1,96 +0,0 @@
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 _cellFormatter = require("./components/cell-formatter");
17
-
18
- require("./app.css");
19
-
20
- var App = /*#__PURE__*/function (_React$Component) {
21
- (0, _inheritsLoose2.default)(App, _React$Component);
22
-
23
- function App() {
24
- var _this;
25
-
26
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
- args[_key] = arguments[_key];
28
- }
29
-
30
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
31
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onDeleteCollaborator", function () {//
32
- });
33
- return _this;
34
- }
35
-
36
- var _proto = App.prototype;
37
-
38
- _proto.render = function render() {
39
- var collaborators = [{
40
- name: '小强',
41
- email: '214402@qq.com',
42
- avatar_url: '你好饿',
43
- contact_email: 'adbd'
44
- }];
45
- var options = [{
46
- id: '1111',
47
- name: '未开始',
48
- color: '#e3f9f6'
49
- }, {
50
- id: '2222',
51
- name: '进行中',
52
- color: '#ff7500'
53
- }, {
54
- id: '3333',
55
- name: '待评审',
56
- color: '#eaff56'
57
- }, {
58
- id: '4444',
59
- name: '已评审',
60
- color: '#faff72'
61
- }, {
62
- id: '5555',
63
- name: '完成',
64
- color: '#00e500'
65
- }];
66
- return /*#__PURE__*/_react.default.createElement("div", {
67
- className: "app"
68
- }, /*#__PURE__*/_react.default.createElement("header", {
69
- className: "app-header"
70
- }, /*#__PURE__*/_react.default.createElement("h1", {
71
- className: "text-center"
72
- }, 'seatable ui component test')), /*#__PURE__*/_react.default.createElement("div", {
73
- className: "app-body"
74
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h2", null, "collaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement("div", null, "\u5355\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_cellFormatter.CollaboratorFormatter, {
75
- value: '123',
76
- collaborators: collaborators
77
- }), /*#__PURE__*/_react.default.createElement("div", null, "\u591A\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_cellFormatter.CollaboratorFormatter, {
78
- value: ['123', '4567'],
79
- collaborators: collaborators
80
- }), /*#__PURE__*/_react.default.createElement("div", null, "\u5E26\u5220\u9664\u6309\u94AE\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_cellFormatter.CollaboratorFormatter, {
81
- containerClassName: "collaborator-container",
82
- value: ['123', '4567'],
83
- collaborators: collaborators,
84
- enableDeleteCollaborator: true,
85
- onDeleteCollaborator: this.onDeleteCollaborator
86
- })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h2", null, "single-select\u6D4B\u8BD5"), /*#__PURE__*/_react.default.createElement(_cellFormatter.SingleSelectFormatter, {
87
- value: '3333',
88
- options: options
89
- }))));
90
- };
91
-
92
- return App;
93
- }(_react.default.Component);
94
-
95
- var _default = App;
96
- exports.default = _default;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file