dtable-ui-component 5.3.1-beta → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/lib/CheckboxEditor/index.css +20 -3
  2. package/lib/CheckboxEditor/index.js +35 -98
  3. package/lib/CheckboxFormatter/index.js +9 -6
  4. package/lib/CollaboratorEditor/index.css +35 -12
  5. package/lib/CollaboratorEditor/index.js +212 -18
  6. package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
  7. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
  8. package/lib/CollaboratorItem/index.css +1 -1
  9. package/lib/CollaboratorItem/index.js +2 -6
  10. package/lib/DTableFiltersPopover/utils/index.js +7 -1
  11. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  12. package/lib/DTableSelect/index.js +1 -3
  13. package/lib/DateEditor/index.js +51 -14
  14. package/lib/DateEditor/pc-date-editor-popover.js +12 -145
  15. package/lib/Department-editor/department-single-select.js +1 -1
  16. package/lib/Department-editor/index.js +4 -3
  17. package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
  18. package/lib/FileEditor/index.js +11 -244
  19. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  20. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  21. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  22. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  23. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  24. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  25. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  26. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  27. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  28. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  29. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  30. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  31. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  32. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  33. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  34. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  35. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  36. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  37. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  38. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  39. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  40. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  41. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  42. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  43. package/lib/FileItemFormatter/index.js +20 -19
  44. package/lib/FileItemFormatter/utils.js +99 -0
  45. package/lib/FileUploader/index.js +14 -268
  46. package/lib/FormulaFormatter/index.js +1 -2
  47. package/lib/FormulaFormatter/utils.js +31 -0
  48. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  49. package/lib/MultipleSelectEditor/index.css +9 -0
  50. package/lib/MultipleSelectEditor/index.js +177 -16
  51. package/lib/NumberEditor/index.js +77 -64
  52. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  53. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  54. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  55. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  56. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  57. package/lib/RowExpandFormatter/index.css +0 -26
  58. package/lib/RowExpandFormatter/index.js +100 -84
  59. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  60. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  61. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  62. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  63. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  64. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +5 -5
  65. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/utils.js +1 -1
  66. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  67. package/lib/RowExpandUrlFormatter/index.css +1 -0
  68. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  69. package/lib/SingleSelectEditor/index.css +14 -0
  70. package/lib/SingleSelectEditor/index.js +156 -16
  71. package/lib/TextEditor/index.js +42 -113
  72. package/lib/constants/index.js +2 -34
  73. package/lib/css/cell-editor.css +2 -18
  74. package/lib/index.js +46 -74
  75. package/lib/lang/index.js +14 -16
  76. package/lib/locals/de.js +103 -0
  77. package/lib/locals/en.js +104 -0
  78. package/lib/locals/es.js +103 -0
  79. package/lib/locals/fr.js +103 -0
  80. package/lib/locals/pt.js +103 -0
  81. package/lib/locals/ru.js +103 -0
  82. package/lib/locals/zh-CN.js +104 -0
  83. package/lib/select-editor/index.js +6 -6
  84. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  85. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  86. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  87. package/lib/utils/editor-utils.js +6 -1
  88. package/lib/utils/url.js +8 -119
  89. package/lib/utils/utils.js +2 -89
  90. package/package.json +2 -3
  91. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  92. package/lib/DeleteTip/index.js +0 -50
  93. package/lib/DigitalSignEditor/constants.js +0 -7
  94. package/lib/DigitalSignEditor/index.css +0 -69
  95. package/lib/DigitalSignEditor/index.js +0 -182
  96. package/lib/DigitalSignEditor/service.js +0 -38
  97. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  98. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  99. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  100. package/lib/DigitalSignEditor/utils.js +0 -29
  101. package/lib/DurationEditor/index.js +0 -111
  102. package/lib/EmailEditor/index.js +0 -59
  103. package/lib/FileEditor/addition-previewer/index.css +0 -1
  104. package/lib/FileEditor/addition-previewer/index.js +0 -52
  105. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  106. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  107. package/lib/FileEditor/constants.js +0 -7
  108. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  109. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  110. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  111. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  112. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  113. package/lib/FileEditor/files-previewer/index.css +0 -56
  114. package/lib/FileEditor/files-previewer/index.js +0 -277
  115. package/lib/FileEditor/index.css +0 -6
  116. package/lib/FileEditor/utils.js +0 -22
  117. package/lib/FileUploader/index.css +0 -9
  118. package/lib/GeolocationEditor/country-editor.js +0 -319
  119. package/lib/GeolocationEditor/index.css +0 -641
  120. package/lib/GeolocationEditor/index.js +0 -241
  121. package/lib/GeolocationEditor/location-editor.js +0 -368
  122. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  123. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  124. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  125. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  126. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  127. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  128. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  129. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  130. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  131. package/lib/GeolocationEditor/province-editor.js +0 -226
  132. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  133. package/lib/GeolocationEditor/selector-list.js +0 -33
  134. package/lib/GeolocationEditor/with-ref.js +0 -27
  135. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  136. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  137. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  138. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  139. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  140. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  141. package/lib/ImageEditor/constants.js +0 -7
  142. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  143. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  144. package/lib/ImageEditor/images-previewer/index.css +0 -18
  145. package/lib/ImageEditor/images-previewer/index.js +0 -140
  146. package/lib/ImageEditor/index.css +0 -24
  147. package/lib/ImageEditor/index.js +0 -194
  148. package/lib/ImageThumbnail/index.css +0 -20
  149. package/lib/ImageThumbnail/index.js +0 -136
  150. package/lib/RowExpandDialog/body/index.css +0 -21
  151. package/lib/RowExpandDialog/body/index.js +0 -279
  152. package/lib/RowExpandDialog/column-content/index.css +0 -43
  153. package/lib/RowExpandDialog/column-content/index.js +0 -50
  154. package/lib/RowExpandDialog/constants.js +0 -114
  155. package/lib/RowExpandDialog/header/index.css +0 -31
  156. package/lib/RowExpandDialog/header/index.js +0 -33
  157. package/lib/RowExpandDialog/index.css +0 -24
  158. package/lib/RowExpandDialog/index.js +0 -268
  159. package/lib/RowExpandDialog/utils.js +0 -83
  160. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  161. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  162. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  163. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  164. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  165. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  166. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  167. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  168. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  169. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  170. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  171. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  172. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  173. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  174. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  175. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  176. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  177. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  178. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  179. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  180. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -124
  181. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  182. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  183. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  184. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  185. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  186. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  187. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  188. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  189. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  190. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  191. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  192. package/lib/RowExpandEditor/constants.js +0 -44
  193. package/lib/RowExpandEditor/index.css +0 -0
  194. package/lib/RowExpandEditor/index.js +0 -32
  195. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  196. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  197. package/lib/RowExpandFormatter/constants.js +0 -60
  198. package/lib/UploadProgress/index.js +0 -38
  199. package/lib/UrlEditor/index.js +0 -62
  200. package/lib/common/editor-base.js +0 -53
  201. package/lib/constants/file.js +0 -96
  202. package/lib/constants/key-codes.js +0 -109
  203. package/lib/hooks/index.js +0 -16
  204. package/lib/locales/de.json +0 -163
  205. package/lib/locales/en.json +0 -163
  206. package/lib/locales/es.json +0 -163
  207. package/lib/locales/fr.json +0 -163
  208. package/lib/locales/pt.json +0 -163
  209. package/lib/locales/ru.json +0 -163
  210. package/lib/locales/zh-CN.json +0 -163
  211. package/lib/select-editor/pc-select-editor/index.css +0 -85
  212. package/lib/select-editor/pc-select-editor/index.js +0 -290
  213. package/lib/utils/cell-comparer.js +0 -35
  214. package/lib/utils/cell.js +0 -55
  215. package/lib/utils/column-utils.js +0 -25
  216. package/lib/utils/get-event-transfer.js +0 -75
  217. package/lib/utils/object-utils.js +0 -61
  218. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  219. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  220. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  221. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  222. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  223. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -3,8 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.throttle = exports.openUrlLink = exports.isValidUrl = exports.isValidCellValue = exports.isMobile = exports.isMac = exports.isFunction = exports.getTrimmedString = exports.getEventClassName = exports.getErrorMsg = exports.downloadFiles = exports.downloadFile = exports.debounce = void 0;
7
- var _url = require("./url");
6
+ exports.throttle = exports.isMac = exports.getEventClassName = exports.downloadFile = exports.debounce = void 0;
8
7
  const debounce = (fn, wait) => {
9
8
  let timeout = null;
10
9
  return function () {
@@ -31,7 +30,6 @@ const throttle = (func, delay) => {
31
30
  };
32
31
  };
33
32
  exports.throttle = throttle;
34
- const isMobile = exports.isMobile = typeof window !== 'undefined' && (window.innerWidth < 768 || navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null);
35
33
  const isMac = () => {
36
34
  const platform = navigator.platform;
37
35
  // eslint-disable-next-line eqeqeq
@@ -50,94 +48,9 @@ const downloadFile = downloadUrl => {
50
48
  document.body.appendChild(iframe);
51
49
  };
52
50
  exports.downloadFile = downloadFile;
53
- const downloadFiles = (downloadUrlList, config) => {
54
- const downloadFrame = document.getElementById('dtableUiComponentDownloadFrame');
55
- if (downloadFrame != null) {
56
- document.body.removeChild(downloadFrame);
57
- }
58
- downloadUrlList.forEach((url, index) => {
59
- if (!(0, _url.isInternalURL)(url, config) && (0, _url.imageCheck)(url.replace('?dl=1', ''))) {
60
- window.open(url);
61
- } else {
62
- const path = url;
63
- let timer1 = setTimeout(function (path) {
64
- return function () {
65
- let iframe = document.createElement('iframe');
66
- iframe.setAttribute('id', 'dtableUiComponentDownloadFrame');
67
- iframe.style.display = 'none';
68
- iframe.src = path;
69
- document.body.appendChild(iframe);
70
- let timer2 = setTimeout(function () {
71
- iframe.remove();
72
- clearTimeout(timer2);
73
- }, 5000);
74
- clearTimeout(timer1);
75
- };
76
- }(path), 1000 * index);
77
- }
78
- });
79
- };
80
- exports.downloadFiles = downloadFiles;
81
51
  const getEventClassName = e => {
82
52
  // svg mouseEvent event.target.className is an object
83
53
  if (!e || !e.target) return '';
84
54
  return e.target.getAttribute('class') || '';
85
55
  };
86
- exports.getEventClassName = getEventClassName;
87
- const getTrimmedString = value => {
88
- return typeof value === 'string' ? value.trim() : '';
89
- };
90
- exports.getTrimmedString = getTrimmedString;
91
- const isFunction = functionToCheck => {
92
- const getType = {};
93
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
94
- };
95
- exports.isFunction = isFunction;
96
- const isValidCellValue = value => {
97
- if (value === undefined) return false;
98
- if (value === null) return false;
99
- if (value === '') return false;
100
- if (JSON.stringify(value) === '{}') return false;
101
- if (JSON.stringify(value) === '[]') return false;
102
- return true;
103
- };
104
- exports.isValidCellValue = isValidCellValue;
105
- const isValidUrl = url => {
106
- const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
107
- return reg.test(url);
108
- };
109
- exports.isValidUrl = isValidUrl;
110
- const openUrlLink = url => {
111
- let a = document.createElement('a');
112
- document.body.appendChild(a);
113
- a.href = url;
114
- a.target = '_blank';
115
- a.rel = 'noopener noreferrer';
116
- a.click();
117
- document.body.removeChild(a);
118
- };
119
- exports.openUrlLink = openUrlLink;
120
- const getErrorMsg = error => {
121
- let errorMsg = '';
122
- if (error.response) {
123
- if (error.response.status === 403) {
124
- errorMsg = 'Permission_denied';
125
- } else if (error.response.data && error.response.data['error_msg']) {
126
- errorMsg = error.response.data['error_msg'];
127
- } else if (error.response.data && error.response.data['error_message']) {
128
- errorMsg = error.response.data['error_message'];
129
- } else {
130
- errorMsg = 'Error';
131
- }
132
- } else {
133
- if (typeof error === 'object' && error.name) {
134
- errorMsg = error.name;
135
- } else {
136
- errorMsg = 'Please_check_the_network';
137
- }
138
- // eslint-disable-next-line
139
- console.log(error);
140
- }
141
- return errorMsg;
142
- };
143
- exports.getErrorMsg = getErrorMsg;
56
+ exports.getEventClassName = getEventClassName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.3.1beta",
3
+ "version": "5.3.1",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "3.0.1",
@@ -9,7 +9,7 @@
9
9
  "antd-mobile": "2.3.1",
10
10
  "classnames": "2.3.2",
11
11
  "dayjs": "1.10.7",
12
- "dtable-utils": "5.0.16",
12
+ "dtable-utils": "5.0.11",
13
13
  "is-hotkey": "0.2.0",
14
14
  "prop-types": "^15.8.1",
15
15
  "react": "17.0.2",
@@ -17,7 +17,6 @@
17
17
  "react-responsive": "9.0.2",
18
18
  "react-color": "2.19.3",
19
19
  "react-select": "5.7.0",
20
- "react-sweet-progress": "^1.1.2",
21
20
  "react-transition-group": "^4.4.1",
22
21
  "reactstrap": "8.9.0"
23
22
  },
@@ -1,257 +0,0 @@
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 _dtableUtils = require("dtable-utils");
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _reactstrap = require("reactstrap");
12
- var _lang = require("../../lang");
13
- var _CollaboratorItem = _interopRequireDefault(require("../../CollaboratorItem"));
14
- var _DTableSearchInput = _interopRequireDefault(require("../../DTableSearchInput"));
15
- var _constants = require("../../constants");
16
- var _objectUtils = _interopRequireDefault(require("../../utils/object-utils"));
17
- require("./index.css");
18
- class PCCollaboratorEditor extends _react.default.Component {
19
- constructor(props) {
20
- super(props);
21
- this.onValueChanged = newSearchValue => {
22
- if (newSearchValue === this.state.searchValue) return;
23
- const {
24
- collaborators
25
- } = this.props;
26
- this.filteredCollaborators = (0, _dtableUtils.searchCollaborators)(collaborators, newSearchValue);
27
- this.setState({
28
- highlightIndex: this.filteredCollaborators.length > 0 ? 0 : -1,
29
- searchValue: newSearchValue
30
- });
31
- };
32
- this.onCollaboratorClick = collaborator => {
33
- this.props.onCommit(collaborator);
34
- };
35
- this.getFilterCollaborator = () => {
36
- const {
37
- collaborators
38
- } = this.props;
39
- const searchValue = this.state.searchValue.toLowerCase();
40
- if (!searchValue) return collaborators;
41
- return (0, _dtableUtils.searchCollaborators)(collaborators, searchValue);
42
- };
43
- this.getMaxItemNum = () => {
44
- let collaboratorContainerStyle = getComputedStyle(this.container, null);
45
- let collaboratorItemStyle = getComputedStyle(this.collaboratorItem, null);
46
- let maxContainerItemNum = Math.floor(parseInt(collaboratorContainerStyle.maxHeight) / parseInt(collaboratorItemStyle.height));
47
- return maxContainerItemNum - 1;
48
- };
49
- this.onHotKey = e => {
50
- if (e.keyCode === _constants.KeyCodes.Enter) {
51
- this.onEnter(e);
52
- } else if (e.keyCode === _constants.KeyCodes.UpArrow) {
53
- this.onUpArrow(e);
54
- } else if (e.keyCode === _constants.KeyCodes.DownArrow) {
55
- this.onDownArrow(e);
56
- } else if (e.keyCode === _constants.KeyCodes.Escape) {
57
- this.onEsc(e);
58
- } else if (e.keyCode === _constants.KeyCodes.Tab) {
59
- if (this.props.onPressTab) {
60
- this.props.onPressTab(e);
61
- }
62
- }
63
- };
64
- this.onEnter = e => {
65
- e.preventDefault();
66
- let collaborator;
67
- if (this.filteredCollaborators.length === 1) {
68
- collaborator = this.filteredCollaborators[0];
69
- } else if (this.state.highlightIndex > -1) {
70
- collaborator = this.filteredCollaborators[this.state.highlightIndex];
71
- }
72
- if (collaborator) {
73
- this.onCollaboratorClick(collaborator);
74
- }
75
- };
76
- this.onUpArrow = e => {
77
- e.preventDefault();
78
- e.stopPropagation();
79
- let {
80
- highlightIndex,
81
- maxItemNum,
82
- itemHeight
83
- } = this.state;
84
- if (highlightIndex > 0) {
85
- this.setState({
86
- highlightIndex: highlightIndex - 1
87
- }, () => {
88
- if (highlightIndex < this.filteredCollaborators.length - maxItemNum) {
89
- this.container.scrollTop -= itemHeight;
90
- }
91
- });
92
- } else {
93
- this.setState({
94
- highlightIndex: this.filteredCollaborators.length - 1
95
- }, () => {
96
- this.container.scrollTop = this.container.scrollHeight;
97
- });
98
- }
99
- };
100
- this.onDownArrow = e => {
101
- e.preventDefault();
102
- e.stopPropagation();
103
- let {
104
- highlightIndex,
105
- maxItemNum,
106
- itemHeight
107
- } = this.state;
108
- if (highlightIndex < this.filteredCollaborators.length - 1) {
109
- this.setState({
110
- highlightIndex: highlightIndex + 1
111
- }, () => {
112
- if (highlightIndex >= maxItemNum) {
113
- this.container.scrollTop += itemHeight;
114
- }
115
- });
116
- } else {
117
- this.setState({
118
- highlightIndex: 0
119
- }, () => {
120
- this.container.scrollTop = 0;
121
- });
122
- }
123
- };
124
- this.onEsc = e => {
125
- e.preventDefault();
126
- e.stopPropagation();
127
- const {
128
- isInModal,
129
- value,
130
- onCommitCancel,
131
- onClose
132
- } = this.props;
133
- if (isInModal) {
134
- onClose && onClose();
135
- return;
136
- }
137
- if (_objectUtils.default.isSameObject({
138
- 'value': this.state.value
139
- }, {
140
- value
141
- })) {
142
- onCommitCancel && onCommitCancel();
143
- return;
144
- }
145
- this.onCommit();
146
- };
147
- this.onCommit = () => {
148
- const value = this.getValue();
149
- this.props.onCommit(value);
150
- };
151
- this.getValue = () => {
152
- return this.state.value;
153
- };
154
- this.onKeyDown = e => {
155
- if (e.keyCode === _constants.KeyCodes.LeftArrow || e.keyCode === _constants.KeyCodes.RightArrow) {
156
- e.stopPropagation();
157
- }
158
- };
159
- this.state = {
160
- searchValue: '',
161
- highlightIndex: -1,
162
- maxItemNum: 0,
163
- itemHeight: 0
164
- };
165
- this.filteredCollaborators = props.collaborators || [];
166
- }
167
- componentDidMount() {
168
- if (this.props.isInModal && this.parent) {
169
- if (this.parent.getBoundingClientRect().top > 330) {
170
- this.ref.style.top = '-200px';
171
- }
172
- }
173
- if (!this.props.isInModal && this.ref) {
174
- const {
175
- bottom
176
- } = this.ref.getBoundingClientRect();
177
- if (bottom > window.innerHeight) {
178
- this.ref.style.top = "".concat(window.innerHeight - bottom, "px");
179
- }
180
- }
181
- if (this.container && this.collaboratorItem) {
182
- this.setState({
183
- maxItemNum: this.getMaxItemNum(),
184
- itemHeight: parseInt(getComputedStyle(this.collaboratorItem, null).height)
185
- });
186
- }
187
- document.addEventListener('keydown', this.onHotKey, true);
188
- }
189
- UNSAFE_componentWillReceiveProps(nextProps) {
190
- if (nextProps.isInModal && nextProps.value !== this.state.value && Array.isArray(nextProps.value)) {
191
- this.setState({
192
- value: nextProps.value
193
- });
194
- }
195
- }
196
- componentWillUnmount() {
197
- document.removeEventListener('keydown', this.onHotKey, true);
198
- }
199
- render() {
200
- const {
201
- searchValue,
202
- highlightIndex
203
- } = this.state;
204
- const {
205
- isInModal,
206
- value = [],
207
- target
208
- } = this.props;
209
- const dom = /*#__PURE__*/_react.default.createElement("div", {
210
- className: "dtable-ui-editor-container dtable-ui-collaborator-editor-container",
211
- ref: ref => this.ref = ref
212
- }, /*#__PURE__*/_react.default.createElement("div", {
213
- className: "collaborator-search-container"
214
- }, /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
215
- autoFocus: true,
216
- placeholder: (0, _lang.getLocale)('Search_collaborator'),
217
- value: searchValue,
218
- onChange: this.onValueChanged,
219
- onKeyDown: this.onKeyDown
220
- })), /*#__PURE__*/_react.default.createElement("div", {
221
- className: "collaborator-list-container",
222
- ref: ref => this.container = ref
223
- }, this.filteredCollaborators.length > 0 && this.filteredCollaborators.map((collaborator, index) => {
224
- const isSelected = value.includes(collaborator.email);
225
- return /*#__PURE__*/_react.default.createElement("div", {
226
- key: collaborator.email,
227
- className: (0, _classnames.default)('collaborator-item-container', {
228
- 'collaborator-item-container-highlight': index === highlightIndex
229
- }),
230
- ref: ref => this.collaboratorItem = ref,
231
- onClick: this.onCollaboratorClick.bind(this, collaborator)
232
- }, /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
233
- collaborator: collaborator
234
- }), /*#__PURE__*/_react.default.createElement("div", {
235
- className: "collaborator-checked"
236
- }, isSelected && /*#__PURE__*/_react.default.createElement("i", {
237
- className: "dtable-font dtable-icon-check-mark"
238
- })));
239
- }), this.filteredCollaborators.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
240
- className: "dtable-ui-editor-no-search-result"
241
- }, (0, _lang.getLocale)('No_collaborators_available'))));
242
- if (isInModal) {
243
- return /*#__PURE__*/_react.default.createElement("div", {
244
- ref: ref => this.parent = ref
245
- }, /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, {
246
- placement: "bottom-start",
247
- isOpen: true,
248
- target: target,
249
- hideArrow: true,
250
- fade: false,
251
- className: "dtable-ui-row-expand-select-editor-popover"
252
- }, dom));
253
- }
254
- return dom;
255
- }
256
- }
257
- var _default = exports.default = PCCollaboratorEditor;
@@ -1,50 +0,0 @@
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 _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
10
- var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
11
- var _lang = require("../lang");
12
- class DeleteTip extends _react.default.Component {
13
- constructor() {
14
- super(...arguments);
15
- this.handleOutsideClick = e => {
16
- if (this.tipContainer && !this.tipContainer.contains(e.target)) {
17
- this.props.toggle();
18
- }
19
- };
20
- }
21
- render() {
22
- const {
23
- toggle,
24
- deleteImage,
25
- position,
26
- deleteTip
27
- } = this.props;
28
- return /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement(_ClickOutside.default, {
29
- onClickOutside: this.handleOutsideClick
30
- }, /*#__PURE__*/_react.default.createElement("div", {
31
- ref: node => this.tipContainer = node,
32
- className: "dtable-tip tip-container",
33
- style: {
34
- top: position.top,
35
- left: position.left
36
- }
37
- }, /*#__PURE__*/_react.default.createElement("b", {
38
- className: "mb-4"
39
- }, deleteTip), /*#__PURE__*/_react.default.createElement("div", {
40
- className: "d-flex justify-content-end"
41
- }, /*#__PURE__*/_react.default.createElement("button", {
42
- className: "btn btn-secondary mr-2",
43
- onClick: toggle
44
- }, (0, _lang.getLocale)('Cancel')), /*#__PURE__*/_react.default.createElement("button", {
45
- className: "btn btn-primary",
46
- onClick: deleteImage
47
- }, (0, _lang.getLocale)('Delete'))))));
48
- }
49
- }
50
- var _default = exports.default = DeleteTip;
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DIGITAL_SIGNS_FOLDER = void 0;
7
- const DIGITAL_SIGNS_FOLDER = exports.DIGITAL_SIGNS_FOLDER = 'digital-signs';
@@ -1,69 +0,0 @@
1
- .dtable-ui-digital-sign-editor-container {
2
- position: fixed;
3
- width: 600px;
4
- box-shadow: 0 0 5px #ccc;
5
- border-radius: 4px;
6
- background-color: #ffffff;
7
- overflow: hidden;
8
- }
9
-
10
- .dtable-ui-digital-sign-editor-header {
11
- height: 50px;
12
- padding: 0 20px;
13
- display: flex;
14
- align-items: center;
15
- justify-content: space-between;
16
- border-bottom: 1px solid #ededed;
17
- }
18
-
19
- .dtable-ui-digital-sign-editor-header .dtable-font {
20
- color: #aaa;
21
- }
22
-
23
- .dtable-ui-digital-sign-editor-logo {
24
- display: flex;
25
- align-items: center;
26
- }
27
-
28
- .dtable-ui-digital-sign-editor-operations {
29
- flex: 1;
30
- display: flex;
31
- justify-content: flex-end;
32
- user-select: none;
33
- }
34
-
35
- .dtable-ui-digital-sign-editor-operations .btn-clear-dtable-ui-digital-sign {
36
- display: flex;
37
- align-items: center;
38
- justify-content: center;
39
- height: 28px;
40
- padding: 0 10px;
41
- border-radius: 3px;
42
- font-size: 14px;
43
- line-height: 28px;
44
- font-weight: 400;
45
- border: 0;
46
- color: #888;
47
- background-color: #f0f0f0;
48
- }
49
-
50
- .dtable-ui-digital-sign-editor-operations .btn-clear-dtable-ui-digital-sign:hover {
51
- color: #666;
52
- background-color: #dbdbdb;
53
- cursor: pointer;
54
- }
55
-
56
- .dtable-ui-digital-sign-editor-operations .dtable-icon-clear-format {
57
- color: #888;
58
- margin-right: 0.25rem;
59
- font-size: 14px;
60
- }
61
-
62
- .dtable-ui-digital-sign-editor-operations .btn-clear-dtable-ui-digital-sign:hover .dtable-icon-clear-format {
63
- color: #666;
64
- }
65
-
66
- .dtable-ui-digital-sign-editor-container .dtable-ui-digital-sign-panel {
67
- position: relative;
68
- height: 300px;
69
- }