dtable-ui-component 5.3.1-beta1 → 5.3.1
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/lib/CheckboxEditor/index.css +20 -3
- package/lib/CheckboxEditor/index.js +35 -98
- package/lib/CheckboxFormatter/index.js +9 -6
- package/lib/CollaboratorEditor/index.css +35 -12
- package/lib/CollaboratorEditor/index.js +212 -18
- package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
- package/lib/CollaboratorItem/index.css +1 -1
- package/lib/CollaboratorItem/index.js +2 -6
- package/lib/DTableFiltersPopover/utils/index.js +7 -1
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
- package/lib/DTableSelect/index.js +1 -3
- package/lib/DateEditor/index.js +51 -14
- package/lib/DateEditor/pc-date-editor-popover.js +12 -145
- package/lib/Department-editor/department-single-select.js +1 -1
- package/lib/Department-editor/index.js +4 -3
- package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
- package/lib/FileEditor/index.js +11 -244
- package/lib/FileEditor/pc-files-addition/index.js +1 -0
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/FileEditor/pc-files-preview/index.js +1 -0
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
- package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
- package/lib/FileItemFormatter/index.js +20 -19
- package/lib/FileItemFormatter/utils.js +99 -0
- package/lib/FileUploader/index.js +14 -268
- package/lib/FormulaFormatter/index.js +1 -2
- package/lib/FormulaFormatter/utils.js +31 -0
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MultipleSelectEditor/index.css +9 -0
- package/lib/MultipleSelectEditor/index.js +177 -16
- package/lib/NumberEditor/index.js +77 -64
- package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
- package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
- package/lib/RowExpandFormatter/index.css +0 -26
- package/lib/RowExpandFormatter/index.js +100 -84
- package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +5 -5
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/utils.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
- package/lib/RowExpandUrlFormatter/index.css +1 -0
- package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
- package/lib/SingleSelectEditor/index.css +14 -0
- package/lib/SingleSelectEditor/index.js +156 -16
- package/lib/TextEditor/index.js +42 -113
- package/lib/constants/index.js +2 -34
- package/lib/css/cell-editor.css +2 -18
- package/lib/index.js +46 -74
- package/lib/lang/index.js +14 -16
- package/lib/locals/de.js +103 -0
- package/lib/locals/en.js +104 -0
- package/lib/locals/es.js +103 -0
- package/lib/locals/fr.js +103 -0
- package/lib/locals/pt.js +103 -0
- package/lib/locals/ru.js +103 -0
- package/lib/locals/zh-CN.js +104 -0
- package/lib/select-editor/index.js +6 -6
- package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
- package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
- package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
- package/lib/utils/editor-utils.js +6 -1
- package/lib/utils/url.js +8 -119
- package/lib/utils/utils.js +2 -89
- package/package.json +2 -3
- package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
- package/lib/DeleteTip/index.js +0 -50
- package/lib/DigitalSignEditor/constants.js +0 -7
- package/lib/DigitalSignEditor/index.css +0 -69
- package/lib/DigitalSignEditor/index.js +0 -182
- package/lib/DigitalSignEditor/service.js +0 -38
- package/lib/DigitalSignEditor/signature-board/index.css +0 -35
- package/lib/DigitalSignEditor/signature-board/index.js +0 -135
- package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
- package/lib/DigitalSignEditor/utils.js +0 -29
- package/lib/DurationEditor/index.js +0 -111
- package/lib/EmailEditor/index.js +0 -59
- package/lib/FileEditor/addition-previewer/index.css +0 -1
- package/lib/FileEditor/addition-previewer/index.js +0 -52
- package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
- package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
- package/lib/FileEditor/constants.js +0 -7
- package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
- package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
- package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
- package/lib/FileEditor/files-previewer/index.css +0 -56
- package/lib/FileEditor/files-previewer/index.js +0 -277
- package/lib/FileEditor/index.css +0 -6
- package/lib/FileEditor/utils.js +0 -22
- package/lib/FileUploader/index.css +0 -9
- package/lib/GeolocationEditor/country-editor.js +0 -319
- package/lib/GeolocationEditor/index.css +0 -641
- package/lib/GeolocationEditor/index.js +0 -241
- package/lib/GeolocationEditor/location-editor.js +0 -368
- package/lib/GeolocationEditor/map-editor/index.js +0 -456
- package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
- package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
- package/lib/GeolocationEditor/map-editor-utils.js +0 -153
- package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
- package/lib/GeolocationEditor/parse-geolocation.js +0 -282
- package/lib/GeolocationEditor/province-city-editor.js +0 -292
- package/lib/GeolocationEditor/province-editor.js +0 -226
- package/lib/GeolocationEditor/selector-header-item.js +0 -28
- package/lib/GeolocationEditor/selector-list.js +0 -33
- package/lib/GeolocationEditor/with-ref.js +0 -27
- package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
- package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
- package/lib/ImageEditor/addition-previewer/index.css +0 -106
- package/lib/ImageEditor/addition-previewer/index.js +0 -63
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
- package/lib/ImageEditor/constants.js +0 -7
- package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
- package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
- package/lib/ImageEditor/images-previewer/index.css +0 -18
- package/lib/ImageEditor/images-previewer/index.js +0 -140
- package/lib/ImageEditor/index.css +0 -24
- package/lib/ImageEditor/index.js +0 -194
- package/lib/ImageThumbnail/index.css +0 -20
- package/lib/ImageThumbnail/index.js +0 -136
- package/lib/RowExpandDialog/body/index.css +0 -21
- package/lib/RowExpandDialog/body/index.js +0 -279
- package/lib/RowExpandDialog/column-content/index.css +0 -43
- package/lib/RowExpandDialog/column-content/index.js +0 -50
- package/lib/RowExpandDialog/constants.js +0 -114
- package/lib/RowExpandDialog/header/index.css +0 -31
- package/lib/RowExpandDialog/header/index.js +0 -33
- package/lib/RowExpandDialog/index.css +0 -24
- package/lib/RowExpandDialog/index.js +0 -272
- package/lib/RowExpandDialog/utils.js +0 -83
- package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
- package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
- package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
- package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
- package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
- package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -124
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
- package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
- package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
- package/lib/RowExpandEditor/constants.js +0 -44
- package/lib/RowExpandEditor/index.css +0 -0
- package/lib/RowExpandEditor/index.js +0 -32
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
- package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
- package/lib/RowExpandFormatter/constants.js +0 -60
- package/lib/UploadProgress/index.js +0 -38
- package/lib/UrlEditor/index.js +0 -62
- package/lib/common/editor-base.js +0 -53
- package/lib/constants/file.js +0 -96
- package/lib/constants/key-codes.js +0 -109
- package/lib/hooks/index.js +0 -16
- package/lib/locales/de.json +0 -163
- package/lib/locales/en.json +0 -163
- package/lib/locales/es.json +0 -163
- package/lib/locales/fr.json +0 -163
- package/lib/locales/pt.json +0 -163
- package/lib/locales/ru.json +0 -163
- package/lib/locales/zh-CN.json +0 -163
- package/lib/select-editor/pc-select-editor/index.css +0 -85
- package/lib/select-editor/pc-select-editor/index.js +0 -290
- package/lib/utils/cell-comparer.js +0 -35
- package/lib/utils/cell.js +0 -55
- package/lib/utils/column-utils.js +0 -25
- package/lib/utils/get-event-transfer.js +0 -75
- package/lib/utils/object-utils.js +0 -61
- /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
- /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
- /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
- /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
- /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
- /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _reactstrap = require("reactstrap");
|
|
12
|
-
var _dtableUtils = require("dtable-utils");
|
|
13
|
-
var _lang = require("../lang");
|
|
14
|
-
var _header = _interopRequireDefault(require("./header"));
|
|
15
|
-
var _body = _interopRequireDefault(require("./body"));
|
|
16
|
-
var _Loading = _interopRequireDefault(require("../Loading"));
|
|
17
|
-
var _utils = require("../utils/utils");
|
|
18
|
-
var _cellComparer = require("../utils/cell-comparer");
|
|
19
|
-
require("./index.css");
|
|
20
|
-
var _toaster = _interopRequireDefault(require("../toaster"));
|
|
21
|
-
const RowExpandDialog = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
22
|
-
let {
|
|
23
|
-
saveImmediately = true,
|
|
24
|
-
isInsertingRow,
|
|
25
|
-
zIndex,
|
|
26
|
-
title,
|
|
27
|
-
className,
|
|
28
|
-
placeholder,
|
|
29
|
-
collaborators,
|
|
30
|
-
component,
|
|
31
|
-
eventBus,
|
|
32
|
-
valueKey = 'name',
|
|
33
|
-
// name or key
|
|
34
|
-
departments,
|
|
35
|
-
userDepartmentIdsMap,
|
|
36
|
-
config,
|
|
37
|
-
lang,
|
|
38
|
-
layout = 'horizontal',
|
|
39
|
-
// horizontal or vertical
|
|
40
|
-
longTextEditorI18n,
|
|
41
|
-
longTextEditorAPI,
|
|
42
|
-
getRow,
|
|
43
|
-
modifyRow,
|
|
44
|
-
getCollaborators,
|
|
45
|
-
queryCollaborators,
|
|
46
|
-
checkEditable = c => c.editable && !_dtableUtils.NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP[c.type],
|
|
47
|
-
onToggle,
|
|
48
|
-
uploadFile
|
|
49
|
-
} = _ref;
|
|
50
|
-
const [isAnimationEnd, setAnimationEnd] = (0, _react.useState)(false);
|
|
51
|
-
const [isLoading, setLoading] = (0, _react.useState)(true);
|
|
52
|
-
const [isSaving, setSaving] = (0, _react.useState)(false);
|
|
53
|
-
const [errorMessage, setErrorMessage] = (0, _react.useState)('');
|
|
54
|
-
const [row, setRow] = (0, _react.useState)({});
|
|
55
|
-
const [columns, setColumns] = (0, _react.useState)([]);
|
|
56
|
-
const modalRef = (0, _react.useRef)(null);
|
|
57
|
-
const isChangedRef = (0, _react.useRef)(false);
|
|
58
|
-
const update = (0, _react.useRef)({});
|
|
59
|
-
const initStyle = (0, _react.useMemo)(() => {
|
|
60
|
-
const defaultMargin = 80; // sequence cell width
|
|
61
|
-
const defaultHeight = 100;
|
|
62
|
-
return {
|
|
63
|
-
width: window.innerWidth - defaultMargin,
|
|
64
|
-
maxWidth: window.innerWidth - defaultMargin,
|
|
65
|
-
marginLeft: defaultMargin,
|
|
66
|
-
height: defaultHeight,
|
|
67
|
-
marginRight: defaultMargin,
|
|
68
|
-
marginTop: '30%',
|
|
69
|
-
transition: 'all .3s'
|
|
70
|
-
};
|
|
71
|
-
}, []);
|
|
72
|
-
const style = (0, _react.useMemo)(() => {
|
|
73
|
-
const width = 800;
|
|
74
|
-
return {
|
|
75
|
-
width,
|
|
76
|
-
maxWidth: width,
|
|
77
|
-
marginLeft: (window.innerWidth - width) / 2,
|
|
78
|
-
height: 'calc(100% - 56px)' // Dialog margin is 3.5rem (56px)
|
|
79
|
-
};
|
|
80
|
-
}, []);
|
|
81
|
-
const _checkEditable = (0, _react.useCallback)((column, row) => {
|
|
82
|
-
if (isSaving) return false;
|
|
83
|
-
if (!column) return false;
|
|
84
|
-
if (!checkEditable) return false;
|
|
85
|
-
if (!checkEditable(column, row)) return false;
|
|
86
|
-
if (column.type === _dtableUtils.CellType.IMAGE || column.type === _dtableUtils.CellType.FILE) return Boolean(uploadFile);
|
|
87
|
-
return true;
|
|
88
|
-
}, [isSaving, checkEditable, uploadFile]);
|
|
89
|
-
const initRowData = (0, _react.useCallback)(() => {
|
|
90
|
-
setLoading(true);
|
|
91
|
-
getRow().then(res => {
|
|
92
|
-
const {
|
|
93
|
-
row,
|
|
94
|
-
columns
|
|
95
|
-
} = res.data;
|
|
96
|
-
setRow(row);
|
|
97
|
-
const validColumns = columns.map(c => ({
|
|
98
|
-
...c,
|
|
99
|
-
editable: _checkEditable(c, row),
|
|
100
|
-
width: 320
|
|
101
|
-
}));
|
|
102
|
-
isChangedRef.current = isInsertingRow && Object.keys(row).length > 0;
|
|
103
|
-
setColumns(validColumns);
|
|
104
|
-
setLoading(false);
|
|
105
|
-
}).catch(error => {
|
|
106
|
-
const errorMsg = (0, _utils.getErrorMsg)(error);
|
|
107
|
-
setErrorMessage((0, _lang.getLocale)(errorMsg));
|
|
108
|
-
setLoading(false);
|
|
109
|
-
});
|
|
110
|
-
}, [isInsertingRow, getRow, _checkEditable]);
|
|
111
|
-
const toggle = (0, _react.useCallback)(() => {
|
|
112
|
-
if (isSaving) return;
|
|
113
|
-
onToggle();
|
|
114
|
-
}, [isSaving, onToggle]);
|
|
115
|
-
const onSave = (0, _react.useCallback)(function (updated) {
|
|
116
|
-
let {
|
|
117
|
-
successCallback,
|
|
118
|
-
failCallback
|
|
119
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
120
|
-
modifyRow(updated, columns, {
|
|
121
|
-
successCallback,
|
|
122
|
-
failCallback
|
|
123
|
-
});
|
|
124
|
-
}, [columns, modifyRow]);
|
|
125
|
-
const onChange = (0, _react.useCallback)((column, value) => {
|
|
126
|
-
const key = column[valueKey];
|
|
127
|
-
const updated = {
|
|
128
|
-
[key]: value
|
|
129
|
-
};
|
|
130
|
-
const oldValue = row[key];
|
|
131
|
-
if (!(0, _cellComparer.isCellValueChanged)(oldValue, value, column.type)) return;
|
|
132
|
-
if (!saveImmediately || isInsertingRow) {
|
|
133
|
-
isChangedRef.current = true;
|
|
134
|
-
update.current = {
|
|
135
|
-
...update.current,
|
|
136
|
-
...updated
|
|
137
|
-
};
|
|
138
|
-
setRow({
|
|
139
|
-
...row,
|
|
140
|
-
...updated
|
|
141
|
-
});
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
onSave(updated, {
|
|
145
|
-
successCallback: () => {
|
|
146
|
-
isChangedRef.current = false;
|
|
147
|
-
update.current = {};
|
|
148
|
-
setRow({
|
|
149
|
-
...row,
|
|
150
|
-
...updated
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
failCallback: () => {
|
|
154
|
-
_toaster.default.danger((0, _lang.getLocale)('Save_failed'));
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
}, [saveImmediately, isInsertingRow, row, valueKey, onSave]);
|
|
158
|
-
const onSubmit = (0, _react.useCallback)(() => {
|
|
159
|
-
setSaving(true);
|
|
160
|
-
const successCallback = isInsertingRow ? onToggle : () => {
|
|
161
|
-
isChangedRef.current = false;
|
|
162
|
-
update.current = {};
|
|
163
|
-
setSaving(false);
|
|
164
|
-
};
|
|
165
|
-
const failCallback = () => {
|
|
166
|
-
setSaving(false);
|
|
167
|
-
_toaster.default.danger((0, _lang.getLocale)('Save_failed'));
|
|
168
|
-
};
|
|
169
|
-
const newRow = isInsertingRow ? {
|
|
170
|
-
...row,
|
|
171
|
-
...update.current
|
|
172
|
-
} : update.current;
|
|
173
|
-
onSave(newRow, {
|
|
174
|
-
successCallback,
|
|
175
|
-
failCallback
|
|
176
|
-
});
|
|
177
|
-
}, [row, isInsertingRow, onSave, onToggle]);
|
|
178
|
-
(0, _react.useEffect)(() => {
|
|
179
|
-
// use setTimeout to make sure real dom rendered
|
|
180
|
-
setTimeout(() => {
|
|
181
|
-
let dom = modalRef.current.firstChild;
|
|
182
|
-
const {
|
|
183
|
-
width,
|
|
184
|
-
maxWidth,
|
|
185
|
-
marginLeft,
|
|
186
|
-
height
|
|
187
|
-
} = style;
|
|
188
|
-
dom.style.width = "".concat(width, "px");
|
|
189
|
-
dom.style.maxWidth = "".concat(maxWidth, "px");
|
|
190
|
-
dom.style.marginLeft = "".concat(marginLeft, "px");
|
|
191
|
-
dom.style.height = height;
|
|
192
|
-
dom.style.marginRight = 'unset';
|
|
193
|
-
dom.style.marginTop = '28px';
|
|
194
|
-
// after animation, change style and run callback
|
|
195
|
-
setTimeout(() => {
|
|
196
|
-
setAnimationEnd(true);
|
|
197
|
-
dom.style.transition = 'none';
|
|
198
|
-
initRowData();
|
|
199
|
-
}, 280);
|
|
200
|
-
}, 1);
|
|
201
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
202
|
-
}, []);
|
|
203
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
204
|
-
getData: () => ({
|
|
205
|
-
row,
|
|
206
|
-
columns
|
|
207
|
-
}),
|
|
208
|
-
setData: function () {
|
|
209
|
-
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
210
|
-
Object.keys(data).forEach(key => {
|
|
211
|
-
if (key === 'row') {
|
|
212
|
-
setRow(data[key]);
|
|
213
|
-
}
|
|
214
|
-
if (key === 'columns') {
|
|
215
|
-
setColumns(data[key]);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}), [row, columns]);
|
|
220
|
-
const renderContent = (0, _react.useCallback)(() => {
|
|
221
|
-
if (!isAnimationEnd) return null;
|
|
222
|
-
if (isLoading) return /*#__PURE__*/_react.default.createElement("div", {
|
|
223
|
-
className: "w-100 -h-100 d-flex align-items-center justify-content-center"
|
|
224
|
-
}, /*#__PURE__*/_react.default.createElement(_Loading.default, null));
|
|
225
|
-
if (errorMessage) return /*#__PURE__*/_react.default.createElement("div", null, errorMessage);
|
|
226
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
227
|
-
className: "dtable-ui-row-expand-details"
|
|
228
|
-
}, /*#__PURE__*/_react.default.createElement(_header.default, {
|
|
229
|
-
onToggle: toggle,
|
|
230
|
-
title: title
|
|
231
|
-
}), /*#__PURE__*/_react.default.createElement(_body.default, {
|
|
232
|
-
isInsertingRow: isInsertingRow,
|
|
233
|
-
row: row,
|
|
234
|
-
lang: lang,
|
|
235
|
-
columns: columns,
|
|
236
|
-
placeholder: placeholder,
|
|
237
|
-
collaborators: collaborators,
|
|
238
|
-
eventBus: eventBus,
|
|
239
|
-
component: component,
|
|
240
|
-
valueKey: valueKey,
|
|
241
|
-
departments: departments,
|
|
242
|
-
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
243
|
-
config: config,
|
|
244
|
-
onChange: onChange,
|
|
245
|
-
getCollaborators: getCollaborators,
|
|
246
|
-
queryCollaborators: queryCollaborators,
|
|
247
|
-
uploadFile: uploadFile,
|
|
248
|
-
longTextEditorI18n: longTextEditorI18n,
|
|
249
|
-
longTextEditorAPI: longTextEditorAPI
|
|
250
|
-
}), (!saveImmediately || isInsertingRow) && /*#__PURE__*/_react.default.createElement(_reactstrap.ModalFooter, null, /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
251
|
-
onClick: toggle,
|
|
252
|
-
color: "secondary"
|
|
253
|
-
}, (0, _lang.getLocale)('Cancel')), /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
254
|
-
onClick: onSubmit,
|
|
255
|
-
disabled: isSaving || !isChangedRef.current,
|
|
256
|
-
color: "primary"
|
|
257
|
-
}, (0, _lang.getLocale)('Submit'))));
|
|
258
|
-
}, [isSaving, saveImmediately, isAnimationEnd, isLoading, isInsertingRow, errorMessage, title, row, columns, placeholder, collaborators, component, valueKey, departments, userDepartmentIdsMap, eventBus, onChange, toggle, getCollaborators, queryCollaborators, uploadFile, longTextEditorI18n, longTextEditorAPI, config, onSubmit]);
|
|
259
|
-
return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
|
|
260
|
-
isOpen: true,
|
|
261
|
-
toggle: onToggle,
|
|
262
|
-
className: (0, _classnames.default)('dtable-ui-row-expand-dialog', className),
|
|
263
|
-
style: isAnimationEnd ? style : initStyle,
|
|
264
|
-
zIndex: zIndex || 1048,
|
|
265
|
-
contentClassName: "dtable-ui-row-expand-content",
|
|
266
|
-
modalClassName: "dtable-ui-row-expand-modal",
|
|
267
|
-
fade: false,
|
|
268
|
-
innerRef: modalRef,
|
|
269
|
-
keyboard: false
|
|
270
|
-
}, renderContent());
|
|
271
|
-
});
|
|
272
|
-
var _default = exports.default = RowExpandDialog;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getTwoDimensionArrayValue = exports.getFormulaArrayValue = exports.downloadFile = void 0;
|
|
7
|
-
exports.isArrayFormalColumn = isArrayFormalColumn;
|
|
8
|
-
exports.isValidCellValue = void 0;
|
|
9
|
-
var _dtableUtils = require("dtable-utils");
|
|
10
|
-
const isValidCellValue = value => {
|
|
11
|
-
if (value === undefined) return false;
|
|
12
|
-
if (value === null) return false;
|
|
13
|
-
if (value === '') return false;
|
|
14
|
-
if (JSON.stringify(value) === '{}') return false;
|
|
15
|
-
if (JSON.stringify(value) === '[]') return false;
|
|
16
|
-
return true;
|
|
17
|
-
};
|
|
18
|
-
exports.isValidCellValue = isValidCellValue;
|
|
19
|
-
function isArrayFormalColumn(columnType) {
|
|
20
|
-
return [_dtableUtils.CellType.IMAGE, _dtableUtils.CellType.FILE, _dtableUtils.CellType.MULTIPLE_SELECT, _dtableUtils.CellType.COLLABORATOR].includes(columnType);
|
|
21
|
-
}
|
|
22
|
-
const getFormulaArrayValue = function (value) {
|
|
23
|
-
let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
24
|
-
if (!Array.isArray(value)) return [];
|
|
25
|
-
if (!isFlat) return getTwoDimensionArrayValue(value);
|
|
26
|
-
return value.map(item => {
|
|
27
|
-
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
28
|
-
return item;
|
|
29
|
-
}
|
|
30
|
-
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
31
|
-
const {
|
|
32
|
-
display_value
|
|
33
|
-
} = item;
|
|
34
|
-
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
35
|
-
return display_value.map(i => {
|
|
36
|
-
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
37
|
-
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
38
|
-
const {
|
|
39
|
-
display_value
|
|
40
|
-
} = i;
|
|
41
|
-
return display_value;
|
|
42
|
-
}
|
|
43
|
-
return i;
|
|
44
|
-
});
|
|
45
|
-
}).flat().filter(item => isValidCellValue(item));
|
|
46
|
-
};
|
|
47
|
-
exports.getFormulaArrayValue = getFormulaArrayValue;
|
|
48
|
-
const getTwoDimensionArrayValue = value => {
|
|
49
|
-
if (!Array.isArray(value)) return [];
|
|
50
|
-
return value.map(item => {
|
|
51
|
-
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
52
|
-
return item;
|
|
53
|
-
}
|
|
54
|
-
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
55
|
-
const {
|
|
56
|
-
display_value
|
|
57
|
-
} = item;
|
|
58
|
-
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
59
|
-
return display_value.map(i => {
|
|
60
|
-
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
61
|
-
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
62
|
-
const {
|
|
63
|
-
display_value
|
|
64
|
-
} = i;
|
|
65
|
-
return display_value;
|
|
66
|
-
}
|
|
67
|
-
return i;
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
exports.getTwoDimensionArrayValue = getTwoDimensionArrayValue;
|
|
72
|
-
const downloadFile = downloadUrl => {
|
|
73
|
-
const downloadFrame = document.getElementById('download-iframe');
|
|
74
|
-
if (downloadFrame != null) {
|
|
75
|
-
document.body.removeChild(downloadFrame);
|
|
76
|
-
}
|
|
77
|
-
let iframe = document.createElement('iframe');
|
|
78
|
-
iframe.setAttribute('id', 'download-iframe');
|
|
79
|
-
iframe.style.display = 'none';
|
|
80
|
-
iframe.src = downloadUrl;
|
|
81
|
-
document.body.appendChild(iframe);
|
|
82
|
-
};
|
|
83
|
-
exports.downloadFile = downloadFile;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.dtable-ui-row-expand-add-btn {
|
|
2
|
-
min-width: 80px;
|
|
3
|
-
max-width: 100%;
|
|
4
|
-
height: 28px;
|
|
5
|
-
line-height: 24px;
|
|
6
|
-
border: 2px solid transparent;
|
|
7
|
-
padding: 0 10px;
|
|
8
|
-
background-color: #f0f0f0;
|
|
9
|
-
border-radius: 3px;
|
|
10
|
-
color: #666666;
|
|
11
|
-
font-size: 14px;
|
|
12
|
-
text-align: center;
|
|
13
|
-
display: inline-flex;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
width: fit-content;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.dtable-ui-row-expand-add-btn:hover {
|
|
19
|
-
background-color: #dbdbdb;
|
|
20
|
-
color: #666666;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _constants = require("../../constants");
|
|
10
|
-
require("./index.css");
|
|
11
|
-
const RowExpandAddBtn = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
12
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
13
|
-
ref: ref,
|
|
14
|
-
tabIndex: 0,
|
|
15
|
-
onClick: props.onClick,
|
|
16
|
-
onFocus: props.onFocus,
|
|
17
|
-
role: "button",
|
|
18
|
-
className: "dtable-ui-row-expand-add-btn d-print-none",
|
|
19
|
-
style: props.isFocus ? _constants.ROW_EXPAND_BTN_FOCUS_STYLE : {}
|
|
20
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
21
|
-
className: "d-print-none"
|
|
22
|
-
}, props.text));
|
|
23
|
-
});
|
|
24
|
-
var _default = exports.default = RowExpandAddBtn;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.dtable-ui-row-expand-checkbox-editor {
|
|
2
|
-
width: 24px;
|
|
3
|
-
height: 24px;
|
|
4
|
-
border: 2px solid #e0e0e0;
|
|
5
|
-
border-radius: 3px;
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
margin-top: 6px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.dtable-ui-checkbox-editor.dtable-ui-row-expand-checkbox-editor {
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.dtable-ui-checkbox-editor.dtable-ui-row-expand-checkbox-editor.focus {
|
|
17
|
-
box-shadow: 0 0 0 2px #66afe9;
|
|
18
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
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 _CheckboxEditor = _interopRequireDefault(require("../../CheckboxEditor"));
|
|
10
|
-
var _constants = require("../../constants");
|
|
11
|
-
require("./index.css");
|
|
12
|
-
class RowExpandCheckboxEditor extends _react.default.Component {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.onChangeCheckboxValue = () => {
|
|
16
|
-
const {
|
|
17
|
-
columnIndex
|
|
18
|
-
} = this.props;
|
|
19
|
-
if (!this.editor) return;
|
|
20
|
-
if (this.props.updateTabIndex) {
|
|
21
|
-
this.props.updateTabIndex(columnIndex);
|
|
22
|
-
}
|
|
23
|
-
const newValue = this.editor.getValue();
|
|
24
|
-
this.props.onCommit(newValue);
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
render() {
|
|
28
|
-
const {
|
|
29
|
-
isEditorFocus,
|
|
30
|
-
column,
|
|
31
|
-
value
|
|
32
|
-
} = this.props;
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement(_CheckboxEditor.default, {
|
|
34
|
-
ref: ref => this.editor = ref,
|
|
35
|
-
className: "dtable-ui-row-expand-checkbox-editor mt-2",
|
|
36
|
-
column: column,
|
|
37
|
-
value: value,
|
|
38
|
-
style: isEditorFocus ? _constants.ROW_EXPAND_FOCUS_STYLE : {},
|
|
39
|
-
onCommit: this.onChangeCheckboxValue
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
var _default = exports.default = RowExpandCheckboxEditor;
|