dtable-ui-component 0.1.75 → 0.1.79

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 (164) 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/DtableSelect/index.js +140 -0
  32. package/lib/DurationFormatter/index.css +1 -0
  33. package/{es/components/cell-formatter/duration-formatter.js → lib/DurationFormatter/index.js} +2 -1
  34. package/{es/components/common/edit-editor-button.js → lib/EditEditorButton/index.js} +0 -0
  35. package/lib/EmailFormatter/index.css +5 -0
  36. package/{es/components/cell-formatter/email-formatter.js → lib/EmailFormatter/index.js} +1 -0
  37. package/lib/FileEditor/index.js +46 -0
  38. package/lib/FileEditor/pc-files-addition/index.js +0 -0
  39. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -0
  40. package/lib/FileEditor/pc-files-preview/index.js +0 -0
  41. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -0
  42. package/lib/FileFormatter/index.css +29 -0
  43. package/{es/components/cell-formatter/file-formatter.js → lib/FileFormatter/index.js} +2 -1
  44. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/excel.png +0 -0
  45. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/file.png +0 -0
  46. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/music.png +0 -0
  47. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pdf.png +0 -0
  48. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pic.png +0 -0
  49. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/ppt.png +0 -0
  50. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/txt.png +0 -0
  51. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/video.png +0 -0
  52. package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/word.png +0 -0
  53. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/excel.png +0 -0
  54. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/file.png +0 -0
  55. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/music.png +0 -0
  56. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pdf.png +0 -0
  57. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pic.png +0 -0
  58. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/ppt.png +0 -0
  59. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/txt.png +0 -0
  60. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/video.png +0 -0
  61. package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/word.png +0 -0
  62. package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-192.png +0 -0
  63. package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-24.png +0 -0
  64. package/{es/components/cell-formatter/widgets/file-item-formatter.js → lib/FileItemFormatter/index.js} +2 -2
  65. package/lib/FileItemFormatter/utils.js +72 -0
  66. package/{es/components/file-uploader → lib/FileUploader}/index.js +0 -0
  67. package/{es/utils → lib/FormulaFormatter}/cell-value-validator.js +1 -2
  68. package/lib/FormulaFormatter/index.css +19 -0
  69. package/{es/components/cell-formatter/formula-formatter.js → lib/FormulaFormatter/index.js} +7 -8
  70. package/{es/utils/column-utils.js → lib/FormulaFormatter/utils.js} +5 -1
  71. package/lib/GeolocationFormatter/index.css +1 -0
  72. package/{es/components/cell-formatter/geolocation-formatter.js → lib/GeolocationFormatter/index.js} +2 -1
  73. package/lib/HtmlLongTextFormatter/index.css +63 -0
  74. package/{es/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js → lib/HtmlLongTextFormatter/index.js} +5 -2
  75. package/{es/utils → lib/HtmlLongTextFormatter}/markdown2html.js +2 -2
  76. package/{es/utils → lib/HtmlLongTextFormatter}/unified/index.js +8 -5
  77. package/{es/utils → lib/HtmlLongTextFormatter}/vfile/core.js +4 -2
  78. package/{es/utils → lib/HtmlLongTextFormatter}/vfile/index.js +4 -3
  79. package/{es/components/common → lib/ImageFormatter}/images-lazy-load.js +2 -2
  80. package/lib/ImageFormatter/index.css +34 -0
  81. package/{es/components/cell-formatter/image-formatter.js → lib/ImageFormatter/index.js} +4 -3
  82. package/lib/ImageFormatter/utils.js +7 -0
  83. package/{es/css/image-previewer-ligntbox.css → lib/ImagePreviewerLightbox/index.css} +0 -0
  84. package/{es/components/cell-formatter/widgets/image-previewer-lightbox.js → lib/ImagePreviewerLightbox/index.js} +3 -3
  85. package/lib/ImagePreviewerLightbox/utils.js +8 -0
  86. package/lib/LastModifierFormatter/index.css +1 -0
  87. package/{es/components/cell-formatter/last-modifier-formatter.js → lib/LastModifierFormatter/index.js} +5 -4
  88. package/lib/LinkEditor/index.css +9 -0
  89. package/lib/LinkEditor/index.js +304 -0
  90. package/{es/components/common → lib/LinkEditor}/link-editor-option.js +0 -0
  91. package/lib/LinkEditor/mb-link-editor-popover/index.css +85 -0
  92. package/lib/LinkEditor/mb-link-editor-popover/index.js +171 -0
  93. package/lib/LinkEditor/pc-link-editor-popover/index.css +63 -0
  94. package/lib/LinkEditor/pc-link-editor-popover/index.js +115 -0
  95. package/lib/LinkFormatter/index.css +27 -0
  96. package/{es/components/cell-formatter/link-formatter.js → lib/LinkFormatter/index.js} +2 -2
  97. package/{es/css/loading.css → lib/Loading/index.css} +0 -0
  98. package/{es/components/loading.js → lib/Loading/index.js} +1 -1
  99. package/{es/components/cell-formatter/long-text-formatter.js → lib/LongTextFormatter/index.js} +4 -6
  100. package/{es/components/common/mobile/mb-editor-header.js → lib/MBEditorHeader/index.js} +0 -0
  101. package/lib/MTimeFormatter/index.css +1 -0
  102. package/{es/components/cell-formatter/mtime-formatter.js → lib/MTimeFormatter/index.js} +1 -0
  103. package/{es/components/common/modal-portal.js → lib/ModalPortal/index.js} +0 -0
  104. package/lib/MultipleSelectEditor/index.css +9 -0
  105. package/lib/MultipleSelectEditor/index.js +236 -0
  106. package/lib/MultipleSelectFormatter/index.css +1 -0
  107. package/{es/components/cell-formatter/multiple-select-formatter.js → lib/MultipleSelectFormatter/index.js} +2 -1
  108. package/lib/NumberEditor/index.js +154 -0
  109. package/lib/NumberFormatter/index.css +1 -0
  110. package/{es/components/cell-formatter/number-formatter.js → lib/NumberFormatter/index.js} +2 -1
  111. package/lib/RateFormatter/index.css +1 -0
  112. package/{es/components/cell-formatter/rate-formatter.js → lib/RateFormatter/index.js} +1 -0
  113. package/{es/components/common/select-item.js → lib/SelectItem/index.js} +0 -0
  114. package/lib/SimpleLongTextFormatter/index.css +63 -0
  115. package/{es/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js → lib/SimpleLongTextFormatter/index.js} +5 -2
  116. package/{es/utils → lib/SimpleLongTextFormatter}/normalize-long-text-value.js +3 -3
  117. package/lib/SingleSelectEditor/index.css +9 -0
  118. package/lib/SingleSelectEditor/index.js +201 -0
  119. package/lib/SingleSelectFormatter/index.css +1 -0
  120. package/{es/components/cell-formatter/single-select-formatter.js → lib/SingleSelectFormatter/index.js} +2 -1
  121. package/lib/TextEditor/index.js +122 -0
  122. package/lib/TextFormatter/index.css +1 -0
  123. package/{es/components/cell-formatter/text-formatter.js → lib/TextFormatter/index.js} +1 -0
  124. package/lib/UrlFormatter/index.css +5 -0
  125. package/{es/components/cell-formatter/url-formatter.js → lib/UrlFormatter/index.js} +1 -0
  126. package/{es → lib}/assets/images/avatar/default_avatar.png +0 -0
  127. package/{es/components/cell-factory/cell-formatter-factory.js → lib/cellFormatterFactory/index.js} +3 -3
  128. package/{es → lib}/constants/cell-types.js +0 -0
  129. package/lib/constants/index.js +49 -0
  130. package/lib/css/cell-editor.css +6 -0
  131. package/lib/css/cell-formatter.css +4 -0
  132. package/lib/css/mb-cell-editor.css +55 -0
  133. package/lib/formatterConfig/index.js +31 -0
  134. package/lib/index.js +45 -0
  135. package/{es → lib}/lang/index.js +0 -0
  136. package/{es → lib}/locals/de.js +0 -0
  137. package/{es → lib}/locals/en.js +0 -0
  138. package/{es → lib}/locals/fr.js +0 -0
  139. package/{es → lib}/locals/zh-CN.js +0 -0
  140. package/lib/select-editor/index.js +4 -0
  141. package/lib/select-editor/mb-select-editor-popover/index.css +127 -0
  142. package/lib/select-editor/mb-select-editor-popover/index.js +231 -0
  143. package/lib/select-editor/pc-select-editor-popover/index.css +72 -0
  144. package/lib/select-editor/pc-select-editor-popover/index.js +144 -0
  145. package/{es/components/common → lib/select-editor}/select-editor-option.js +0 -0
  146. package/{es/components/toast → lib/toaster}/alert.js +0 -0
  147. package/{es/components/toast → lib/toaster}/index.js +0 -0
  148. package/{es/components/toast → lib/toaster}/toast.js +0 -0
  149. package/{es/components/toast → lib/toaster}/toastManager.js +0 -0
  150. package/{es/components/toast → lib/toaster}/toaster.js +0 -0
  151. package/lib/utils/editor-utils.js +71 -0
  152. package/{es → lib}/utils/number-precision.js +1 -0
  153. package/lib/utils/utils.js +25 -0
  154. package/{es → lib}/utils/value-format-utils.js +7 -10
  155. package/package.json +9 -8
  156. package/es/app.css +0 -20
  157. package/es/app.js +0 -91
  158. package/es/components/cell-formatter/formatter-config.js +0 -31
  159. package/es/components/cell-formatter/index.js +0 -27
  160. package/es/constants/index.js +0 -48
  161. package/es/css/cell-editor.css +0 -614
  162. package/es/css/cell-formatter.css +0 -247
  163. package/es/index.js +0 -6
  164. 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,140 @@
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 _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import React from 'react';
7
+ import Select, { components } from 'react-select';
8
+ var MenuSelectStyle = {
9
+ option: function option(provided, state) {
10
+ var isDisabled = state.isDisabled,
11
+ isSelected = state.isSelected,
12
+ isFocused = state.isFocused;
13
+ return _objectSpread(_objectSpread({}, provided), {}, {
14
+ cursor: isDisabled ? 'default' : 'pointer',
15
+ backgroundColor: isSelected ? '#5A98F8' : isFocused ? '#f5f5f5' : '#fff',
16
+ '.header-icon .dtable-font': {
17
+ color: isSelected ? '#fff' : '#aaa'
18
+ }
19
+ });
20
+ },
21
+ control: function control(provided) {
22
+ return _objectSpread(_objectSpread({}, provided), {}, {
23
+ fontSize: '14px',
24
+ cursor: 'pointer',
25
+ lineHeight: '1.5'
26
+ });
27
+ },
28
+ menuPortal: function menuPortal(base) {
29
+ return _objectSpread(_objectSpread({}, base), {}, {
30
+ zIndex: 9999
31
+ });
32
+ },
33
+ indicatorSeparator: function indicatorSeparator() {}
34
+ };
35
+
36
+ var DropdownIndicator = function DropdownIndicator(props) {
37
+ return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
38
+ className: "dtable-font dtable-icon-drop-down",
39
+ style: {
40
+ fontSize: '12px'
41
+ }
42
+ }));
43
+ };
44
+
45
+ var MenuList = function MenuList(props) {
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ onClick: function onClick(e) {
48
+ return e.nativeEvent.stopImmediatePropagation();
49
+ },
50
+ onMouseDown: function onMouseDown(e) {
51
+ return e.nativeEvent.stopImmediatePropagation();
52
+ }
53
+ }, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
54
+ };
55
+
56
+ var Option = function Option(props) {
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ style: props.data.style
59
+ }, /*#__PURE__*/React.createElement(components.Option, props));
60
+ };
61
+
62
+ var DTableSelect = /*#__PURE__*/function (_React$Component) {
63
+ _inherits(DTableSelect, _React$Component);
64
+
65
+ var _super = _createSuper(DTableSelect);
66
+
67
+ function DTableSelect() {
68
+ var _this;
69
+
70
+ _classCallCheck(this, DTableSelect);
71
+
72
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
73
+ args[_key] = arguments[_key];
74
+ }
75
+
76
+ _this = _super.call.apply(_super, [this].concat(args));
77
+
78
+ _this.getMenuPortalTarget = function () {
79
+ var menuPortalTarget = _this.props.menuPortalTarget;
80
+ return document.querySelector(menuPortalTarget);
81
+ };
82
+
83
+ return _this;
84
+ }
85
+
86
+ _createClass(DTableSelect, [{
87
+ key: "render",
88
+ value: function render() {
89
+ var _this$props = this.props,
90
+ options = _this$props.options,
91
+ onChange = _this$props.onChange,
92
+ value = _this$props.value,
93
+ isSearchable = _this$props.isSearchable,
94
+ placeholder = _this$props.placeholder,
95
+ isMulti = _this$props.isMulti,
96
+ menuPosition = _this$props.menuPosition,
97
+ isClearable = _this$props.isClearable,
98
+ noOptionsMessage = _this$props.noOptionsMessage,
99
+ classNamePrefix = _this$props.classNamePrefix;
100
+ return /*#__PURE__*/React.createElement(Select, {
101
+ value: value,
102
+ onChange: onChange,
103
+ options: options,
104
+ isMulti: isMulti,
105
+ classNamePrefix: classNamePrefix,
106
+ styles: MenuSelectStyle,
107
+ components: {
108
+ Option: Option,
109
+ DropdownIndicator: DropdownIndicator,
110
+ MenuList: MenuList
111
+ },
112
+ placeholder: placeholder,
113
+ isSearchable: isSearchable,
114
+ isClearable: isClearable,
115
+ menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
116
+ ,
117
+ menuShouldScrollIntoView: true,
118
+ menuPortalTarget: this.getMenuPortalTarget(),
119
+ captureMenuScroll: false,
120
+ noOptionsMessage: noOptionsMessage
121
+ });
122
+ }
123
+ }]);
124
+
125
+ return DTableSelect;
126
+ }(React.Component);
127
+
128
+ DTableSelect.defaultProps = {
129
+ options: [],
130
+ value: {},
131
+ isSearchable: false,
132
+ isClearable: false,
133
+ placeholder: '',
134
+ isMulti: false,
135
+ menuPortalTarget: '.modal',
136
+ noOptionsMessage: function noOptionsMessage() {
137
+ return null;
138
+ }
139
+ };
140
+ export default DTableSelect;
@@ -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);