dtable-ui-component 6.0.2 → 6.0.4

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 (262) hide show
  1. package/lib/ButtonFormatter/index.js +8 -2
  2. package/lib/CheckboxEditor/index.css +8 -20
  3. package/lib/CheckboxEditor/index.js +98 -35
  4. package/lib/CheckboxFormatter/index.css +5 -0
  5. package/lib/CheckboxFormatter/index.js +9 -15
  6. package/lib/CollaboratorEditor/index.css +12 -35
  7. package/lib/CollaboratorEditor/index.js +18 -212
  8. package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.js +27 -30
  9. package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +257 -0
  10. package/lib/CollaboratorItem/index.css +7 -1
  11. package/lib/CollaboratorItem/index.js +6 -2
  12. package/lib/Comment/body/comment.js +190 -0
  13. package/lib/Comment/body/index.css +95 -0
  14. package/lib/Comment/body/index.js +32 -0
  15. package/lib/Comment/footer/btns/index.css +40 -0
  16. package/lib/Comment/footer/btns/index.js +113 -0
  17. package/lib/Comment/footer/index.css +157 -0
  18. package/lib/Comment/footer/index.js +169 -0
  19. package/lib/Comment/footer/input/index.css +52 -0
  20. package/lib/Comment/footer/input/index.js +448 -0
  21. package/lib/Comment/footer/input/participant/index.css +0 -0
  22. package/lib/Comment/footer/input/participant/index.js +53 -0
  23. package/lib/Comment/footer/participants/index.css +22 -0
  24. package/lib/Comment/footer/participants/index.js +68 -0
  25. package/lib/Comment/footer/participants/participant/index.css +5 -0
  26. package/lib/Comment/footer/participants/participant/index.js +32 -0
  27. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  28. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  29. package/lib/Comment/index.css +19 -0
  30. package/lib/Comment/index.js +304 -0
  31. package/lib/Comment/model.js +25 -0
  32. package/lib/Comment/utils/common.js +62 -0
  33. package/lib/Comment/utils/index.js +27 -0
  34. package/lib/Comment/utils/utilities.js +176 -0
  35. package/lib/DTableColorPicker/index.css +1 -1
  36. package/lib/DTableCustomizeSelect/index.js +2 -2
  37. package/lib/DTableFiltersPopover/utils/index.js +1 -7
  38. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
  39. package/lib/DTableGroupSelect/index.js +3 -3
  40. package/lib/DTableSelect/index.js +3 -1
  41. package/lib/DateEditor/index.js +14 -51
  42. package/lib/DateEditor/pc-date-editor-popover.js +149 -12
  43. package/lib/{common/delete-tip.js → DeleteTip/index.js} +12 -16
  44. package/lib/Department-editor/department-single-select.js +1 -1
  45. package/lib/Department-editor/index.js +3 -4
  46. package/lib/DepartmentSingleSelectFormatter/index.js +3 -2
  47. package/lib/DigitalSignEditor/constants.js +7 -0
  48. package/lib/DigitalSignEditor/index.css +69 -0
  49. package/lib/DigitalSignEditor/index.js +182 -0
  50. package/lib/DigitalSignEditor/service.js +39 -0
  51. package/lib/DigitalSignEditor/signature-board/index.css +35 -0
  52. package/lib/DigitalSignEditor/signature-board/index.js +135 -0
  53. package/lib/DigitalSignEditor/signature-board/signature-tool.js +396 -0
  54. package/lib/DigitalSignEditor/utils.js +29 -0
  55. package/lib/DurationEditor/index.js +110 -0
  56. package/lib/EmailEditor/index.js +58 -0
  57. package/lib/FileEditor/addition-previewer/index.css +1 -0
  58. package/lib/FileEditor/addition-previewer/index.js +52 -0
  59. package/lib/FileEditor/addition-previewer/local-file-addition/index.css +1 -0
  60. package/lib/FileEditor/addition-previewer/local-file-addition/index.js +252 -0
  61. package/lib/FileEditor/constants.js +7 -0
  62. package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +74 -0
  63. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +5 -0
  64. package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +77 -0
  65. package/lib/FileEditor/files-previewer/file-previewer/index.css +88 -0
  66. package/lib/FileEditor/files-previewer/file-previewer/index.js +167 -0
  67. package/lib/FileEditor/files-previewer/index.css +56 -0
  68. package/lib/FileEditor/files-previewer/index.js +277 -0
  69. package/lib/FileEditor/index.css +6 -0
  70. package/lib/FileEditor/index.js +258 -11
  71. package/lib/FileEditor/utils.js +22 -0
  72. package/lib/FileItemFormatter/index.js +19 -20
  73. package/lib/FileUploader/index.css +9 -0
  74. package/lib/FileUploader/index.js +268 -14
  75. package/lib/FormulaFormatter/cell-value-validator.js +17 -17
  76. package/lib/FormulaFormatter/index.js +2 -1
  77. package/lib/FormulaFormatter/utils.js +0 -31
  78. package/lib/GeolocationEditor/country-editor.js +319 -0
  79. package/lib/GeolocationEditor/index.css +641 -0
  80. package/lib/GeolocationEditor/index.js +240 -0
  81. package/lib/GeolocationEditor/location-editor.js +368 -0
  82. package/lib/GeolocationEditor/map-editor/index.js +456 -0
  83. package/lib/GeolocationEditor/map-editor/large-editor/index.css +137 -0
  84. package/lib/GeolocationEditor/map-editor/large-editor/index.js +461 -0
  85. package/lib/GeolocationEditor/map-editor-utils.js +153 -0
  86. package/lib/GeolocationEditor/map-selection-editor/index.js +455 -0
  87. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +1 -0
  88. package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +447 -0
  89. package/lib/GeolocationEditor/parse-geolocation.js +282 -0
  90. package/lib/GeolocationEditor/province-city-editor.js +292 -0
  91. package/lib/GeolocationEditor/province-editor.js +226 -0
  92. package/lib/GeolocationEditor/selector-header-item.js +28 -0
  93. package/lib/GeolocationEditor/selector-list.js +33 -0
  94. package/lib/ImageEditor/addition-previewer/image-link/index.css +45 -0
  95. package/lib/ImageEditor/addition-previewer/image-link/index.js +73 -0
  96. package/lib/ImageEditor/addition-previewer/index.css +106 -0
  97. package/lib/ImageEditor/addition-previewer/index.js +63 -0
  98. package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +125 -0
  99. package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +254 -0
  100. package/lib/ImageEditor/constants.js +7 -0
  101. package/lib/ImageEditor/images-previewer/image-preview/index.css +59 -0
  102. package/lib/ImageEditor/images-previewer/image-preview/index.js +155 -0
  103. package/lib/ImageEditor/images-previewer/index.css +18 -0
  104. package/lib/ImageEditor/images-previewer/index.js +140 -0
  105. package/lib/ImageEditor/index.css +24 -0
  106. package/lib/ImageEditor/index.js +194 -0
  107. package/lib/ImageFormatter/images-lazy-load.js +4 -2
  108. package/lib/ImageFormatter/index.js +8 -3
  109. package/lib/ImageThumbnail/index.css +20 -0
  110. package/lib/ImageThumbnail/index.js +137 -0
  111. package/lib/LinkEditor/index.js +2 -3
  112. package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
  113. package/lib/MultipleSelectEditor/index.js +16 -177
  114. package/lib/NumberEditor/index.js +63 -77
  115. package/lib/RoleStatusEditor/index.css +0 -2
  116. package/lib/RowExpandDialog/body/index.css +21 -0
  117. package/lib/RowExpandDialog/body/index.js +262 -0
  118. package/lib/RowExpandDialog/column-content/index.css +48 -0
  119. package/lib/RowExpandDialog/column-content/index.js +50 -0
  120. package/lib/RowExpandDialog/header/index.css +31 -0
  121. package/lib/RowExpandDialog/header/index.js +55 -0
  122. package/lib/RowExpandDialog/index.css +28 -0
  123. package/lib/RowExpandDialog/index.js +237 -0
  124. package/lib/RowExpandEditor/RowExpandAddBtn/index.css +22 -0
  125. package/lib/RowExpandEditor/RowExpandAddBtn/index.js +24 -0
  126. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +18 -0
  127. package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +43 -0
  128. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +5 -0
  129. package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +232 -0
  130. package/lib/RowExpandEditor/RowExpandDateEditor/index.js +130 -0
  131. package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +104 -0
  132. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +13 -0
  133. package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +208 -0
  134. package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +105 -0
  135. package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +2 -0
  136. package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +125 -0
  137. package/lib/RowExpandEditor/RowExpandFileEditor/index.css +1 -0
  138. package/lib/RowExpandEditor/RowExpandFileEditor/index.js +148 -0
  139. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +17 -0
  140. package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +165 -0
  141. package/lib/RowExpandEditor/RowExpandImageEditor/index.css +11 -0
  142. package/lib/RowExpandEditor/RowExpandImageEditor/index.js +170 -0
  143. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +6 -0
  144. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +123 -0
  145. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +44 -0
  146. package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +247 -0
  147. package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +105 -0
  148. package/lib/RowExpandEditor/RowExpandRateEditor/index.css +13 -0
  149. package/lib/RowExpandEditor/RowExpandRateEditor/index.js +152 -0
  150. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +58 -0
  151. package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +206 -0
  152. package/lib/RowExpandEditor/RowExpandTextEditor/index.css +4 -0
  153. package/lib/RowExpandEditor/RowExpandTextEditor/index.js +127 -0
  154. package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +31 -0
  155. package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +130 -0
  156. package/lib/RowExpandEditor/constants.js +44 -0
  157. package/lib/RowExpandEditor/index.css +0 -0
  158. package/lib/RowExpandEditor/index.js +32 -0
  159. package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +27 -0
  160. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.css +1 -1
  161. package/lib/{RowExpandEmailFormatter → RowExpandFormatter/RowExpandEmailFormatter}/index.js +1 -1
  162. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.css +6 -6
  163. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/index.js +3 -1
  164. package/lib/{RowExpandFileFormatter → RowExpandFormatter/RowExpandFileFormatter}/row-expand-file-item-formatter.js +12 -13
  165. package/lib/{RowExpandFormulaFormatter → RowExpandFormatter/RowExpandFormulaFormatter}/index.js +11 -10
  166. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.css +6 -6
  167. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/index.js +1 -1
  168. package/lib/{RowExpandImageFormatter → RowExpandFormatter/RowExpandImageFormatter}/row-expand-image-item-formatter.js +5 -5
  169. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
  170. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.css +2 -2
  171. package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/index.js +20 -20
  172. package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.css +1 -1
  173. package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +1 -0
  174. package/lib/{RowExpandUrlFormatter → RowExpandFormatter/RowExpandUrlFormatter}/index.js +4 -3
  175. package/lib/RowExpandFormatter/constants.js +61 -0
  176. package/lib/RowExpandFormatter/index.css +28 -3
  177. package/lib/RowExpandFormatter/index.js +113 -131
  178. package/lib/SimpleLongTextFormatter/widgets/longTextEditor.css +2 -2
  179. package/lib/SingleSelectEditor/index.js +16 -156
  180. package/lib/SvgIcon/index.css +11 -0
  181. package/lib/SvgIcon/index.js +29 -0
  182. package/lib/TextEditor/index.js +112 -42
  183. package/lib/UploadProgress/index.js +38 -0
  184. package/lib/UrlEditor/index.js +61 -0
  185. package/lib/common/editor-base.js +52 -0
  186. package/lib/constants/file.js +96 -0
  187. package/lib/constants/index.js +27 -15
  188. package/lib/constants/key-codes.js +109 -0
  189. package/lib/css/cell-editor.css +18 -2
  190. package/lib/formatterConfig/base-formatter-config.js +23 -23
  191. package/lib/formatterConfig/index.js +3 -3
  192. package/lib/hooks/index.js +16 -0
  193. package/lib/index.js +81 -46
  194. package/lib/lang/index.js +19 -16
  195. package/lib/locales/de.json +167 -0
  196. package/lib/locales/en.json +167 -0
  197. package/lib/locales/es.json +167 -0
  198. package/lib/locales/fr.json +167 -0
  199. package/lib/locales/pt.json +167 -0
  200. package/lib/locales/ru.json +167 -0
  201. package/lib/locales/zh-CN.json +167 -0
  202. package/lib/select-editor/index.js +6 -6
  203. package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.js +3 -3
  204. package/lib/select-editor/pc-select-editor/index.css +85 -0
  205. package/lib/select-editor/pc-select-editor/index.js +295 -0
  206. package/lib/toaster/toast.js +19 -15
  207. package/lib/utils/cell-comparer.js +35 -0
  208. package/lib/utils/cell.js +55 -0
  209. package/lib/utils/column-utils.js +25 -0
  210. package/lib/utils/editor-utils.js +1 -6
  211. package/lib/utils/get-event-transfer.js +75 -0
  212. package/lib/utils/hotkey.js +37 -0
  213. package/lib/utils/object-utils.js +61 -0
  214. package/lib/utils/url.js +127 -8
  215. package/lib/utils/utils.js +119 -2
  216. package/package.json +4 -3
  217. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +0 -97
  218. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  219. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  220. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  221. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  222. package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
  223. package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
  224. package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
  225. package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
  226. package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
  227. package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
  228. package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
  229. package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
  230. package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
  231. package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
  232. package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
  233. package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
  234. package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
  235. package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
  236. package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
  237. package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
  238. package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
  239. package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
  240. package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
  241. package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
  242. package/lib/FileItemFormatter/utils.js +0 -99
  243. package/lib/MultipleSelectEditor/index.css +0 -9
  244. package/lib/RowExpandLinkFormatter/utils.js +0 -71
  245. package/lib/RowExpandUrlFormatter/index.css +0 -1
  246. package/lib/SingleSelectEditor/index.css +0 -14
  247. package/lib/common/modal-portal.js +0 -26
  248. package/lib/locals/de.js +0 -103
  249. package/lib/locals/en.js +0 -104
  250. package/lib/locals/es.js +0 -103
  251. package/lib/locals/fr.js +0 -103
  252. package/lib/locals/pt.js +0 -103
  253. package/lib/locals/ru.js +0 -103
  254. package/lib/locals/zh-CN.js +0 -104
  255. package/lib/select-editor/pc-select-editor-popover/index.css +0 -71
  256. package/lib/select-editor/pc-select-editor-popover/index.js +0 -122
  257. /package/lib/CollaboratorEditor/{mb-collaborator-editor-popover → mb-collaborator-editor}/index.css +0 -0
  258. /package/lib/CollaboratorEditor/{pc-collaborator-editor-popover → pc-collaborator-editor}/index.css +0 -0
  259. /package/lib/{common/delete-tip.css → DeleteTip/index.css} +0 -0
  260. /package/lib/{RowExpandLinkFormatter → RowExpandFormatter/RowExpandLinkFormatter}/value-display-utils.js +0 -0
  261. /package/lib/{RowExpandRateFormatter → RowExpandFormatter/RowExpandRateFormatter}/index.js +0 -0
  262. /package/lib/select-editor/{mb-select-editor-popover → mb-select-editor}/index.css +0 -0
@@ -0,0 +1,226 @@
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 _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
11
+ var _constants = require("../constants");
12
+ var _Loading = _interopRequireDefault(require("../Loading"));
13
+ var _lang = require("../lang");
14
+ class ProvinceEditor extends _react.Component {
15
+ constructor(props) {
16
+ super(props);
17
+ this.getLocationData = () => {
18
+ // mediaUrl
19
+ const {
20
+ mediaUrl
21
+ } = window.dtable;
22
+ // get locations from server
23
+ return fetch("".concat(mediaUrl, "geo-data/cn-location.json")).then(res => {
24
+ return res.json();
25
+ }).catch(() => {
26
+ // get locations from local
27
+ return fetch('./geo-data/cn-location.json').then(res => {
28
+ return res.json();
29
+ });
30
+ });
31
+ };
32
+ this.onHotKey = e => {
33
+ if (e.keyCode === _constants.KeyCodes.Enter) {
34
+ this.onEnter(e);
35
+ } else if (e.keyCode === _constants.KeyCodes.UpArrow) {
36
+ this.onUpArrow(e);
37
+ } else if (e.keyCode === _constants.KeyCodes.DownArrow) {
38
+ this.onDownArrow(e);
39
+ } else if (e.keyCode === _constants.KeyCodes.Tab) {
40
+ if (this.props.onPressTab) {
41
+ this.props.onPressTab(e);
42
+ }
43
+ }
44
+ };
45
+ this.onEnter = e => {
46
+ e.stopPropagation();
47
+ let selectedProvince;
48
+ if (this.filteredProvince.length === 1) {
49
+ selectedProvince = this.filteredProvince[0];
50
+ } else if (this.state.highlightIndex > -1) {
51
+ selectedProvince = this.filteredProvince[this.state.highlightIndex];
52
+ }
53
+ if (selectedProvince) {
54
+ this.props.setValue({
55
+ province: selectedProvince.name
56
+ });
57
+ this.props.onSubmit();
58
+ }
59
+ };
60
+ this.onUpArrow = e => {
61
+ e.preventDefault();
62
+ e.stopPropagation();
63
+ let {
64
+ highlightIndex
65
+ } = this.state;
66
+ if (highlightIndex > 0) {
67
+ this.setState({
68
+ highlightIndex: highlightIndex - 1
69
+ }, () => {
70
+ if (highlightIndex < this.filteredProvince.length - this.maxItemNum) {
71
+ this.selectContainer.scrollTop -= this.itemHeight;
72
+ }
73
+ });
74
+ }
75
+ };
76
+ this.onDownArrow = e => {
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ let {
80
+ highlightIndex
81
+ } = this.state;
82
+ if (highlightIndex < this.filteredProvince.length - 1) {
83
+ this.setState({
84
+ highlightIndex: highlightIndex + 1
85
+ }, () => {
86
+ if (highlightIndex >= this.maxItemNum) {
87
+ this.selectContainer.scrollTop += this.itemHeight;
88
+ }
89
+ });
90
+ }
91
+ };
92
+ this.onClick = province => {
93
+ this.props.setValue({
94
+ province
95
+ });
96
+ this.setState({
97
+ value: province
98
+ });
99
+ this.props.onSubmit();
100
+ };
101
+ this.onChange = searchVal => {
102
+ const value = searchVal.trim();
103
+ if (value === this.state.searchingProvince) return;
104
+ if (value.length === 0) {
105
+ this.provinceReg = null;
106
+ }
107
+ if (value.length > 0) {
108
+ this.provinceReg = new RegExp(value, 'i');
109
+ }
110
+ this.filteredProvince = this.locations.children.filter(item => {
111
+ if (!this.provinceReg) {
112
+ return true;
113
+ }
114
+ return this.provinceReg.test(item.name) || this.provinceReg.test(item.alphabetic);
115
+ });
116
+ this.setState({
117
+ searchingProvince: value,
118
+ highlightIndex: this.filteredProvince.length > 0 ? 0 : -1
119
+ });
120
+ };
121
+ this.onKeyDown = e => {
122
+ if (e.keyCode === _constants.KeyCodes.ChineseInputMethod || e.keyCode === _constants.KeyCodes.Enter || e.keyCode === _constants.KeyCodes.LeftArrow || e.keyCode === _constants.KeyCodes.RightArrow) {
123
+ e.stopPropagation();
124
+ }
125
+ };
126
+ this.onMenuMouseEnter = index => {
127
+ this.setState({
128
+ highlightIndex: index
129
+ });
130
+ };
131
+ this.onMenuMouseLeave = index => {
132
+ this.timer = setTimeout(() => {
133
+ if (this.state.highlightIndex === index) {
134
+ this.setState({
135
+ highlightIndex: -1
136
+ });
137
+ }
138
+ }, 300);
139
+ };
140
+ this.createProvinceList = () => {
141
+ const {
142
+ value,
143
+ highlightIndex
144
+ } = this.state;
145
+ let provinceList = this.filteredProvince.map((item, index) => {
146
+ return /*#__PURE__*/_react.default.createElement("div", {
147
+ className: "geolocation-region-editor-province ".concat(highlightIndex === index ? 'geolocation-region-editor-province-highlight' : ''),
148
+ key: item.alphabetic + index,
149
+ title: item.name,
150
+ "aria-label": item.name,
151
+ onClick: () => this.onClick(item.name),
152
+ onMouseEnter: () => this.onMenuMouseEnter(index),
153
+ onMouseLeave: () => this.onMenuMouseLeave(index)
154
+ }, /*#__PURE__*/_react.default.createElement("span", {
155
+ className: "province-name"
156
+ }, item.name), /*#__PURE__*/_react.default.createElement("span", {
157
+ className: "icon ".concat(value === item.name ? 'province-selected-icon dtable-font dtable-icon-check-mark' : '')
158
+ }));
159
+ });
160
+ if (provinceList.length === 0) {
161
+ provinceList.push( /*#__PURE__*/_react.default.createElement("div", {
162
+ key: 'province-null',
163
+ className: "country-list-empty"
164
+ }, (0, _lang.getLocale)('No_options')));
165
+ }
166
+ return provinceList;
167
+ };
168
+ this.value = props.value || {};
169
+ this.locations = {};
170
+ this.state = {
171
+ isLoadingData: true,
172
+ searchingProvince: '',
173
+ value: this.value.province,
174
+ highlightIndex: -1
175
+ };
176
+ this.filteredProvince = [];
177
+ this.timer = null;
178
+ this.maxItemNum = 5;
179
+ this.itemHeight = 30;
180
+ }
181
+ componentDidMount() {
182
+ if (!window.app.location) {
183
+ this.getLocationData().then(data => {
184
+ this.locations = data;
185
+ window.app.location = data;
186
+ this.filteredProvince = this.locations.children;
187
+ this.setState({
188
+ isLoadingData: false
189
+ });
190
+ });
191
+ } else {
192
+ this.locations = window.app.location;
193
+ this.filteredProvince = this.locations.children;
194
+ this.setState({
195
+ isLoadingData: false
196
+ });
197
+ }
198
+ document.addEventListener('keydown', this.onHotKey, true);
199
+ }
200
+ componentWillUnmount() {
201
+ document.removeEventListener('keydown', this.onHotKey, true);
202
+ if (this.timer) {
203
+ clearTimeout(this.timer);
204
+ this.timer = null;
205
+ }
206
+ }
207
+ render() {
208
+ const {
209
+ isLoadingData
210
+ } = this.state;
211
+ return /*#__PURE__*/_react.default.createElement("div", {
212
+ className: "dtable-ui-geolocation-province-editor"
213
+ }, /*#__PURE__*/_react.default.createElement("div", {
214
+ className: "geolocation-province-list-header"
215
+ }, /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
216
+ placeholder: (0, _lang.getLocale)('Search_province'),
217
+ onKeyDown: this.onKeyDown,
218
+ onChange: this.onChange,
219
+ autoFocus: true
220
+ })), /*#__PURE__*/_react.default.createElement("div", {
221
+ className: "geolocation-province-list-container",
222
+ ref: ref => this.selectContainer = ref
223
+ }, isLoadingData ? /*#__PURE__*/_react.default.createElement(_Loading.default, null) : this.createProvinceList()));
224
+ }
225
+ }
226
+ var _default = exports.default = ProvinceEditor;
@@ -0,0 +1,28 @@
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 _lang = require("../lang");
10
+ class SelectorHeaderItem extends _react.default.Component {
11
+ render() {
12
+ const {
13
+ type,
14
+ clickHandler,
15
+ selectedType,
16
+ selectedItem
17
+ } = this.props;
18
+ return /*#__PURE__*/_react.default.createElement("div", {
19
+ className: 'dtable-ui-geolocation-selector-header-item ' + (selectedType === type ? 'selected-dtable-ui-geolocation-selector-header-item' : ''),
20
+ onClick: () => {
21
+ clickHandler(type);
22
+ }
23
+ }, /*#__PURE__*/_react.default.createElement("span", null, selectedItem ? selectedItem.name ? selectedItem.name : selectedItem : (0, _lang.getLocale)('Select_location')), /*#__PURE__*/_react.default.createElement("i", {
24
+ className: "dtable-font dtable-icon-down3"
25
+ }));
26
+ }
27
+ }
28
+ var _default = exports.default = SelectorHeaderItem;
@@ -0,0 +1,33 @@
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
+ class SelectorList extends _react.default.Component {
10
+ render() {
11
+ const {
12
+ clickHandler,
13
+ type,
14
+ selectedItem,
15
+ parent,
16
+ doubleClickHandler
17
+ } = this.props;
18
+ return /*#__PURE__*/_react.default.createElement("ul", {
19
+ className: "dtable-ui-geolocation-selector-list"
20
+ }, parent.children.map((item, index) => {
21
+ const isSelected = selectedItem && item.name === selectedItem.name;
22
+ return /*#__PURE__*/_react.default.createElement("li", {
23
+ onClick: () => clickHandler(item),
24
+ onDoubleClick: () => {
25
+ doubleClickHandler && doubleClickHandler(item);
26
+ },
27
+ key: type + '-item-' + index,
28
+ className: "dtable-ui-geolocation-selector-list-item ".concat(type === 'province' ? 'province-item' : '', " ").concat(isSelected ? 'selected-list-item' : '')
29
+ }, item.name);
30
+ }));
31
+ }
32
+ }
33
+ var _default = exports.default = SelectorList;
@@ -0,0 +1,45 @@
1
+ .dtable-ui-image-link {
2
+ width: 100%;
3
+ padding: 6rem 0;
4
+ }
5
+
6
+ .dtable-ui-image-link-container {
7
+ width: 100%;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ }
12
+
13
+ .dtable-ui-image-link-input {
14
+ border-bottom-right-radius: 0;
15
+ border-top-right-radius: 0;
16
+ width: 50%;
17
+ }
18
+
19
+ .dtable-ui-image-link-input:focus {
20
+ z-index: 2;
21
+ }
22
+
23
+ .dtable-ui-image-link-icon {
24
+ display: flex;
25
+ width: 2.375rem;
26
+ height: 2.375rem;
27
+ justify-content: center;
28
+ align-items: center;
29
+ border: 1px solid rgba(0, 40, 100, 0.12);
30
+ border-left: none;
31
+ color: #a6aeb6;
32
+ cursor: pointer;
33
+ border-radius: 0 3px 3px 0;
34
+ background: #fafafa;
35
+ }
36
+
37
+ .dtable-ui-image-link-icon:hover {
38
+ background: #ededed;
39
+ }
40
+
41
+ .dtable-ui-image-link-error-message {
42
+ margin-top: 10px;
43
+ text-align: center;
44
+ color: red;
45
+ }
@@ -0,0 +1,73 @@
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 _reactstrap = require("reactstrap");
10
+ var _lang = require("../../../lang");
11
+ require("./index.css");
12
+ class ImageLink extends _react.default.Component {
13
+ constructor(props) {
14
+ super(props);
15
+ this.saveImageLink = () => {
16
+ let {
17
+ imageLink
18
+ } = this.state;
19
+ let _this = this;
20
+ let image = new Image();
21
+ image.onload = function () {
22
+ // Determine if the picture url is correct
23
+ if (image.fileSize > 0 || image.width > 0 && image.height > 0) {
24
+ _this.props.saveImageLink(imageLink);
25
+ }
26
+ };
27
+ image.onerror = function () {
28
+ _this.setState({
29
+ isShowErrorMessage: true
30
+ });
31
+ };
32
+ image.src = imageLink;
33
+ };
34
+ this.handleChange = event => {
35
+ let value = event.target.value;
36
+ this.setState({
37
+ imageLink: value
38
+ });
39
+ };
40
+ this.imageLinkPaste = e => {
41
+ e.stopPropagation();
42
+ };
43
+ this.onKeyDown = e => {
44
+ e.stopPropagation();
45
+ };
46
+ this.state = {
47
+ imageLink: '',
48
+ isShowErrorMessage: false
49
+ };
50
+ }
51
+ render() {
52
+ const {
53
+ isShowErrorMessage
54
+ } = this.state;
55
+ return /*#__PURE__*/_react.default.createElement("div", {
56
+ className: "dtable-ui-image-link",
57
+ onKeyDown: this.onKeyDown
58
+ }, /*#__PURE__*/_react.default.createElement("div", {
59
+ className: "dtable-ui-image-link-container"
60
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
61
+ className: "dtable-ui-image-link-input",
62
+ placeholder: (0, _lang.getLocale)('Enter_a_URL'),
63
+ onPaste: this.imageLinkPaste,
64
+ onChange: this.handleChange
65
+ }), /*#__PURE__*/_react.default.createElement("span", {
66
+ className: "dtable-ui-image-link-icon dtable-font dtable-icon-url",
67
+ onClick: this.saveImageLink
68
+ })), isShowErrorMessage && /*#__PURE__*/_react.default.createElement("div", {
69
+ className: "dtable-ui-image-link-error-message"
70
+ }, (0, _lang.getLocale)('Please_enter_the_correct_image_address')));
71
+ }
72
+ }
73
+ var _default = exports.default = ImageLink;
@@ -0,0 +1,106 @@
1
+ .dtable-ui-image-addition-left {
2
+ border-right: 1px solid #e9ecef;
3
+ width: 150px;
4
+ padding: 12px 8px;
5
+ }
6
+
7
+ .dtable-ui-image-addition-left .dtable-ui-addition-item {
8
+ padding: 5px 0 5px 8px;
9
+ border-radius: 3px;
10
+ display: inline-block;
11
+ cursor: pointer;
12
+ width: 100%;
13
+ }
14
+
15
+ .dtable-ui-image-addition-left .dtable-ui-addition-item:hover {
16
+ background-color: #f5f5f5;
17
+ }
18
+
19
+ .dtable-ui-image-addition-container .dtable-ui-image-addition-left .dtable-ui-addition-item-selected {
20
+ background-color: #FF8000;
21
+ color: #fff;
22
+ }
23
+
24
+ .dtable-ui-image-addition-right {
25
+ height: 350px;
26
+ overflow-y: auto;
27
+ overflow-x: hidden;
28
+ padding: 1rem;
29
+ width: 470px;
30
+ }
31
+
32
+ .dtable-ui-image-addition-right.dtable-ui-image-addition-right-recent {
33
+ padding: 0;
34
+ }
35
+
36
+ .dtable-ui-image-addition-right .dtable-ui-image-addition-right-container {
37
+ display: flex;
38
+ flex-wrap: wrap;
39
+ align-content: flex-start;
40
+ width: 100%;
41
+ height: 100%;
42
+ }
43
+
44
+ .dtable-ui-image-addition-right.dtable-ui-image-addition-right-recent .dtable-ui-image-addition-right-container {
45
+ width: 100%;
46
+ }
47
+
48
+ .dtable-ui-image-addition-right .dtable-ui-image-upload-container {
49
+ height: 100%;
50
+ width: 100%;
51
+ border: 1px dashed transparent;
52
+ position: relative;
53
+ cursor: pointer;
54
+ }
55
+
56
+ .dtable-ui-image-addition-right .dtable-ui-image-upload-container-active {
57
+ border: 1px dashed #ccc;
58
+ }
59
+
60
+ .dtable-ui-image-addition-right .dtable-ui-image-upload-container .dtable-ui-image-add-span {
61
+ margin-top: 5px;
62
+ font-size: 12px;
63
+ }
64
+
65
+ .dtable-ui-image-addition-right .dtable-ui-image-upload-container .image-addition-paste {
66
+ position: absolute;
67
+ height: 100%;
68
+ width: 100%;
69
+ top: 0;
70
+ pointer-events: none;
71
+ opacity: 0;
72
+ z-index: 3;
73
+ }
74
+
75
+ .dtable-ui-image-addition-right .dtable-ui-image-wrapper {
76
+ height: 100px;
77
+ width: 100px;
78
+ border: 2px solid #ededed;
79
+ border-radius: 4px;
80
+ position: relative;
81
+ margin-right: 12px;
82
+ margin-bottom: 12px;
83
+ }
84
+
85
+ .dtable-ui-image-addition-right .dtable-ui-image-wrapper:hover {
86
+ border-color: #c9c9c9;
87
+ }
88
+
89
+ .dtable-ui-image-addition-right .dtable-ui-image-wrapper:nth-child(4n) {
90
+ margin-right: 0px;
91
+ }
92
+
93
+ .dtable-ui-image-addition-right .dtable-ui-image-wrapper .dtable-ui-image-content {
94
+ width: 96px;
95
+ height: 96px;
96
+ text-align: center;
97
+ line-height: 30px;
98
+ display: flex;
99
+ justify-content: center;
100
+ align-items: center;
101
+ }
102
+
103
+ .dtable-ui-image-addition-right .dtable-ui-image-wrapper img {
104
+ max-height: 96px;
105
+ max-width: 96px;
106
+ }
@@ -0,0 +1,63 @@
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 _localImageAddition = _interopRequireDefault(require("./local-image-addition"));
10
+ var _imageLink = _interopRequireDefault(require("./image-link"));
11
+ var _lang = require("../../lang");
12
+ require("./index.css");
13
+ class AdditionPreviewer extends _react.default.Component {
14
+ constructor(props) {
15
+ super(props);
16
+ this.toggle = tab => {
17
+ if (this.state.activeTab !== tab) {
18
+ this.setState({
19
+ activeTab: tab
20
+ });
21
+ }
22
+ };
23
+ this.addFiles = fileSelectedList => {
24
+ this.props.addUploadedFile(fileSelectedList);
25
+ setTimeout(() => {
26
+ this.props.showImageListPreviewer();
27
+ }, 0);
28
+ };
29
+ this.state = {
30
+ activeTab: 'localPicture'
31
+ };
32
+ }
33
+ render() {
34
+ const {
35
+ activeTab
36
+ } = this.state;
37
+ return /*#__PURE__*/_react.default.createElement("div", {
38
+ className: "dtable-ui-image-addition-container"
39
+ }, /*#__PURE__*/_react.default.createElement("div", {
40
+ className: "dtable-ui-image-addition-left"
41
+ }, /*#__PURE__*/_react.default.createElement("div", {
42
+ className: "dtable-ui-image-addition-nav"
43
+ }, /*#__PURE__*/_react.default.createElement("div", {
44
+ className: "dtable-ui-addition-item ".concat(activeTab === 'localPicture' ? 'dtable-ui-addition-item-selected' : ''),
45
+ onClick: this.toggle.bind(this, 'localPicture')
46
+ }, (0, _lang.getLocale)('Local_Images')), this.props.saveImageLink && /*#__PURE__*/_react.default.createElement("div", {
47
+ className: "dtable-ui-addition-item ".concat(activeTab === 'imageLink' ? 'dtable-ui-addition-item-selected' : ''),
48
+ onClick: this.toggle.bind(this, 'imageLink')
49
+ }, (0, _lang.getLocale)('Image_Link')))), /*#__PURE__*/_react.default.createElement("div", {
50
+ className: "dtable-ui-image-addition-right"
51
+ }, /*#__PURE__*/_react.default.createElement("div", {
52
+ className: "dtable-ui-image-addition-right-container"
53
+ }, activeTab === 'localPicture' && /*#__PURE__*/_react.default.createElement(_localImageAddition.default, {
54
+ uploadLocalImageValue: this.props.uploadLocalImageValue,
55
+ deleteImage: this.props.deleteImage,
56
+ fileUploadCompleted: this.props.fileUploadCompleted,
57
+ uploadFile: this.props.uploadFile
58
+ }), activeTab === 'imageLink' && /*#__PURE__*/_react.default.createElement(_imageLink.default, {
59
+ saveImageLink: this.props.saveImageLink
60
+ }))));
61
+ }
62
+ }
63
+ var _default = exports.default = AdditionPreviewer;
@@ -0,0 +1,125 @@
1
+ .dtable-ui-image-add-box {
2
+ display: flex;
3
+ background: #f0f0f0;
4
+ height: 100%;
5
+ width: 100%;
6
+ flex-direction: column;
7
+ font-size: 12px;
8
+ cursor: pointer;
9
+ }
10
+
11
+ .dtable-ui-image-add-box .dtable-ui-image-add-button {
12
+ cursor: pointer;
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ padding: 16px 10px 0;
17
+ }
18
+
19
+ .dtable-ui-image-add-box .dtable-ui-image-add-button i {
20
+ color: #999;
21
+ font-size: 25px;
22
+ }
23
+
24
+ dtable-ui-image-add-box .dtable-ui-image-add-span {
25
+ color: #999;
26
+ margin-top: 5px;
27
+ font-size: 12px;
28
+ }
29
+
30
+ .dtable-ui-dtable-ui-image-add-icon {
31
+ line-height: 1;
32
+ }
33
+
34
+ .dtable-ui-dtable-ui-image-add-icon i {
35
+ font-size: 54px;
36
+ color: #ccc;
37
+ }
38
+
39
+ .dtable-ui-image-tip-addition {
40
+ text-align: center;
41
+ padding: 6rem 4rem;
42
+ width: 100%;
43
+ }
44
+
45
+ .dtable-ui-image-upload-percent {
46
+ width: 100%;
47
+ height: 100%;
48
+ border-radius: 2px;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ position: relative;
53
+ }
54
+
55
+ .dtable-ui-image-upload-success {
56
+ width: 60px;
57
+ height: 60px;
58
+ background: rgba(0, 0, 0, 0.7);
59
+ border-radius: 2px;
60
+ position: absolute;
61
+ z-index: 5;
62
+ }
63
+
64
+ .dtable-ui-image-upload-success .dtable-ui-image-upload-success-scale {
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ width: 100%;
69
+ height: 100%;
70
+ }
71
+
72
+ .dtable-ui-image-upload-success .dtable-ui-image-upload-success-scale .dtable-ui-image-upload-success-tip {
73
+ color: #fff;
74
+ font-size: 12px;
75
+ width: 100%;
76
+ transform: scale(0.8);
77
+ text-align: center;
78
+ }
79
+
80
+ .dtable-ui-image-upload-success .dtable-ui-image-upload-success-icon i {
81
+ display: inline-block;
82
+ color: #757474;
83
+ }
84
+
85
+ .dtable-ui-image-upload-mask {
86
+ height: 100%;
87
+ width: 100%;
88
+ background: rgba(0, 0, 0, 0.6);
89
+ z-index: 2;
90
+ border-radius: 2px;
91
+ }
92
+
93
+ .dtable-ui-image-upload-error-tip {
94
+ z-index: 3;
95
+ font-size: 12px;
96
+ transform: scale(0.7);
97
+ position: absolute;
98
+ color: #fff;
99
+ white-space: nowrap;
100
+ text-align: center;
101
+ }
102
+
103
+ .dtable-ui-image-upload-again {
104
+ text-decoration: underline;
105
+ cursor: pointer;
106
+ margin-left: 3px;
107
+ }
108
+
109
+ .dtable-delete-image-icon {
110
+ position: absolute;
111
+ top: -4px;
112
+ right: -4px;
113
+ height: 32px;
114
+ width: 32px;
115
+ border-radius: 50%;
116
+ background: rgba(0, 0, 0, 0.6);
117
+ color: #fff;
118
+ text-align: center;
119
+ cursor: pointer;
120
+ transform: scale(0.5);
121
+ }
122
+
123
+ .dtable-delete-image-icon .image-delete-span {
124
+ font-size: 20px;
125
+ }