dtable-ui-component 5.3.0 → 5.3.1-beta

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 (239) hide show
  1. package/assets/dtable-font/dtable-font.eot +0 -0
  2. package/assets/dtable-font/dtable-font.svg +116 -0
  3. package/assets/dtable-font/dtable-font.ttf +0 -0
  4. package/assets/dtable-font/dtable-font.woff +0 -0
  5. package/assets/dtable-font/dtable-font.woff2 +0 -0
  6. package/assets/dtable-font.css +238 -6
  7. package/lib/CheckboxEditor/index.css +3 -20
  8. package/lib/CheckboxEditor/index.js +98 -35
  9. package/lib/CheckboxFormatter/index.js +6 -9
  10. package/lib/CollaboratorEditor/index.css +12 -35
  11. package/lib/CollaboratorEditor/index.js +18 -212
  12. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +26 -29
  13. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  14. package/lib/CollaboratorItem/index.css +1 -1
  15. package/lib/CollaboratorItem/index.js +6 -2
  16. package/lib/DTableCustomizeCollaboratorSelect/index.css +1 -1
  17. package/lib/DTableCustomizeCollaboratorSelect/index.js +1 -1
  18. package/lib/DTableCustomizeSelect/index.css +2 -2
  19. package/lib/DTableCustomizeSelect/index.js +1 -1
  20. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  21. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +1 -1
  22. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +1 -1
  23. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  24. package/lib/DTableFiltersPopover/widgets/filter-list/index.css +2 -2
  25. package/lib/DTableSelect/index.js +3 -1
  26. package/lib/DTableSelect/utils.js +1 -1
  27. package/lib/DateEditor/index.js +14 -51
  28. package/lib/DateEditor/pc-date-editor-popover.js +145 -12
  29. package/lib/DeleteTip/index.js +50 -0
  30. package/lib/Department-editor/department-single-select.js +1 -1
  31. package/lib/Department-editor/index.js +3 -4
  32. package/lib/DepartmentSingleSelectFormatter/index.js +2 -1
  33. package/lib/DigitalSignEditor/constants.js +7 -0
  34. package/lib/DigitalSignEditor/index.css +69 -0
  35. package/lib/DigitalSignEditor/index.js +182 -0
  36. package/lib/DigitalSignEditor/service.js +38 -0
  37. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  38. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  39. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  40. package/lib/DigitalSignEditor/utils.js +29 -0
  41. package/lib/DurationEditor/index.js +111 -0
  42. package/lib/EmailEditor/index.js +59 -0
  43. package/lib/FileEditor/addition-previewer/index.css +1 -0
  44. package/lib/FileEditor/addition-previewer/index.js +52 -0
  45. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  46. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  47. package/lib/FileEditor/constants.js +7 -0
  48. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  49. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  50. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  51. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  52. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  53. package/lib/FileEditor/files-previewer/index.css +56 -0
  54. package/lib/FileEditor/files-previewer/index.js +277 -0
  55. package/lib/FileEditor/index.css +6 -0
  56. package/lib/FileEditor/index.js +244 -11
  57. package/lib/FileEditor/utils.js +22 -0
  58. package/lib/FileItemFormatter/index.js +19 -20
  59. package/lib/FileUploader/index.css +9 -0
  60. package/lib/FileUploader/index.js +268 -14
  61. package/lib/FormulaFormatter/index.js +2 -1
  62. package/lib/FormulaFormatter/utils.js +0 -31
  63. package/lib/GeolocationEditor/country-editor.js +319 -0
  64. package/lib/GeolocationEditor/index.css +641 -0
  65. package/lib/GeolocationEditor/index.js +241 -0
  66. package/lib/GeolocationEditor/location-editor.js +368 -0
  67. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  68. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  69. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  70. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  71. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  72. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  73. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  74. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  75. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  76. package/lib/GeolocationEditor/province-editor.js +226 -0
  77. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  78. package/lib/GeolocationEditor/selector-list.js +33 -0
  79. package/lib/GeolocationEditor/with-ref.js +27 -0
  80. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  81. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  82. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  83. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  84. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  85. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  86. package/lib/ImageEditor/constants.js +7 -0
  87. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  88. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  89. package/lib/ImageEditor/images-previewer/index.css +18 -0
  90. package/lib/ImageEditor/images-previewer/index.js +140 -0
  91. package/lib/ImageEditor/index.css +24 -0
  92. package/lib/ImageEditor/index.js +194 -0
  93. package/lib/ImageThumbnail/index.css +20 -0
  94. package/lib/ImageThumbnail/index.js +136 -0
  95. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  96. package/lib/MultipleSelectEditor/index.js +16 -177
  97. package/lib/NumberEditor/index.js +64 -77
  98. package/lib/RoleStatusEditor/index.css +3 -3
  99. package/lib/RoleStatusEditor/index.js +1 -1
  100. package/lib/RowExpandDialog/body/index.css +21 -0
  101. package/lib/RowExpandDialog/body/index.js +279 -0
  102. package/lib/RowExpandDialog/column-content/index.css +43 -0
  103. package/lib/RowExpandDialog/column-content/index.js +50 -0
  104. package/lib/RowExpandDialog/constants.js +114 -0
  105. package/lib/RowExpandDialog/header/index.css +31 -0
  106. package/lib/RowExpandDialog/header/index.js +33 -0
  107. package/lib/RowExpandDialog/index.css +24 -0
  108. package/lib/RowExpandDialog/index.js +268 -0
  109. package/lib/RowExpandDialog/utils.js +83 -0
  110. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  111. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  112. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  113. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  114. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  115. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  116. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  117. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +129 -0
  118. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  119. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  120. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  121. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  122. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  123. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  124. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +146 -0
  125. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  126. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  127. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +6 -0
  128. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  129. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  130. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +124 -0
  131. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  132. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +224 -0
  133. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  134. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  135. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  136. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  137. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +192 -0
  138. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  139. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  140. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  141. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  142. package/lib/RowExpandEditor/constants.js +44 -0
  143. package/lib/RowExpandEditor/index.css +0 -0
  144. package/lib/RowExpandEditor/index.js +32 -0
  145. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  146. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  147. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  148. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  149. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  150. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +10 -11
  151. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  152. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  153. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  154. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  155. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  156. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +5 -5
  157. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/utils.js +1 -1
  158. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  159. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  160. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  161. package/lib/RowExpandFormatter/constants.js +60 -0
  162. package/lib/RowExpandFormatter/index.css +26 -0
  163. package/lib/RowExpandFormatter/index.js +84 -100
  164. package/lib/SingleSelectEditor/index.js +16 -156
  165. package/lib/TextEditor/index.js +113 -42
  166. package/lib/UploadProgress/index.js +38 -0
  167. package/lib/UrlEditor/index.js +62 -0
  168. package/lib/common/editor-base.js +53 -0
  169. package/lib/constants/file.js +96 -0
  170. package/lib/constants/index.js +34 -2
  171. package/lib/constants/key-codes.js +109 -0
  172. package/lib/css/cell-editor.css +18 -2
  173. package/lib/hooks/index.js +16 -0
  174. package/lib/index.js +74 -46
  175. package/lib/lang/index.js +16 -14
  176. package/lib/locales/de.json +163 -0
  177. package/lib/locales/en.json +163 -0
  178. package/lib/locales/es.json +163 -0
  179. package/lib/locales/fr.json +163 -0
  180. package/lib/locales/pt.json +163 -0
  181. package/lib/locales/ru.json +163 -0
  182. package/lib/locales/zh-CN.json +163 -0
  183. package/lib/select-editor/index.js +6 -6
  184. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  185. package/lib/select-editor/pc-select-editor/index.css +85 -0
  186. package/lib/select-editor/pc-select-editor/index.js +290 -0
  187. package/lib/utils/cell-comparer.js +35 -0
  188. package/lib/utils/cell.js +55 -0
  189. package/lib/utils/column-utils.js +25 -0
  190. package/lib/utils/editor-utils.js +1 -6
  191. package/lib/utils/get-event-transfer.js +75 -0
  192. package/lib/utils/object-utils.js +61 -0
  193. package/lib/utils/url.js +119 -8
  194. package/lib/utils/utils.js +89 -2
  195. package/package.json +3 -2
  196. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  197. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  198. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  199. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  200. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  201. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  202. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  203. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  204. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  205. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  206. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  207. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  208. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  209. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  210. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  211. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  212. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  213. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  214. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  215. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  216. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  217. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  218. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  219. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  220. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  221. package/lib/FileItemFormatter/utils.js +0 -99
  222. package/lib/MultipleSelectEditor/index.css +0 -9
  223. package/lib/RowExpandUrlFormatter/index.css +0 -1
  224. package/lib/SingleSelectEditor/index.css +0 -14
  225. package/lib/locals/de.js +0 -103
  226. package/lib/locals/en.js +0 -104
  227. package/lib/locals/es.js +0 -103
  228. package/lib/locals/fr.js +0 -103
  229. package/lib/locals/pt.js +0 -103
  230. package/lib/locals/ru.js +0 -103
  231. package/lib/locals/zh-CN.js +0 -104
  232. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  233. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  234. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  235. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  236. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +0 -0
  237. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  238. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  239. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -6,13 +6,16 @@ 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"));
9
10
  var _dayjs = _interopRequireDefault(require("dayjs"));
10
11
  var _classnames = _interopRequireDefault(require("classnames"));
11
12
  var _Picker = _interopRequireDefault(require("@seafile/seafile-calendar/lib/Picker"));
12
13
  var _seafileCalendar = _interopRequireDefault(require("@seafile/seafile-calendar"));
13
14
  var _editorUtils = require("../utils/editor-utils");
15
+ var _constants = require("../constants");
14
16
  require("@seafile/seafile-calendar/assets/index.css");
15
17
  var _lang = require("../lang");
18
+ let now = (0, _dayjs.default)();
16
19
  class PCDateEditorPopover extends _react.default.Component {
17
20
  constructor(props) {
18
21
  super(props);
@@ -23,20 +26,44 @@ class PCDateEditorPopover extends _react.default.Component {
23
26
  dateFormat
24
27
  } = this.props;
25
28
  this.setState({
26
- datePickerValue: value,
29
+ value: value,
27
30
  open: true // if value changed, don't close datePicker
28
31
  });
29
32
  this.props.onValueChanged(value.format(dateFormat));
30
33
  };
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
+ };
31
48
  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 => {
32
60
  this.setState({
33
- open: open
61
+ open
34
62
  });
35
- return;
36
63
  };
37
64
  this.onClear = () => {
38
65
  this.setState({
39
- datePickerValue: null
66
+ value: null
40
67
  });
41
68
  };
42
69
  this.onFocusDatePicker = () => {
@@ -49,7 +76,59 @@ class PCDateEditorPopover extends _react.default.Component {
49
76
  event.stopPropagation();
50
77
  };
51
78
  this.getCalendarContainer = () => {
52
- return this.calendarContainerRef.current;
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 '';
53
132
  };
54
133
  this.getCalender = () => {
55
134
  let {
@@ -59,6 +138,7 @@ class PCDateEditorPopover extends _react.default.Component {
59
138
  className
60
139
  } = this.props;
61
140
  let defaultValue = (0, _dayjs.default)().clone();
141
+ const defaultTime = this.getDefaultTime();
62
142
  return /*#__PURE__*/_react.default.createElement(_seafileCalendar.default, {
63
143
  className: (0, _classnames.default)('dtable-rc-calendar', className),
64
144
  locale: (0, _editorUtils.initDateEditorLanguage)(lang),
@@ -69,29 +149,82 @@ class PCDateEditorPopover extends _react.default.Component {
69
149
  defaultValue: defaultValue,
70
150
  showHourAndMinute: showHourAndMinute,
71
151
  dateInputPlaceholder: (0, _lang.getLocale)('Please_input'),
152
+ defaultMinutesTime: defaultTime,
72
153
  showDateInput: true,
73
154
  focusablePanel: false,
74
155
  onClear: this.onClear
75
156
  });
76
157
  };
158
+ const {
159
+ dateFormat: _dateFormat,
160
+ value: _value
161
+ } = this.props;
77
162
  this.state = {
78
- open: true,
79
- datePickerValue: props.value ? (0, _dayjs.default)(props.value) : null
163
+ value: _value ? (0, _dayjs.default)(_value) : null,
164
+ open: false
80
165
  };
81
166
  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
+ }
82
210
  }
83
211
  render() {
84
212
  let {
85
- dateFormat
213
+ dateFormat,
214
+ isInModal
86
215
  } = this.props;
87
216
  let {
88
217
  open,
89
- datePickerValue
218
+ value
90
219
  } = this.state;
91
220
  const calendar = this.getCalender();
92
- return /*#__PURE__*/_react.default.createElement(_Picker.default, {
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, {
93
226
  open: open,
94
- value: datePickerValue,
227
+ value: value,
95
228
  animation: "slide-up",
96
229
  style: {
97
230
  zIndex: 1001
@@ -119,7 +252,7 @@ class PCDateEditorPopover extends _react.default.Component {
119
252
  }), /*#__PURE__*/_react.default.createElement("div", {
120
253
  ref: this.calendarContainerRef
121
254
  }));
122
- });
255
+ }));
123
256
  }
124
257
  }
125
258
  var _default = exports.default = PCDateEditorPopover;
@@ -0,0 +1,50 @@
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;
@@ -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: "none-search-result d-flex justify-content-center"
202
+ className: "dtable-ui-editor-no-search-result"
203
203
  }, (0, _lang.getLocale)('No_departments_available'));
204
204
  };
205
205
  this.renderMenuContent = () => {
@@ -47,22 +47,21 @@ class DepartmentSingleSelectEditor extends _react.Component {
47
47
  };
48
48
  const {
49
49
  column: _column,
50
- mode,
50
+ isInModal,
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';
56
55
  const data = _column.data || {};
57
56
  this.state = {
58
57
  value: _value || '',
59
- menuStyle: isRowExpand ? {} : {
58
+ menuStyle: isInModal ? {} : {
60
59
  width: editorWidth,
61
60
  top: height - 2
62
61
  }
63
62
  };
64
63
  this.enableSelectRange = data.enable_select_range || false;
65
- this.isRowExpand = isRowExpand;
64
+ this.isRowExpand = isInModal;
66
65
  }
67
66
  componentDidMount() {
68
67
  if (this.isRowExpand) {
@@ -7,6 +7,7 @@ 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");
10
11
  require("./index.css");
11
12
  function DepartmentSingleSelectFormatter(props) {
12
13
  const {
@@ -16,7 +17,7 @@ function DepartmentSingleSelectFormatter(props) {
16
17
  tip
17
18
  } = props;
18
19
  if (!value) return null;
19
- const deletedTip = tip || 'Deleted department';
20
+ const deletedTip = tip || (0, _lang.getLocale)('Deleted_department');
20
21
  const department = departments.find(department => department.id === value);
21
22
  const name = department ? department.name : deletedTip;
22
23
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -0,0 +1,7 @@
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';
@@ -0,0 +1,69 @@
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
+ }
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _reactstrap = require("reactstrap");
11
+ var _signatureBoard = _interopRequireDefault(require("./signature-board"));
12
+ var _service = _interopRequireDefault(require("./service"));
13
+ var _utils = _interopRequireDefault(require("./utils"));
14
+ var _url = require("../utils/url");
15
+ var _toaster = _interopRequireDefault(require("../toaster"));
16
+ var _lang = require("../lang");
17
+ var _utils2 = require("../utils/utils");
18
+ require("./index.css");
19
+ class DigitalSignEditor extends _react.Component {
20
+ constructor(props) {
21
+ super(props);
22
+ this.setPosition = () => {
23
+ if (!this.editor) return;
24
+ const {
25
+ offsetLeft,
26
+ offsetTop
27
+ } = this.editor.parentNode;
28
+ const {
29
+ offsetWidth: editorWidth,
30
+ offsetHeight: editorHeight
31
+ } = this.editor;
32
+ let editorLeft = offsetLeft - editorWidth;
33
+ let editorTop = offsetTop;
34
+ if (this.props.isInModal) {
35
+ const innerHeight = window.innerHeight;
36
+ const offsetTop = this.editor.parentNode.getBoundingClientRect().y;
37
+ editorTop = offsetTop;
38
+ editorTop = editorHeight + editorTop > innerHeight ? innerHeight - editorHeight - 30 : editorTop;
39
+ editorLeft = -30;
40
+ } else {
41
+ if (offsetLeft < editorWidth) {
42
+ editorLeft = offsetLeft + this.props.column.width;
43
+ }
44
+ if (editorLeft + editorWidth > window.innerWidth) {
45
+ editorLeft = window.innerWidth - editorWidth;
46
+ }
47
+ if (offsetTop + editorHeight > window.innerHeight) {
48
+ editorTop = window.innerHeight - editorHeight - 10;
49
+ }
50
+ }
51
+ this.setState({
52
+ editorPosition: {
53
+ top: editorTop,
54
+ left: editorLeft
55
+ }
56
+ });
57
+ };
58
+ this.getValue = () => {
59
+ const updated = {
60
+ [this.props.column.key]: this.value
61
+ };
62
+ return updated;
63
+ };
64
+ this.saveSignature = () => {
65
+ if (!this.signatureBoard || this.state.saving) return;
66
+ if (!this.signatureBoard.checkHasChanged()) {
67
+ this.props.onCommitCancel();
68
+ return;
69
+ }
70
+ this.signatureBoard.convert2BlobPNG(signBlob => {
71
+ if (!signBlob) {
72
+ if (!this.props.value) {
73
+ this.props.onCommitCancel();
74
+ return;
75
+ }
76
+
77
+ // clear the old dtable-ui-digital-sign
78
+ this.value = null;
79
+ this.props.onCommit(this.value);
80
+ return;
81
+ }
82
+ this.setState({
83
+ saving: true
84
+ });
85
+ this.digitalService.uploadSignImage(signBlob, {
86
+ successCallback: signature => {
87
+ this.value = signature;
88
+ this.setState({
89
+ saving: false
90
+ }, () => {
91
+ this.props.onCommit(Object.assign({}, this.value));
92
+ });
93
+ },
94
+ failedCallback: error => {
95
+ const errMsg = (0, _utils2.getErrorMsg)(error, true);
96
+ if (!error.response || error.response.status !== 403) {
97
+ _toaster.default.danger(this.props.t(errMsg));
98
+ }
99
+ this.setState({
100
+ saving: false
101
+ });
102
+ }
103
+ });
104
+ });
105
+ };
106
+ this.clearSignature = () => {
107
+ this.signatureBoard.clear();
108
+ };
109
+ this.state = {
110
+ editorPosition: {},
111
+ saving: false
112
+ };
113
+ const {
114
+ uploadFile,
115
+ config,
116
+ value
117
+ } = props;
118
+ const {
119
+ username
120
+ } = config || {};
121
+ this.value = value || {};
122
+ this.digitalService = new _service.default({
123
+ uploadFile,
124
+ username
125
+ });
126
+ }
127
+ componentDidMount() {
128
+ this.setPosition();
129
+ }
130
+ render() {
131
+ const {
132
+ value,
133
+ config
134
+ } = this.props;
135
+ const {
136
+ editorPosition,
137
+ saving
138
+ } = this.state;
139
+ const signImageUrl = (0, _url.generateCurrentBaseImageUrl)({
140
+ ...config,
141
+ partUrl: _utils.default.getSignImageUrl(value)
142
+ });
143
+ return /*#__PURE__*/_react.default.createElement("div", {
144
+ className: "dtable-ui-digital-sign-editor-container",
145
+ ref: ref => this.editor = ref,
146
+ style: {
147
+ ...editorPosition,
148
+ zIndex: 1000
149
+ }
150
+ }, /*#__PURE__*/_react.default.createElement("div", {
151
+ className: "dtable-ui-digital-sign-editor-header"
152
+ }, /*#__PURE__*/_react.default.createElement("div", {
153
+ className: "dtable-ui-digital-sign-editor-logo"
154
+ }, /*#__PURE__*/_react.default.createElement("i", {
155
+ className: "dtable-font dtable-icon-handwritten-signature"
156
+ }), /*#__PURE__*/_react.default.createElement("span", {
157
+ className: "ml-2 dtable-ui-digital-sign-editor-title"
158
+ }, (0, _lang.getLocale)('Digital_signature'))), /*#__PURE__*/_react.default.createElement("div", {
159
+ className: "dtable-ui-digital-sign-editor-operations"
160
+ }, /*#__PURE__*/_react.default.createElement("div", {
161
+ className: "btn-clear-dtable-ui-digital-sign",
162
+ onClick: this.clearSignature
163
+ }, /*#__PURE__*/_react.default.createElement("i", {
164
+ className: "dtable-font dtable-icon-clear-format"
165
+ }), /*#__PURE__*/_react.default.createElement("span", null, (0, _lang.getLocale)('Re-sign'))))), /*#__PURE__*/_react.default.createElement("div", {
166
+ className: "dtable-ui-digital-sign-panel"
167
+ }, /*#__PURE__*/_react.default.createElement(_signatureBoard.default, {
168
+ ref: ref => this.signatureBoard = ref,
169
+ signImageUrl: signImageUrl
170
+ })), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalFooter, {
171
+ className: "dtable-ui-geolocation-editor-footer"
172
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
173
+ onClick: this.props.onCommitCancel,
174
+ color: "secondary"
175
+ }, (0, _lang.getLocale)('Cancel')), /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
176
+ onClick: this.saveSignature,
177
+ color: "primary",
178
+ disabled: saving
179
+ }, (0, _lang.getLocale)(saving ? 'Saving' : 'Save'))));
180
+ }
181
+ }
182
+ var _default = exports.default = DigitalSignEditor;
@@ -0,0 +1,38 @@
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 _utils = _interopRequireDefault(require("./utils"));
9
+ var _constants = require("./constants");
10
+ class DigitalService {
11
+ constructor(props) {
12
+ this.init(props);
13
+ }
14
+ init(props) {
15
+ this.uploadFile = props.uploadFile;
16
+ this.username = props.username;
17
+ }
18
+ uploadSignImage(signBlob, _ref) {
19
+ let {
20
+ successCallback,
21
+ failedCallback
22
+ } = _ref;
23
+ const name = "".concat(this.username, "-").concat(Date.now().toString(), ".png");
24
+ const file = new File([signBlob], name, {
25
+ type: 'image/png'
26
+ });
27
+ this.uploadFile(file, _constants.DIGITAL_SIGNS_FOLDER).then(data => {
28
+ const signature = _utils.default.getUpdatedSign({
29
+ username: this.username,
30
+ sign_image_url: data.url
31
+ });
32
+ successCallback && successCallback(signature);
33
+ }).catch(error => {
34
+ failedCallback && failedCallback(error);
35
+ });
36
+ }
37
+ }
38
+ var _default = exports.default = DigitalService;
@@ -0,0 +1,35 @@
1
+ .signature-board {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ background-color: #fff;
6
+ }
7
+
8
+ .signature-board canvas {
9
+ position: relative;
10
+ z-index: 1;
11
+ }
12
+
13
+ .signature-board-tips {
14
+ position: absolute;
15
+ left: 50%;
16
+ top: 50%;
17
+ transform: translate(-50%, -50%);
18
+ font-size: 14px;
19
+ opacity: 0.5;
20
+ }
21
+
22
+ .signature-board-image-wrapper {
23
+ position: absolute;
24
+ left: 0;
25
+ top: 0;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+
33
+ .signature-board-image-wrapper img {
34
+ max-height: 100%;
35
+ }