dtable-ui-component 0.1.75 → 0.1.76

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 (163) hide show
  1. package/README.md +20 -2
  2. package/lib/AutoNumberFormatter/index.css +1 -0
  3. package/{es/components/cell-formatter/auto-number-formatter.js → lib/AutoNumberFormatter/index.js} +1 -0
  4. package/lib/ButtonFormatter/index.css +13 -0
  5. package/{es/components/cell-formatter/button-formatter.js → lib/ButtonFormatter/index.js} +1 -0
  6. package/lib/CTimeFormatter/index.css +1 -0
  7. package/{es/components/cell-formatter/ctime-formatter.js → lib/CTimeFormatter/index.js} +1 -0
  8. package/lib/CheckboxEditor/index.js +104 -0
  9. package/lib/CheckboxFormatter/index.css +1 -0
  10. package/{es/components/cell-formatter/checkbox-formatter.js → lib/CheckboxFormatter/index.js} +1 -0
  11. package/lib/CollaboratorEditor/index.css +48 -0
  12. package/lib/CollaboratorEditor/index.js +237 -0
  13. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.css +86 -0
  14. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +178 -0
  15. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.css +1 -0
  16. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +110 -0
  17. package/lib/CollaboratorFormatter/index.css +1 -0
  18. package/{es/components/cell-formatter/collaborator-formatter.js → lib/CollaboratorFormatter/index.js} +3 -2
  19. package/lib/CollaboratorItem/index.css +49 -0
  20. package/{es/components/common/collaborator-item.js → lib/CollaboratorItem/index.js} +1 -0
  21. package/lib/CreatorFormatter/index.css +1 -0
  22. package/{es/components/cell-formatter/creator-formatter.js → lib/CreatorFormatter/index.js} +3 -2
  23. package/lib/DateEditor/index.css +4 -0
  24. package/lib/DateEditor/index.js +152 -0
  25. package/{es/css → lib/DateEditor/mb-date-editor-popover}/custom-rc-calendar.css +0 -0
  26. package/lib/DateEditor/mb-date-editor-popover/index.css +45 -0
  27. package/lib/DateEditor/mb-date-editor-popover/index.js +245 -0
  28. package/lib/DateEditor/pc-date-editor-popover.js +142 -0
  29. package/lib/DateFormatter/index.css +1 -0
  30. package/{es/components/cell-formatter/date-formatter.js → lib/DateFormatter/index.js} +2 -1
  31. package/lib/DurationFormatter/index.css +1 -0
  32. package/{es/components/cell-formatter/duration-formatter.js → lib/DurationFormatter/index.js} +2 -1
  33. package/{es/components/common/edit-editor-button.js → lib/EditEditorButton/index.js} +0 -0
  34. package/lib/EmailFormatter/index.css +5 -0
  35. package/{es/components/cell-formatter/email-formatter.js → lib/EmailFormatter/index.js} +1 -0
  36. package/lib/FileEditor/index.js +46 -0
  37. package/lib/FileEditor/pc-files-addition/index.js +0 -0
  38. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -0
  39. package/lib/FileEditor/pc-files-preview/index.js +0 -0
  40. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -0
  41. package/lib/FileFormatter/index.css +29 -0
  42. package/{es/components/cell-formatter/file-formatter.js → lib/FileFormatter/index.js} +2 -1
  43. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/excel.png +0 -0
  44. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/file.png +0 -0
  45. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/music.png +0 -0
  46. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pdf.png +0 -0
  47. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pic.png +0 -0
  48. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/ppt.png +0 -0
  49. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/txt.png +0 -0
  50. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/video.png +0 -0
  51. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/word.png +0 -0
  52. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/excel.png +0 -0
  53. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/file.png +0 -0
  54. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/music.png +0 -0
  55. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pdf.png +0 -0
  56. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pic.png +0 -0
  57. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/ppt.png +0 -0
  58. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/txt.png +0 -0
  59. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/video.png +0 -0
  60. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/word.png +0 -0
  61. package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-192.png +0 -0
  62. package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-24.png +0 -0
  63. package/{es/components/cell-formatter/widgets/file-item-formatter.js → lib/FileItemFormatter/index.js} +2 -2
  64. package/lib/FileItemFormatter/utils.js +72 -0
  65. package/{es/components/file-uploader → lib/FileUploader}/index.js +0 -0
  66. package/{es/utils → lib/FormulaFormatter}/cell-value-validator.js +1 -2
  67. package/lib/FormulaFormatter/index.css +19 -0
  68. package/{es/components/cell-formatter/formula-formatter.js → lib/FormulaFormatter/index.js} +7 -8
  69. package/{es/utils/column-utils.js → lib/FormulaFormatter/utils.js} +5 -1
  70. package/lib/GeolocationFormatter/index.css +1 -0
  71. package/{es/components/cell-formatter/geolocation-formatter.js → lib/GeolocationFormatter/index.js} +2 -1
  72. package/lib/HtmlLongTextFormatter/index.css +63 -0
  73. package/{es/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js → lib/HtmlLongTextFormatter/index.js} +5 -2
  74. package/{es/utils → lib/HtmlLongTextFormatter}/markdown2html.js +0 -0
  75. package/{es/utils → lib/HtmlLongTextFormatter}/unified/index.js +1 -0
  76. package/{es/utils → lib/HtmlLongTextFormatter}/vfile/core.js +1 -0
  77. package/{es/utils → lib/HtmlLongTextFormatter}/vfile/index.js +0 -0
  78. package/{es/components/common → lib/ImageFormatter}/images-lazy-load.js +2 -2
  79. package/lib/ImageFormatter/index.css +34 -0
  80. package/{es/components/cell-formatter/image-formatter.js → lib/ImageFormatter/index.js} +4 -3
  81. package/lib/ImageFormatter/utils.js +7 -0
  82. package/{es/css/image-previewer-ligntbox.css → lib/ImagePreviewerLightbox/index.css} +0 -0
  83. package/{es/components/cell-formatter/widgets/image-previewer-lightbox.js → lib/ImagePreviewerLightbox/index.js} +3 -3
  84. package/lib/ImagePreviewerLightbox/utils.js +8 -0
  85. package/lib/LastModifierFormatter/index.css +1 -0
  86. package/{es/components/cell-formatter/last-modifier-formatter.js → lib/LastModifierFormatter/index.js} +5 -4
  87. package/lib/LinkEditor/index.css +9 -0
  88. package/lib/LinkEditor/index.js +304 -0
  89. package/{es/components/common → lib/LinkEditor}/link-editor-option.js +0 -0
  90. package/lib/LinkEditor/mb-link-editor-popover/index.css +85 -0
  91. package/lib/LinkEditor/mb-link-editor-popover/index.js +171 -0
  92. package/lib/LinkEditor/pc-link-editor-popover/index.css +63 -0
  93. package/lib/LinkEditor/pc-link-editor-popover/index.js +115 -0
  94. package/lib/LinkFormatter/index.css +27 -0
  95. package/{es/components/cell-formatter/link-formatter.js → lib/LinkFormatter/index.js} +2 -2
  96. package/{es/css/loading.css → lib/Loading/index.css} +0 -0
  97. package/{es/components/loading.js → lib/Loading/index.js} +1 -1
  98. package/{es/components/cell-formatter/long-text-formatter.js → lib/LongTextFormatter/index.js} +4 -6
  99. package/{es/components/common/mobile/mb-editor-header.js → lib/MBEditorHeader/index.js} +0 -0
  100. package/lib/MTimeFormatter/index.css +1 -0
  101. package/{es/components/cell-formatter/mtime-formatter.js → lib/MTimeFormatter/index.js} +1 -0
  102. package/{es/components/common/modal-portal.js → lib/ModalPortal/index.js} +0 -0
  103. package/lib/MultipleSelectEditor/index.css +9 -0
  104. package/lib/MultipleSelectEditor/index.js +236 -0
  105. package/lib/MultipleSelectFormatter/index.css +1 -0
  106. package/{es/components/cell-formatter/multiple-select-formatter.js → lib/MultipleSelectFormatter/index.js} +2 -1
  107. package/lib/NumberEditor/index.js +154 -0
  108. package/lib/NumberFormatter/index.css +1 -0
  109. package/{es/components/cell-formatter/number-formatter.js → lib/NumberFormatter/index.js} +2 -1
  110. package/lib/RateFormatter/index.css +1 -0
  111. package/{es/components/cell-formatter/rate-formatter.js → lib/RateFormatter/index.js} +1 -0
  112. package/{es/components/common/select-item.js → lib/SelectItem/index.js} +0 -0
  113. package/lib/SimpleLongTextFormatter/index.css +63 -0
  114. package/{es/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js → lib/SimpleLongTextFormatter/index.js} +5 -2
  115. package/{es/utils → lib/SimpleLongTextFormatter}/normalize-long-text-value.js +3 -3
  116. package/lib/SingleSelectEditor/index.css +9 -0
  117. package/lib/SingleSelectEditor/index.js +201 -0
  118. package/lib/SingleSelectFormatter/index.css +1 -0
  119. package/{es/components/cell-formatter/single-select-formatter.js → lib/SingleSelectFormatter/index.js} +2 -1
  120. package/lib/TextEditor/index.js +122 -0
  121. package/lib/TextFormatter/index.css +1 -0
  122. package/{es/components/cell-formatter/text-formatter.js → lib/TextFormatter/index.js} +1 -0
  123. package/lib/UrlFormatter/index.css +5 -0
  124. package/{es/components/cell-formatter/url-formatter.js → lib/UrlFormatter/index.js} +1 -0
  125. package/{es → lib}/assets/images/avatar/default_avatar.png +0 -0
  126. package/{es/components/cell-factory/cell-formatter-factory.js → lib/cellFormatterFactory/index.js} +3 -3
  127. package/{es → lib}/constants/cell-types.js +0 -0
  128. package/lib/constants/index.js +49 -0
  129. package/lib/css/cell-editor.css +6 -0
  130. package/lib/css/cell-formatter.css +4 -0
  131. package/lib/css/mb-cell-editor.css +55 -0
  132. package/lib/formatterConfig/index.js +31 -0
  133. package/lib/index.js +43 -0
  134. package/{es → lib}/lang/index.js +0 -0
  135. package/{es → lib}/locals/de.js +0 -0
  136. package/{es → lib}/locals/en.js +0 -0
  137. package/{es → lib}/locals/fr.js +0 -0
  138. package/{es → lib}/locals/zh-CN.js +0 -0
  139. package/lib/select-editor/index.js +4 -0
  140. package/lib/select-editor/mb-select-editor-popover/index.css +127 -0
  141. package/lib/select-editor/mb-select-editor-popover/index.js +231 -0
  142. package/lib/select-editor/pc-select-editor-popover/index.css +72 -0
  143. package/lib/select-editor/pc-select-editor-popover/index.js +144 -0
  144. package/{es/components/common → lib/select-editor}/select-editor-option.js +0 -0
  145. package/{es/components/toast → lib/toaster}/alert.js +0 -0
  146. package/{es/components/toast → lib/toaster}/index.js +0 -0
  147. package/{es/components/toast → lib/toaster}/toast.js +0 -0
  148. package/{es/components/toast → lib/toaster}/toastManager.js +0 -0
  149. package/{es/components/toast → lib/toaster}/toaster.js +0 -0
  150. package/lib/utils/editor-utils.js +71 -0
  151. package/{es → lib}/utils/number-precision.js +1 -0
  152. package/lib/utils/utils.js +25 -0
  153. package/{es → lib}/utils/value-format-utils.js +3 -2
  154. package/package.json +8 -8
  155. package/es/app.css +0 -20
  156. package/es/app.js +0 -91
  157. package/es/components/cell-formatter/formatter-config.js +0 -31
  158. package/es/components/cell-formatter/index.js +0 -27
  159. package/es/constants/index.js +0 -48
  160. package/es/css/cell-editor.css +0 -614
  161. package/es/css/cell-formatter.css +0 -247
  162. package/es/index.js +0 -6
  163. package/es/utils/utils.js +0 -116
@@ -0,0 +1,245 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ import { DatePicker } from 'antd-mobile';
7
+ import moment from 'moment';
8
+ import Calendar from '@seafile/seafile-calendar';
9
+ import * as SeaDatePicker from '@seafile/seafile-calendar/lib/Picker';
10
+ import { getLocale } from '../../lang';
11
+ import { initDateEditorLanguage } from '../../utils/editor-utils';
12
+ import MBEditorHeader from '../../MBEditorHeader';
13
+ import '@seafile/seafile-calendar/assets/index.css';
14
+ import './index.css';
15
+
16
+ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
17
+ _inherits(DateEditorPopover, _React$PureComponent);
18
+
19
+ var _super = _createSuper(DateEditorPopover);
20
+
21
+ function DateEditorPopover(props) {
22
+ var _this;
23
+
24
+ _classCallCheck(this, DateEditorPopover);
25
+
26
+ _this = _super.call(this, props);
27
+
28
+ _this.handleHistaryBack = function (e) {
29
+ e.preventDefault();
30
+
31
+ _this.closePopover();
32
+ };
33
+
34
+ _this.handleDateChange = function (date) {
35
+ var _this$props = _this.props,
36
+ dateFormat = _this$props.dateFormat,
37
+ showHourAndMinute = _this$props.showHourAndMinute;
38
+ var newValue = moment(date);
39
+
40
+ if (showHourAndMinute) {
41
+ var datePickerValue = _this.state.datePickerValue;
42
+ var HM = datePickerValue.format('HH:mm');
43
+ var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
44
+
45
+ var newDate = moment(date).format(format) + ' ' + HM;
46
+ newValue = moment(newDate);
47
+ }
48
+
49
+ _this.setState({
50
+ datePickerValue: moment(date)
51
+ });
52
+
53
+ _this.props.onValueChanged(newValue.format(dateFormat));
54
+ };
55
+
56
+ _this.handleTimeChange = function (time) {
57
+ var datePickerValue = _this.state.datePickerValue;
58
+ var dateFormat = _this.props.dateFormat;
59
+ var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
60
+
61
+ var YMD = datePickerValue.format(format);
62
+ var newDate = YMD + ' ' + moment(time).format('HH:mm');
63
+ var newValue = moment(newDate);
64
+
65
+ _this.setState({
66
+ datePickerValue: newValue
67
+ });
68
+
69
+ _this.props.onValueChanged(datePickerValue.format(dateFormat));
70
+ };
71
+
72
+ _this.closePopover = function () {
73
+ _this.props.onClosePopover();
74
+ };
75
+
76
+ _this.deleteDate = function () {
77
+ _this.props.onValueChanged('');
78
+
79
+ _this.closePopover();
80
+ };
81
+
82
+ _this.onChange = function (value) {
83
+ if (!value) return;
84
+ var dateFormat = _this.props.dateFormat;
85
+
86
+ _this.setState({
87
+ datePickerValue: value
88
+ });
89
+
90
+ _this.props.onValueChanged(value.format(dateFormat));
91
+ };
92
+
93
+ _this.onContainerClick = function (event) {
94
+ if (_this.editorPopover && _this.editorPopover.contains(event.target)) {
95
+ event.stopPropagation();
96
+ event.nativeEvent.stopImmediatePropagation();
97
+ return false;
98
+ }
99
+ };
100
+
101
+ _this.setEditorPopover = function (editorPopover) {
102
+ _this.editorPopover = editorPopover;
103
+ };
104
+
105
+ _this.getCalendarContainer = function () {
106
+ return _this.calendarContainerRef.current;
107
+ };
108
+
109
+ _this.getCalender = function () {
110
+ var _this$props2 = _this.props,
111
+ dateFormat = _this$props2.dateFormat,
112
+ lang = _this$props2.lang;
113
+ var defaultValue = moment().clone();
114
+ return /*#__PURE__*/React.createElement(Calendar, {
115
+ locale: initDateEditorLanguage(lang),
116
+ format: dateFormat,
117
+ defaultValue: defaultValue,
118
+ dateInputPlaceholder: getLocale('Please_input'),
119
+ showDateInput: false,
120
+ focusablePanel: false,
121
+ showToday: false,
122
+ showTime: false,
123
+ style: {
124
+ width: '100%',
125
+ fontSize: '14px'
126
+ }
127
+ });
128
+ };
129
+
130
+ _this.renderDataPicker = function () {
131
+ var dateFormat = _this.props.dateFormat;
132
+ var datePickerValue = _this.state.datePickerValue;
133
+
134
+ var calendar = _this.getCalender();
135
+
136
+ return /*#__PURE__*/React.createElement(SeaDatePicker, {
137
+ open: true,
138
+ style: {
139
+ width: '100%'
140
+ },
141
+ calendar: calendar,
142
+ value: datePickerValue,
143
+ getCalendarContainer: _this.getCalendarContainer,
144
+ onChange: _this.onChange
145
+ }, function (_ref) {
146
+ var value = _ref.value;
147
+ value = value && value.format(dateFormat);
148
+ return /*#__PURE__*/React.createElement("div", {
149
+ tabIndex: "0",
150
+ onFocus: _this.onReadOnlyFocus
151
+ }, /*#__PURE__*/React.createElement("input", {
152
+ placeholder: getLocale('Please_select'),
153
+ readOnly: true,
154
+ tabIndex: "-1",
155
+ className: "form-control",
156
+ value: value || ''
157
+ }), /*#__PURE__*/React.createElement("div", {
158
+ ref: _this.calendarContainerRef,
159
+ style: {
160
+ height: '22rem'
161
+ }
162
+ }));
163
+ });
164
+ };
165
+
166
+ _this.state = {
167
+ open: true,
168
+ datePickerValue: props.value ? moment(props.value) : moment().clone()
169
+ };
170
+ _this.calendarContainerRef = React.createRef();
171
+ return _this;
172
+ }
173
+
174
+ _createClass(DateEditorPopover, [{
175
+ key: "componentDidMount",
176
+ value: function componentDidMount() {
177
+ history.pushState(null, null, '#'); // eslint-disable-line
178
+
179
+ window.addEventListener('popstate', this.handleHistaryBack, false);
180
+ }
181
+ }, {
182
+ key: "componentWillUnmount",
183
+ value: function componentWillUnmount() {
184
+ window.removeEventListener('popstate', this.handleHistaryBack, false);
185
+ }
186
+ }, {
187
+ key: "render",
188
+ value: function render() {
189
+ var _this$props3 = this.props,
190
+ lang = _this$props3.lang,
191
+ column = _this$props3.column,
192
+ dateFormat = _this$props3.dateFormat,
193
+ showHourAndMinute = _this$props3.showHourAndMinute;
194
+ var leftFormat = dateFormat.split(' ')[0];
195
+ var rightFormat = dateFormat.split(' ')[1];
196
+ var datePickerValue = this.state.datePickerValue;
197
+ return /*#__PURE__*/React.createElement("div", {
198
+ ref: this.setEditorPopover,
199
+ className: "dtable-ui-mb-editor-popover mb-date-editor-popover",
200
+ onClick: this.onContainerClick
201
+ }, /*#__PURE__*/React.createElement(MBEditorHeader, {
202
+ title: column.name,
203
+ leftContent: /*#__PURE__*/React.createElement("i", {
204
+ className: "dtable-font dtable-icon-return"
205
+ }),
206
+ rightContent: /*#__PURE__*/React.createElement("span", null, getLocale('Done')),
207
+ onLeftClick: this.props.onClosePopover,
208
+ onRightClick: this.props.onClosePopover
209
+ }), /*#__PURE__*/React.createElement("div", {
210
+ className: "dtable-ui-mb-editor-body dtable-ui-mb-date-editor-body"
211
+ }, /*#__PURE__*/React.createElement("div", {
212
+ className: "mb-date-editor-input"
213
+ }, /*#__PURE__*/React.createElement("div", {
214
+ className: "date-input"
215
+ }, /*#__PURE__*/React.createElement(DatePicker, {
216
+ mode: "date",
217
+ locale: initDateEditorLanguage(lang),
218
+ value: this.state.value,
219
+ onChange: this.handleDateChange
220
+ }, /*#__PURE__*/React.createElement("div", {
221
+ className: "date-input-day"
222
+ }, datePickerValue && datePickerValue.format(leftFormat)))), showHourAndMinute && /*#__PURE__*/React.createElement("div", {
223
+ className: "date-input"
224
+ }, /*#__PURE__*/React.createElement(DatePicker, {
225
+ mode: "time",
226
+ locale: initDateEditorLanguage(lang),
227
+ value: this.state.value,
228
+ onChange: this.handleTimeChange
229
+ }, /*#__PURE__*/React.createElement("div", {
230
+ className: "date-input-day"
231
+ }, datePickerValue && datePickerValue.format(rightFormat))))), /*#__PURE__*/React.createElement("div", {
232
+ className: "dtable-ui mb-date-editor-picker"
233
+ }, this.renderDataPicker()), /*#__PURE__*/React.createElement("div", {
234
+ className: "mb-date-editor-clear"
235
+ }, /*#__PURE__*/React.createElement("div", {
236
+ onClick: this.deleteDate,
237
+ className: "clear-date"
238
+ }, getLocale('Clear')))));
239
+ }
240
+ }]);
241
+
242
+ return DateEditorPopover;
243
+ }(React.PureComponent);
244
+
245
+ export default DateEditorPopover;
@@ -0,0 +1,142 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ import moment from 'moment';
7
+ import DatePicker from '@seafile/seafile-calendar/lib/Picker';
8
+ import Calendar from '@seafile/seafile-calendar';
9
+ import { initDateEditorLanguage } from '../utils/editor-utils';
10
+ import '@seafile/seafile-calendar/assets/index.css';
11
+ import { getLocale } from '../lang';
12
+
13
+ var PCDateEditorPopover = /*#__PURE__*/function (_React$Component) {
14
+ _inherits(PCDateEditorPopover, _React$Component);
15
+
16
+ var _super = _createSuper(PCDateEditorPopover);
17
+
18
+ function PCDateEditorPopover(props) {
19
+ var _this;
20
+
21
+ _classCallCheck(this, PCDateEditorPopover);
22
+
23
+ _this = _super.call(this, props);
24
+
25
+ _this.onChange = function (value) {
26
+ if (!value) return;
27
+ var dateFormat = _this.props.dateFormat;
28
+
29
+ _this.setState({
30
+ datePickerValue: value,
31
+ open: true // if value changed, don't close datePicker
32
+
33
+ });
34
+
35
+ _this.props.onValueChanged(value.format(dateFormat));
36
+ };
37
+
38
+ _this.onOpenChange = function (open) {
39
+ _this.setState({
40
+ open: open
41
+ });
42
+
43
+ return;
44
+ };
45
+
46
+ _this.onClear = function () {
47
+ _this.setState({
48
+ datePickerValue: null
49
+ });
50
+ };
51
+
52
+ _this.onFocusDatePicker = function () {
53
+ _this.setState({
54
+ open: true
55
+ });
56
+ };
57
+
58
+ _this.handleMouseDown = function (event) {
59
+ event.preventDefault();
60
+ event.stopPropagation();
61
+ };
62
+
63
+ _this.getCalendarContainer = function () {
64
+ return _this.calendarContainerRef.current;
65
+ };
66
+
67
+ _this.getCalender = function () {
68
+ var _this$props = _this.props,
69
+ dateFormat = _this$props.dateFormat,
70
+ showHourAndMinute = _this$props.showHourAndMinute,
71
+ lang = _this$props.lang;
72
+ var defaultValue = moment().clone();
73
+ return /*#__PURE__*/React.createElement(Calendar, {
74
+ locale: initDateEditorLanguage(lang),
75
+ style: {
76
+ zIndex: 1001
77
+ },
78
+ format: dateFormat,
79
+ defaultValue: defaultValue,
80
+ showHourAndMinute: showHourAndMinute,
81
+ dateInputPlaceholder: getLocale('Please_input'),
82
+ showDateInput: true,
83
+ focusablePanel: false,
84
+ onClear: _this.onClear
85
+ });
86
+ };
87
+
88
+ _this.state = {
89
+ open: true,
90
+ datePickerValue: props.value ? moment(props.value) : null
91
+ };
92
+ _this.calendarContainerRef = React.createRef();
93
+ return _this;
94
+ } // event trigger sequence: onOpenChange --> onChange
95
+
96
+
97
+ _createClass(PCDateEditorPopover, [{
98
+ key: "render",
99
+ value: function render() {
100
+ var _this2 = this;
101
+
102
+ var dateFormat = this.props.dateFormat;
103
+ var _this$state = this.state,
104
+ open = _this$state.open,
105
+ datePickerValue = _this$state.datePickerValue;
106
+ var calendar = this.getCalender();
107
+ return /*#__PURE__*/React.createElement(DatePicker, {
108
+ open: open,
109
+ value: datePickerValue,
110
+ animation: "slide-up",
111
+ style: {
112
+ zIndex: 1001
113
+ },
114
+ calendar: calendar,
115
+ getCalendarContainer: this.getCalendarContainer,
116
+ onChange: this.onChange,
117
+ onOpenChange: this.onOpenChange
118
+ }, function (_ref) {
119
+ var value = _ref.value;
120
+ value = value && value.format(dateFormat);
121
+ return /*#__PURE__*/React.createElement("span", {
122
+ className: "dtable-ui-date-editor-container",
123
+ tabIndex: "0",
124
+ onFocus: _this2.onFocusDatePicker
125
+ }, /*#__PURE__*/React.createElement("input", {
126
+ readOnly: true,
127
+ tabIndex: "-1",
128
+ className: "form-control",
129
+ placeholder: getLocale('Please_select'),
130
+ value: value || '',
131
+ onMouseDown: _this2.handleMouseDown
132
+ }), /*#__PURE__*/React.createElement("div", {
133
+ ref: _this2.calendarContainerRef
134
+ }));
135
+ });
136
+ }
137
+ }]);
138
+
139
+ return PCDateEditorPopover;
140
+ }(React.Component);
141
+
142
+ export default PCDateEditorPopover;
@@ -0,0 +1 @@
1
+ @import url('../css/cell-formatter.css');
@@ -4,7 +4,8 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import cn from 'astro-classname';
7
- import { getDateDisplayString } from '../../utils/value-format-utils';
7
+ import { getDateDisplayString } from '../utils/value-format-utils';
8
+ import './index.css';
8
9
 
9
10
  var DateFormatter = /*#__PURE__*/function (_React$Component) {
10
11
  _inherits(DateFormatter, _React$Component);
@@ -0,0 +1 @@
1
+ @import url('../css/cell-formatter.css');
@@ -4,7 +4,8 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import cn from 'astro-classname';
7
- import { getDurationDisplayString } from '../../utils/value-format-utils';
7
+ import { getDurationDisplayString } from '../utils/value-format-utils';
8
+ import './index.css';
8
9
 
9
10
  var DurationFormatter = /*#__PURE__*/function (_React$Component) {
10
11
  _inherits(DurationFormatter, _React$Component);
@@ -0,0 +1,5 @@
1
+ @import url('../css/cell-formatter.css');
2
+
3
+ .dtable-ui.email-formatter {
4
+ text-decoration: underline;
5
+ }
@@ -4,6 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import cn from 'astro-classname';
7
+ import './index.css';
7
8
 
8
9
  var EmailFormatter = /*#__PURE__*/function (_React$Component) {
9
10
  _inherits(EmailFormatter, _React$Component);
@@ -0,0 +1,46 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ import { Modal, ModalHeader, ModalBody } from 'reactstrap';
7
+ import { getLocale } from '../lang';
8
+
9
+ var FileEditor = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(FileEditor, _React$Component);
11
+
12
+ var _super = _createSuper(FileEditor);
13
+
14
+ function FileEditor(props) {
15
+ var _this;
16
+
17
+ _classCallCheck(this, FileEditor);
18
+
19
+ _this = _super.call(this, props);
20
+ _this.state = {};
21
+ return _this;
22
+ }
23
+
24
+ _createClass(FileEditor, [{
25
+ key: "render",
26
+ value: function render() {
27
+ var closeEditor = this.props.closeEditor;
28
+ return /*#__PURE__*/React.createElement(Modal, {
29
+ isOpen: true,
30
+ toggle: closeEditor
31
+ }, /*#__PURE__*/React.createElement(ModalHeader, {
32
+ toggle: closeEditor
33
+ }, getLocale('Add_Files')), /*#__PURE__*/React.createElement(ModalBody, {
34
+ className: "file-editor-container"
35
+ }));
36
+ }
37
+ }]);
38
+
39
+ return FileEditor;
40
+ }(React.Component);
41
+
42
+ FileEditor.defaultProps = {
43
+ isCheckRepeat: false,
44
+ columnType: 'file'
45
+ };
46
+ export default FileEditor;
File without changes
File without changes
@@ -0,0 +1,29 @@
1
+ @import url('../css/cell-formatter.css');
2
+
3
+ .dtable-ui.file-formatter {
4
+ display: flex;
5
+ align-items: center;
6
+ }
7
+
8
+ .dtable-ui.file-formatter .file-item-icon {
9
+ display: inline-block;
10
+ height: 28px;
11
+ width: 28px;
12
+ border: 1px solid #f0f0f0;
13
+ }
14
+
15
+ .dtable-ui.file-formatter .file-item-count {
16
+ display: inline-block;
17
+ padding: 0 3px;
18
+ min-width: 14px;
19
+ line-height: 14px;
20
+ font-size: 12px;
21
+ border-radius: 6px;
22
+ text-align: center;
23
+ text-overflow: ellipsis;
24
+ white-space: nowrap;
25
+ color: #fff;
26
+ background-color: #999;
27
+ -webkit-transform: translate(-50%, 8px) scale(.8);
28
+ transform: translate(-50%, 8px) scale(.8);
29
+ }
@@ -4,7 +4,8 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import cn from 'astro-classname';
7
- import FileItemFormatter from './widgets/file-item-formatter';
7
+ import FileItemFormatter from '../FileItemFormatter';
8
+ import './index.css';
8
9
 
9
10
  var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
10
11
  _inherits(FileFormatter, _React$PureComponent);
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
- import { getFileIconUrl } from '../../../utils/utils';
6
+ import { getFileIconUrl } from './utils';
7
7
 
8
8
  var FileItemFormatter = /*#__PURE__*/function (_Component) {
9
9
  _inherits(FileItemFormatter, _Component);
@@ -24,7 +24,7 @@ var FileItemFormatter = /*#__PURE__*/function (_Component) {
24
24
  _this.getFileIconData = function (item) {
25
25
  var fileIconUrl = getFileIconUrl(item.name, item.type);
26
26
 
27
- var fileIconData = require('../../../' + fileIconUrl);
27
+ var fileIconData = require('./' + fileIconUrl);
28
28
 
29
29
  return fileIconData;
30
30
  };
@@ -0,0 +1,72 @@
1
+ var FILEEXT_ICON_MAP = {
2
+ // text file
3
+ md: 'txt.png',
4
+ txt: 'txt.png',
5
+ // pdf file
6
+ pdf: 'pdf.png',
7
+ // document file
8
+ doc: 'word.png',
9
+ docx: 'word.png',
10
+ odt: 'word.png',
11
+ fodt: 'word.png',
12
+ ppt: 'ppt.png',
13
+ pptx: 'ppt.png',
14
+ odp: 'ppt.png',
15
+ fodp: 'ppt.png',
16
+ xls: 'excel.png',
17
+ xlsx: 'excel.png',
18
+ ods: 'excel.png',
19
+ fods: 'excel.png',
20
+ // video
21
+ mp4: 'video.png',
22
+ ogv: 'video.png',
23
+ webm: 'video.png',
24
+ mov: 'video.png',
25
+ flv: 'video.png',
26
+ wmv: 'video.png',
27
+ rmvb: 'video.png',
28
+ // music file
29
+ mp3: 'music.png',
30
+ oga: 'music.png',
31
+ ogg: 'music.png',
32
+ flac: 'music.png',
33
+ aac: 'music.png',
34
+ ac3: 'music.png',
35
+ wma: 'music.png',
36
+ // image file
37
+ jpg: 'pic.png',
38
+ jpeg: 'pic.png',
39
+ png: 'pic.png',
40
+ svg: 'pic.png',
41
+ gif: 'pic.png',
42
+ bmp: 'pic.png',
43
+ ico: 'pic.png',
44
+ // folder dir
45
+ folder: 'folder-192.png',
46
+ // default
47
+ default: 'file.png'
48
+ };
49
+ export var getFileIconUrl = function getFileIconUrl(filename, direntType) {
50
+ if (direntType === 'dir') {
51
+ var _iconUrl = 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
52
+
53
+ return _iconUrl;
54
+ }
55
+
56
+ var iconUrl = '';
57
+
58
+ if (filename.lastIndexOf('.') === -1) {
59
+ iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
60
+ return iconUrl;
61
+ }
62
+
63
+ var file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
64
+
65
+ if (FILEEXT_ICON_MAP[file_ext]) {
66
+ iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext];
67
+ } else {
68
+ iconUrl = 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
69
+ }
70
+
71
+ return iconUrl;
72
+ };