@seafile/sdoc-editor 2.0.23 → 2.0.25
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.
- package/dist/api/seafile-api.js +4 -1
- package/dist/basic-sdk/extension/commons/insert-element-dialog/index.js +12 -2
- package/dist/basic-sdk/extension/constants/element-type.js +2 -1
- package/dist/basic-sdk/extension/constants/index.js +8 -2
- package/dist/basic-sdk/extension/constants/menus-config.js +5 -0
- package/dist/basic-sdk/extension/plugins/ai/ai-module/index.js +44 -24
- package/dist/basic-sdk/extension/plugins/ai/ai-module/style.css +6 -0
- package/dist/basic-sdk/extension/plugins/index.js +7 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/index.css +414 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/index.js +76 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/record-content.js +209 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/resize-handle/ResizeHandle.js +38 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/resize-handle/index.css +384 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/row-card-header-cell.js +125 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/row-card-header.js +144 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/row-card-item.js +161 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/dialog/add-seatable-row-dialog/seatable-table-record.js +47 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/helpers.js +98 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/index.js +17 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/menu/index.css +3 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/menu/index.js +46 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/menu/seatable-list.js +62 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/model.js +19 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/plugin.js +60 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/render-elem/index.css +124 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/render-elem/index.js +160 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/render-elem/record-header.js +78 -0
- package/dist/basic-sdk/extension/plugins/seatable-row/render-elem/record-item.js +41 -0
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/index.js +7 -2
- package/dist/basic-sdk/extension/render/custom-element.js +5 -0
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +3 -2
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +2 -1
- package/dist/constants/index.js +1 -0
- package/dist/context.js +2 -2
- package/dist/pages/document-plugin-editor.js +2 -1
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +7 -1
- package/public/locales/de/sdoc-editor.json +66 -60
- package/public/locales/en/sdoc-editor.json +10 -2
- package/public/locales/es/sdoc-editor.json +7 -1
- package/public/locales/es_AR/sdoc-editor.json +7 -1
- package/public/locales/es_MX/sdoc-editor.json +7 -1
- package/public/locales/fr/sdoc-editor.json +240 -234
- package/public/locales/it/sdoc-editor.json +7 -1
- package/public/locales/ru/sdoc-editor.json +8 -2
- package/public/locales/zh_CN/sdoc-editor.json +7 -2
- package/public/media/sdoc-editor-font/iconfont.css +15 -14
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +3 -1
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +11 -7
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _draggable = _interopRequireDefault(require("../../../../seatable-tables/draggable"));
|
|
11
|
+
require("./index.css");
|
|
12
|
+
const style = {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
top: 0,
|
|
15
|
+
width: 5,
|
|
16
|
+
borderRadius: '3px',
|
|
17
|
+
margin: '3px 0',
|
|
18
|
+
height: '80%'
|
|
19
|
+
};
|
|
20
|
+
class ResizeHandle extends _react.default.Component {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
(0, _defineProperty2.default)(this, "setResizeHandleLeft", left => {
|
|
24
|
+
this.draggable.setDraggableLeft(left);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_draggable.default, Object.assign({}, this.props, {
|
|
29
|
+
ref: ref => this.draggable = ref,
|
|
30
|
+
className: "react-grid-HeaderCell__resizeHandle",
|
|
31
|
+
style: {
|
|
32
|
+
...this.props.style,
|
|
33
|
+
...style
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var _default = exports.default = ResizeHandle;
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
.react-grid-Header {
|
|
2
|
+
background: #f9f9f9;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.react-grid-Header--resizing {
|
|
6
|
+
cursor: ew-resize;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.react-grid-HeaderRow {
|
|
10
|
+
-webkit-user-select: none;
|
|
11
|
+
-moz-user-select: none;
|
|
12
|
+
-ms-user-select: none;
|
|
13
|
+
user-select: none;
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dtable-header-setting {
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 30px;
|
|
21
|
+
float: right;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
color: #666666;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dtable-header-setting::after {
|
|
28
|
+
content: '';
|
|
29
|
+
display: block;
|
|
30
|
+
clear: both;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dtable-header-setting:hover {
|
|
34
|
+
color: #444;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dtable-header-setting-submenu .dtable-dropdown-menu {
|
|
39
|
+
top: -12px !important;
|
|
40
|
+
left: -10px !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.dtable-dropdown-menu .dtable-header-setting-submenu:hover .dtable-dropdown-menu .item-icon {
|
|
44
|
+
color: #8c8c8c;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dtable-dropdown-menu .dtable-header-setting-submenu:hover .dropdown-item:hover .item-icon {
|
|
48
|
+
color: #fff;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.react-grid-HeaderCell {
|
|
52
|
+
user-select: none;
|
|
53
|
+
background: #f9f9f9;
|
|
54
|
+
padding: 8px;
|
|
55
|
+
font-weight: normal;
|
|
56
|
+
border-right: 1px solid #dddddd;
|
|
57
|
+
border-bottom: 1px solid #dddddd;
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.react-grid-HeaderCell.rdg-row-actions-cell {
|
|
62
|
+
z-index: 3;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.react-grid-HeaderCell__value {
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
position: relative;
|
|
70
|
+
top: 50%;
|
|
71
|
+
transform: translateY(-50%);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.react-grid-HeaderCell__resizeHandle {
|
|
75
|
+
cursor: ew-resize;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.react-grid-HeaderCell__resizeHandle:hover {
|
|
79
|
+
background: #dddddd;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.react-grid-HeaderCell--frozen:last-of-type {
|
|
83
|
+
box-shadow: 2px 0 5px -2px rgba(136, 136, 136, 0.3);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.react-grid-HeaderCell--resizing .react-grid-HeaderCell__resizeHandle {
|
|
87
|
+
background: #dddddd;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.react-grid-HeaderCell__draggable {
|
|
91
|
+
cursor: col-resize;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.react-grid-HeaderCell__draggable:hover {
|
|
95
|
+
background-color: #2d7ff9;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rdg-can-drop > .react-grid-HeaderCell {
|
|
99
|
+
background: #ececec;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.react-grid-HeaderCell .Select {
|
|
103
|
+
max-height: 30px;
|
|
104
|
+
font-size: 12px;
|
|
105
|
+
font-weight: normal;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.react-grid-HeaderCell .Select-control {
|
|
109
|
+
max-height: 30px;
|
|
110
|
+
border: 1px solid #cccccc;
|
|
111
|
+
color: #555;
|
|
112
|
+
border-radius: 3px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.react-grid-HeaderCell .is-focused:not(.is-open) > .Select-control {
|
|
116
|
+
border-color: #66afe9;
|
|
117
|
+
outline: 0;
|
|
118
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
|
119
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.react-grid-HeaderCell .Select-control .Select-placeholder {
|
|
123
|
+
line-height: 20px;
|
|
124
|
+
color: #999;
|
|
125
|
+
padding: 4px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.react-grid-HeaderCell .Select-control .Select-input {
|
|
129
|
+
max-height: 28px;
|
|
130
|
+
padding: 4px;
|
|
131
|
+
margin-left: 0px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.react-grid-HeaderCell .Select-control .Select-input input {
|
|
135
|
+
padding: 0px;
|
|
136
|
+
height: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.react-grid-HeaderCell .Select-control .Select-arrow-zone .Select-arrow {
|
|
140
|
+
border-color: gray transparent transparent;
|
|
141
|
+
border-width: 4px 4px 2.5px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.react-grid-HeaderCell .Select-control .Select-value {
|
|
145
|
+
padding: 4px;
|
|
146
|
+
line-height: 20px !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.react-grid-HeaderCell .Select--multi .Select-control .Select-value {
|
|
150
|
+
padding: 0px;
|
|
151
|
+
line-height: 16px !important;
|
|
152
|
+
max-height: 20px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.react-grid-HeaderCell .Select--multi .Select-control .Select-value .Select-value-icon {
|
|
156
|
+
max-height: 20px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.react-grid-HeaderCell .Select--multi .Select-control .Select-value .Select-value-label {
|
|
160
|
+
max-height: 20px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.react-grid-HeaderCell .Select-control .Select-value .Select-value-label {
|
|
164
|
+
color: #555555 !important;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.react-grid-HeaderCell .Select-menu-outer {
|
|
168
|
+
z-index: 2;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.react-grid-HeaderCell .Select-menu-outer .Select-option {
|
|
172
|
+
padding: 4px;
|
|
173
|
+
line-height: 20px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.react-grid-HeaderCell .Select-menu-outer .Select-menu .Select-option.is-selected {
|
|
177
|
+
color: #555555;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.react-grid-HeaderCell .Select-menu-outer .Select-menu .Select-option.is-focused {
|
|
181
|
+
color: #555555;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* custom */
|
|
185
|
+
.header-cell-container {
|
|
186
|
+
width: 100%;
|
|
187
|
+
height: 100%;
|
|
188
|
+
display: flex;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.header-cell-container > div {
|
|
192
|
+
display: flex;
|
|
193
|
+
flex: 1;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: space-between;
|
|
196
|
+
width: 100%;
|
|
197
|
+
min-width: 30px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.header-cell-container .header-cell-left {
|
|
201
|
+
width: calc(100% - 20px);
|
|
202
|
+
display: flex;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.header-cell-container .header-uneditable-cell-left {
|
|
206
|
+
width: calc(100% - 34px);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.header-cell-container .header-uneditable-description-cell-left {
|
|
210
|
+
width: calc(100% - 50px);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.header-cell-container .dtable-dropdown-menu {
|
|
214
|
+
width: 20px;
|
|
215
|
+
padding: 0 5px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.header-icon {
|
|
219
|
+
display: inline-block;
|
|
220
|
+
padding: 0 0.3125rem;
|
|
221
|
+
margin-left: -0.3125rem;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.header-cell-container .header-icon {
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.header-icon:hover {
|
|
230
|
+
cursor: default;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.header-icon .dtable-font {
|
|
234
|
+
font-size: 14px;
|
|
235
|
+
color: #aaa;
|
|
236
|
+
cursor: default;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.header-icon .dtable-font.dtable-icon-use-help {
|
|
240
|
+
color: #bdbdbd;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.header-icon .dtable-font.dtable-icon-use-help:hover {
|
|
244
|
+
color: #888;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.bs-tooltip-bottom .arrow::before,
|
|
248
|
+
.bs-tooltip-auto[x-placement^='bottom'] .arrow::before {
|
|
249
|
+
border-bottom-color: #303133;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.bs-tooltip-auto[x-placement^='right'] .arrow::before {
|
|
253
|
+
border-right-color: #303133;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.bs-tooltip-auto[x-placement^='left'] .arrow::before {
|
|
257
|
+
border-left-color: #303133;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.tooltip-inner {
|
|
261
|
+
max-width: 242px;
|
|
262
|
+
font-weight: lighter;
|
|
263
|
+
text-align: start;
|
|
264
|
+
background-color: #303133;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.help-icon-tooltip-inner {
|
|
268
|
+
position: relative;
|
|
269
|
+
overflow: hidden;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.help-icon-tooltip-btn {
|
|
273
|
+
float: right;
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
color: rgba(255, 255, 255, 0.6);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.help-icon-tooltip-btn:hover {
|
|
279
|
+
color: rgba(255, 255, 255, 1);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.expand-row-icon {
|
|
283
|
+
display: inline-block;
|
|
284
|
+
margin-right: 0.5rem;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.expand-row-icon .dtable-font {
|
|
288
|
+
font-size: 14px;
|
|
289
|
+
color: #535354;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.header-name {
|
|
293
|
+
margin-left: 3px;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.header-cell-container .header-name {
|
|
298
|
+
align-items: center;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.header-dropdown {
|
|
302
|
+
position: unset;
|
|
303
|
+
display: inline-block;
|
|
304
|
+
margin-left: auto;
|
|
305
|
+
z-index: 1;
|
|
306
|
+
cursor: pointer !important;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.header-dropdown:hover {
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.header-dropdown > span {
|
|
314
|
+
display: inline-block;
|
|
315
|
+
padding: 0 6px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.header-dropdown .dtable-icon-drop-down {
|
|
319
|
+
display: inline-block;
|
|
320
|
+
font-size: 12px;
|
|
321
|
+
color: #999;
|
|
322
|
+
transform: scale(0.8);
|
|
323
|
+
transition: all 0.1s;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.header-dropdown:hover .dtable-icon-drop-down {
|
|
327
|
+
color: #aaa;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.header-dropdown .dropdown-item:hover {
|
|
331
|
+
background-color: #20a0ff;
|
|
332
|
+
color: #fff;
|
|
333
|
+
cursor: pointer;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.dtable-dropdown-menu .header-dropdown .grid-header-dropdown-item {
|
|
337
|
+
padding: 0 1rem !important;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.header-dropdown .grid-header-dropdown-item .item-icon {
|
|
341
|
+
line-height: 32px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.dtable-dropdown-menu .grid-header-dropdown-item.formula-date-format-item {
|
|
345
|
+
padding-left: 15px;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.react-grid-HeaderCell.add-column-icon {
|
|
349
|
+
display: flex;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
align-items: center;
|
|
352
|
+
padding: 0;
|
|
353
|
+
position: absolute;
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.react-grid-HeaderCell.add-column-icon .dtable-font {
|
|
358
|
+
font-size: 15px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.react-grid-HeaderCell-default .header-cell-container .widget-HeaderCell__value {
|
|
362
|
+
line-height: 24px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.react-grid-HeaderCell-default .header-name .header-name-text {
|
|
366
|
+
overflow: hidden;
|
|
367
|
+
text-overflow: ellipsis;
|
|
368
|
+
white-space: nowrap;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.react-grid-HeaderCell-double .header-cell-container .header-cell-left {
|
|
372
|
+
height: 100%;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.react-grid-HeaderCell-double .header-name .header-name-text {
|
|
376
|
+
display: -webkit-box;
|
|
377
|
+
-webkit-line-clamp: 2;
|
|
378
|
+
-webkit-box-orient: vertical;
|
|
379
|
+
overflow: hidden;
|
|
380
|
+
text-overflow: ellipsis;
|
|
381
|
+
white-space: initial;
|
|
382
|
+
max-height: 46px;
|
|
383
|
+
height: fit-content;
|
|
384
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _ResizeHandle = _interopRequireDefault(require("./resize-handle/ResizeHandle"));
|
|
13
|
+
var _constants = require("../../../../../../constants");
|
|
14
|
+
var _basicSdk = require("../../../../../../basic-sdk");
|
|
15
|
+
class RowCardHeaderCell extends _react.default.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
(0, _defineProperty2.default)(this, "getHeaderCellWidth", () => {
|
|
19
|
+
const {
|
|
20
|
+
column,
|
|
21
|
+
rowCardType,
|
|
22
|
+
table
|
|
23
|
+
} = this.props;
|
|
24
|
+
const {
|
|
25
|
+
key,
|
|
26
|
+
width
|
|
27
|
+
} = column;
|
|
28
|
+
let headerCellWidth = width;
|
|
29
|
+
if (rowCardType === 'link') {
|
|
30
|
+
const tableId = table._id;
|
|
31
|
+
const draggedCellId = `${tableId}-${key}`;
|
|
32
|
+
const existedWidth = JSON.parse(localStorage.getItem(draggedCellId));
|
|
33
|
+
if (existedWidth) {
|
|
34
|
+
headerCellWidth = existedWidth;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return headerCellWidth;
|
|
38
|
+
});
|
|
39
|
+
(0, _defineProperty2.default)(this, "onDrag", e => {
|
|
40
|
+
const headerCellWidth = this.getWidthFromMouseEvent(e);
|
|
41
|
+
this.setState({
|
|
42
|
+
headerCellWidth
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
(0, _defineProperty2.default)(this, "onDragStart", e => {
|
|
46
|
+
this.setState({
|
|
47
|
+
resizing: true
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
(0, _defineProperty2.default)(this, "onDragEnd", e => {
|
|
51
|
+
const {
|
|
52
|
+
column,
|
|
53
|
+
table
|
|
54
|
+
} = this.props;
|
|
55
|
+
const columnKey = column.key;
|
|
56
|
+
const {
|
|
57
|
+
_id: tableId
|
|
58
|
+
} = table;
|
|
59
|
+
const draggedCellId = `${tableId}-${columnKey}`;
|
|
60
|
+
let width = this.getWidthFromMouseEvent(e);
|
|
61
|
+
this.setState({
|
|
62
|
+
resizing: false
|
|
63
|
+
});
|
|
64
|
+
const eventBus = _basicSdk.EventBus.getInstance();
|
|
65
|
+
eventBus.dispatch(_constants.EXTERNAL_EVENT.CHANGE_HEADER_WIDTH, {
|
|
66
|
+
id: draggedCellId,
|
|
67
|
+
width
|
|
68
|
+
});
|
|
69
|
+
localStorage.setItem(draggedCellId, width);
|
|
70
|
+
});
|
|
71
|
+
(0, _defineProperty2.default)(this, "getWidthFromMouseEvent", e => {
|
|
72
|
+
let right = e.pageX || e.touches && e.touches[0] && e.touches[0].pageX || e.changedTouches && e.changedTouches[e.changedTouches.length - 1].pageX;
|
|
73
|
+
if (e.pageX === 0) {
|
|
74
|
+
right = 0;
|
|
75
|
+
}
|
|
76
|
+
const left = _reactDom.default.findDOMNode(this.headerCell).getBoundingClientRect().left;
|
|
77
|
+
// add 5px is ResizeHandle component DOM width, and the draggable column minimum width is 50px
|
|
78
|
+
return Math.max(right - left + 5, 50);
|
|
79
|
+
});
|
|
80
|
+
this.state = {
|
|
81
|
+
resizing: false,
|
|
82
|
+
headerCellWidth: this.getHeaderCellWidth(),
|
|
83
|
+
isDraggable: props.rowCardType === 'link'
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
const {
|
|
88
|
+
column
|
|
89
|
+
} = this.props;
|
|
90
|
+
const {
|
|
91
|
+
headerCellWidth,
|
|
92
|
+
resizing,
|
|
93
|
+
isDraggable
|
|
94
|
+
} = this.state;
|
|
95
|
+
const {
|
|
96
|
+
name,
|
|
97
|
+
key
|
|
98
|
+
} = column;
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: (0, _classnames.default)('row-card-column-name text-truncate position-relative', {
|
|
101
|
+
'row-card-column--resizing': resizing
|
|
102
|
+
}, {
|
|
103
|
+
'row-card-draggable': isDraggable
|
|
104
|
+
})
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
ref: ref => this.headerCell = ref,
|
|
107
|
+
className: "row-card-column-name-item position-relative",
|
|
108
|
+
style: {
|
|
109
|
+
width: headerCellWidth
|
|
110
|
+
},
|
|
111
|
+
key: key,
|
|
112
|
+
title: name
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
114
|
+
title: name
|
|
115
|
+
}, name)), isDraggable && /*#__PURE__*/_react.default.createElement(_ResizeHandle.default, {
|
|
116
|
+
style: {
|
|
117
|
+
right: 0
|
|
118
|
+
},
|
|
119
|
+
onDrag: this.onDrag,
|
|
120
|
+
onDragStart: this.onDragStart,
|
|
121
|
+
onDragEnd: this.onDragEnd
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var _default = exports.default = RowCardHeaderCell;
|
|
@@ -0,0 +1,144 @@
|
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _rowCardHeaderCell = _interopRequireDefault(require("./row-card-header-cell"));
|
|
12
|
+
class RowCardHeader extends _react.default.Component {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super(props);
|
|
15
|
+
(0, _defineProperty2.default)(this, "onScrollControlClick", type => {
|
|
16
|
+
const tablesNav = this.linkRecordsHeader;
|
|
17
|
+
const {
|
|
18
|
+
offsetWidth,
|
|
19
|
+
scrollWidth,
|
|
20
|
+
scrollLeft
|
|
21
|
+
} = tablesNav;
|
|
22
|
+
let targetScrollLeft;
|
|
23
|
+
if (type === 'prev') {
|
|
24
|
+
if (scrollLeft === 0) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
targetScrollLeft = scrollLeft - offsetWidth;
|
|
28
|
+
targetScrollLeft = targetScrollLeft > 0 ? targetScrollLeft : 0;
|
|
29
|
+
}
|
|
30
|
+
if (type === 'next') {
|
|
31
|
+
if (scrollLeft + offsetWidth === scrollWidth) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
targetScrollLeft = scrollLeft + offsetWidth;
|
|
35
|
+
targetScrollLeft = targetScrollLeft > scrollWidth - offsetWidth ? scrollWidth - offsetWidth : targetScrollLeft;
|
|
36
|
+
}
|
|
37
|
+
if (this.state.canCardHeaderScroll) {
|
|
38
|
+
this.setState({
|
|
39
|
+
canCardHeaderScroll: false
|
|
40
|
+
});
|
|
41
|
+
let timer = null;
|
|
42
|
+
let step = (targetScrollLeft - scrollLeft) / 10;
|
|
43
|
+
step = step > 0 ? Math.ceil(step) : Math.floor(step);
|
|
44
|
+
timer = setInterval(() => {
|
|
45
|
+
tablesNav.scrollLeft = tablesNav.scrollLeft + step;
|
|
46
|
+
if (Math.abs(targetScrollLeft - tablesNav.scrollLeft) <= Math.abs(step)) {
|
|
47
|
+
tablesNav.scrollLeft = targetScrollLeft;
|
|
48
|
+
clearInterval(timer);
|
|
49
|
+
this.setState({
|
|
50
|
+
canCardHeaderScroll: true
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, 30);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
(0, _defineProperty2.default)(this, "onScrollHeader", () => {
|
|
57
|
+
let {
|
|
58
|
+
scrollLeft
|
|
59
|
+
} = this.linkRecordsHeader;
|
|
60
|
+
this.props.setItemScrollLeft(scrollLeft, -1);
|
|
61
|
+
if (this.timer) {
|
|
62
|
+
clearTimeout(this.timer);
|
|
63
|
+
}
|
|
64
|
+
this.timer = setTimeout(() => {
|
|
65
|
+
this.props.setScrollLeft(scrollLeft);
|
|
66
|
+
}, 60);
|
|
67
|
+
});
|
|
68
|
+
(0, _defineProperty2.default)(this, "setHeaderScrollLeft", scrollLeft => {
|
|
69
|
+
this.linkRecordsHeader.scrollLeft = scrollLeft;
|
|
70
|
+
});
|
|
71
|
+
(0, _defineProperty2.default)(this, "getCardHeaderCells", () => {
|
|
72
|
+
const cardHeaderCells = [];
|
|
73
|
+
const {
|
|
74
|
+
renderedColumns,
|
|
75
|
+
rowCardType,
|
|
76
|
+
table
|
|
77
|
+
} = this.props;
|
|
78
|
+
// Start from the second column without name
|
|
79
|
+
for (let i = 1; i < renderedColumns.length; i++) {
|
|
80
|
+
const renderedColumn = renderedColumns[i];
|
|
81
|
+
cardHeaderCells.push( /*#__PURE__*/_react.default.createElement(_rowCardHeaderCell.default, {
|
|
82
|
+
key: renderedColumn.key,
|
|
83
|
+
column: renderedColumn,
|
|
84
|
+
rowCardType: rowCardType,
|
|
85
|
+
table: table
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
return cardHeaderCells;
|
|
89
|
+
});
|
|
90
|
+
this.state = {
|
|
91
|
+
canCardHeaderScroll: true,
|
|
92
|
+
linkRecordsNavScrollWidth: 0,
|
|
93
|
+
linkRecordsNavWidth: 0
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
componentDidUpdate(prevProps, prevState) {
|
|
97
|
+
const {
|
|
98
|
+
offsetWidth,
|
|
99
|
+
scrollWidth
|
|
100
|
+
} = this.linkRecordsHeader;
|
|
101
|
+
if (prevState.linkRecordsNavScrollWidth !== scrollWidth || prevState.linkRecordsNavWidth !== offsetWidth) {
|
|
102
|
+
this.props.getCurrentDisplayRowMaxIndex();
|
|
103
|
+
this.setState({
|
|
104
|
+
linkRecordsNavScrollWidth: scrollWidth,
|
|
105
|
+
linkRecordsNavWidth: offsetWidth
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
render() {
|
|
110
|
+
const {
|
|
111
|
+
showScrollBtn,
|
|
112
|
+
scrollLeft,
|
|
113
|
+
cardHeaderClassName
|
|
114
|
+
} = this.props;
|
|
115
|
+
const {
|
|
116
|
+
linkRecordsNavWidth,
|
|
117
|
+
linkRecordsNavScrollWidth
|
|
118
|
+
} = this.state;
|
|
119
|
+
const cardHeaderCells = this.getCardHeaderCells();
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
+
className: `row-card-header ${cardHeaderClassName ? cardHeaderClassName : ''}`
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
className: "row-card-column-names records-column-names",
|
|
124
|
+
ref: ref => this.recordItemRef = ref
|
|
125
|
+
}, showScrollBtn && /*#__PURE__*/_react.default.createElement("span", {
|
|
126
|
+
className: (0, _classnames.default)('dtable-font', 'dtable-icon-left', 'row-card-scroll', 'link-scroll-prev', {
|
|
127
|
+
'scroll-active': scrollLeft > 0
|
|
128
|
+
}),
|
|
129
|
+
onClick: this.onScrollControlClick.bind(this, 'prev')
|
|
130
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: "row-card-columns-container",
|
|
132
|
+
onScroll: this.onScrollHeader,
|
|
133
|
+
ref: ref => this.linkRecordsHeader = ref
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
135
|
+
className: "d-inline-flex"
|
|
136
|
+
}, cardHeaderCells)), showScrollBtn && /*#__PURE__*/_react.default.createElement("span", {
|
|
137
|
+
className: (0, _classnames.default)('dtable-font', 'dtable-icon-right', 'row-card-scroll', 'link-scroll-next', {
|
|
138
|
+
'scroll-active': scrollLeft + linkRecordsNavWidth < linkRecordsNavScrollWidth
|
|
139
|
+
}),
|
|
140
|
+
onClick: this.onScrollControlClick.bind(this, 'next')
|
|
141
|
+
})));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
var _default = exports.default = RowCardHeader;
|