@seafile/seafile-database 0.0.24 → 0.0.26
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/api.js +19 -21
- package/dist/assets/css/dropdown-menu.css +96 -0
- package/dist/assets/css/file-repo.css +3 -0
- package/dist/common/components/file-tag/index.js +2 -2
- package/dist/common/components/modal-portal.js +12 -0
- package/dist/common/utils/icon-utils.js +9 -2
- package/dist/common/utils/utils.js +28 -0
- package/dist/components/cell-editors/index.js +2 -2
- package/dist/components/cell-editors/multiple-select-editor/index.js +2 -2
- package/dist/components/cell-editors/single-select-editor/index.js +2 -2
- package/dist/components/cell-editors/tags-editor/index.js +1 -2
- package/dist/components/cell-formatter/creator.js +3 -2
- package/dist/components/context-menu/index.js +2 -2
- package/dist/components/data-process-setter/filter-setter.js +2 -3
- package/dist/components/data-process-setter/hide-column-setter.js +1 -1
- package/dist/components/data-process-setter/index.js +7 -0
- package/dist/components/data-process-setter/manage-setter.js +1 -2
- package/dist/components/data-process-setter/settings-setter.js +119 -0
- package/dist/components/data-process-setter/sort-setter.js +2 -2
- package/dist/components/data-process-setter/view-type-setter.js +53 -0
- package/dist/components/dialogs/custom-modal-header/index.css +34 -0
- package/dist/components/dialogs/custom-modal-header/index.js +34 -0
- package/dist/components/dialogs/insert-view-dialog.js +104 -0
- package/dist/components/hover-menu/index.css +85 -0
- package/dist/components/hover-menu/index.js +107 -0
- package/dist/components/icons/arrow-down-icon.js +19 -0
- package/dist/components/icons/arrow-right-icon.js +29 -0
- package/dist/components/icons/arrow-up-icon.js +19 -0
- package/dist/components/icons/card-icon.js +28 -0
- package/dist/components/icons/close-icon.js +23 -0
- package/dist/components/icons/index.js +23 -1
- package/dist/components/icons/set-up-icon.js +22 -0
- package/dist/components/icons/table-icon.js +19 -0
- package/dist/components/image-previewer/_hooks/metadata-details.js +1 -1
- package/dist/components/image-previewer/_hooks/metadata-status.js +2 -2
- package/dist/components/image-previewer/image-detail/index.js +1 -1
- package/dist/components/image-previewer/index.js +2 -2
- package/dist/components/popover/groupbys-popover/index.js +5 -5
- package/dist/components/popover/index.js +7 -0
- package/dist/components/popover/settings-popover/field-display-settings/field-item.js +110 -0
- package/dist/components/popover/settings-popover/field-display-settings/index.css +135 -0
- package/dist/components/popover/settings-popover/field-display-settings/index.js +119 -0
- package/dist/components/popover/settings-popover/index.css +52 -0
- package/dist/components/popover/settings-popover/index.js +99 -0
- package/dist/components/popover/sort-popover/index.js +1 -1
- package/dist/components/popover/view-type-popover/index.css +51 -0
- package/dist/components/popover/view-type-popover/index.js +64 -0
- package/dist/components/searcher/index.js +3 -3
- package/dist/components/view-toolbar/card-view-toolbar/index.js +89 -0
- package/dist/components/view-toolbar/index.css +54 -1
- package/dist/components/view-toolbar/index.js +40 -48
- package/dist/components/view-toolbar/rows-toolbar/index.js +2 -2
- package/dist/components/view-toolbar/table-view-toolbar/index.js +1 -1
- package/dist/components/view-toolbar/view-items/index.css +55 -0
- package/dist/components/view-toolbar/view-items/index.js +98 -0
- package/dist/components/view-toolbar/view-items/views-popover.js +80 -0
- package/dist/constants/event-bus-type.js +3 -1
- package/dist/constants/view/index.js +44 -2
- package/dist/context.js +60 -35
- package/dist/file-view-base.js +44 -0
- package/dist/file-view.js +140 -0
- package/dist/global-settings.js +3 -1
- package/dist/hooks/collaborators.js +9 -3
- package/dist/hooks/file-view-context.js +95 -0
- package/dist/hooks/index.js +14 -14
- package/dist/hooks/metadata.js +51 -47
- package/dist/hooks/tagsData.js +8 -2
- package/dist/hooks/view-context.js +69 -0
- package/dist/index.js +3 -3
- package/dist/locale/en.js +11 -1
- package/dist/locale/zh_CN.js +6 -1
- package/dist/store/data-processor.js +1 -0
- package/dist/store/index.js +8 -6
- package/dist/store/operations/apply.js +1 -1
- package/dist/store/server-operator.js +20 -7
- package/dist/views/card/card-items/card-item/formatter.js +45 -0
- package/dist/views/card/card-items/card-item/index.css +234 -0
- package/dist/views/card/card-items/card-item/index.js +206 -0
- package/dist/views/card/card-items/index.css +31 -0
- package/dist/views/card/card-items/index.js +189 -0
- package/dist/views/card/context-menu/index.js +165 -0
- package/dist/views/card/index.js +64 -0
- package/dist/views/card/settings/index.css +68 -0
- package/dist/views/card/settings/index.js +143 -0
- package/dist/views/index.js +5 -3
- package/dist/views/table/editors/editor-container/index.js +2 -2
- package/dist/views/table/formatters/file-name.js +3 -3
- package/dist/views/table/index.js +2 -3
- package/dist/views/table/table-main/index.js +2 -2
- package/dist/views/table/table-main/rows/row/cell/formatter.js +2 -2
- package/dist/views/table/table-main/rows/row/cell/index.js +2 -2
- package/dist/views/table/table-main/rows-header/cell/dropdown-menu/index.js +1 -1
- package/dist/views/table/table-main/rows-header/cell/index.js +1 -1
- package/dist/views/table/table-main/rows-header/index.js +2 -2
- package/package.json +3 -2
- package/dist/components/view-toolbar/views/all-views/index.css +0 -85
- package/dist/components/view-toolbar/views/all-views/index.js +0 -165
- package/dist/components/view-toolbar/views/index.css +0 -22
- package/dist/components/view-toolbar/views/index.js +0 -215
- package/dist/components/view-toolbar/views/view-item/index.css +0 -83
- package/dist/components/view-toolbar/views/view-item/index.js +0 -159
- package/dist/database.js +0 -53
- package/dist/hooks/viewsData.js +0 -114
package/dist/hooks/metadata.js
CHANGED
|
@@ -14,11 +14,12 @@ var _translate = _interopRequireDefault(require("../lang/translate"));
|
|
|
14
14
|
var _constants = require("../constants");
|
|
15
15
|
var _store = _interopRequireDefault(require("../store"));
|
|
16
16
|
var _row = require("../utils/row");
|
|
17
|
-
var _appContext = require("./app-context");
|
|
18
17
|
var _collaborators = require("./collaborators");
|
|
18
|
+
var _fileViewContext = require("./file-view-context");
|
|
19
19
|
var _selectedRows = require("./selected-rows");
|
|
20
20
|
var _tagsData = require("./tagsData");
|
|
21
21
|
var _typesData = require("./typesData");
|
|
22
|
+
var _viewContext = require("./view-context");
|
|
22
23
|
/* eslint-disable react/prop-types */
|
|
23
24
|
|
|
24
25
|
const MetadataContext = /*#__PURE__*/_react.default.createContext(null);
|
|
@@ -31,12 +32,18 @@ const MetadataProvider = _ref => {
|
|
|
31
32
|
} = _ref;
|
|
32
33
|
const {
|
|
33
34
|
context
|
|
34
|
-
} = (0,
|
|
35
|
+
} = (0, _fileViewContext.useFileViewContext)();
|
|
36
|
+
const {
|
|
37
|
+
currentViewId
|
|
38
|
+
} = (0, _viewContext.useViewContext)();
|
|
35
39
|
const [isLoading, setLoading] = (0, _react.useState)(true);
|
|
36
40
|
const [metadata, setMetadata] = (0, _react.useState)({
|
|
37
41
|
rows: [],
|
|
38
42
|
columns: [],
|
|
39
|
-
view: {
|
|
43
|
+
view: {
|
|
44
|
+
type: '',
|
|
45
|
+
columns: []
|
|
46
|
+
}
|
|
40
47
|
});
|
|
41
48
|
const [errorMessage, setErrorMessage] = (0, _react.useState)(null);
|
|
42
49
|
const storeRef = (0, _react.useRef)(null);
|
|
@@ -53,7 +60,38 @@ const MetadataProvider = _ref => {
|
|
|
53
60
|
const {
|
|
54
61
|
typesData
|
|
55
62
|
} = (0, _typesData.useTypesData)();
|
|
56
|
-
|
|
63
|
+
|
|
64
|
+
// init
|
|
65
|
+
(0, _react.useEffect)(() => {
|
|
66
|
+
let isCancelled = false;
|
|
67
|
+
setLoading(true);
|
|
68
|
+
const allCollaborators = [...collaborators, ...Object.values(collaboratorsCache)];
|
|
69
|
+
const props = {
|
|
70
|
+
context,
|
|
71
|
+
collaborators: allCollaborators,
|
|
72
|
+
tagsData,
|
|
73
|
+
typesData,
|
|
74
|
+
viewId: currentViewId
|
|
75
|
+
};
|
|
76
|
+
storeRef.current = new _store.default(props);
|
|
77
|
+
storeRef.current.initStartIndex();
|
|
78
|
+
storeRef.current.load(_constants.PER_LOAD_NUMBER).then(() => {
|
|
79
|
+
if (!isCancelled) {
|
|
80
|
+
setMetadata(storeRef.current.data);
|
|
81
|
+
setLoading(false);
|
|
82
|
+
}
|
|
83
|
+
}).catch(error => {
|
|
84
|
+
if (!isCancelled) {
|
|
85
|
+
const errorMsg = _utils.Utils.getErrorMsg(error);
|
|
86
|
+
setErrorMessage(errorMsg);
|
|
87
|
+
setLoading(false);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return () => {
|
|
91
|
+
isCancelled = true;
|
|
92
|
+
storeRef.current.destroy();
|
|
93
|
+
};
|
|
94
|
+
}, [collaborators, collaboratorsCache, context, currentViewId, localStorageNamePrefix, tagsData, typesData]);
|
|
57
95
|
const tableChanged = (0, _react.useCallback)(() => {
|
|
58
96
|
setMetadata(storeRef.current.data);
|
|
59
97
|
}, []);
|
|
@@ -76,6 +114,9 @@ const MetadataProvider = _ref => {
|
|
|
76
114
|
setLoading(false);
|
|
77
115
|
});
|
|
78
116
|
}, []);
|
|
117
|
+
const modifyViewType = (0, _react.useCallback)(viewType => {
|
|
118
|
+
storeRef.current.modifyViewType(viewType);
|
|
119
|
+
}, [storeRef]);
|
|
79
120
|
const modifyFilters = (0, _react.useCallback)((filters, filterConjunction, basicFilters) => {
|
|
80
121
|
storeRef.current.modifyFilters(filterConjunction, filters, basicFilters);
|
|
81
122
|
}, [storeRef]);
|
|
@@ -250,59 +291,20 @@ const MetadataProvider = _ref => {
|
|
|
250
291
|
let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
251
292
|
storeRef.current.searchRows(searchValue);
|
|
252
293
|
}, [storeRef]);
|
|
294
|
+
const updateSelectedRecordIds = () => {};
|
|
295
|
+
const updateCurrentDirent = () => {};
|
|
253
296
|
const onKeydown = (0, _react.useCallback)(event => {
|
|
254
297
|
if ((0, _hotkey.isModF)(event) && (!event.target || event.target.className.indexOf('modal') < 0)) {
|
|
255
298
|
event.preventDefault();
|
|
256
299
|
context.eventBus && context.eventBus.dispatch(_constants.EVENT_BUS_TYPE.START_SEARCH_ROWS);
|
|
257
300
|
}
|
|
258
301
|
}, [context.eventBus]);
|
|
259
|
-
(0, _react.useEffect)(() => {
|
|
260
|
-
if (isLoading) return;
|
|
261
|
-
storeRef.current.tagsData = tagsData;
|
|
262
|
-
}, [isLoading, tagsData]);
|
|
263
|
-
(0, _react.useEffect)(() => {
|
|
264
|
-
if (isLoading) return;
|
|
265
|
-
storeRef.current.typesData = typesData;
|
|
266
|
-
}, [isLoading, typesData]);
|
|
267
|
-
(0, _react.useEffect)(() => {
|
|
268
|
-
if (isLoading) return;
|
|
269
|
-
storeRef.current.collaborators = [...collaborators, ...Object.values(collaboratorsCache)];
|
|
270
|
-
}, [isLoading, collaborators, collaboratorsCache]);
|
|
271
302
|
(0, _react.useEffect)(() => {
|
|
272
303
|
document.addEventListener('keydown', onKeydown);
|
|
273
304
|
return () => {
|
|
274
305
|
document.removeEventListener('keydown', onKeydown);
|
|
275
306
|
};
|
|
276
307
|
}, [onKeydown]);
|
|
277
|
-
|
|
278
|
-
// init
|
|
279
|
-
(0, _react.useEffect)(() => {
|
|
280
|
-
let isCancelled = false;
|
|
281
|
-
setLoading(true);
|
|
282
|
-
storeRef.current = new _store.default({
|
|
283
|
-
context,
|
|
284
|
-
viewId: viewID,
|
|
285
|
-
typesData,
|
|
286
|
-
tagsData
|
|
287
|
-
});
|
|
288
|
-
storeRef.current.initStartIndex();
|
|
289
|
-
storeRef.current.load(_constants.PER_LOAD_NUMBER).then(() => {
|
|
290
|
-
if (!isCancelled) {
|
|
291
|
-
setMetadata(storeRef.current.data);
|
|
292
|
-
setLoading(false);
|
|
293
|
-
}
|
|
294
|
-
}).catch(error => {
|
|
295
|
-
if (!isCancelled) {
|
|
296
|
-
const errorMsg = _utils.Utils.getErrorMsg(error);
|
|
297
|
-
setErrorMessage(errorMsg);
|
|
298
|
-
setLoading(false);
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
return () => {
|
|
302
|
-
isCancelled = true;
|
|
303
|
-
storeRef.current.destroy();
|
|
304
|
-
};
|
|
305
|
-
}, [context, localStorageNamePrefix, tagsData, typesData, viewID]);
|
|
306
308
|
(0, _react.useEffect)(() => {
|
|
307
309
|
const eventBus = context.eventBus;
|
|
308
310
|
const unsubscribeServerTableChanged = eventBus.subscribe(_constants.EVENT_BUS_TYPE.SERVER_DATA_CHANGED, tableChanged);
|
|
@@ -335,10 +337,10 @@ const MetadataProvider = _ref => {
|
|
|
335
337
|
value: {
|
|
336
338
|
...params,
|
|
337
339
|
isLoading,
|
|
338
|
-
viewID,
|
|
339
340
|
errorMessage,
|
|
340
341
|
metadata,
|
|
341
342
|
store: storeRef.current,
|
|
343
|
+
modifyViewType,
|
|
342
344
|
modifySettings,
|
|
343
345
|
modifyFilters,
|
|
344
346
|
modifySorts,
|
|
@@ -361,7 +363,9 @@ const MetadataProvider = _ref => {
|
|
|
361
363
|
modifyColumnWidth,
|
|
362
364
|
insertColumn,
|
|
363
365
|
updateLocalRow,
|
|
364
|
-
createContextMenuOptions
|
|
366
|
+
createContextMenuOptions,
|
|
367
|
+
updateSelectedRecordIds,
|
|
368
|
+
updateCurrentDirent
|
|
365
369
|
}
|
|
366
370
|
}, children);
|
|
367
371
|
};
|
package/dist/hooks/tagsData.js
CHANGED
|
@@ -7,10 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.useTagsData = exports.TagsDataProvider = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _components = require("../common/components");
|
|
10
11
|
var _tagsSort = require("../constants/tags-sort");
|
|
11
12
|
var _tagsData = _interopRequireDefault(require("../models/tagsData"));
|
|
12
13
|
var _column = require("../utils/column");
|
|
13
|
-
var
|
|
14
|
+
var _fileViewContext = require("./file-view-context");
|
|
14
15
|
/* eslint-disable react/prop-types */
|
|
15
16
|
|
|
16
17
|
const TagsDataContext = /*#__PURE__*/_react.default.createContext(null);
|
|
@@ -31,7 +32,7 @@ const TagsDataProvider = _ref => {
|
|
|
31
32
|
} = _ref;
|
|
32
33
|
const {
|
|
33
34
|
context
|
|
34
|
-
} = (0,
|
|
35
|
+
} = (0, _fileViewContext.useFileViewContext)();
|
|
35
36
|
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
36
37
|
const [tagsData, setTagsData] = (0, _react.useState)([]);
|
|
37
38
|
(0, _react.useEffect)(() => {
|
|
@@ -46,6 +47,11 @@ const TagsDataProvider = _ref => {
|
|
|
46
47
|
const addTag = () => {};
|
|
47
48
|
const toggleAllTags = () => {};
|
|
48
49
|
const modifyLocalFileTags = () => {};
|
|
50
|
+
if (isLoading) {
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: 'sea-metadata'
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_components.CenteredLoading, null));
|
|
54
|
+
}
|
|
49
55
|
return /*#__PURE__*/_react.default.createElement(TagsDataContext.Provider, {
|
|
50
56
|
value: {
|
|
51
57
|
isLoading,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useViewContext = exports.ViewContextProvider = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _components = require("../common/components");
|
|
10
|
+
var _fileViewContext = require("./file-view-context");
|
|
11
|
+
/* eslint-disable react/prop-types */
|
|
12
|
+
|
|
13
|
+
const ViewContext = /*#__PURE__*/_react.default.createContext(null);
|
|
14
|
+
const ViewContextProvider = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
settings,
|
|
17
|
+
children
|
|
18
|
+
} = _ref;
|
|
19
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
20
|
+
const {
|
|
21
|
+
fileRepo,
|
|
22
|
+
context
|
|
23
|
+
} = (0, _fileViewContext.useFileViewContext)();
|
|
24
|
+
const [views, setViews] = (0, _react.useState)([]);
|
|
25
|
+
const [currentViewId, setCurrentViewId] = (0, _react.useState)('');
|
|
26
|
+
(0, _react.useEffect)(() => {
|
|
27
|
+
const initViewContext = async () => {
|
|
28
|
+
const views = fileRepo.views;
|
|
29
|
+
const currentView = views[views.length - 1];
|
|
30
|
+
const {
|
|
31
|
+
linked_repo_id: repoID
|
|
32
|
+
} = currentView;
|
|
33
|
+
const res = await context.getRepo(repoID);
|
|
34
|
+
const repo = res.data;
|
|
35
|
+
context.addRepoSetting(repo);
|
|
36
|
+
setViews(views);
|
|
37
|
+
setCurrentViewId(currentView._id);
|
|
38
|
+
setIsLoading(false);
|
|
39
|
+
};
|
|
40
|
+
initViewContext();
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
+
}, []);
|
|
43
|
+
const insertView = (0, _react.useCallback)(view => {
|
|
44
|
+
setViews([...views, view]);
|
|
45
|
+
setCurrentViewId(view._id);
|
|
46
|
+
}, [views]);
|
|
47
|
+
if (isLoading) {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
className: 'sea-metadata'
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_components.CenteredLoading, null));
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(ViewContext.Provider, {
|
|
53
|
+
value: {
|
|
54
|
+
views,
|
|
55
|
+
currentViewId,
|
|
56
|
+
setCurrentViewId,
|
|
57
|
+
insertView
|
|
58
|
+
}
|
|
59
|
+
}, children);
|
|
60
|
+
};
|
|
61
|
+
exports.ViewContextProvider = ViewContextProvider;
|
|
62
|
+
const useViewContext = () => {
|
|
63
|
+
const context = (0, _react.useContext)(ViewContext);
|
|
64
|
+
if (!context) {
|
|
65
|
+
throw new Error('\'AppContext\' is null');
|
|
66
|
+
}
|
|
67
|
+
return context;
|
|
68
|
+
};
|
|
69
|
+
exports.useViewContext = useViewContext;
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "FileView", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _fileView.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
require("./index.css");
|
|
14
|
-
var
|
|
14
|
+
var _fileView = _interopRequireDefault(require("./file-view"));
|
package/dist/locale/en.js
CHANGED
|
@@ -319,6 +319,16 @@ const en = {
|
|
|
319
319
|
'Thousands separator': 'Thousands separator',
|
|
320
320
|
'Enforce precision': 'Enforce precision',
|
|
321
321
|
'Precision': 'Permission',
|
|
322
|
-
'Select all': 'Select all'
|
|
322
|
+
'Select all': 'Select all',
|
|
323
|
+
'Add view': 'Add view',
|
|
324
|
+
'View name': 'View name',
|
|
325
|
+
'View type': 'View type',
|
|
326
|
+
'View name is required.': 'View name is required.',
|
|
327
|
+
'View type is required.': 'View type is required.',
|
|
328
|
+
'Show property names': 'Show property names',
|
|
329
|
+
'Don\'t show empty values': 'Don\'t show empty values',
|
|
330
|
+
'Text wraps': 'Text wraps',
|
|
331
|
+
'Properties to display on the card': 'Properties to display on the card',
|
|
332
|
+
'Search properties': 'Search properties'
|
|
323
333
|
};
|
|
324
334
|
var _default = exports.default = en;
|
package/dist/locale/zh_CN.js
CHANGED
|
@@ -319,6 +319,11 @@ const zh_CN = {
|
|
|
319
319
|
'Thousands separator': '千位分隔符',
|
|
320
320
|
'Enforce precision': '指定精度',
|
|
321
321
|
'Precision': '精度',
|
|
322
|
-
'Select all': '选择全部'
|
|
322
|
+
'Select all': '选择全部',
|
|
323
|
+
'Add view': '增加视图',
|
|
324
|
+
'View name': '视图名称',
|
|
325
|
+
'View type': '视图类型',
|
|
326
|
+
'View name is required.': '视图名称是必填项.',
|
|
327
|
+
'View type is required.': '视图类型是必填项.'
|
|
323
328
|
};
|
|
324
329
|
var _default = exports.default = zh_CN;
|
package/dist/store/index.js
CHANGED
|
@@ -211,8 +211,10 @@ class Store {
|
|
|
211
211
|
async load() {
|
|
212
212
|
let limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants.PER_LOAD_NUMBER;
|
|
213
213
|
return this.context.getView(this.viewId).then(res => {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
const {
|
|
215
|
+
file_view
|
|
216
|
+
} = res.data;
|
|
217
|
+
const view = file_view.views[0];
|
|
216
218
|
return this.loadMetadata(view, limit);
|
|
217
219
|
});
|
|
218
220
|
}
|
|
@@ -222,14 +224,14 @@ class Store {
|
|
|
222
224
|
return this.loadMetadata(this.data.view, limit);
|
|
223
225
|
}
|
|
224
226
|
async loadMore(limit) {
|
|
225
|
-
var _res$
|
|
227
|
+
var _res$data3;
|
|
226
228
|
if (!this.data) return;
|
|
227
229
|
const res = await this.context.getMetadata({
|
|
228
230
|
view_id: this.viewId,
|
|
229
231
|
start: this.startIndex,
|
|
230
232
|
limit
|
|
231
233
|
});
|
|
232
|
-
let rows = (res === null || res === void 0 ? void 0 : (_res$
|
|
234
|
+
let rows = (res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.rows) || [];
|
|
233
235
|
if (!Array.isArray(rows) || rows.length === 0) {
|
|
234
236
|
this.hasMore = false;
|
|
235
237
|
return;
|
|
@@ -648,11 +650,11 @@ class Store {
|
|
|
648
650
|
});
|
|
649
651
|
this.applyOperation(operation);
|
|
650
652
|
}
|
|
651
|
-
modifyViewType(
|
|
653
|
+
modifyViewType(update) {
|
|
652
654
|
const type = _operations.OPERATION_TYPE.MODIFY_VIEW_TYPE;
|
|
653
655
|
const operation = this.createOperation({
|
|
654
656
|
type,
|
|
655
|
-
view_id: viewId,
|
|
657
|
+
view_id: this.viewId,
|
|
656
658
|
update
|
|
657
659
|
});
|
|
658
660
|
this.applyOperation(operation);
|
|
@@ -472,6 +472,26 @@ class ServerOperator {
|
|
|
472
472
|
});
|
|
473
473
|
break;
|
|
474
474
|
}
|
|
475
|
+
case _operations.OPERATION_TYPE.MODIFY_VIEW_TYPE:
|
|
476
|
+
{
|
|
477
|
+
const {
|
|
478
|
+
view_id,
|
|
479
|
+
update
|
|
480
|
+
} = operation;
|
|
481
|
+
this.context.modifyView(view_id, {
|
|
482
|
+
type: update
|
|
483
|
+
}).then(res => {
|
|
484
|
+
callback({
|
|
485
|
+
operation
|
|
486
|
+
});
|
|
487
|
+
}).catch(error => {
|
|
488
|
+
callback({
|
|
489
|
+
operation,
|
|
490
|
+
error: _translate.default.gettext('Failed to modify view type')
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
475
495
|
case _operations.OPERATION_TYPE.MODIFY_HIDDEN_COLUMNS:
|
|
476
496
|
{
|
|
477
497
|
const {
|
|
@@ -512,13 +532,6 @@ class ServerOperator {
|
|
|
512
532
|
});
|
|
513
533
|
break;
|
|
514
534
|
}
|
|
515
|
-
case _operations.OPERATION_TYPE.MODIFY_VIEW_TYPE:
|
|
516
|
-
{
|
|
517
|
-
callback({
|
|
518
|
-
operation
|
|
519
|
-
});
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
535
|
default:
|
|
523
536
|
{
|
|
524
537
|
break;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _iconUtils = require("../../../../common/utils/icon-utils");
|
|
10
|
+
var _cellFormatter = _interopRequireDefault(require("../../../../components/cell-formatter"));
|
|
11
|
+
var _constants = require("../../../../constants");
|
|
12
|
+
var _fileName = _interopRequireDefault(require("../../../table/formatters/file-name"));
|
|
13
|
+
const SPECIAL_FILE_ICON = ['excel.png', 'md.png', 'ppt.png', 'sdoc_notification.ico', 'sdoc.png', 'txt.png', 'word.png'];
|
|
14
|
+
const Formatter = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
value,
|
|
17
|
+
column,
|
|
18
|
+
record,
|
|
19
|
+
tagsData,
|
|
20
|
+
...params
|
|
21
|
+
} = _ref;
|
|
22
|
+
let className = '';
|
|
23
|
+
if (column.type === _constants.CellType.FILE_NAME && value) {
|
|
24
|
+
const icon = (0, _iconUtils.getFileIconName)(value);
|
|
25
|
+
if (SPECIAL_FILE_ICON.includes(icon)) {
|
|
26
|
+
className = 'sf-metadata-special-file-name-formatter';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (column.type === _constants.CellType.FILE_NAME) {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_fileName.default, Object.assign({
|
|
31
|
+
row: record,
|
|
32
|
+
column: column,
|
|
33
|
+
value: value
|
|
34
|
+
}, params));
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_cellFormatter.default, Object.assign({}, params, {
|
|
37
|
+
readonly: true,
|
|
38
|
+
className: className,
|
|
39
|
+
value: value,
|
|
40
|
+
column: column,
|
|
41
|
+
row: record,
|
|
42
|
+
tagsData: tagsData
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
var _default = exports.default = Formatter;
|