dtable-ui-component 5.3.1-beta6 → 5.3.2

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 (247) 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/DTableGroupSelect/select-option-group.css +17 -17
  13. package/lib/DTableGroupSelect/select-option-group.js +1 -1
  14. package/lib/DTableSelect/index.js +1 -3
  15. package/lib/DateEditor/index.js +51 -14
  16. package/lib/DateEditor/pc-date-editor-popover.js +12 -145
  17. package/lib/Department-editor/department-single-select.js +1 -1
  18. package/lib/Department-editor/index.js +4 -3
  19. package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
  20. package/lib/FileEditor/index.js +11 -258
  21. package/lib/FileEditor/pc-files-addition/index.js +1 -0
  22. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
  23. package/lib/FileEditor/pc-files-preview/index.js +1 -0
  24. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
  25. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  26. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  27. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  28. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  29. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  30. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  31. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  32. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  33. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  34. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  35. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  36. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  37. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  38. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  39. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  40. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  41. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  42. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  43. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  44. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  45. package/lib/FileItemFormatter/index.js +20 -19
  46. package/lib/FileItemFormatter/utils.js +99 -0
  47. package/lib/FileUploader/index.js +14 -268
  48. package/lib/FormulaFormatter/index.js +1 -2
  49. package/lib/FormulaFormatter/utils.js +31 -0
  50. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  51. package/lib/MultipleSelectEditor/index.css +9 -0
  52. package/lib/MultipleSelectEditor/index.js +177 -16
  53. package/lib/NumberEditor/index.js +77 -64
  54. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
  55. package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
  56. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
  57. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
  58. package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
  59. package/lib/RowExpandFormatter/index.css +1 -27
  60. package/lib/RowExpandFormatter/index.js +100 -83
  61. package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
  62. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
  63. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
  64. package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
  65. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  66. package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +6 -6
  67. package/lib/RowExpandLinkFormatter/utils.js +71 -0
  68. package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
  69. package/lib/RowExpandUrlFormatter/index.css +1 -0
  70. package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
  71. package/lib/SingleSelectEditor/index.css +14 -0
  72. package/lib/SingleSelectEditor/index.js +156 -16
  73. package/lib/TextEditor/index.js +42 -113
  74. package/lib/constants/index.js +2 -34
  75. package/lib/css/cell-editor.css +2 -18
  76. package/lib/index.js +46 -74
  77. package/lib/lang/index.js +16 -19
  78. package/lib/locals/de.js +103 -0
  79. package/lib/locals/en.js +104 -0
  80. package/lib/locals/es.js +103 -0
  81. package/lib/locals/fr.js +103 -0
  82. package/lib/locals/pt.js +103 -0
  83. package/lib/locals/ru.js +103 -0
  84. package/lib/locals/zh-CN.js +104 -0
  85. package/lib/select-editor/index.js +6 -6
  86. package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
  87. package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
  88. package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
  89. package/lib/utils/editor-utils.js +6 -1
  90. package/lib/utils/url.js +8 -121
  91. package/lib/utils/utils.js +2 -145
  92. package/package.json +2 -3
  93. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
  94. package/lib/Comment/body/comment.js +0 -190
  95. package/lib/Comment/body/index.css +0 -95
  96. package/lib/Comment/body/index.js +0 -32
  97. package/lib/Comment/footer/btns/index.css +0 -40
  98. package/lib/Comment/footer/btns/index.js +0 -113
  99. package/lib/Comment/footer/index.css +0 -157
  100. package/lib/Comment/footer/index.js +0 -170
  101. package/lib/Comment/footer/input/index.css +0 -52
  102. package/lib/Comment/footer/input/index.js +0 -448
  103. package/lib/Comment/footer/input/participant/index.css +0 -0
  104. package/lib/Comment/footer/input/participant/index.js +0 -53
  105. package/lib/Comment/footer/participants/index.css +0 -22
  106. package/lib/Comment/footer/participants/index.js +0 -68
  107. package/lib/Comment/footer/participants/participant/index.css +0 -5
  108. package/lib/Comment/footer/participants/participant/index.js +0 -32
  109. package/lib/Comment/footer/participants/participant-select/index.css +0 -104
  110. package/lib/Comment/footer/participants/participant-select/index.js +0 -182
  111. package/lib/Comment/index.css +0 -19
  112. package/lib/Comment/index.js +0 -305
  113. package/lib/Comment/model.js +0 -25
  114. package/lib/Comment/utils/common.js +0 -62
  115. package/lib/Comment/utils/index.js +0 -27
  116. package/lib/Comment/utils/utilities.js +0 -176
  117. package/lib/DeleteTip/index.js +0 -50
  118. package/lib/DigitalSignEditor/constants.js +0 -7
  119. package/lib/DigitalSignEditor/index.css +0 -69
  120. package/lib/DigitalSignEditor/index.js +0 -182
  121. package/lib/DigitalSignEditor/service.js +0 -38
  122. package/lib/DigitalSignEditor/signature-board/index.css +0 -35
  123. package/lib/DigitalSignEditor/signature-board/index.js +0 -135
  124. package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
  125. package/lib/DigitalSignEditor/utils.js +0 -29
  126. package/lib/DurationEditor/index.js +0 -111
  127. package/lib/EmailEditor/index.js +0 -59
  128. package/lib/FileEditor/addition-previewer/index.css +0 -1
  129. package/lib/FileEditor/addition-previewer/index.js +0 -52
  130. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
  131. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
  132. package/lib/FileEditor/constants.js +0 -7
  133. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
  134. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
  135. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
  136. package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
  137. package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
  138. package/lib/FileEditor/files-previewer/index.css +0 -56
  139. package/lib/FileEditor/files-previewer/index.js +0 -277
  140. package/lib/FileEditor/index.css +0 -6
  141. package/lib/FileEditor/utils.js +0 -22
  142. package/lib/FileUploader/index.css +0 -9
  143. package/lib/GeolocationEditor/country-editor.js +0 -319
  144. package/lib/GeolocationEditor/index.css +0 -641
  145. package/lib/GeolocationEditor/index.js +0 -241
  146. package/lib/GeolocationEditor/location-editor.js +0 -368
  147. package/lib/GeolocationEditor/map-editor/index.js +0 -456
  148. package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
  149. package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
  150. package/lib/GeolocationEditor/map-editor-utils.js +0 -153
  151. package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
  152. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
  153. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
  154. package/lib/GeolocationEditor/parse-geolocation.js +0 -282
  155. package/lib/GeolocationEditor/province-city-editor.js +0 -292
  156. package/lib/GeolocationEditor/province-editor.js +0 -226
  157. package/lib/GeolocationEditor/selector-header-item.js +0 -28
  158. package/lib/GeolocationEditor/selector-list.js +0 -33
  159. package/lib/GeolocationEditor/with-ref.js +0 -27
  160. package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
  161. package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
  162. package/lib/ImageEditor/addition-previewer/index.css +0 -106
  163. package/lib/ImageEditor/addition-previewer/index.js +0 -63
  164. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
  165. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
  166. package/lib/ImageEditor/constants.js +0 -7
  167. package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
  168. package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
  169. package/lib/ImageEditor/images-previewer/index.css +0 -18
  170. package/lib/ImageEditor/images-previewer/index.js +0 -140
  171. package/lib/ImageEditor/index.css +0 -24
  172. package/lib/ImageEditor/index.js +0 -194
  173. package/lib/ImageThumbnail/index.css +0 -20
  174. package/lib/ImageThumbnail/index.js +0 -136
  175. package/lib/RowExpandDialog/body/index.css +0 -21
  176. package/lib/RowExpandDialog/body/index.js +0 -262
  177. package/lib/RowExpandDialog/column-content/index.css +0 -44
  178. package/lib/RowExpandDialog/column-content/index.js +0 -50
  179. package/lib/RowExpandDialog/header/index.css +0 -31
  180. package/lib/RowExpandDialog/header/index.js +0 -55
  181. package/lib/RowExpandDialog/index.css +0 -24
  182. package/lib/RowExpandDialog/index.js +0 -252
  183. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
  184. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
  185. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
  186. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
  187. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
  188. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
  189. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
  190. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
  191. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
  192. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
  193. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
  194. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
  195. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
  196. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
  197. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
  198. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
  199. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
  200. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
  201. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
  202. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
  203. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -123
  204. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
  205. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
  206. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
  207. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
  208. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
  209. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
  210. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
  211. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
  212. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
  213. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
  214. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
  215. package/lib/RowExpandEditor/constants.js +0 -44
  216. package/lib/RowExpandEditor/index.css +0 -0
  217. package/lib/RowExpandEditor/index.js +0 -32
  218. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
  219. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
  220. package/lib/RowExpandFormatter/constants.js +0 -60
  221. package/lib/UploadProgress/index.js +0 -38
  222. package/lib/UrlEditor/index.js +0 -62
  223. package/lib/common/editor-base.js +0 -53
  224. package/lib/constants/file.js +0 -96
  225. package/lib/constants/key-codes.js +0 -109
  226. package/lib/hooks/index.js +0 -16
  227. package/lib/locales/de.json +0 -167
  228. package/lib/locales/en.json +0 -167
  229. package/lib/locales/es.json +0 -167
  230. package/lib/locales/fr.json +0 -167
  231. package/lib/locales/pt.json +0 -167
  232. package/lib/locales/ru.json +0 -167
  233. package/lib/locales/zh-CN.json +0 -167
  234. package/lib/select-editor/pc-select-editor/index.css +0 -85
  235. package/lib/select-editor/pc-select-editor/index.js +0 -290
  236. package/lib/utils/cell-comparer.js +0 -35
  237. package/lib/utils/cell.js +0 -55
  238. package/lib/utils/column-utils.js +0 -25
  239. package/lib/utils/get-event-transfer.js +0 -75
  240. package/lib/utils/hotkey.js +0 -37
  241. package/lib/utils/object-utils.js +0 -61
  242. /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
  243. /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
  244. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
  245. /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
  246. /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
  247. /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
@@ -1,123 +0,0 @@
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 _toaster = _interopRequireDefault(require("../../toaster"));
11
- var _Loading = _interopRequireDefault(require("../../Loading"));
12
- var _reactI18next = require("react-i18next");
13
- var _seafileEditor = require("@seafile/seafile-editor");
14
- var _constants = require("../../constants");
15
- var _cell = require("../../utils/cell");
16
- var _lang = require("../../lang");
17
- require("./index.css");
18
- class RowExpandLongTextEditor extends _react.default.Component {
19
- constructor(props) {
20
- super(props);
21
- this.convertMarkdown = value => {
22
- const newValue = value && typeof value === 'object' ? value.text : value;
23
- this.setState({
24
- value: newValue,
25
- isLoading: false
26
- });
27
- };
28
- this.onSaveEditorValue = value => {
29
- if ((0, _cell.isLongTextValueExceedLimit)(value)) {
30
- _toaster.default.closeAll();
31
- _toaster.default.danger((0, _lang.getLocale)(_constants.LONG_TEXT_EXCEED_LIMIT_MESSAGE), {
32
- duration: null
33
- });
34
- return;
35
- }
36
- this.onCommit(value);
37
- this.isLongTextValueChanged = false;
38
- };
39
- this.onCommit = value => {
40
- this.props.onCommit(value);
41
- };
42
- this.openEditor = () => {
43
- this.editorRef.current.openEditor();
44
- };
45
- this.closeEditor = () => {
46
- this.editorRef.current.closeEditor();
47
- };
48
- this.onClick = () => {
49
- const {
50
- columnIndex
51
- } = this.props;
52
- this.props.updateTabIndex && this.props.updateTabIndex(columnIndex);
53
- };
54
- this.state = {
55
- isLoading: true,
56
- value: ''
57
- };
58
- this.editorRef = /*#__PURE__*/(0, _react.createRef)();
59
- }
60
- componentDidMount() {
61
- this.convertMarkdown(this.props.value);
62
- }
63
- UNSAFE_componentWillReceiveProps(nextProps) {
64
- var _this$editorRef, _this$editorRef$curre;
65
- const {
66
- column,
67
- row,
68
- isEditorFocus: nextIsEditorFocus,
69
- valueKey
70
- } = nextProps;
71
- const {
72
- column: currentColumn,
73
- row: currentRow,
74
- isEditorFocus
75
- } = this.props;
76
- const value = row[column[valueKey]];
77
- const currentValue = currentRow[currentColumn[valueKey]];
78
- if (value !== currentValue && !((_this$editorRef = this.editorRef) !== null && _this$editorRef !== void 0 && (_this$editorRef$curre = _this$editorRef.current) !== null && _this$editorRef$curre !== void 0 && _this$editorRef$curre.enableEdit)) {
79
- this.setState({
80
- isLoading: true
81
- }, () => {
82
- this.convertMarkdown(value);
83
- });
84
- }
85
- if (isEditorFocus && !nextIsEditorFocus) {
86
- this.closeEditor();
87
- }
88
- if (!isEditorFocus && nextIsEditorFocus) {
89
- this.openEditor();
90
- }
91
- }
92
- render() {
93
- const {
94
- column,
95
- longTextEditorAPI,
96
- longTextEditorI18n
97
- } = this.props;
98
- const {
99
- isLoading,
100
- value
101
- } = this.state;
102
- if (isLoading) return null;
103
- return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
104
- fallback: /*#__PURE__*/_react.default.createElement("div", {
105
- className: "d-center-middle"
106
- }, /*#__PURE__*/_react.default.createElement(_Loading.default, null))
107
- }, /*#__PURE__*/_react.default.createElement(_reactI18next.I18nextProvider, {
108
- i18n: longTextEditorI18n
109
- }, /*#__PURE__*/_react.default.createElement(_seafileEditor.LongTextInlineEditor, {
110
- ref: this.editorRef,
111
- lang: _lang.LANGUAGE,
112
- headerName: column.name,
113
- value: value || '',
114
- autoSave: true,
115
- saveDelay: 20 * 1000,
116
- isCheckBrowser: true,
117
- onClick: this.onClick,
118
- editorApi: longTextEditorAPI,
119
- onSaveEditorValue: this.onSaveEditorValue
120
- })));
121
- }
122
- }
123
- var _default = exports.default = RowExpandLongTextEditor;
@@ -1,44 +0,0 @@
1
- @import url('../RowExpandSingleSelectorEditor/index.css');
2
-
3
- .dtable-ui-row-expand-select-options {
4
- min-height: 30px;
5
- cursor: pointer;
6
- display: flex;
7
- flex-direction: row;
8
- align-items: center;
9
- justify-content: flex-start;
10
- flex-wrap: wrap;
11
- }
12
-
13
- .dtable-ui-row-expand-select-options .dtable-ui-select-option.dtable-ui-multiple-select-option {
14
- margin-right: 10px !important;
15
- display: inline-flex;
16
- max-width: 250px;
17
- }
18
-
19
- .dtable-ui-row-expand-select-options .dtable-ui-multiple-select-option .dtable-ui-select-option-name {
20
- max-width: 250px;
21
- overflow: hidden;
22
- text-overflow: ellipsis;
23
- }
24
-
25
- .dtable-ui-row-expand-select-options .dtable-ui-multiple-select-option .dtable-ui-select-option-remove {
26
- width: 16px;
27
- text-align: right;
28
- }
29
-
30
- .dtable-ui-row-expand-select-options .dtable-ui-multiple-select-option .dtable-ui-select-option-remove .remove-icon {
31
- display: inline-block;
32
- position: relative;
33
- right: -2px;
34
- width: 14px;
35
- height: 20px;
36
- cursor: pointer;
37
- }
38
-
39
- .dtable-ui-row-expand-select-options .dtable-ui-multiple-select-option .dtable-ui-select-option-remove .dtable-font {
40
- display: inline-block;
41
- font-size: 12px;
42
- color: #999;
43
- transform: scale(0.8);
44
- }
@@ -1,224 +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 _constants = require("../../constants");
12
- var _MultipleSelectEditor = _interopRequireDefault(require("../../MultipleSelectEditor"));
13
- var _lang = require("../../lang");
14
- require("./index.css");
15
- class RowExpandMultipleSelectEditor extends _react.default.Component {
16
- constructor(_props) {
17
- super(_props);
18
- this.getOptions = props => {
19
- const {
20
- column
21
- } = props;
22
- return (0, _dtableUtils.getColumnOptions)(column);
23
- };
24
- this.onKeyDown = e => {
25
- if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.showSelectPopover) {
26
- this.setState({
27
- showSelectPopover: true
28
- });
29
- }
30
- };
31
- this.toggleSingleSelect = value => {
32
- this.setState({
33
- showSelectPopover: value
34
- }, () => {
35
- var _this$selectRef;
36
- if (value) return;
37
- // eslint-disable-next-line no-unused-expressions
38
- (_this$selectRef = this.selectRef) === null || _this$selectRef === void 0 ? void 0 : _this$selectRef.focus();
39
- });
40
- };
41
- this.hideDropDownMenu = event => {
42
- if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
43
- if (!this.ref.contains(event.target) && this.state.showSelectPopover) {
44
- const singleSelectEditor = document.getElementsByClassName('dtable-ui-select-editor-container')[0];
45
- if (singleSelectEditor && singleSelectEditor.contains(event.target)) return;
46
- this.toggleSingleSelect(false);
47
- }
48
- };
49
- this.onToggleSelect = e => {
50
- e.preventDefault();
51
- e.stopPropagation();
52
- this.props.updateTabIndex(this.props.columnIndex);
53
- this.toggleSingleSelect(true);
54
- };
55
- this.closeEditor = () => {
56
- this.toggleSingleSelect(false);
57
- };
58
- this.onFocus = () => {
59
- this.props.updateTabIndex(this.props.columnIndex);
60
- };
61
- this.onChange = option => {
62
- const optionKey = option[this.key];
63
- let newValue = this.state.value.slice(0);
64
- const optionKeyIndex = newValue.findIndex(o => o === optionKey);
65
- if (optionKeyIndex === -1) {
66
- newValue.push(optionKey);
67
- } else {
68
- newValue.splice(optionKeyIndex, 1);
69
- }
70
- this.setState({
71
- value: newValue
72
- });
73
- this.props.onCommit(newValue);
74
- };
75
- this.removeOption = (option, event) => {
76
- event.stopPropagation();
77
- this.onChange(option);
78
- };
79
- this.getMultipleSelectList = () => {
80
- const {
81
- value
82
- } = this.state;
83
- if (!Array.isArray(value)) return [];
84
- const selectedOptions = this.options.filter(option => value.includes(option[this.key]));
85
- const selectedOptionIds = selectedOptions.map(option => option[this.key]);
86
- const invalidOptionIds = value.filter(optionId => !selectedOptionIds.includes(optionId));
87
- return selectedOptions.map((option, optionIdx) => {
88
- let textColor = option.textColor || null;
89
- return /*#__PURE__*/_react.default.createElement("div", {
90
- className: "dtable-ui-select-option dtable-ui-multiple-select-option",
91
- style: {
92
- backgroundColor: option.color,
93
- color: textColor
94
- },
95
- title: option.name,
96
- key: optionIdx
97
- }, /*#__PURE__*/_react.default.createElement("span", {
98
- className: "dtable-ui-select-option-name"
99
- }, option.name), /*#__PURE__*/_react.default.createElement("div", {
100
- className: "dtable-ui-select-option-remove"
101
- }, /*#__PURE__*/_react.default.createElement("span", {
102
- className: "remove-icon",
103
- onClick: this.removeOption.bind(this, option),
104
- "aria-label": (0, _lang.getLocale)('Delete')
105
- }, /*#__PURE__*/_react.default.createElement("i", {
106
- className: "dtable-font dtable-icon-fork-number",
107
- style: {
108
- color: textColor === '#FFFFFF' ? textColor : null
109
- },
110
- "aria-hidden": "true"
111
- }))));
112
- }).concat(invalidOptionIds.map((optionId, index) => {
113
- return /*#__PURE__*/_react.default.createElement("div", {
114
- className: "dtable-ui-select-option dtable-ui-multiple-select-option",
115
- style: {
116
- backgroundColor: _constants.DELETED_OPTION_BACKGROUND_COLOR
117
- },
118
- title: (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS),
119
- key: "deleted-multiple-select-".concat(index)
120
- }, /*#__PURE__*/_react.default.createElement("span", {
121
- className: "dtable-ui-select-option-name"
122
- }, (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS)), /*#__PURE__*/_react.default.createElement("div", {
123
- className: "dtable-ui-select-option-remove"
124
- }, /*#__PURE__*/_react.default.createElement("span", {
125
- className: "remove-icon",
126
- onClick: this.removeOption.bind(this, {
127
- id: optionId
128
- }),
129
- "aria-label": (0, _lang.getLocale)('Delete')
130
- }, /*#__PURE__*/_react.default.createElement("i", {
131
- className: "dtable-font dtable-icon-fork-number",
132
- "aria-hidden": "true"
133
- }))));
134
- }));
135
- };
136
- this.renderOptions = () => {
137
- const {
138
- isEditorFocus
139
- } = this.props;
140
- const options = this.getMultipleSelectList();
141
- return /*#__PURE__*/_react.default.createElement("div", {
142
- tabIndex: 0,
143
- onFocus: this.onFocus,
144
- onClick: this.onToggleSelect,
145
- ref: ref => this.multipleSelectOptionsRef = ref,
146
- className: (0, _classnames.default)('dtable-ui-row-expand-select-editor custom-select', {
147
- 'focus': isEditorFocus
148
- })
149
- }, /*#__PURE__*/_react.default.createElement("div", {
150
- className: "dtable-ui-row-expand-select-editor-inner"
151
- }, /*#__PURE__*/_react.default.createElement("div", null, options.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
152
- className: "dtable-ui-row-expand-select-options"
153
- }, options)), /*#__PURE__*/_react.default.createElement("i", {
154
- "aria-hidden": "true",
155
- className: "dtable-font dtable-icon-down3"
156
- })));
157
- };
158
- this.state = {
159
- value: _props.value || [],
160
- showSelectPopover: false
161
- };
162
- this.key = _props.valueKey === 'name' ? 'name' : 'id';
163
- this.options = this.getOptions(_props);
164
- this.selectRef = null;
165
- }
166
- componentDidMount() {
167
- document.addEventListener('mousedown', this.hideDropDownMenu);
168
- document.addEventListener('keydown', this.onKeyDown);
169
- }
170
- UNSAFE_componentWillReceiveProps(nextProps) {
171
- const {
172
- value
173
- } = nextProps;
174
- if (value !== this.props.value) {
175
- this.options = this.getOptions(nextProps);
176
- this.setState({
177
- value
178
- });
179
- }
180
- }
181
- componentDidUpdate(prevProps, prevState) {
182
- if (this.state.showSelectPopover !== prevState.showSelectPopover) {
183
- if (this.state.showSelectPopover === true && this.props.onEditorOpen) {
184
- this.props.onEditorOpen();
185
- }
186
- if (this.state.showSelectPopover === false && this.props.onEditorClose) {
187
- this.props.onEditorClose();
188
- }
189
- }
190
- }
191
- componentWillUnmount() {
192
- document.removeEventListener('mousedown', this.hideDropDownMenu);
193
- document.removeEventListener('keydown', this.onKeyDown);
194
- }
195
- render() {
196
- const {
197
- column,
198
- isSupportNewOption,
199
- onAddNewOption
200
- } = this.props;
201
- const {
202
- showSelectPopover,
203
- value
204
- } = this.state;
205
- return /*#__PURE__*/_react.default.createElement("div", {
206
- className: "position-relative w-100",
207
- ref: ref => this.ref = ref
208
- }, this.renderOptions(), /*#__PURE__*/_react.default.createElement("span", {
209
- ref: ref => this.targetRef = ref
210
- }), showSelectPopover && /*#__PURE__*/_react.default.createElement(_MultipleSelectEditor.default, {
211
- isInModal: true,
212
- options: this.options,
213
- column: column,
214
- value: value,
215
- valueKey: this.key,
216
- target: this.targetRef,
217
- onCommit: this.onChange,
218
- isSupportNewOption: isSupportNewOption,
219
- onAddNewOption: onAddNewOption,
220
- onClose: this.closeEditor
221
- }));
222
- }
223
- }
224
- var _default = exports.default = RowExpandMultipleSelectEditor;
@@ -1,105 +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 _NumberEditor = _interopRequireDefault(require("../../NumberEditor"));
11
- class RowExpandNumberEditor extends _react.default.Component {
12
- constructor(props) {
13
- super(props);
14
- this.toggleEditor = () => {
15
- this.props.updateTabIndex(this.props.columnIndex);
16
- if (this.props.readOnly) return;
17
- this.setState({
18
- isShowEditor: !this.state.isShowEditor
19
- });
20
- };
21
- this.onCommit = value => {
22
- this.props.onCommit(value);
23
- this.setState({
24
- value
25
- }, () => {
26
- this.setState({
27
- isShowEditor: false
28
- });
29
- });
30
- };
31
- this.onBlur = () => {
32
- this.setState({
33
- isShowEditor: false
34
- });
35
- };
36
- const {
37
- column,
38
- row,
39
- isEditorFocus
40
- } = props;
41
- this.state = {
42
- isShowEditor: isEditorFocus || false,
43
- value: row[column.key]
44
- };
45
- }
46
- UNSAFE_componentWillReceiveProps(nextProps) {
47
- const {
48
- column,
49
- row
50
- } = nextProps;
51
- if (row._id !== this.props.row._id) {
52
- this.setState({
53
- value: row[column.key],
54
- isShowEditor: false
55
- });
56
- }
57
- if (nextProps.isEditorFocus !== this.props.isEditorFocus) {
58
- let activeInput = document.activeElement;
59
- if (nextProps.isEditorFocus === false && activeInput) {
60
- activeInput.blur();
61
- }
62
- this.setState({
63
- isShowEditor: nextProps.isEditorFocus
64
- });
65
- }
66
- }
67
- render() {
68
- let {
69
- column,
70
- isInModal
71
- } = this.props;
72
- let {
73
- value,
74
- isShowEditor
75
- } = this.state;
76
- if (isShowEditor) {
77
- return /*#__PURE__*/_react.default.createElement(_NumberEditor.default, {
78
- isInModal: isInModal,
79
- column: column,
80
- value: value,
81
- onBlur: this.onBlur,
82
- onCommit: this.onCommit
83
- });
84
- }
85
- let formatValue = '';
86
- if ((0, _dtableUtils.isNumber)(value)) {
87
- let {
88
- data = {}
89
- } = column;
90
- formatValue = (0, _dtableUtils.getNumberDisplayString)(value, data);
91
- }
92
- return /*#__PURE__*/_react.default.createElement("div", {
93
- tabIndex: 0,
94
- onClick: this.toggleEditor,
95
- onFocus: this.toggleEditor,
96
- className: "form-control",
97
- style: {
98
- width: 320,
99
- lineHeight: '1.625rem'
100
- },
101
- "aria-label": formatValue
102
- }, formatValue);
103
- }
104
- }
105
- var _default = exports.default = RowExpandNumberEditor;
@@ -1,13 +0,0 @@
1
- .dtable-ui-row-expand-rate-editor {
2
- display: flex;
3
- }
4
-
5
- .dtable-ui-row-expand-rate-editor > div {
6
- padding-right: 5px;
7
- cursor: pointer;
8
- line-height: 1.5;
9
- }
10
-
11
- .dtable-ui-row-expand-rate-editor .rate-item-active {
12
- opacity: 1 !important;
13
- }
@@ -1,152 +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 _classnames = _interopRequireDefault(require("classnames"));
10
- var _lang = require("../../lang");
11
- require("./index.css");
12
- class RowExpandRateEditor extends _react.default.Component {
13
- constructor(props) {
14
- super(props);
15
- this.onKeyDown = event => {
16
- event.stopPropagation();
17
- const {
18
- isEditorFocus,
19
- column
20
- } = this.props;
21
- if (!isEditorFocus || !this.canEdit) return;
22
- const {
23
- rate_max_number
24
- } = column.data || {};
25
- const currentInputNum = Number(event.key);
26
- const isValidNumber = currentInputNum <= rate_max_number;
27
- if (isValidNumber) {
28
- this.onChangeRateNumber(currentInputNum);
29
- }
30
- };
31
- this.onChangeRateNumber = index => {
32
- this.props.updateTabIndex(this.props.columnIndex);
33
- if (!this.canEdit) return;
34
- const {
35
- value
36
- } = this.state;
37
- let newValue = value === index ? '' : index;
38
- this.setState({
39
- value: newValue
40
- });
41
- this.props.onCommit(newValue);
42
- };
43
- this.onMouseEnterRateItem = index => {
44
- if (this.canEdit) {
45
- this.setState({
46
- enterRateItemIndex: index
47
- });
48
- }
49
- };
50
- this.onMouseLeaveRateItem = () => {
51
- if (this.canEdit) {
52
- this.setState({
53
- enterRateItemIndex: -1
54
- });
55
- }
56
- };
57
- this.getRateMaxStar = () => {
58
- const {
59
- enterRateItemIndex,
60
- value
61
- } = this.state;
62
- const {
63
- column
64
- } = this.props;
65
- const {
66
- rate_max_number,
67
- rate_style_color,
68
- rate_style_type
69
- } = column.data || {};
70
- const rateShowType = rate_style_type ? rate_style_type : 'dtable-icon-rate';
71
- const {
72
- editable
73
- } = column;
74
- let rateList = [];
75
- for (let i = 0; i < rate_max_number; i++) {
76
- const rateItemIndex = i + 1;
77
- let itemStyle = {
78
- cursor: editable ? 'pointer' : 'default',
79
- color: value >= rateItemIndex ? rate_style_color : '#e5e5e5'
80
- };
81
- let style = itemStyle;
82
- if (enterRateItemIndex >= rateItemIndex) {
83
- style = {
84
- ...itemStyle,
85
- color: rate_style_color,
86
- opacity: 0.4
87
- };
88
- }
89
- let rateItem = /*#__PURE__*/_react.default.createElement("div", {
90
- key: i,
91
- onMouseEnter: this.onMouseEnterRateItem.bind(this, rateItemIndex),
92
- onMouseLeave: this.onMouseLeaveRateItem.bind(this, rateItemIndex),
93
- onClick: this.onChangeRateNumber.bind(this, rateItemIndex),
94
- style: style,
95
- className: value >= rateItemIndex ? 'rate-item-active' : ''
96
- }, /*#__PURE__*/_react.default.createElement("span", {
97
- className: "dtable-font ".concat(rateShowType)
98
- }));
99
- rateList.push(rateItem);
100
- }
101
- return rateList;
102
- };
103
- this.state = {
104
- value: props.value || '',
105
- enterRateItemIndex: -1
106
- };
107
- let {
108
- column: _column
109
- } = this.props;
110
- const {
111
- editable: _editable
112
- } = _column;
113
- this.canEdit = _editable;
114
- }
115
- UNSAFE_componentWillReceiveProps(nextProps) {
116
- const {
117
- column,
118
- row,
119
- valueKey
120
- } = nextProps;
121
- if (row._id !== this.props.row._id) {
122
- this.setState({
123
- value: row[column[valueKey]] || ''
124
- });
125
- } else if (nextProps.value !== this.props.value) {
126
- this.setState({
127
- value: nextProps.value || ''
128
- });
129
- }
130
- }
131
- render() {
132
- const rateList = this.getRateMaxStar();
133
- let style = {
134
- width: 320
135
- };
136
- if (this.canEdit && this.props.isEditorFocus) {
137
- style.boxShadow = 'rgba(70, 127, 207, 0.25) 0px 0px 0px 2px';
138
- style.borderColor = 'rgb(25, 145, 235)';
139
- }
140
- return /*#__PURE__*/_react.default.createElement("div", {
141
- tabIndex: 0,
142
- style: style,
143
- onKeyDown: this.onKeyDown,
144
- onFocus: this.props.updateTabIndex.bind(this, this.props.columnIndex),
145
- "aria-label": "".concat(this.state.value, ", ").concat((0, _lang.getLocale)('Press_the_number_keys_to_enter_the_corresponding_value')),
146
- className: (0, _classnames.default)('form-control dtable-ui-row-expand-rate-editor', {
147
- 'disabled': !this.canEdit
148
- })
149
- }, rateList);
150
- }
151
- }
152
- var _default = exports.default = RowExpandRateEditor;