ods-component-lib 1.20.2 → 1.20.4
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/components/antd/fileUpload/OdsFileUpload.d.ts +3 -0
- package/dist/index.js +186 -150
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +188 -152
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/commonFunctions.d.ts +1 -0
- package/package.json +1 -1
|
@@ -16,10 +16,13 @@ declare type FileUploadProps = {
|
|
|
16
16
|
RemoveCancelText?: string;
|
|
17
17
|
skipSizeValidation?: boolean;
|
|
18
18
|
maxFileSizeMB?: number;
|
|
19
|
+
minWidth?: number;
|
|
20
|
+
minHeight?: number;
|
|
19
21
|
};
|
|
20
22
|
interface IValidationMessageOptions {
|
|
21
23
|
sizeValidationFailMessage?: string;
|
|
22
24
|
typeValidationFailMessage?: string;
|
|
25
|
+
dimensionValidationFailMessage?: string;
|
|
23
26
|
}
|
|
24
27
|
declare function OdsFileUpload(props: FileUploadProps): React.JSX.Element;
|
|
25
28
|
export default OdsFileUpload;
|
package/dist/index.js
CHANGED
|
@@ -1119,25 +1119,50 @@ function OdsFileUpload(props) {
|
|
|
1119
1119
|
var fileType = allowDocumentUpload ? ["image/png", "image/jpg", "image/jpeg", "image/svg+xml", "application/pdf", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] : ["image/png", "image/jpg", "image/jpeg", "image/svg+xml"];
|
|
1120
1120
|
var isFileSizeOk = skipSizeValidation ? true : file.size / (1024 * 1024) <= maxFileSizeMB;
|
|
1121
1121
|
var checkType = fileType.includes(file.type);
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
content: customValidationMessages.sizeValidationFailMessage,
|
|
1135
|
-
type: "warning",
|
|
1136
|
-
placement: "bottom"
|
|
1122
|
+
var checkDimensions = function checkDimensions(file) {
|
|
1123
|
+
return new Promise(function (resolve) {
|
|
1124
|
+
if (file.type.startsWith("image/") && (props.minWidth || props.minHeight)) {
|
|
1125
|
+
var img = new Image();
|
|
1126
|
+
img.src = URL.createObjectURL(file);
|
|
1127
|
+
img.onload = function () {
|
|
1128
|
+
var isValid = (!props.minWidth || img.width >= props.minWidth) && (!props.minHeight || img.height >= props.minHeight);
|
|
1129
|
+
resolve(isValid);
|
|
1130
|
+
};
|
|
1131
|
+
} else {
|
|
1132
|
+
resolve(true);
|
|
1133
|
+
}
|
|
1137
1134
|
});
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1135
|
+
};
|
|
1136
|
+
return Promise.resolve(checkDimensions(file)).then(function (isDimensionsOk) {
|
|
1137
|
+
if (!isDimensionsOk) {
|
|
1138
|
+
OdsNotification({
|
|
1139
|
+
title: "",
|
|
1140
|
+
content: customValidationMessages.dimensionValidationFailMessage || "Image dimensions are too small. Minimum size is " + (props.minWidth || 0) + "px width and " + (props.minHeight || 0) + "px height.",
|
|
1141
|
+
type: "warning",
|
|
1142
|
+
placement: "bottom"
|
|
1143
|
+
});
|
|
1144
|
+
return antd.Upload.LIST_IGNORE;
|
|
1145
|
+
}
|
|
1146
|
+
if (!checkType) {
|
|
1147
|
+
OdsNotification({
|
|
1148
|
+
title: "",
|
|
1149
|
+
content: customValidationMessages.typeValidationFailMessage,
|
|
1150
|
+
type: "warning",
|
|
1151
|
+
placement: "bottom"
|
|
1152
|
+
});
|
|
1153
|
+
return antd.Upload.LIST_IGNORE;
|
|
1154
|
+
}
|
|
1155
|
+
if (!isFileSizeOk) {
|
|
1156
|
+
OdsNotification({
|
|
1157
|
+
title: "",
|
|
1158
|
+
content: customValidationMessages.sizeValidationFailMessage,
|
|
1159
|
+
type: "warning",
|
|
1160
|
+
placement: "bottom"
|
|
1161
|
+
});
|
|
1162
|
+
return antd.Upload.LIST_IGNORE;
|
|
1163
|
+
}
|
|
1164
|
+
return false;
|
|
1165
|
+
});
|
|
1141
1166
|
} catch (e) {
|
|
1142
1167
|
return Promise.reject(e);
|
|
1143
1168
|
}
|
|
@@ -34107,6 +34132,70 @@ var ExportDataGridToExcel = function ExportDataGridToExcel(_ref) {
|
|
|
34107
34132
|
});
|
|
34108
34133
|
};
|
|
34109
34134
|
|
|
34135
|
+
var uniqueRecords = function uniqueRecords(value, index, array) {
|
|
34136
|
+
return array.indexOf(value) === index;
|
|
34137
|
+
};
|
|
34138
|
+
var exportToExcel = function exportToExcel(props) {
|
|
34139
|
+
var workbook = new exceljs.Workbook();
|
|
34140
|
+
var worksheet = workbook.addWorksheet('Main Sheet');
|
|
34141
|
+
var lastProcessedRowData = null;
|
|
34142
|
+
var rowCount = 0;
|
|
34143
|
+
excel_exporter.exportDataGrid({
|
|
34144
|
+
component: props.gridComponent,
|
|
34145
|
+
worksheet: worksheet,
|
|
34146
|
+
selectedRowsOnly: props.selectedRowsOnly,
|
|
34147
|
+
customizeCell: function customizeCell(options) {
|
|
34148
|
+
var gridCell = options.gridCell,
|
|
34149
|
+
excelCell = options.excelCell;
|
|
34150
|
+
if (gridCell && excelCell) {
|
|
34151
|
+
if (gridCell.rowType === 'data' && lastProcessedRowData !== gridCell.data) {
|
|
34152
|
+
rowCount++;
|
|
34153
|
+
lastProcessedRowData = gridCell.data;
|
|
34154
|
+
}
|
|
34155
|
+
if ((gridCell.column.dataType === "datetime" || gridCell.column.dataField === "CreateDate" || gridCell.column.dataField === "ModifyDate") && gridCell.value) {
|
|
34156
|
+
excelCell.value = moment__default(gridCell.value).format("DD.MM.YYYY HH:mm");
|
|
34157
|
+
} else if (gridCell.column.dataType === "date" && gridCell.value) {
|
|
34158
|
+
excelCell.value = moment__default(gridCell.value).format("DD.MM.YYYY");
|
|
34159
|
+
}
|
|
34160
|
+
if (gridCell.rowType === 'data' && gridCell.column.dataField.toLowerCase() === "isactive") {
|
|
34161
|
+
excelCell.value = gridCell.value === true ? "" + props.activeText : "" + props.passiveText;
|
|
34162
|
+
}
|
|
34163
|
+
excelCell.font = {
|
|
34164
|
+
name: 'Arial',
|
|
34165
|
+
size: 12
|
|
34166
|
+
};
|
|
34167
|
+
excelCell.alignment = {
|
|
34168
|
+
horizontal: 'left'
|
|
34169
|
+
};
|
|
34170
|
+
}
|
|
34171
|
+
}
|
|
34172
|
+
}).then(function () {
|
|
34173
|
+
var summaryResult = props.getSummary();
|
|
34174
|
+
var summaryText = props.selectedRowsOnly ? summaryResult + " - " + rowCount + " " + props.selectedText : summaryResult;
|
|
34175
|
+
var lastRow = worksheet.addRow([summaryText]);
|
|
34176
|
+
lastRow.font = {
|
|
34177
|
+
name: 'Arial',
|
|
34178
|
+
size: 10,
|
|
34179
|
+
bold: true
|
|
34180
|
+
};
|
|
34181
|
+
lastRow.alignment = {
|
|
34182
|
+
horizontal: 'left'
|
|
34183
|
+
};
|
|
34184
|
+
workbook.xlsx.writeBuffer().then(function (buffer) {
|
|
34185
|
+
var now = new Date();
|
|
34186
|
+
var datePart = ('0' + now.getDate()).slice(-2) + "-" + ('0' + (now.getMonth() + 1)).slice(-2) + "-" + now.getFullYear();
|
|
34187
|
+
var timePart = ('0' + now.getHours()).slice(-2) + ":" + ('0' + now.getMinutes()).slice(-2);
|
|
34188
|
+
var fullFileName = props.baseFileName + "-" + datePart + "-" + timePart + ".xlsx";
|
|
34189
|
+
FileSaver.saveAs(new Blob([buffer], {
|
|
34190
|
+
type: 'application/octet-stream'
|
|
34191
|
+
}), fullFileName);
|
|
34192
|
+
});
|
|
34193
|
+
});
|
|
34194
|
+
};
|
|
34195
|
+
var isTextEmpty = function isTextEmpty(text) {
|
|
34196
|
+
return text === undefined || text === null || (text === null || text === void 0 ? void 0 : text.trim()) === '';
|
|
34197
|
+
};
|
|
34198
|
+
|
|
34110
34199
|
var useToken = antd.theme.useToken;
|
|
34111
34200
|
var OdsBatchEditDataGrid = function OdsBatchEditDataGrid(props) {
|
|
34112
34201
|
var _props$columnResizing, _props$className, _props$selection, _props$selectOptions, _props$selectOptions$, _props$selectOptions2, _props$selectOptions$2, _props$selectOptions3;
|
|
@@ -34491,23 +34580,25 @@ var OdsBatchEditDataGrid = function OdsBatchEditDataGrid(props) {
|
|
|
34491
34580
|
}
|
|
34492
34581
|
});
|
|
34493
34582
|
}
|
|
34494
|
-
|
|
34495
|
-
|
|
34496
|
-
|
|
34497
|
-
|
|
34498
|
-
|
|
34499
|
-
|
|
34500
|
-
|
|
34501
|
-
|
|
34502
|
-
|
|
34503
|
-
|
|
34504
|
-
|
|
34505
|
-
|
|
34506
|
-
|
|
34507
|
-
|
|
34508
|
-
|
|
34509
|
-
|
|
34510
|
-
|
|
34583
|
+
if (!isTextEmpty(props.pageTitle)) {
|
|
34584
|
+
e.toolbarOptions.items.unshift({
|
|
34585
|
+
location: "before",
|
|
34586
|
+
cssClass: "toolbarTitleItem",
|
|
34587
|
+
template: function template(_, __, container) {
|
|
34588
|
+
var wrapper = document.createElement("div");
|
|
34589
|
+
container.appendChild(wrapper);
|
|
34590
|
+
reactDom.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsTitle, {
|
|
34591
|
+
level: 5,
|
|
34592
|
+
style: {
|
|
34593
|
+
display: "flex",
|
|
34594
|
+
alignItems: "center",
|
|
34595
|
+
alignSelf: "stretch",
|
|
34596
|
+
margin: 0
|
|
34597
|
+
}
|
|
34598
|
+
}, props.pageTitle)), wrapper);
|
|
34599
|
+
}
|
|
34600
|
+
});
|
|
34601
|
+
}
|
|
34511
34602
|
};
|
|
34512
34603
|
var checkIsPropArray = function checkIsPropArray(prop) {
|
|
34513
34604
|
return prop && Array.isArray(prop);
|
|
@@ -35521,23 +35612,25 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
|
|
|
35521
35612
|
}
|
|
35522
35613
|
});
|
|
35523
35614
|
}
|
|
35524
|
-
|
|
35525
|
-
|
|
35526
|
-
|
|
35527
|
-
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35532
|
-
|
|
35533
|
-
|
|
35534
|
-
|
|
35535
|
-
|
|
35536
|
-
|
|
35537
|
-
|
|
35538
|
-
|
|
35539
|
-
|
|
35540
|
-
|
|
35615
|
+
if (!isTextEmpty(props.pageTitle)) {
|
|
35616
|
+
e.toolbarOptions.items.unshift({
|
|
35617
|
+
location: "before",
|
|
35618
|
+
cssClass: "toolbarTitleItem",
|
|
35619
|
+
template: function template(_, __, container) {
|
|
35620
|
+
var wrapper = document.createElement("div");
|
|
35621
|
+
container.appendChild(wrapper);
|
|
35622
|
+
reactDom.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsTitle, {
|
|
35623
|
+
level: 5,
|
|
35624
|
+
style: {
|
|
35625
|
+
display: "flex",
|
|
35626
|
+
alignItems: "center",
|
|
35627
|
+
alignSelf: "stretch",
|
|
35628
|
+
margin: 0
|
|
35629
|
+
}
|
|
35630
|
+
}, props.pageTitle)), wrapper);
|
|
35631
|
+
}
|
|
35632
|
+
});
|
|
35633
|
+
}
|
|
35541
35634
|
};
|
|
35542
35635
|
var renderMasterDetailGrid = React.useCallback(function (_ref) {
|
|
35543
35636
|
var _dataSource$data, _dataSource$data2;
|
|
@@ -54283,24 +54376,26 @@ var OdsMergeCellDataGrid = React.forwardRef(function (props, ref) {
|
|
|
54283
54376
|
}
|
|
54284
54377
|
});
|
|
54285
54378
|
}
|
|
54286
|
-
|
|
54287
|
-
|
|
54288
|
-
|
|
54289
|
-
|
|
54290
|
-
|
|
54291
|
-
|
|
54292
|
-
|
|
54293
|
-
|
|
54294
|
-
|
|
54295
|
-
|
|
54296
|
-
|
|
54297
|
-
|
|
54298
|
-
|
|
54299
|
-
|
|
54300
|
-
|
|
54301
|
-
|
|
54302
|
-
|
|
54303
|
-
|
|
54379
|
+
if (!isTextEmpty(props.pageTitle)) {
|
|
54380
|
+
e.toolbarOptions.items.unshift({
|
|
54381
|
+
location: "before",
|
|
54382
|
+
cssClass: "toolbarTitleItem",
|
|
54383
|
+
template: function template(_, __, container) {
|
|
54384
|
+
var wrapper = document.createElement("div");
|
|
54385
|
+
container.appendChild(wrapper);
|
|
54386
|
+
var root = client_1(wrapper);
|
|
54387
|
+
root.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsTitle, {
|
|
54388
|
+
level: 5,
|
|
54389
|
+
style: {
|
|
54390
|
+
display: "flex",
|
|
54391
|
+
alignItems: "center",
|
|
54392
|
+
alignSelf: "stretch",
|
|
54393
|
+
margin: 0
|
|
54394
|
+
}
|
|
54395
|
+
}, props.pageTitle)));
|
|
54396
|
+
}
|
|
54397
|
+
});
|
|
54398
|
+
}
|
|
54304
54399
|
};
|
|
54305
54400
|
var handleSelectionChanged = function handleSelectionChanged(e) {
|
|
54306
54401
|
var triggerEvent = true;
|
|
@@ -55691,23 +55786,25 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
55691
55786
|
}
|
|
55692
55787
|
});
|
|
55693
55788
|
}
|
|
55694
|
-
|
|
55695
|
-
|
|
55696
|
-
|
|
55697
|
-
|
|
55698
|
-
|
|
55699
|
-
|
|
55700
|
-
|
|
55701
|
-
|
|
55702
|
-
|
|
55703
|
-
|
|
55704
|
-
|
|
55705
|
-
|
|
55706
|
-
|
|
55707
|
-
|
|
55708
|
-
|
|
55709
|
-
|
|
55710
|
-
|
|
55789
|
+
if (!isTextEmpty(props.pageTitle)) {
|
|
55790
|
+
e.toolbarOptions.items.unshift({
|
|
55791
|
+
location: 'before',
|
|
55792
|
+
cssClass: 'toolbarTitleItem',
|
|
55793
|
+
template: function template(_, __, container) {
|
|
55794
|
+
var wrapper = document.createElement('div');
|
|
55795
|
+
container.appendChild(wrapper);
|
|
55796
|
+
reactDom.render(React__default.createElement(React__default.StrictMode, null, React__default.createElement(OdsTitle, {
|
|
55797
|
+
level: 5,
|
|
55798
|
+
style: {
|
|
55799
|
+
display: "flex",
|
|
55800
|
+
alignItems: "center",
|
|
55801
|
+
alignSelf: "stretch",
|
|
55802
|
+
margin: 0
|
|
55803
|
+
}
|
|
55804
|
+
}, props.pageTitle)), wrapper);
|
|
55805
|
+
}
|
|
55806
|
+
});
|
|
55807
|
+
}
|
|
55711
55808
|
};
|
|
55712
55809
|
var detailGrid = function detailGrid(_ref) {
|
|
55713
55810
|
var data = _ref.data;
|
|
@@ -56308,67 +56405,6 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
|
|
|
56308
56405
|
}, React__default.createElement("p", null, renderTotal())));
|
|
56309
56406
|
};
|
|
56310
56407
|
|
|
56311
|
-
var uniqueRecords = function uniqueRecords(value, index, array) {
|
|
56312
|
-
return array.indexOf(value) === index;
|
|
56313
|
-
};
|
|
56314
|
-
var exportToExcel = function exportToExcel(props) {
|
|
56315
|
-
var workbook = new exceljs.Workbook();
|
|
56316
|
-
var worksheet = workbook.addWorksheet('Main Sheet');
|
|
56317
|
-
var lastProcessedRowData = null;
|
|
56318
|
-
var rowCount = 0;
|
|
56319
|
-
excel_exporter.exportDataGrid({
|
|
56320
|
-
component: props.gridComponent,
|
|
56321
|
-
worksheet: worksheet,
|
|
56322
|
-
selectedRowsOnly: props.selectedRowsOnly,
|
|
56323
|
-
customizeCell: function customizeCell(options) {
|
|
56324
|
-
var gridCell = options.gridCell,
|
|
56325
|
-
excelCell = options.excelCell;
|
|
56326
|
-
if (gridCell && excelCell) {
|
|
56327
|
-
if (gridCell.rowType === 'data' && lastProcessedRowData !== gridCell.data) {
|
|
56328
|
-
rowCount++;
|
|
56329
|
-
lastProcessedRowData = gridCell.data;
|
|
56330
|
-
}
|
|
56331
|
-
if ((gridCell.column.dataType === "datetime" || gridCell.column.dataField === "CreateDate" || gridCell.column.dataField === "ModifyDate") && gridCell.value) {
|
|
56332
|
-
excelCell.value = moment__default(gridCell.value).format("DD.MM.YYYY HH:mm");
|
|
56333
|
-
} else if (gridCell.column.dataType === "date" && gridCell.value) {
|
|
56334
|
-
excelCell.value = moment__default(gridCell.value).format("DD.MM.YYYY");
|
|
56335
|
-
}
|
|
56336
|
-
if (gridCell.rowType === 'data' && gridCell.column.dataField.toLowerCase() === "isactive") {
|
|
56337
|
-
excelCell.value = gridCell.value === true ? "" + props.activeText : "" + props.passiveText;
|
|
56338
|
-
}
|
|
56339
|
-
excelCell.font = {
|
|
56340
|
-
name: 'Arial',
|
|
56341
|
-
size: 12
|
|
56342
|
-
};
|
|
56343
|
-
excelCell.alignment = {
|
|
56344
|
-
horizontal: 'left'
|
|
56345
|
-
};
|
|
56346
|
-
}
|
|
56347
|
-
}
|
|
56348
|
-
}).then(function () {
|
|
56349
|
-
var summaryResult = props.getSummary();
|
|
56350
|
-
var summaryText = props.selectedRowsOnly ? summaryResult + " - " + rowCount + " " + props.selectedText : summaryResult;
|
|
56351
|
-
var lastRow = worksheet.addRow([summaryText]);
|
|
56352
|
-
lastRow.font = {
|
|
56353
|
-
name: 'Arial',
|
|
56354
|
-
size: 10,
|
|
56355
|
-
bold: true
|
|
56356
|
-
};
|
|
56357
|
-
lastRow.alignment = {
|
|
56358
|
-
horizontal: 'left'
|
|
56359
|
-
};
|
|
56360
|
-
workbook.xlsx.writeBuffer().then(function (buffer) {
|
|
56361
|
-
var now = new Date();
|
|
56362
|
-
var datePart = ('0' + now.getDate()).slice(-2) + "-" + ('0' + (now.getMonth() + 1)).slice(-2) + "-" + now.getFullYear();
|
|
56363
|
-
var timePart = ('0' + now.getHours()).slice(-2) + ":" + ('0' + now.getMinutes()).slice(-2);
|
|
56364
|
-
var fullFileName = props.baseFileName + "-" + datePart + "-" + timePart + ".xlsx";
|
|
56365
|
-
FileSaver.saveAs(new Blob([buffer], {
|
|
56366
|
-
type: 'application/octet-stream'
|
|
56367
|
-
}), fullFileName);
|
|
56368
|
-
});
|
|
56369
|
-
});
|
|
56370
|
-
};
|
|
56371
|
-
|
|
56372
56408
|
var _templateObject$A, _templateObject2$8;
|
|
56373
56409
|
var useStyles$a = antdStyle.createStyles(function (_ref) {
|
|
56374
56410
|
var css = _ref.css;
|
|
@@ -57801,7 +57837,7 @@ var OdsTransfer = function OdsTransfer(props) {
|
|
|
57801
57837
|
calculateSortValue: column.calculateSortValue,
|
|
57802
57838
|
allowHeaderFiltering: props.showFilters
|
|
57803
57839
|
});
|
|
57804
|
-
}), props.displayPageTitle && React__default.createElement(DataGrid.Toolbar, null, React__default.createElement(DataGrid.Item, {
|
|
57840
|
+
}), props.displayPageTitle && !isTextEmpty(props.pageTitle) && React__default.createElement(DataGrid.Toolbar, null, React__default.createElement(DataGrid.Item, {
|
|
57805
57841
|
location: "before",
|
|
57806
57842
|
cssClass: "toolbarTitleItem"
|
|
57807
57843
|
}, React__default.createElement(OdsTitle, {
|
|
@@ -58064,7 +58100,7 @@ var OdsTransferV2 = function OdsTransferV2(_ref) {
|
|
|
58064
58100
|
calculateSortValue: column.calculateSortValue,
|
|
58065
58101
|
headerFilter: {}
|
|
58066
58102
|
});
|
|
58067
|
-
}), displayPageTitle && React__default.createElement(DataGrid.Toolbar, null, React__default.createElement(DataGrid.Item, {
|
|
58103
|
+
}), displayPageTitle && !isTextEmpty(pageTitle) && React__default.createElement(DataGrid.Toolbar, null, React__default.createElement(DataGrid.Item, {
|
|
58068
58104
|
location: "before",
|
|
58069
58105
|
cssClass: "toolbarTitleItem"
|
|
58070
58106
|
}, React__default.createElement(OdsTitle, {
|