dtable-ui-component 5.3.1-beta6 → 5.3.2-alpha1

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 (248) 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/DTableCustomizeSelect/index.css +1 -1
  11. package/lib/DTableFiltersPopover/utils/index.js +7 -1
  12. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  13. package/lib/DTableGroupSelect/select-option-group.css +17 -17
  14. package/lib/DTableGroupSelect/select-option-group.js +1 -1
  15. package/lib/DTableSelect/index.js +1 -3
  16. package/lib/DateEditor/index.js +51 -14
  17. package/lib/DateEditor/pc-date-editor-popover.js +12 -145
  18. package/lib/Department-editor/department-single-select.js +1 -1
  19. package/lib/Department-editor/index.js +4 -3
  20. package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
  21. package/lib/FileEditor/index.js +11 -258
  22. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  23. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  24. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  25. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  26. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  27. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  28. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  29. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  30. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  31. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  32. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  33. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  34. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  35. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  36. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  37. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  38. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  39. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  40. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  41. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  42. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  43. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  44. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  45. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  46. package/lib/FileItemFormatter/index.js +20 -19
  47. package/lib/FileItemFormatter/utils.js +99 -0
  48. package/lib/FileUploader/index.js +14 -268
  49. package/lib/FormulaFormatter/index.js +1 -2
  50. package/lib/FormulaFormatter/utils.js +31 -0
  51. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  52. package/lib/MultipleSelectEditor/index.css +9 -0
  53. package/lib/MultipleSelectEditor/index.js +177 -16
  54. package/lib/NumberEditor/index.js +77 -64
  55. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  56. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  57. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  58. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  59. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  60. package/lib/RowExpandFormatter/index.css +1 -27
  61. package/lib/RowExpandFormatter/index.js +100 -83
  62. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  63. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  64. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  65. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  66. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  67. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +6 -6
  68. package/lib/RowExpandLinkFormatter/utils.js +71 -0
  69. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  70. package/lib/RowExpandUrlFormatter/index.css +1 -0
  71. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  72. package/lib/SingleSelectEditor/index.css +14 -0
  73. package/lib/SingleSelectEditor/index.js +156 -16
  74. package/lib/TextEditor/index.js +42 -113
  75. package/lib/constants/index.js +2 -34
  76. package/lib/css/cell-editor.css +2 -18
  77. package/lib/index.js +46 -74
  78. package/lib/lang/index.js +16 -19
  79. package/lib/locals/de.js +103 -0
  80. package/lib/locals/en.js +104 -0
  81. package/lib/locals/es.js +103 -0
  82. package/lib/locals/fr.js +103 -0
  83. package/lib/locals/pt.js +103 -0
  84. package/lib/locals/ru.js +103 -0
  85. package/lib/locals/zh-CN.js +104 -0
  86. package/lib/select-editor/index.js +6 -6
  87. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  88. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  89. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  90. package/lib/utils/editor-utils.js +6 -1
  91. package/lib/utils/url.js +8 -121
  92. package/lib/utils/utils.js +2 -145
  93. package/package.json +2 -3
  94. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  95. package/lib/Comment/body/comment.js +0 -190
  96. package/lib/Comment/body/index.css +0 -95
  97. package/lib/Comment/body/index.js +0 -32
  98. package/lib/Comment/footer/btns/index.css +0 -40
  99. package/lib/Comment/footer/btns/index.js +0 -113
  100. package/lib/Comment/footer/index.css +0 -157
  101. package/lib/Comment/footer/index.js +0 -170
  102. package/lib/Comment/footer/input/index.css +0 -52
  103. package/lib/Comment/footer/input/index.js +0 -448
  104. package/lib/Comment/footer/input/participant/index.css +0 -0
  105. package/lib/Comment/footer/input/participant/index.js +0 -53
  106. package/lib/Comment/footer/participants/index.css +0 -22
  107. package/lib/Comment/footer/participants/index.js +0 -68
  108. package/lib/Comment/footer/participants/participant/index.css +0 -5
  109. package/lib/Comment/footer/participants/participant/index.js +0 -32
  110. package/lib/Comment/footer/participants/participant-select/index.css +0 -104
  111. package/lib/Comment/footer/participants/participant-select/index.js +0 -182
  112. package/lib/Comment/index.css +0 -19
  113. package/lib/Comment/index.js +0 -305
  114. package/lib/Comment/model.js +0 -25
  115. package/lib/Comment/utils/common.js +0 -62
  116. package/lib/Comment/utils/index.js +0 -27
  117. package/lib/Comment/utils/utilities.js +0 -176
  118. package/lib/DeleteTip/index.js +0 -50
  119. package/lib/DigitalSignEditor/constants.js +0 -7
  120. package/lib/DigitalSignEditor/index.css +0 -69
  121. package/lib/DigitalSignEditor/index.js +0 -182
  122. package/lib/DigitalSignEditor/service.js +0 -38
  123. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  124. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  125. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  126. package/lib/DigitalSignEditor/utils.js +0 -29
  127. package/lib/DurationEditor/index.js +0 -111
  128. package/lib/EmailEditor/index.js +0 -59
  129. package/lib/FileEditor/addition-previewer/index.css +0 -1
  130. package/lib/FileEditor/addition-previewer/index.js +0 -52
  131. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  132. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  133. package/lib/FileEditor/constants.js +0 -7
  134. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  135. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  136. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  137. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  138. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  139. package/lib/FileEditor/files-previewer/index.css +0 -56
  140. package/lib/FileEditor/files-previewer/index.js +0 -277
  141. package/lib/FileEditor/index.css +0 -6
  142. package/lib/FileEditor/utils.js +0 -22
  143. package/lib/FileUploader/index.css +0 -9
  144. package/lib/GeolocationEditor/country-editor.js +0 -319
  145. package/lib/GeolocationEditor/index.css +0 -641
  146. package/lib/GeolocationEditor/index.js +0 -241
  147. package/lib/GeolocationEditor/location-editor.js +0 -368
  148. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  149. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  150. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  151. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  152. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  153. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  154. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  155. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  156. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  157. package/lib/GeolocationEditor/province-editor.js +0 -226
  158. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  159. package/lib/GeolocationEditor/selector-list.js +0 -33
  160. package/lib/GeolocationEditor/with-ref.js +0 -27
  161. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  162. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  163. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  164. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  165. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  166. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  167. package/lib/ImageEditor/constants.js +0 -7
  168. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  169. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  170. package/lib/ImageEditor/images-previewer/index.css +0 -18
  171. package/lib/ImageEditor/images-previewer/index.js +0 -140
  172. package/lib/ImageEditor/index.css +0 -24
  173. package/lib/ImageEditor/index.js +0 -194
  174. package/lib/ImageThumbnail/index.css +0 -20
  175. package/lib/ImageThumbnail/index.js +0 -136
  176. package/lib/RowExpandDialog/body/index.css +0 -21
  177. package/lib/RowExpandDialog/body/index.js +0 -262
  178. package/lib/RowExpandDialog/column-content/index.css +0 -44
  179. package/lib/RowExpandDialog/column-content/index.js +0 -50
  180. package/lib/RowExpandDialog/header/index.css +0 -31
  181. package/lib/RowExpandDialog/header/index.js +0 -55
  182. package/lib/RowExpandDialog/index.css +0 -24
  183. package/lib/RowExpandDialog/index.js +0 -252
  184. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  185. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  186. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  187. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  188. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  189. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  190. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  191. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  192. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  193. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  194. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  195. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  196. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  197. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  198. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  199. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  200. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  201. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  202. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  203. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  204. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -123
  205. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  206. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  207. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  208. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  209. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  210. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  211. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  212. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  213. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  214. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  215. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  216. package/lib/RowExpandEditor/constants.js +0 -44
  217. package/lib/RowExpandEditor/index.css +0 -0
  218. package/lib/RowExpandEditor/index.js +0 -32
  219. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  220. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  221. package/lib/RowExpandFormatter/constants.js +0 -60
  222. package/lib/UploadProgress/index.js +0 -38
  223. package/lib/UrlEditor/index.js +0 -62
  224. package/lib/common/editor-base.js +0 -53
  225. package/lib/constants/file.js +0 -96
  226. package/lib/constants/key-codes.js +0 -109
  227. package/lib/hooks/index.js +0 -16
  228. package/lib/locales/de.json +0 -167
  229. package/lib/locales/en.json +0 -167
  230. package/lib/locales/es.json +0 -167
  231. package/lib/locales/fr.json +0 -167
  232. package/lib/locales/pt.json +0 -167
  233. package/lib/locales/ru.json +0 -167
  234. package/lib/locales/zh-CN.json +0 -167
  235. package/lib/select-editor/pc-select-editor/index.css +0 -85
  236. package/lib/select-editor/pc-select-editor/index.js +0 -290
  237. package/lib/utils/cell-comparer.js +0 -35
  238. package/lib/utils/cell.js +0 -55
  239. package/lib/utils/column-utils.js +0 -25
  240. package/lib/utils/get-event-transfer.js +0 -75
  241. package/lib/utils/hotkey.js +0 -37
  242. package/lib/utils/object-utils.js +0 -61
  243. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  244. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  245. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  246. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  247. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  248. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -6,16 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
- var _reactDom = _interopRequireDefault(require("react-dom"));
10
9
  var _dayjs = _interopRequireDefault(require("dayjs"));
11
10
  var _classnames = _interopRequireDefault(require("classnames"));
12
11
  var _Picker = _interopRequireDefault(require("@seafile/seafile-calendar/lib/Picker"));
13
12
  var _seafileCalendar = _interopRequireDefault(require("@seafile/seafile-calendar"));
14
13
  var _editorUtils = require("../utils/editor-utils");
15
- var _constants = require("../constants");
16
14
  require("@seafile/seafile-calendar/assets/index.css");
17
15
  var _lang = require("../lang");
18
- let now = (0, _dayjs.default)();
19
16
  class PCDateEditorPopover extends _react.default.Component {
20
17
  constructor(props) {
21
18
  super(props);
@@ -26,44 +23,20 @@ class PCDateEditorPopover extends _react.default.Component {
26
23
  dateFormat
27
24
  } = this.props;
28
25
  this.setState({
29
- value: value,
26
+ datePickerValue: value,
30
27
  open: true // if value changed, don't close datePicker
31
28
  });
32
29
  this.props.onValueChanged(value.format(dateFormat));
33
30
  };
34
- this.getValue = () => {
35
- let {
36
- dateFormat
37
- } = this.props;
38
- let value = this.state.value ? this.state.value.format(dateFormat) : null;
39
- return value;
40
- };
41
- this.getInputNode = () => {
42
- const domNode = _reactDom.default.findDOMNode(this);
43
- if (domNode.tagName === 'INPUT') {
44
- return domNode;
45
- }
46
- return domNode.querySelector('input:not([type=hidden])');
47
- };
48
31
  this.onOpenChange = open => {
49
- const {
50
- isInModal
51
- } = this.props;
52
- if (open) {
53
- this.toggleCalendar(open);
54
- }
55
- if (isInModal && !open) {
56
- this.props.hideCalendar && this.props.hideCalendar();
57
- }
58
- };
59
- this.toggleCalendar = open => {
60
32
  this.setState({
61
- open
33
+ open: open
62
34
  });
35
+ return;
63
36
  };
64
37
  this.onClear = () => {
65
38
  this.setState({
66
- value: null
39
+ datePickerValue: null
67
40
  });
68
41
  };
69
42
  this.onFocusDatePicker = () => {
@@ -76,59 +49,7 @@ class PCDateEditorPopover extends _react.default.Component {
76
49
  event.stopPropagation();
77
50
  };
78
51
  this.getCalendarContainer = () => {
79
- const {
80
- isInModal
81
- } = this.props;
82
- return isInModal ? this.calendarContainerRef.current : document.body;
83
- };
84
- this.handleKeyDown = e => {
85
- const directionKeyCodes = [37, 38, 39, 40];
86
- if (directionKeyCodes.includes(e.keyCode)) {
87
- e.stopPropagation();
88
- } else if (e.keyCode === _constants.KeyCodes.Enter) {
89
- e.preventDefault();
90
- this.onBlur();
91
- if (this.props.selectDownCell) this.props.selectDownCell();
92
- }
93
- };
94
- this.onClick = e => {
95
- if (!this.showHourAndMinute && e.target.className === 'rc-calendar-date') {
96
- this.timer = setTimeout(() => {
97
- this.closeEditor();
98
- }, 1);
99
- }
100
- };
101
- this.closeEditor = () => {
102
- this.toggleCalendar(false);
103
- this.onBlur();
104
- };
105
- this.onReadOnlyFocus = () => {
106
- this.toggleCalendar(true);
107
- };
108
- this.onClickRightPanelTime = () => {
109
- const {
110
- isInModal
111
- } = this.props;
112
- let onClickRightPanelTime = isInModal ? this.props.hideCalendar : this.closeEditor;
113
- // we should change value and save it(async function), then close Editor.
114
- setTimeout(() => {
115
- onClickRightPanelTime && onClickRightPanelTime();
116
- }, 1);
117
- };
118
- this.onHotKey = e => {
119
- if (e.keyCode === _constants.KeyCodes.Escape) {
120
- if (this.props.isInModal) {
121
- e.stopPropagation();
122
- this.props.hideCalendar && this.props.hideCalendar();
123
- }
124
- }
125
- };
126
- this.getDefaultTime = () => {
127
- const {
128
- value
129
- } = this.props;
130
- if (value) return (0, _dayjs.default)(value).format('HH:mm');
131
- return '';
52
+ return this.calendarContainerRef.current;
132
53
  };
133
54
  this.getCalender = () => {
134
55
  let {
@@ -138,7 +59,6 @@ class PCDateEditorPopover extends _react.default.Component {
138
59
  className
139
60
  } = this.props;
140
61
  let defaultValue = (0, _dayjs.default)().clone();
141
- const defaultTime = this.getDefaultTime();
142
62
  return /*#__PURE__*/_react.default.createElement(_seafileCalendar.default, {
143
63
  className: (0, _classnames.default)('dtable-rc-calendar', className),
144
64
  locale: (0, _editorUtils.initDateEditorLanguage)(lang),
@@ -149,82 +69,29 @@ class PCDateEditorPopover extends _react.default.Component {
149
69
  defaultValue: defaultValue,
150
70
  showHourAndMinute: showHourAndMinute,
151
71
  dateInputPlaceholder: (0, _lang.getLocale)('Please_input'),
152
- defaultMinutesTime: defaultTime,
153
72
  showDateInput: true,
154
73
  focusablePanel: false,
155
74
  onClear: this.onClear
156
75
  });
157
76
  };
158
- const {
159
- dateFormat: _dateFormat,
160
- value: _value
161
- } = this.props;
162
77
  this.state = {
163
- value: _value ? (0, _dayjs.default)(_value) : null,
164
- open: false
78
+ open: true,
79
+ datePickerValue: props.value ? (0, _dayjs.default)(props.value) : null
165
80
  };
166
81
  this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
167
- this.defaultCalendarValue = null;
168
- this.showHourAndMinute = !!(_dateFormat.indexOf('HH:mm') > -1);
169
- }
170
- componentDidMount() {
171
- const {
172
- value,
173
- lang,
174
- isInModal
175
- } = this.props;
176
- const iszhcn = lang === 'zh-cn';
177
- if (iszhcn) {
178
- now = now.locale('zh-cn');
179
- } else {
180
- now = now.locale('en-gb');
181
- }
182
- this.timer = null;
183
- this.defaultCalendarValue = now.clone();
184
- if (value) {
185
- if (typeof value === 'string' && value.length === 1 && !isNaN(Number(value, 10))) {
186
- this.timer = setTimeout(() => {
187
- let inputDom = document.getElementsByClassName('rc-calendar-input')[0];
188
- if (inputDom) {
189
- inputDom.value = value;
190
- }
191
- }, 200);
192
- return;
193
- }
194
- let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
195
- this.setState({
196
- value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
197
- });
198
- }
199
- if (isInModal) {
200
- this.onReadOnlyFocus();
201
- }
202
- document.addEventListener('keydown', this.onHotKey, true);
203
- }
204
- componentWillUnmount() {
205
- document.removeEventListener('keydown', this.onHotKey, true);
206
- if (this.timer) {
207
- clearTimeout(this.timer);
208
- this.timer = null;
209
- }
210
82
  }
211
83
  render() {
212
84
  let {
213
- dateFormat,
214
- isInModal
85
+ dateFormat
215
86
  } = this.props;
216
87
  let {
217
88
  open,
218
- value
89
+ datePickerValue
219
90
  } = this.state;
220
91
  const calendar = this.getCalender();
221
- return /*#__PURE__*/_react.default.createElement("div", {
222
- className: "date-picker-container ".concat(isInModal ? 'modal-date-picker-container' : ''),
223
- onKeyDown: this.handleKeyDown,
224
- onClick: this.onClick
225
- }, /*#__PURE__*/_react.default.createElement(_Picker.default, {
92
+ return /*#__PURE__*/_react.default.createElement(_Picker.default, {
226
93
  open: open,
227
- value: value,
94
+ value: datePickerValue,
228
95
  animation: "slide-up",
229
96
  style: {
230
97
  zIndex: 1001
@@ -252,7 +119,7 @@ class PCDateEditorPopover extends _react.default.Component {
252
119
  }), /*#__PURE__*/_react.default.createElement("div", {
253
120
  ref: this.calendarContainerRef
254
121
  }));
255
- }));
122
+ });
256
123
  }
257
124
  }
258
125
  var _default = exports.default = PCDateEditorPopover;
@@ -199,7 +199,7 @@ class DepartmentSingleSelect extends _react.Component {
199
199
  };
200
200
  this.renderEmptyTip = () => {
201
201
  return /*#__PURE__*/_react.default.createElement("span", {
202
- className: "dtable-ui-editor-no-search-result"
202
+ className: "none-search-result d-flex justify-content-center"
203
203
  }, (0, _lang.getLocale)('No_departments_available'));
204
204
  };
205
205
  this.renderMenuContent = () => {
@@ -47,21 +47,22 @@ class DepartmentSingleSelectEditor extends _react.Component {
47
47
  };
48
48
  const {
49
49
  column: _column,
50
- isInModal,
50
+ mode,
51
51
  value: _value,
52
52
  height
53
53
  } = props;
54
54
  const editorWidth = _column.width > 300 ? _column.width : 300;
55
+ const isRowExpand = mode === 'row_expand';
55
56
  const data = _column.data || {};
56
57
  this.state = {
57
58
  value: _value || '',
58
- menuStyle: isInModal ? {} : {
59
+ menuStyle: isRowExpand ? {} : {
59
60
  width: editorWidth,
60
61
  top: height - 2
61
62
  }
62
63
  };
63
64
  this.enableSelectRange = data.enable_select_range || false;
64
- this.isRowExpand = isInModal;
65
+ this.isRowExpand = isRowExpand;
65
66
  }
66
67
  componentDidMount() {
67
68
  if (this.isRowExpand) {
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
- var _lang = require("../lang");
11
10
  require("./index.css");
12
11
  function DepartmentSingleSelectFormatter(props) {
13
12
  const {
@@ -17,7 +16,7 @@ function DepartmentSingleSelectFormatter(props) {
17
16
  tip
18
17
  } = props;
19
18
  if (!value) return null;
20
- const deletedTip = tip || (0, _lang.getLocale)('Deleted_department');
19
+ const deletedTip = tip || 'Deleted department';
21
20
  const department = departments.find(department => department.id === value);
22
21
  const name = department ? department.name : deletedTip;
23
22
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -7,268 +7,21 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactstrap = require("reactstrap");
10
- var _filesPreviewer = _interopRequireDefault(require("./files-previewer"));
11
- var _additionPreviewer = _interopRequireDefault(require("./addition-previewer"));
12
- var _constants = require("../constants");
13
- var _DTableModalHeader = _interopRequireDefault(require("../DTableModalHeader"));
14
10
  var _lang = require("../lang");
15
- var _constants2 = require("./constants");
16
- var _utils = require("../utils/utils");
17
- var _toaster = _interopRequireDefault(require("../toaster"));
18
- require("./index.css");
11
+ var _index = _interopRequireDefault(require("../DTableModalHeader/index"));
19
12
  class FileEditor extends _react.default.Component {
20
- constructor(props) {
21
- var _this;
22
- super(props);
23
- _this = this;
24
- this.getValue = () => {
25
- return this.state.value;
26
- };
27
- this.getEditorView = () => {
28
- const {
29
- isInModal,
30
- value
31
- } = this.props;
32
- return !value || value.length === 0 || isInModal ? _constants.FILE_EDITOR_STATUS.ADDITION : _constants.FILE_EDITOR_STATUS.PREVIEWER;
33
- };
34
- this.deleteImage = function (index) {
35
- let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
36
- let uploadLocalFileValue = _this.state.uploadLocalFileValue.slice(0);
37
- let value = _this.state.value.slice(0);
38
- if (_this.state.editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER) {
39
- value.splice(index, 1);
40
- } else {
41
- if (type === 'localPicture') {
42
- uploadLocalFileValue.splice(index, 1);
43
- }
44
- }
45
- _this.setState({
46
- uploadLocalFileValue: uploadLocalFileValue,
47
- isUpdated: true,
48
- value: value
49
- });
50
- };
51
- this.resetAdditionImage = () => {
52
- this.setState({
53
- uploadLocalFileValue: [],
54
- imageLinkValue: []
55
- });
56
- };
57
- this.toggle = e => {
58
- e.stopPropagation();
59
- if (this.state.isOpen && this.state.isUpdated) {
60
- if (this.state.editorView === _constants.FILE_EDITOR_STATUS.ADDITION) {
61
- let {
62
- value,
63
- uploadLocalFileValue
64
- } = this.state;
65
- let newValue = value.concat(uploadLocalFileValue);
66
- this.setState({
67
- value: newValue
68
- }, () => {
69
- this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onCommit();
70
- });
71
- return;
72
- }
73
- this.props.isInModal ? this.props.onCommit(this.getValue()) : this.props.onCommit();
74
- }
75
- if (this.props.isInModal) {
76
- this.props.onToggle();
77
- }
78
- const nextIsOpen = !this.state.isOpen;
79
- this.setState({
80
- isOpen: nextIsOpen
81
- }, () => {
82
- if (!nextIsOpen) {
83
- this.props.onCommitCancel && this.props.onCommitCancel();
84
- }
85
- });
86
- };
87
- this.closeEditor = () => {
88
- this.setState({
89
- isOpen: false
90
- });
91
- };
92
- this.togglePreviewer = type => {
93
- this.setState({
94
- editorView: type
95
- });
96
- };
97
- this.fileUploadCompleted = fileMessage => {
98
- let uploadLocalFileValue = this.state.uploadLocalFileValue.slice(0);
99
- let fileUploadMessage = {
100
- name: fileMessage.name,
101
- size: fileMessage.size,
102
- type: fileMessage.type,
103
- url: fileMessage.url,
104
- upload_time: fileMessage.upload_time
105
- };
106
- uploadLocalFileValue.push(fileUploadMessage);
107
- this.setState({
108
- uploadLocalFileValue: uploadLocalFileValue,
109
- isUpdated: true
110
- });
111
- };
112
- this.addUploadedFile = fileMessageList => {
113
- const uploadLocalFileValue = [...this.state.uploadLocalFileValue, ...fileMessageList.map(_ref => {
114
- let {
115
- name,
116
- size,
117
- type,
118
- url,
119
- mtime
120
- } = _ref;
121
- return {
122
- name,
123
- size,
124
- type: type || 'file',
125
- url,
126
- upload_time: mtime
127
- };
128
- })];
129
- this.setState({
130
- uploadLocalFileValue,
131
- isUpdated: true
132
- });
133
- };
134
- this.renderHeader = () => {
135
- let {
136
- editorView
137
- } = this.state;
138
- // if (this.props.isInModal) {
139
- // return (<span>{getLocale('Add_files')}</span>);
140
- // }
141
- if (editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER) {
142
- return /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('All_files'));
143
- }
144
- return /*#__PURE__*/_react.default.createElement("div", {
145
- onClick: this.showImageListPreviewer
146
- }, /*#__PURE__*/_react.default.createElement("span", {
147
- "aria-hidden": "true",
148
- className: "dtable-font dtable-icon-return mr-2"
149
- }), /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Add_files')));
150
- };
151
- this.showImageListPreviewer = () => {
152
- let {
153
- value,
154
- uploadLocalFileValue,
155
- imageLinkValue
156
- } = this.state;
157
- let newValue = value.concat(uploadLocalFileValue, imageLinkValue);
158
- this.setState({
159
- value: newValue
160
- });
161
- this.togglePreviewer(_constants.FILE_EDITOR_STATUS.PREVIEWER);
162
- };
163
- this.uploadFile = (file, callback) => {
164
- return this.props.uploadFile(file, _constants2.FILES_FOLDER, callback);
165
- };
166
- this.resetFileValue = () => {
167
- this.setState({
168
- uploadLocalFileValue: []
169
- });
170
- };
171
- this.deleteFile = (index, type) => {
172
- let uploadLocalFileValue = this.state.uploadLocalFileValue.slice(0);
173
- let value = this.state.value.slice(0);
174
- if (this.state.editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER) {
175
- value.splice(index, 1);
176
- } else {
177
- if (type === 'localFile') {
178
- uploadLocalFileValue.splice(index, 1);
179
- }
180
- }
181
- this.setState({
182
- uploadLocalFileValue: uploadLocalFileValue,
183
- isUpdated: true,
184
- value: value
185
- });
186
- };
187
- this.deleteFilesByPreviewer = fileList => {
188
- const result = this.state.value.filter(file => !fileList.includes(file.name));
189
- this.setState({
190
- isUpdated: true,
191
- value: result
192
- });
193
- };
194
- this.onRenameFile = (index, newName) => {
195
- let newValue = this.state.value.slice(0);
196
- let fileItem = newValue[index];
197
- if (!this.props.renameFile) return;
198
- this.props.renameFile(fileItem, newName).then(res => {
199
- const {
200
- name,
201
- url
202
- } = res.data;
203
- fileItem = {
204
- ...fileItem,
205
- name,
206
- url
207
- };
208
- newValue[index] = fileItem;
209
- this.setState({
210
- value: newValue
211
- });
212
- }).catch(error => {
213
- const errorMessage = (0, _utils.getErrorMsg)(error);
214
- if (!error.response || error.response.status !== 403) {
215
- _toaster.default.danger((0, _lang.getLocale)(errorMessage));
216
- }
217
- });
218
- };
219
- this.onRotateImage = (url, degree) => {
220
- this.props.rotateImage(url, degree).then(res => {
221
- // todo
222
- }).catch(error => {
223
- const errorMessage = (0, _utils.getErrorMsg)(error);
224
- if (!error.response || error.response.status !== 403) {
225
- _toaster.default.danger((0, _lang.getLocale)(errorMessage));
226
- }
227
- });
228
- };
229
- this.state = {
230
- value: props.value || [],
231
- editorView: this.getEditorView(),
232
- isOpen: true,
233
- isShowFileChooser: false,
234
- uploadLocalFileValue: [],
235
- imageLinkValue: [],
236
- isUpdated: false
237
- };
238
- }
239
13
  render() {
14
+ let {
15
+ closeEditor
16
+ } = this.props;
240
17
  return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
241
- className: "dtable-ui-image-editor-dialog dtable-ui-file-editor-dialog",
242
- contentClassName: "dtable-ui-image-editor-modal",
243
- isOpen: this.state.isOpen,
244
- toggle: this.toggle
245
- }, /*#__PURE__*/_react.default.createElement(_DTableModalHeader.default, {
246
- toggle: this.toggle
247
- }, this.renderHeader()), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
248
- className: "p-0"
249
- }, /*#__PURE__*/_react.default.createElement("div", {
250
- className: "dtable-ui-image-editor-container dtable-ui-file-editor-container"
251
- }, this.state.editorView === _constants.FILE_EDITOR_STATUS.PREVIEWER && /*#__PURE__*/_react.default.createElement(_filesPreviewer.default, {
252
- value: this.state.value,
253
- config: this.props.config,
254
- togglePreviewer: this.togglePreviewer,
255
- deleteFile: this.deleteFile,
256
- deleteFiles: this.deleteFilesByPreviewer,
257
- renameFile: this.props.renameFile ? this.onRenameFile : null,
258
- resetFileValue: this.resetFileValue,
259
- rotateImage: this.props.rotateImage ? this.onRotateImage : null,
260
- getDownLoadFiles: this.props.getDownLoadFiles || (() => {})
261
- }), this.state.editorView === _constants.FILE_EDITOR_STATUS.ADDITION && /*#__PURE__*/_react.default.createElement(_additionPreviewer.default, {
262
- config: this.props.config,
263
- deleteImage: this.deleteImage,
264
- handleFilesChange: this.handleFilesChange,
265
- uploadLocalFileValue: this.state.uploadLocalFileValue,
266
- togglePreviewer: this.togglePreviewer,
267
- fileUploadCompleted: this.fileUploadCompleted,
268
- addUploadedFile: this.addUploadedFile,
269
- showImageListPreviewer: this.showImageListPreviewer,
270
- uploadFile: this.uploadFile
271
- }))));
18
+ isOpen: true,
19
+ toggle: closeEditor
20
+ }, /*#__PURE__*/_react.default.createElement(_index.default, {
21
+ toggle: closeEditor
22
+ }, (0, _lang.getLocale)('Add_Files')), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
23
+ className: "file-editor-container"
24
+ }));
272
25
  }
273
26
  }
274
27
  var _default = exports.default = FileEditor;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,25 +1,26 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _url = require("../utils/url");
10
- const FileItemFormatter = _ref => {
11
- let {
12
- file,
13
- config
14
- } = _ref;
15
- const {
16
- fileIconUrl,
17
- isImage
18
- } = (0, _url.getFileThumbnailInfo)(file, config);
19
- return /*#__PURE__*/_react.default.createElement("img", {
20
- className: "file-item-icon ".concat(isImage ? 'img' : ''),
21
- src: fileIconUrl,
22
- alt: (file === null || file === void 0 ? void 0 : file.name) || ''
23
- });
24
- };
25
- var _default = exports.default = FileItemFormatter;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _utils = require("./utils");
10
+ class FileItemFormatter extends _react.Component {
11
+ render() {
12
+ const {
13
+ file
14
+ } = this.props;
15
+ const {
16
+ fileIconUrl,
17
+ isImage
18
+ } = (0, _utils.getFileThumbnailInfo)(file);
19
+ return /*#__PURE__*/_react.default.createElement("img", {
20
+ className: "file-item-icon ".concat(isImage ? 'img' : ''),
21
+ src: fileIconUrl,
22
+ alt: (file === null || file === void 0 ? void 0 : file.name) || ''
23
+ });
24
+ }
25
+ }
26
+ exports.default = FileItemFormatter;