dtable-ui-component 5.3.5 → 5.3.7

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 (258) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +5 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableCustomizeSelect/index.js +2 -2
  36. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  37. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  38. package/lib/DTableGroupSelect/index.js +3 -3
  39. package/lib/DTableSelect/index.js +3 -1
  40. package/lib/DateEditor/index.js +14 -51
  41. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  42. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  43. package/lib/Department-editor/department-single-select.js +1 -1
  44. package/lib/Department-editor/index.js +3 -4
  45. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  46. package/lib/DigitalSignEditor/constants.js +7 -0
  47. package/lib/DigitalSignEditor/index.css +69 -0
  48. package/lib/DigitalSignEditor/index.js +182 -0
  49. package/lib/DigitalSignEditor/service.js +39 -0
  50. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  51. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  52. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  53. package/lib/DigitalSignEditor/utils.js +29 -0
  54. package/lib/DurationEditor/index.js +110 -0
  55. package/lib/EmailEditor/index.js +58 -0
  56. package/lib/FileEditor/addition-previewer/index.css +1 -0
  57. package/lib/FileEditor/addition-previewer/index.js +52 -0
  58. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  60. package/lib/FileEditor/constants.js +7 -0
  61. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  66. package/lib/FileEditor/files-previewer/index.css +56 -0
  67. package/lib/FileEditor/files-previewer/index.js +277 -0
  68. package/lib/FileEditor/index.css +6 -0
  69. package/lib/FileEditor/index.js +258 -11
  70. package/lib/FileEditor/utils.js +22 -0
  71. package/lib/FileItemFormatter/index.js +19 -20
  72. package/lib/FileUploader/index.css +9 -0
  73. package/lib/FileUploader/index.js +268 -14
  74. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  75. package/lib/FormulaFormatter/index.js +2 -1
  76. package/lib/FormulaFormatter/utils.js +0 -31
  77. package/lib/GeolocationEditor/country-editor.js +319 -0
  78. package/lib/GeolocationEditor/index.css +641 -0
  79. package/lib/GeolocationEditor/index.js +240 -0
  80. package/lib/GeolocationEditor/location-editor.js +368 -0
  81. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  82. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  84. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  85. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  86. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  88. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  89. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  90. package/lib/GeolocationEditor/province-editor.js +226 -0
  91. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  92. package/lib/GeolocationEditor/selector-list.js +33 -0
  93. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  95. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  96. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  97. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  99. package/lib/ImageEditor/constants.js +7 -0
  100. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  102. package/lib/ImageEditor/images-previewer/index.css +18 -0
  103. package/lib/ImageEditor/images-previewer/index.js +140 -0
  104. package/lib/ImageEditor/index.css +24 -0
  105. package/lib/ImageEditor/index.js +194 -0
  106. package/lib/ImageThumbnail/index.css +20 -0
  107. package/lib/ImageThumbnail/index.js +136 -0
  108. package/lib/LinkEditor/index.js +2 -3
  109. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  110. package/lib/MultipleSelectEditor/index.js +16 -177
  111. package/lib/NumberEditor/index.js +63 -77
  112. package/lib/RoleStatusEditor/index.css +0 -2
  113. package/lib/RowExpandDialog/body/index.css +21 -0
  114. package/lib/RowExpandDialog/body/index.js +262 -0
  115. package/lib/RowExpandDialog/column-content/index.css +48 -0
  116. package/lib/RowExpandDialog/column-content/index.js +50 -0
  117. package/lib/RowExpandDialog/header/index.css +31 -0
  118. package/lib/RowExpandDialog/header/index.js +55 -0
  119. package/lib/RowExpandDialog/index.css +28 -0
  120. package/lib/RowExpandDialog/index.js +237 -0
  121. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  122. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  123. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  124. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  125. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  126. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  127. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  128. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +106 -0
  129. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  130. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  131. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  132. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  133. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  134. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  135. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +147 -0
  136. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  137. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  138. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  139. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  140. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  141. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  142. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  143. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  144. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  145. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  146. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  147. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  148. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +193 -0
  149. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  150. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  151. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  152. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  153. package/lib/RowExpandEditor/constants.js +44 -0
  154. package/lib/RowExpandEditor/index.css +0 -0
  155. package/lib/RowExpandEditor/index.js +32 -0
  156. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  157. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  158. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  159. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  160. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  161. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  162. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  163. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  164. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  165. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  166. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  167. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  168. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  169. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  170. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  171. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  172. package/lib/RowExpandFormatter/constants.js +61 -0
  173. package/lib/RowExpandFormatter/index.css +28 -3
  174. package/lib/RowExpandFormatter/index.js +111 -130
  175. package/lib/SimpleLongTextFormatter/widgets/longTextEditor.css +2 -2
  176. package/lib/SingleSelectEditor/index.js +16 -156
  177. package/lib/SvgIcon/index.css +11 -0
  178. package/lib/SvgIcon/index.js +29 -0
  179. package/lib/TextEditor/index.js +112 -42
  180. package/lib/UploadProgress/index.js +38 -0
  181. package/lib/UrlEditor/index.js +61 -0
  182. package/lib/common/editor-base.js +52 -0
  183. package/lib/constants/file.js +96 -0
  184. package/lib/constants/index.js +27 -15
  185. package/lib/constants/key-codes.js +109 -0
  186. package/lib/css/cell-editor.css +18 -2
  187. package/lib/formatterConfig/base-formatter-config.js +23 -23
  188. package/lib/formatterConfig/index.js +3 -3
  189. package/lib/hooks/index.js +16 -0
  190. package/lib/index.js +81 -46
  191. package/lib/lang/index.js +19 -16
  192. package/lib/locales/de.json +167 -0
  193. package/lib/locales/en.json +167 -0
  194. package/lib/locales/es.json +167 -0
  195. package/lib/locales/fr.json +167 -0
  196. package/lib/locales/pt.json +167 -0
  197. package/lib/locales/ru.json +167 -0
  198. package/lib/locales/zh-CN.json +167 -0
  199. package/lib/select-editor/index.js +6 -6
  200. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  201. package/lib/select-editor/pc-select-editor/index.css +85 -0
  202. package/lib/select-editor/pc-select-editor/index.js +290 -0
  203. package/lib/utils/cell-comparer.js +35 -0
  204. package/lib/utils/cell.js +55 -0
  205. package/lib/utils/column-utils.js +25 -0
  206. package/lib/utils/editor-utils.js +1 -6
  207. package/lib/utils/get-event-transfer.js +75 -0
  208. package/lib/utils/hotkey.js +37 -0
  209. package/lib/utils/object-utils.js +61 -0
  210. package/lib/utils/url.js +121 -8
  211. package/lib/utils/utils.js +119 -2
  212. package/package.json +3 -2
  213. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  214. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  215. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  216. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  217. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  218. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  219. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  220. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  221. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  222. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  234. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  235. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  236. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  237. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  238. package/lib/FileItemFormatter/utils.js +0 -99
  239. package/lib/MultipleSelectEditor/index.css +0 -9
  240. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  241. package/lib/RowExpandUrlFormatter/index.css +0 -1
  242. package/lib/SingleSelectEditor/index.css +0 -14
  243. package/lib/common/modal-portal.js +0 -26
  244. package/lib/locals/de.js +0 -103
  245. package/lib/locals/en.js +0 -104
  246. package/lib/locals/es.js +0 -103
  247. package/lib/locals/fr.js +0 -103
  248. package/lib/locals/pt.js +0 -103
  249. package/lib/locals/ru.js +0 -103
  250. package/lib/locals/zh-CN.js +0 -104
  251. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  252. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  253. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  254. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  255. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  256. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  257. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  258. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _reactstrap = require("reactstrap");
11
+ var _lang = require("../../lang");
12
+ var _DTableSearchInput = _interopRequireDefault(require("../../DTableSearchInput"));
13
+ var _constants = require("../../constants");
14
+ require("./index.css");
15
+ class PCSelectEditor extends _react.default.Component {
16
+ constructor(props) {
17
+ super(props);
18
+ this.onHotKey = e => {
19
+ if (e.keyCode === _constants.KeyCodes.Enter) {
20
+ this.onEnter(e);
21
+ } else if (e.keyCode === _constants.KeyCodes.UpArrow) {
22
+ this.onUpArrow(e);
23
+ } else if (e.keyCode === _constants.KeyCodes.DownArrow) {
24
+ this.onDownArrow(e);
25
+ } else if (e.keyCode === _constants.KeyCodes.Tab) {
26
+ if (this.props.onPressTab) {
27
+ this.props.onPressTab(e);
28
+ }
29
+ } else if (e.keyCode === _constants.KeyCodes.Escape) {
30
+ if (this.props.isInModal) {
31
+ e.stopPropagation();
32
+ this.props.onClose && this.props.onClose();
33
+ }
34
+ }
35
+ };
36
+ this.onEnter = e => {
37
+ e.preventDefault();
38
+ let option;
39
+ const {
40
+ isSupportNewOption
41
+ } = this.props;
42
+ if (this.filteredOptions.length === 1) {
43
+ option = this.filteredOptions[0];
44
+ } else if (this.state.highlightIndex > -1) {
45
+ option = this.filteredOptions[this.state.highlightIndex];
46
+ }
47
+ if (option) {
48
+ this.onOptionItemToggle(option);
49
+ } else {
50
+ const {
51
+ searchValue
52
+ } = this.state;
53
+ if (searchValue && isSupportNewOption && this.filteredOptions.length === 0) {
54
+ e.stopPropagation();
55
+ this.onAddNewOption();
56
+ }
57
+ }
58
+ };
59
+ this.onUpArrow = e => {
60
+ e.preventDefault();
61
+ e.stopPropagation();
62
+ let {
63
+ highlightIndex,
64
+ maxItemNum,
65
+ itemHeight
66
+ } = this.state;
67
+ if (highlightIndex > 0) {
68
+ this.setState({
69
+ highlightIndex: highlightIndex - 1
70
+ }, () => {
71
+ if (highlightIndex < this.filteredOptions.length - maxItemNum) {
72
+ this.container.scrollTop -= itemHeight;
73
+ }
74
+ });
75
+ }
76
+ };
77
+ this.onDownArrow = e => {
78
+ e.preventDefault();
79
+ e.stopPropagation();
80
+ let {
81
+ highlightIndex,
82
+ maxItemNum,
83
+ itemHeight
84
+ } = this.state;
85
+ if (highlightIndex < this.filteredOptions.length - 1) {
86
+ this.setState({
87
+ highlightIndex: highlightIndex + 1
88
+ }, () => {
89
+ if (highlightIndex >= maxItemNum) {
90
+ this.container.scrollTop += itemHeight;
91
+ }
92
+ });
93
+ }
94
+ };
95
+ this.onValueChanged = searchValue => {
96
+ const {
97
+ searchValue: oldSearchVal
98
+ } = this.state;
99
+ const {
100
+ options
101
+ } = this.props;
102
+ if (oldSearchVal === searchValue) return;
103
+ this.setState({
104
+ searchValue
105
+ });
106
+ let val = searchValue.toLowerCase();
107
+ this.filteredOptions = val ? options.filter(item => item.name && item.name.toLowerCase().indexOf(val) > -1) : options;
108
+ this.setState({
109
+ highlightIndex: this.filteredOptions.length > 0 ? 0 : -1
110
+ });
111
+ };
112
+ this.onAddNewOption = () => {
113
+ let name = this.state.searchValue.trim();
114
+ this.props.onAddNewOption(name);
115
+ };
116
+ this.onOptionItemToggle = item => {
117
+ this.props.onCommit(item);
118
+ };
119
+ this.onMenuMouseEnter = index => {
120
+ this.setState({
121
+ highlightIndex: index
122
+ });
123
+ };
124
+ this.onMenuMouseLeave = index => {
125
+ this.timer = setTimeout(() => {
126
+ if (this.state.highlightIndex === index) {
127
+ this.setState({
128
+ highlightIndex: -1
129
+ });
130
+ }
131
+ }, 300);
132
+ };
133
+ this.getOptionStyle = option => {
134
+ const {
135
+ optionWidth
136
+ } = this.props;
137
+ const textColor = option.textColor || null;
138
+ return {
139
+ display: 'inline-block',
140
+ padding: '0px 10px',
141
+ height: '20px',
142
+ lineHeight: '20px',
143
+ borderRadius: '10px',
144
+ fontSize: '13px',
145
+ backgroundColor: option.color,
146
+ color: textColor,
147
+ maxWidth: optionWidth || 138
148
+ };
149
+ };
150
+ this.onKeyDown = e => {
151
+ if (e.keyCode === _constants.KeyCodes.ChineseInputMethod || e.keyCode === _constants.KeyCodes.Enter || e.keyCode === _constants.KeyCodes.LeftArrow || e.keyCode === _constants.KeyCodes.RightArrow) {
152
+ e.stopPropagation();
153
+ }
154
+ };
155
+ this.getMaxItemNum = () => {
156
+ let selectContainerStyle = getComputedStyle(this.container, null);
157
+ let selectItemStyle = getComputedStyle(this.selectItem, null);
158
+ let maxSelectItemNum = Math.floor(parseInt(selectContainerStyle.maxHeight) / parseInt(selectItemStyle.height));
159
+ return maxSelectItemNum - 1;
160
+ };
161
+ this.state = {
162
+ searchValue: '',
163
+ highlightIndex: -1,
164
+ maxItemNum: 0,
165
+ itemHeight: 0
166
+ };
167
+ this.filteredOptions = props.options;
168
+ this.timer = null;
169
+ this.parent = null;
170
+ this.ref = null;
171
+ this.container = null;
172
+ this.selectItem = null;
173
+ }
174
+ componentDidMount() {
175
+ if (this.props.isInModal && this.parent) {
176
+ if (this.parent.getBoundingClientRect().top > 330) {
177
+ this.ref.style.top = '-200px';
178
+ }
179
+ }
180
+ const {
181
+ bottom
182
+ } = this.ref.getBoundingClientRect();
183
+ if (bottom > window.innerHeight) {
184
+ this.ref.style.top = parseInt(this.ref.style.top) - bottom + window.innerHeight + 'px';
185
+ }
186
+ if (this.container && this.selectItem) {
187
+ this.setState({
188
+ maxItemNum: this.getMaxItemNum(),
189
+ itemHeight: parseInt(getComputedStyle(this.selectItem, null).height)
190
+ });
191
+ }
192
+ document.addEventListener('keydown', this.onHotKey, true);
193
+ }
194
+ componentWillUnmount() {
195
+ document.removeEventListener('keydown', this.onHotKey, true);
196
+ if (this.timer) {
197
+ clearTimeout(this.timer);
198
+ this.timer = null;
199
+ }
200
+ }
201
+ render() {
202
+ const {
203
+ isInModal,
204
+ className,
205
+ value,
206
+ column,
207
+ valueKey,
208
+ isSupportNewOption,
209
+ target
210
+ } = this.props;
211
+ const {
212
+ searchValue,
213
+ highlightIndex
214
+ } = this.state;
215
+
216
+ // maxWidth = single-selects-container's width - single-selects-container's padding-left and padding-right - single-select-container's padding-left - single-select-check-icon's width - The gap between the single-select-check-icon and single-select-name or scroll's width
217
+ // maxWidth = column.width > 200 ? column.width - 20 - 12 - 20 - 10 : 200 - 20 - 12 - 20 - 10
218
+ // maxWidth = column.width > 200 ? column.width - 62 : 200 - 62
219
+ let maxWidth = isInModal ? 250 : (column === null || column === void 0 ? void 0 : column.width) > 200 ? column.width - 62 : 138;
220
+ const dom = /*#__PURE__*/_react.default.createElement("div", {
221
+ className: (0, _classnames.default)('dtable-ui-editor-container dtable-ui-select-editor-container', className),
222
+ ref: ref => this.ref = ref
223
+ }, /*#__PURE__*/_react.default.createElement("div", {
224
+ className: "select-options-search"
225
+ }, /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
226
+ placeholder: (0, _lang.getLocale)('Search_option'),
227
+ onKeyDown: this.onKeyDown,
228
+ onChange: this.onValueChanged,
229
+ autoFocus: true
230
+ })), /*#__PURE__*/_react.default.createElement("div", {
231
+ className: "select-options-container",
232
+ ref: ref => this.container = ref
233
+ }, this.filteredOptions.length > 0 && this.filteredOptions.map((option, index) => {
234
+ let optionStyle = this.getOptionStyle(option);
235
+ optionStyle = {
236
+ ...optionStyle,
237
+ maxWidth
238
+ };
239
+ let isSelected = value.includes(option[valueKey]);
240
+ return /*#__PURE__*/_react.default.createElement("div", {
241
+ key: option.id,
242
+ className: "select-option-item",
243
+ ref: ref => this.selectItem = ref
244
+ }, /*#__PURE__*/_react.default.createElement("div", {
245
+ className: (0, _classnames.default)('select-option-item-container', {
246
+ 'select-option-item-container-highlight': index === highlightIndex
247
+ }),
248
+ onMouseDown: this.onOptionItemToggle.bind(this, option),
249
+ onMouseEnter: this.onMenuMouseEnter.bind(this, index),
250
+ onMouseLeave: this.onMenuMouseLeave.bind(this, index)
251
+ }, /*#__PURE__*/_react.default.createElement("div", {
252
+ className: "option-info"
253
+ }, /*#__PURE__*/_react.default.createElement("div", {
254
+ className: "option-name",
255
+ style: optionStyle,
256
+ title: option.name
257
+ }, option.name)), /*#__PURE__*/_react.default.createElement("div", {
258
+ className: "option-checked"
259
+ }, isSelected && /*#__PURE__*/_react.default.createElement("i", {
260
+ className: "dtable-font dtable-icon-check-mark"
261
+ }))));
262
+ }), this.filteredOptions.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
263
+ className: "dtable-ui-editor-no-search-result"
264
+ }, (0, _lang.getLocale)('No_options_available'))), isSupportNewOption && !!searchValue && /*#__PURE__*/_react.default.createElement("div", {
265
+ className: "select-options-add",
266
+ onClick: this.onAddNewOption
267
+ }, /*#__PURE__*/_react.default.createElement("i", {
268
+ className: "dtable-font dtable-icon-add-table"
269
+ }), /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Add_an_option'), ' ', searchValue)));
270
+ if (isInModal) {
271
+ return /*#__PURE__*/_react.default.createElement("div", {
272
+ ref: ref => this.parent = ref
273
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, {
274
+ placement: "bottom-start",
275
+ isOpen: true,
276
+ target: target,
277
+ hideArrow: true,
278
+ fade: false,
279
+ className: "dtable-ui dtable-ui-row-expand-select-editor-popover"
280
+ }, dom));
281
+ }
282
+ return dom;
283
+ }
284
+ }
285
+ PCSelectEditor.defaultProps = {
286
+ options: [],
287
+ value: [],
288
+ valueKey: 'id'
289
+ };
290
+ var _default = exports.default = PCSelectEditor;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.isCellValueChanged = void 0;
8
+ var _dtableUtils = require("dtable-utils");
9
+ var _objectUtils = _interopRequireDefault(require("./object-utils"));
10
+ const isCellValueChanged = (oldVal, newVal, columnType) => {
11
+ if (oldVal === newVal) {
12
+ return false;
13
+ }
14
+ if (oldVal === undefined || oldVal === null) {
15
+ if (columnType === _dtableUtils.CellType.GEOLOCATION && (0, _dtableUtils.isEmptyObject)(newVal)) {
16
+ return false;
17
+ }
18
+ if ((columnType === _dtableUtils.CellType.DATE || columnType === _dtableUtils.CellType.NUMBER || columnType === _dtableUtils.CellType.AUTO_NUMBER) && newVal === null) {
19
+ return false;
20
+ }
21
+ if (Array.isArray(newVal)) {
22
+ return newVal.length !== 0;
23
+ }
24
+ return newVal !== false && newVal !== '';
25
+ }
26
+ if (Array.isArray(oldVal) && Array.isArray(newVal)) {
27
+ // [{}].toString(): [object Object]
28
+ return JSON.stringify(oldVal) !== JSON.stringify(newVal);
29
+ }
30
+ if (typeof oldVal === 'object' && typeof newVal === 'object' && newVal !== null) {
31
+ return !_objectUtils.default.isSameObject(oldVal, newVal);
32
+ }
33
+ return oldVal !== newVal;
34
+ };
35
+ exports.isCellValueChanged = isCellValueChanged;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isValidPosition = exports.isLongTextValueExceedLimit = exports.checkValueConformityFormat = exports.checkNumberValidation = void 0;
7
+ var _constants = require("../constants");
8
+ var _utils = require("./utils");
9
+ const checkValueConformityFormat = (columnData, value) => {
10
+ const {
11
+ format_specification_value,
12
+ format_check_type
13
+ } = columnData || {};
14
+ let isMatched = false;
15
+ if (format_check_type !== 'custom_format') {
16
+ const reg = _constants.FORMAT_REG_EXP_LIST[format_check_type];
17
+ isMatched = reg && reg.test((0, _utils.getTrimmedString)(value));
18
+ } else {
19
+ const reg = new RegExp(format_specification_value);
20
+ isMatched = reg.test((0, _utils.getTrimmedString)(value));
21
+ }
22
+ return isMatched;
23
+ };
24
+ exports.checkValueConformityFormat = checkValueConformityFormat;
25
+ const checkNumberValidation = (columnData, value) => {
26
+ const {
27
+ format_max_value,
28
+ format_min_value
29
+ } = columnData || {};
30
+ const num = parseFloat(value);
31
+ if (isNaN(num) || !num && num !== 0) {
32
+ return false;
33
+ }
34
+ if ((format_max_value || format_max_value === 0) && num > format_max_value) {
35
+ return false;
36
+ }
37
+ if ((format_min_value || format_min_value === 0) && num < format_min_value) {
38
+ return false;
39
+ }
40
+ return true;
41
+ };
42
+ exports.checkNumberValidation = checkNumberValidation;
43
+ const isLongTextValueExceedLimit = value => {
44
+ if (!value) return false;
45
+ if (typeof value === 'string') return value.length >= _constants.LONG_TEXT_LENGTH_LIMIT;
46
+ const {
47
+ text
48
+ } = value || {};
49
+ return text ? text.length >= _constants.LONG_TEXT_LENGTH_LIMIT : false;
50
+ };
51
+ exports.isLongTextValueExceedLimit = isLongTextValueExceedLimit;
52
+ const isValidPosition = (lng, lat) => {
53
+ return (lng || lng === 0) && (lat || lat === 0);
54
+ };
55
+ exports.isValidPosition = isValidPosition;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isEnableCheckFormat = exports.getDateColumnFormat = void 0;
7
+ var _dtableUtils = require("dtable-utils");
8
+ const isEnableCheckFormat = column => {
9
+ if (!column) return false;
10
+ const {
11
+ data
12
+ } = column;
13
+ const {
14
+ enable_check_format
15
+ } = data || {};
16
+ if (enable_check_format) return true;
17
+ return false;
18
+ };
19
+ exports.isEnableCheckFormat = isEnableCheckFormat;
20
+ const getDateColumnFormat = column => {
21
+ const format = column && column.data && column.data.format ? column.data.format : _dtableUtils.DEFAULT_DATE_FORMAT;
22
+ // Old Europe format is D/M/YYYY new format is DD/MM/YYYY
23
+ return format;
24
+ };
25
+ exports.getDateColumnFormat = getDateColumnFormat;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isValidUrl = exports.initDateEditorLanguage = exports.getTrimmedString = exports.getSelectOptionItem = void 0;
6
+ exports.initDateEditorLanguage = exports.getTrimmedString = exports.getSelectOptionItem = void 0;
7
7
  const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
8
8
  const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
9
9
  const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
@@ -63,11 +63,6 @@ const getSelectOptionItem = (options, optionId) => {
63
63
  return options.find(option => option.id === optionId);
64
64
  };
65
65
  exports.getSelectOptionItem = getSelectOptionItem;
66
- const isValidUrl = url => {
67
- const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
68
- return reg.test(url);
69
- };
70
- exports.isValidUrl = isValidUrl;
71
66
  const getTrimmedString = value => {
72
67
  return typeof value === 'string' ? value.trim() : '';
73
68
  };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const HTML = 'text/html';
8
+ const TEXT = 'text/plain';
9
+ // const FILES = 'files';
10
+
11
+ function getType(transfer, type) {
12
+ if (!transfer.types || !transfer.types.length) {
13
+ // COMPAT: In IE 11, there is no `types` field but `getData('Text')`
14
+ // is supported`. (2017/06/23)
15
+ return type === TEXT ? transfer.getData('Text') || null : null;
16
+ }
17
+ return transfer.getData(type);
18
+ }
19
+ function getFiles(transfer) {
20
+ let files;
21
+ try {
22
+ // Get and normalize files if they exist.
23
+ if (transfer.items && transfer.items.length) {
24
+ files = Array.from(transfer.items).map(item => item.kind === 'file' ? item.getAsFile() : null).filter(exists => exists);
25
+ } else if (transfer.files && transfer.files.length) {
26
+ files = Array.from(transfer.files);
27
+ }
28
+ } catch (err) {
29
+ if (transfer.files && transfer.files.length) {
30
+ files = Array.from(transfer.files);
31
+ }
32
+ }
33
+ return files;
34
+ }
35
+ function getEventTransfer(event) {
36
+ let html;
37
+ let text;
38
+ let files;
39
+ if (window.isMobile) {
40
+ if (window.dtableTransfer) {
41
+ text = window.dtableTransfer['TEXT'];
42
+ }
43
+ } else {
44
+ const transfer = event.dataTransfer || event.clipboardData;
45
+ html = getType(transfer, HTML);
46
+ text = getType(transfer, TEXT);
47
+ files = getFiles(transfer);
48
+ }
49
+
50
+ // paste html
51
+ if (html) {
52
+ return {
53
+ html,
54
+ text,
55
+ type: 'html'
56
+ };
57
+ }
58
+
59
+ // paste local picture or other files here
60
+ if (files && files.length) {
61
+ return {
62
+ 'files': files,
63
+ type: 'files'
64
+ };
65
+ }
66
+
67
+ // paste text
68
+ if (text) {
69
+ return {
70
+ text,
71
+ type: 'text'
72
+ };
73
+ }
74
+ }
75
+ var _default = exports.default = getEventTransfer;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.isSpace = exports.isShiftModEnter = exports.isShiftEnter = exports.isOptPageup = exports.isOptPagedown = exports.isModZ = exports.isModUp = exports.isModSlash = exports.isModShiftZ = exports.isModShiftG = exports.isModShiftDot = exports.isModShiftComma = exports.isModSemicolon = exports.isModS = exports.isModRight = exports.isModP = exports.isModOptionR = exports.isModOptionE = exports.isModLeft = exports.isModL = exports.isModG = exports.isModF = exports.isModDown = exports.isModDot = exports.isModComma = exports.isModC = exports.isModBackslash = exports.isEsc = exports.isEnter = void 0;
8
+ var _isHotkey = _interopRequireDefault(require("is-hotkey"));
9
+ const isModC = exports.isModC = (0, _isHotkey.default)('mod+c');
10
+ const isModS = exports.isModS = (0, _isHotkey.default)('mod+s');
11
+ const isModZ = exports.isModZ = (0, _isHotkey.default)('mod+z');
12
+ const isModL = exports.isModL = (0, _isHotkey.default)('mod+l');
13
+ const isModF = exports.isModF = (0, _isHotkey.default)('mod+f');
14
+ const isModP = exports.isModP = (0, _isHotkey.default)('mod+p');
15
+ const isModG = exports.isModG = (0, _isHotkey.default)('mod+g');
16
+ const isModDot = exports.isModDot = (0, _isHotkey.default)('mod+.');
17
+ const isModComma = exports.isModComma = (0, _isHotkey.default)('mod+,');
18
+ const isModSlash = exports.isModSlash = (0, _isHotkey.default)('mod+/');
19
+ const isModBackslash = exports.isModBackslash = (0, _isHotkey.default)('mod+\'');
20
+ const isModSemicolon = exports.isModSemicolon = (0, _isHotkey.default)('mod+;');
21
+ const isModUp = exports.isModUp = (0, _isHotkey.default)('mod+up');
22
+ const isModDown = exports.isModDown = (0, _isHotkey.default)('mod+down');
23
+ const isModLeft = exports.isModLeft = (0, _isHotkey.default)('mod+left');
24
+ const isModRight = exports.isModRight = (0, _isHotkey.default)('mod+right');
25
+ const isModShiftZ = exports.isModShiftZ = (0, _isHotkey.default)('mod+shift+z');
26
+ const isModShiftG = exports.isModShiftG = (0, _isHotkey.default)('mod+shift+g');
27
+ const isModOptionR = exports.isModOptionR = (0, _isHotkey.default)('mod+option+r');
28
+ const isModOptionE = exports.isModOptionE = (0, _isHotkey.default)('mod+option+e');
29
+ const isModShiftDot = exports.isModShiftDot = (0, _isHotkey.default)('mod+shift+.');
30
+ const isModShiftComma = exports.isModShiftComma = (0, _isHotkey.default)('mod+shift+,');
31
+ const isShiftEnter = exports.isShiftEnter = (0, _isHotkey.default)('shift+enter');
32
+ const isShiftModEnter = exports.isShiftModEnter = (0, _isHotkey.default)('shift+mod+enter');
33
+ const isOptPageup = exports.isOptPageup = (0, _isHotkey.default)('opt+pageup');
34
+ const isOptPagedown = exports.isOptPagedown = (0, _isHotkey.default)('opt+pagedown');
35
+ const isSpace = exports.isSpace = (0, _isHotkey.default)('space');
36
+ const isEsc = exports.isEsc = (0, _isHotkey.default)('esc');
37
+ const isEnter = exports.isEnter = (0, _isHotkey.default)('enter');
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shallowCloneObject = exports.hasOwnProperty = exports.default = void 0;
7
+ class ObjectUtils {
8
+ static getDataType(data) {
9
+ let type = typeof data;
10
+ if (type !== 'object') {
11
+ return type;
12
+ }
13
+ return Object.prototype.toString.call(data).replace(/^\[object (\S+)\]$/, '$1');
14
+ }
15
+ static iterable(data) {
16
+ return ['Object', 'Array'].includes(this.getDataType(data));
17
+ }
18
+ static isObjectChanged(source, comparison) {
19
+ if (!this.iterable(source)) {
20
+ throw new Error("source should be a Object or Array , but got ".concat(this.getDataType(source)));
21
+ }
22
+ if (this.getDataType(source) !== this.getDataType(comparison)) {
23
+ return true;
24
+ }
25
+ const sourceKeys = Object.keys(source);
26
+ const comparisonKeys = Object.keys({
27
+ ...source,
28
+ ...comparison
29
+ });
30
+ if (sourceKeys.length !== comparisonKeys.length) {
31
+ return true;
32
+ }
33
+ return comparisonKeys.some(key => {
34
+ if (this.iterable(source[key])) {
35
+ return this.isObjectChanged(source[key], comparison[key]);
36
+ } else {
37
+ return source[key] !== comparison[key];
38
+ }
39
+ });
40
+ }
41
+ static isSameObject(source, comparison) {
42
+ if (!source || !comparison) return false;
43
+ return !this.isObjectChanged(source, comparison);
44
+ }
45
+ }
46
+ const hasOwnProperty = (obj, propertyKey) => {
47
+ if (!obj || !propertyKey) return false;
48
+ return Object.prototype.hasOwnProperty.call(obj, propertyKey);
49
+ };
50
+ exports.hasOwnProperty = hasOwnProperty;
51
+ const shallowCloneObject = obj => {
52
+ const result = {};
53
+ for (const k in obj) {
54
+ if (Object.prototype.hasOwnProperty.call(obj, k)) {
55
+ result[k] = obj[k];
56
+ }
57
+ }
58
+ return result;
59
+ };
60
+ exports.shallowCloneObject = shallowCloneObject;
61
+ var _default = exports.default = ObjectUtils;