@easydata/crud 1.4.0-rc01 → 1.4.1-rc02
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/browser/easydata.css +6 -6
- package/dist/browser/easydata.css.map +1 -1
- package/dist/browser/easydata.js +172 -150
- package/dist/browser/easydata.js.map +1 -1
- package/dist/browser/easydata.min.css +1 -1
- package/dist/browser/easydata.min.js +1 -1
- package/dist/browser/easydata.min.js.map +1 -1
- package/dist/bundles/easydata.crud.js +151 -129
- package/dist/bundles/easydata.crud.js.map +1 -1
- package/dist/bundles/easydata.crud.min.js +1 -1
- package/dist/bundles/easydata.crud.min.js.map +1 -1
- package/dist/lib/form/entity_form_builder.js +7 -10
- package/dist/lib/form/entity_form_builder.js.map +1 -1
- package/dist/lib/i18n/text_resources.js +1 -0
- package/dist/lib/i18n/text_resources.js.map +1 -1
- package/dist/lib/main/data_context.d.ts +1 -1
- package/dist/lib/main/data_context.js +1 -1
- package/dist/lib/views/easy_data_view_dispatcher.d.ts +4 -4
- package/dist/lib/views/easy_data_view_dispatcher.js +38 -35
- package/dist/lib/views/easy_data_view_dispatcher.js.map +1 -1
- package/dist/lib/views/entity_data_view.js +6 -4
- package/dist/lib/views/entity_data_view.js.map +1 -1
- package/package.json +3 -3
|
@@ -2738,6 +2738,7 @@ var easy_data_table_EasyDataTable = /** @class */ (function () {
|
|
|
2738
2738
|
this.cachedRows = [];
|
|
2739
2739
|
this.total = 0;
|
|
2740
2740
|
this.needTotal = !this._elasticChunks;
|
|
2741
|
+
this.fireUpdated();
|
|
2741
2742
|
};
|
|
2742
2743
|
EasyDataTable.prototype.createRow = function (dataOrRow) {
|
|
2743
2744
|
var _this = this;
|
|
@@ -4511,7 +4512,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4511
4512
|
pageSizeItems: [20, 30, 50, 100, 200]
|
|
4512
4513
|
},
|
|
4513
4514
|
columnWidths: {
|
|
4514
|
-
autoResize: AutoResizeColumns.
|
|
4515
|
+
autoResize: AutoResizeColumns.Always,
|
|
4515
4516
|
stringColumns: {
|
|
4516
4517
|
min: 100,
|
|
4517
4518
|
max: 500,
|
|
@@ -4539,7 +4540,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4539
4540
|
default: 60
|
|
4540
4541
|
}
|
|
4541
4542
|
},
|
|
4542
|
-
|
|
4543
|
+
showPlusButton: false,
|
|
4543
4544
|
viewportRowsCount: null,
|
|
4544
4545
|
showActiveRow: true
|
|
4545
4546
|
};
|
|
@@ -4638,8 +4639,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4638
4639
|
if (options.onRowDbClick) {
|
|
4639
4640
|
this.addEventListener('rowDbClick', options.onRowDbClick);
|
|
4640
4641
|
}
|
|
4641
|
-
if (options.
|
|
4642
|
-
this.addEventListener('
|
|
4642
|
+
if (options.onPlusButtonClick) {
|
|
4643
|
+
this.addEventListener('plusButtonClick', options.onPlusButtonClick);
|
|
4643
4644
|
}
|
|
4644
4645
|
if (options.onColumnChanged) {
|
|
4645
4646
|
this.addEventListener('columnChanged', options.onColumnChanged);
|
|
@@ -4725,7 +4726,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4725
4726
|
};
|
|
4726
4727
|
EasyGrid.prototype.render = function () {
|
|
4727
4728
|
var _this = this;
|
|
4728
|
-
if (!this.hasData() && !this.options.
|
|
4729
|
+
if (!this.hasData() && !this.options.showPlusButton)
|
|
4729
4730
|
return;
|
|
4730
4731
|
this.containerInitialHeight = this.slot.clientHeight;
|
|
4731
4732
|
this.rootDiv = document.createElement('div');
|
|
@@ -4742,6 +4743,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4742
4743
|
gridContainer.classList.add(this.cssPrefix + "-container");
|
|
4743
4744
|
gridContainer.appendChild(this.rootDiv);
|
|
4744
4745
|
this.slot.appendChild(gridContainer);
|
|
4746
|
+
var needAutoResize = this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4745
4747
|
if (this.rowsOnPagePromise) {
|
|
4746
4748
|
this.rowsOnPagePromise
|
|
4747
4749
|
.then(function () { return _this.updateHeight(); })
|
|
@@ -4755,17 +4757,12 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4755
4757
|
_this.updateHeight()
|
|
4756
4758
|
.then(function () {
|
|
4757
4759
|
_this.firstRender = false;
|
|
4760
|
+
if (needAutoResize) {
|
|
4761
|
+
_this.resizeColumns();
|
|
4762
|
+
}
|
|
4758
4763
|
});
|
|
4759
4764
|
}, 100);
|
|
4760
4765
|
}
|
|
4761
|
-
var needAutoResize = this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4762
|
-
if (needAutoResize) {
|
|
4763
|
-
this.bodyCellContainerDiv.style.visibility = 'hidden';
|
|
4764
|
-
setTimeout(function () {
|
|
4765
|
-
_this.resizeColumns();
|
|
4766
|
-
_this.bodyCellContainerDiv.style.visibility = null;
|
|
4767
|
-
}, 20);
|
|
4768
|
-
}
|
|
4769
4766
|
};
|
|
4770
4767
|
EasyGrid.prototype.updateHeight = function () {
|
|
4771
4768
|
var _this = this;
|
|
@@ -4774,14 +4771,14 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4774
4771
|
var firstRow = _this.bodyCellContainerDiv.firstElementChild;
|
|
4775
4772
|
var rowHeight = firstRow ? firstRow.offsetHeight : DEFAULT_ROW_HEIGHT;
|
|
4776
4773
|
var rowCount = _this.options.viewportRowsCount; // || DEFAULT_ROW_COUNT;
|
|
4777
|
-
var
|
|
4778
|
-
domel(_this.
|
|
4779
|
-
.setStyle('height',
|
|
4774
|
+
var viewportHeight_1 = rowHeight * rowCount;
|
|
4775
|
+
domel(_this.bodyViewportDiv)
|
|
4776
|
+
.setStyle('height', viewportHeight_1 + "px");
|
|
4780
4777
|
setTimeout(function () {
|
|
4781
4778
|
var sbHeight = _this.bodyViewportDiv.offsetHeight - _this.bodyViewportDiv.clientHeight;
|
|
4782
|
-
|
|
4783
|
-
domel(_this.
|
|
4784
|
-
.setStyle('height',
|
|
4779
|
+
viewportHeight_1 = viewportHeight_1 + sbHeight;
|
|
4780
|
+
domel(_this.bodyViewportDiv)
|
|
4781
|
+
.setStyle('height', viewportHeight_1 + "px");
|
|
4785
4782
|
resolve();
|
|
4786
4783
|
}, 100);
|
|
4787
4784
|
return;
|
|
@@ -4828,7 +4825,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4828
4825
|
_this.headerRowDiv.appendChild(hd);
|
|
4829
4826
|
if (column.isRowNum) {
|
|
4830
4827
|
domel(hd)
|
|
4831
|
-
.addChildElement(_this.
|
|
4828
|
+
.addChildElement(_this.renderHeaderButtons());
|
|
4832
4829
|
}
|
|
4833
4830
|
});
|
|
4834
4831
|
var containerWidth = this.getContainerWidth();
|
|
@@ -4925,9 +4922,15 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
4925
4922
|
_this.updateTotalsState(groups_1, row, true);
|
|
4926
4923
|
}
|
|
4927
4924
|
}
|
|
4928
|
-
var
|
|
4929
|
-
|
|
4930
|
-
.
|
|
4925
|
+
var needAutoResize = _this.options.columnWidths.autoResize !== AutoResizeColumns.Never;
|
|
4926
|
+
if (needAutoResize) {
|
|
4927
|
+
_this.resizeColumns();
|
|
4928
|
+
}
|
|
4929
|
+
else {
|
|
4930
|
+
var containerWidth = _this.getContainerWidth();
|
|
4931
|
+
domel(_this.bodyCellContainerDiv)
|
|
4932
|
+
.setStyle('width', containerWidth + "px");
|
|
4933
|
+
}
|
|
4931
4934
|
return rowsToRender;
|
|
4932
4935
|
})
|
|
4933
4936
|
.catch(function (error) { console.error(error); return 0; });
|
|
@@ -5167,23 +5170,26 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5167
5170
|
var pageInfoDiv = domel('div')
|
|
5168
5171
|
.addClass(this.cssPrefix + "-page-info")
|
|
5169
5172
|
.toDOM();
|
|
5170
|
-
var
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
var
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
.
|
|
5186
|
-
|
|
5173
|
+
var rowCount = this.dataTable.getTotal();
|
|
5174
|
+
if (rowCount > 0) {
|
|
5175
|
+
var fistPageRecordNum = count
|
|
5176
|
+
? (this.pagination.page - 1) * this.pagination.pageSize + 1
|
|
5177
|
+
: 0;
|
|
5178
|
+
var lastPageRecordNum = count
|
|
5179
|
+
? fistPageRecordNum + count - 1
|
|
5180
|
+
: 0;
|
|
5181
|
+
var totalStr = this.dataTable.getTotal().toString();
|
|
5182
|
+
if (this.dataTable.elasticChunks) {
|
|
5183
|
+
var count_1 = this.dataTable.getCachedCount();
|
|
5184
|
+
var total = this.dataTable.getTotal();
|
|
5185
|
+
if (count_1 !== total)
|
|
5186
|
+
totalStr = '?';
|
|
5187
|
+
}
|
|
5188
|
+
pageInfoDiv.innerHTML = i18n_i18n.getText('GridPageInfo')
|
|
5189
|
+
.replace('{FirstPageRecordNum}', "<span>" + fistPageRecordNum.toString() + "</span>")
|
|
5190
|
+
.replace('{LastPageRecordNum}', "<span>" + lastPageRecordNum.toString() + "</span>")
|
|
5191
|
+
.replace('{Total}', "<span>" + totalStr + "</span>");
|
|
5192
|
+
}
|
|
5187
5193
|
return pageInfoDiv;
|
|
5188
5194
|
};
|
|
5189
5195
|
EasyGrid.prototype.showProgress = function () {
|
|
@@ -5278,7 +5284,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5278
5284
|
var _this = this;
|
|
5279
5285
|
var paginateDiv = document.createElement('div');
|
|
5280
5286
|
paginateDiv.className = this.cssPrefix + "-pagination-wrapper";
|
|
5281
|
-
|
|
5287
|
+
var rowCount = this.dataTable.getTotal();
|
|
5288
|
+
if (this.options.paging && this.options.paging.enabled && rowCount > 0) {
|
|
5282
5289
|
var prefix_1 = this.paginationOptions.useBootstrap ? '' : this.cssPrefix + "-";
|
|
5283
5290
|
var buttonClickHandler_1 = function (ev) {
|
|
5284
5291
|
var element = ev.target;
|
|
@@ -5404,18 +5411,18 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5404
5411
|
EasyGrid.prototype.removeEventListener = function (eventType, handlerId) {
|
|
5405
5412
|
this.eventEmitter.unsubscribe(eventType, handlerId);
|
|
5406
5413
|
};
|
|
5407
|
-
EasyGrid.prototype.
|
|
5414
|
+
EasyGrid.prototype.renderHeaderButtons = function () {
|
|
5408
5415
|
var _this = this;
|
|
5409
|
-
if (this.options.
|
|
5416
|
+
if (this.options.showPlusButton) {
|
|
5410
5417
|
return domel('div')
|
|
5411
|
-
.addClass(this.cssPrefix + "-
|
|
5412
|
-
.title(this.options.
|
|
5418
|
+
.addClass(this.cssPrefix + "-header-btn-plus")
|
|
5419
|
+
.title(this.options.plusButtonTitle || 'Add')
|
|
5413
5420
|
.addChild('a', function (builder) { return builder
|
|
5414
5421
|
.attr('href', 'javascript:void(0)')
|
|
5415
5422
|
.on('click', function (e) {
|
|
5416
5423
|
e.preventDefault();
|
|
5417
5424
|
_this.fireEvent({
|
|
5418
|
-
type: '
|
|
5425
|
+
type: 'plusButtonClick',
|
|
5419
5426
|
sourceEvent: e
|
|
5420
5427
|
});
|
|
5421
5428
|
}); })
|
|
@@ -5522,6 +5529,8 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5522
5529
|
var containerWidth = this.bodyCellContainerDiv.style.width;
|
|
5523
5530
|
this.bodyCellContainerDiv.style.visibility = 'hidden';
|
|
5524
5531
|
this.bodyCellContainerDiv.style.width = '1px';
|
|
5532
|
+
//this.headerRowDiv.style.visibility = 'hidden';
|
|
5533
|
+
this.headerRowDiv.style.width = '1px';
|
|
5525
5534
|
var sumWidth = 0;
|
|
5526
5535
|
var columns = this.columns.getItems();
|
|
5527
5536
|
var headerCells = this.headerCellContainerDiv.querySelectorAll("." + this.cssPrefix + "-header-cell");
|
|
@@ -5542,44 +5551,53 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5542
5551
|
value.parentElement.style.width = calculatedWidth + "px";
|
|
5543
5552
|
});
|
|
5544
5553
|
headerCells[headerIdx].style.width = calculatedWidth + "px";
|
|
5545
|
-
headerIdx++;
|
|
5546
5554
|
}
|
|
5547
|
-
else
|
|
5548
|
-
cellValues.
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
if (width > maxWidth) {
|
|
5552
|
-
maxWidth = width;
|
|
5553
|
-
}
|
|
5554
|
-
});
|
|
5555
|
-
maxWidth += 3;
|
|
5556
|
-
var maxOption = column.isRowNum
|
|
5557
|
-
? this_1.options.columnWidths.rowNumColumn.max || 500
|
|
5558
|
-
: this_1.options.columnWidths[column.dataColumn.type].max || 2000;
|
|
5559
|
-
var minOption = column.isRowNum
|
|
5560
|
-
? this_1.options.columnWidths.rowNumColumn.min || 0
|
|
5561
|
-
: this_1.options.columnWidths[column.dataColumn.type].min || 20;
|
|
5562
|
-
if (maxWidth > maxOption) {
|
|
5563
|
-
maxWidth = maxOption;
|
|
5564
|
-
}
|
|
5565
|
-
if (maxWidth < minOption) {
|
|
5566
|
-
maxWidth = minOption;
|
|
5555
|
+
else {
|
|
5556
|
+
if (cellValues.length == 0) {
|
|
5557
|
+
headerCells[headerIdx].style.width = null;
|
|
5558
|
+
headerCells[headerIdx].style.whiteSpace = 'nowrap';
|
|
5567
5559
|
}
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5560
|
+
maxWidth = headerCells[headerIdx].offsetWidth;
|
|
5561
|
+
if (cellValues.length > 0) {
|
|
5562
|
+
cellValues.forEach(function (value) {
|
|
5563
|
+
value.parentElement.style.width = null;
|
|
5564
|
+
var width = value.parentElement.offsetWidth;
|
|
5565
|
+
if (width > maxWidth) {
|
|
5566
|
+
maxWidth = width;
|
|
5567
|
+
}
|
|
5568
|
+
});
|
|
5569
|
+
maxWidth += 3;
|
|
5570
|
+
var maxOption = column.isRowNum
|
|
5571
|
+
? this_1.options.columnWidths.rowNumColumn.max || 500
|
|
5572
|
+
: this_1.options.columnWidths[column.dataColumn.type].max || 2000;
|
|
5573
|
+
var minOption = column.isRowNum
|
|
5574
|
+
? this_1.options.columnWidths.rowNumColumn.min || 0
|
|
5575
|
+
: this_1.options.columnWidths[column.dataColumn.type].min || 20;
|
|
5576
|
+
if (maxWidth > maxOption) {
|
|
5577
|
+
maxWidth = maxOption;
|
|
5578
|
+
}
|
|
5579
|
+
if (maxWidth < minOption) {
|
|
5580
|
+
maxWidth = minOption;
|
|
5581
|
+
}
|
|
5582
|
+
if (utils_utils.isNumericType(column.type)) {
|
|
5583
|
+
//increase the calculated width in 1.3 times for numeric columns
|
|
5584
|
+
maxWidth = Math.round(maxWidth * 1.3);
|
|
5585
|
+
}
|
|
5586
|
+
sumWidth += maxWidth;
|
|
5587
|
+
column.width = maxWidth;
|
|
5588
|
+
cellValues.forEach(function (value) {
|
|
5589
|
+
value.parentElement.style.width = maxWidth + "px";
|
|
5590
|
+
});
|
|
5591
|
+
headerCells[headerIdx].style.width = maxWidth + "px";
|
|
5592
|
+
if (column.dataColumn) {
|
|
5593
|
+
column.dataColumn.calculatedWidth = maxWidth;
|
|
5594
|
+
}
|
|
5571
5595
|
}
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
cellValues.forEach(function (value) {
|
|
5575
|
-
value.parentElement.style.width = maxWidth + "px";
|
|
5576
|
-
});
|
|
5577
|
-
headerCells[headerIdx].style.width = maxWidth + "px";
|
|
5578
|
-
headerIdx++;
|
|
5579
|
-
if (column.dataColumn) {
|
|
5580
|
-
column.dataColumn.calculatedWidth = maxWidth;
|
|
5596
|
+
else {
|
|
5597
|
+
sumWidth += maxWidth;
|
|
5581
5598
|
}
|
|
5582
5599
|
}
|
|
5600
|
+
headerIdx++;
|
|
5583
5601
|
};
|
|
5584
5602
|
var this_1 = this;
|
|
5585
5603
|
for (var idx = 0; idx < this.columns.count; idx++) {
|
|
@@ -5594,6 +5612,7 @@ var easy_grid_EasyGrid = /** @class */ (function () {
|
|
|
5594
5612
|
this.headerCellContainerDiv.style.width = containerWidth;
|
|
5595
5613
|
}
|
|
5596
5614
|
this.bodyCellContainerDiv.style.visibility = null;
|
|
5615
|
+
this.headerRowDiv.removeAttribute('style');
|
|
5597
5616
|
};
|
|
5598
5617
|
return EasyGrid;
|
|
5599
5618
|
}());
|
|
@@ -7258,7 +7277,9 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7258
7277
|
var lookupEntity = this.context.getMetaData().getRootEntity()
|
|
7259
7278
|
.subEntities.filter(function (ent) { return ent.id == attr.lookupEntity; })[0];
|
|
7260
7279
|
var dataAttr = this.context.getMetaData().getAttributeById(attr.dataAttr);
|
|
7261
|
-
|
|
7280
|
+
if (!dataAttr)
|
|
7281
|
+
return;
|
|
7282
|
+
readOnly = readOnly || !dataAttr.isEditable;
|
|
7262
7283
|
value = this.params.values
|
|
7263
7284
|
? this.params.values.getValue(dataAttr.id)
|
|
7264
7285
|
: undefined;
|
|
@@ -7649,15 +7670,10 @@ var entity_form_builder_EntityEditFormBuilder = /** @class */ (function () {
|
|
|
7649
7670
|
this.form['setHtmlInt'](formHtml);
|
|
7650
7671
|
for (var _i = 0, _a = this.context.getActiveEntity().attributes; _i < _a.length; _i++) {
|
|
7651
7672
|
var attr = _a[_i];
|
|
7652
|
-
if (!attr.
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
}
|
|
7657
|
-
else {
|
|
7658
|
-
if (!attr.showOnCreate)
|
|
7659
|
-
continue;
|
|
7660
|
-
}
|
|
7673
|
+
if (!this.params.isEditForm && !attr.showOnCreate)
|
|
7674
|
+
continue;
|
|
7675
|
+
if (!attr.isPrimaryKey && this.params.isEditForm && !attr.showOnEdit) {
|
|
7676
|
+
continue;
|
|
7661
7677
|
}
|
|
7662
7678
|
this.addFormField(fb.toDOM(), attr);
|
|
7663
7679
|
}
|
|
@@ -7760,7 +7776,7 @@ var data_context_DataContext = /** @class */ (function () {
|
|
|
7760
7776
|
DataContext.prototype.getActiveEntity = function () {
|
|
7761
7777
|
return this.activeEntity;
|
|
7762
7778
|
};
|
|
7763
|
-
DataContext.prototype.
|
|
7779
|
+
DataContext.prototype.setActiveSource = function (entityId) {
|
|
7764
7780
|
this.activeEntity = this.model.getRootEntity().subEntities
|
|
7765
7781
|
.filter(function (e) { return e.id == entityId; })[0];
|
|
7766
7782
|
};
|
|
@@ -7998,10 +8014,12 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
7998
8014
|
showBackToEntities: true
|
|
7999
8015
|
};
|
|
8000
8016
|
this.defaultValidators = [new required_validator_RequiredValidator(), new type_validator_TypeValidator()];
|
|
8001
|
-
options = options || {};
|
|
8002
8017
|
this.options = utils_utils.assignDeep(this.options, options || {});
|
|
8003
8018
|
this.dlg = new DefaultDialogService();
|
|
8004
8019
|
var ent = this.context.getActiveEntity();
|
|
8020
|
+
if (!ent) {
|
|
8021
|
+
throw "Can't find active entity for " + window.location.pathname;
|
|
8022
|
+
}
|
|
8005
8023
|
this.slot.innerHTML += "<h1>" + (ent.captionPlural || ent.caption) + "</h1>";
|
|
8006
8024
|
if (this.options.showBackToEntities) {
|
|
8007
8025
|
domel(this.slot)
|
|
@@ -8038,10 +8056,10 @@ var entity_data_view_EntityDataView = /** @class */ (function () {
|
|
|
8038
8056
|
allowPageSizeChange: true,
|
|
8039
8057
|
pageSizeItems: [15, 30, 50, 100, 200]
|
|
8040
8058
|
},
|
|
8041
|
-
|
|
8042
|
-
|
|
8059
|
+
showPlusButton: _this.context.getActiveEntity().isEditable,
|
|
8060
|
+
plusButtonTitle: i18n_i18n.getText('AddRecordBtnTitle'),
|
|
8043
8061
|
showActiveRow: false,
|
|
8044
|
-
|
|
8062
|
+
onPlusButtonClick: _this.addClickHandler.bind(_this),
|
|
8045
8063
|
onGetCellRenderer: _this.manageCellRenderer.bind(_this),
|
|
8046
8064
|
onRowDbClick: _this.rowDbClickHandler.bind(_this),
|
|
8047
8065
|
onSyncGridColumn: _this.syncGridColumnHandler.bind(_this)
|
|
@@ -8254,51 +8272,62 @@ var root_data_view_RootDataView = /** @class */ (function () {
|
|
|
8254
8272
|
var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function () {
|
|
8255
8273
|
function EasyDataViewDispatcher(options) {
|
|
8256
8274
|
var _this = this;
|
|
8257
|
-
this.options = {
|
|
8275
|
+
this.options = {
|
|
8276
|
+
container: '#EasyDataContainer',
|
|
8277
|
+
basePath: 'easydata'
|
|
8278
|
+
};
|
|
8258
8279
|
this.onSetLocation = function () {
|
|
8259
8280
|
_this.setActiveView();
|
|
8260
8281
|
};
|
|
8261
|
-
options = options || {};
|
|
8262
|
-
|
|
8263
|
-
this.options.basePath = (!this.options.rootEntity)
|
|
8264
|
-
? this.pretiffyPath(this.options.basePath)
|
|
8265
|
-
: this.pretiffyPath(window.location.pathname);
|
|
8266
|
-
if (this.options.rootEntity)
|
|
8282
|
+
this.options = utils_utils.assign(this.options, options || {});
|
|
8283
|
+
if (this.options.rootEntity) {
|
|
8267
8284
|
this.options.showBackToEntities = false;
|
|
8268
|
-
|
|
8285
|
+
this.basePath = '/';
|
|
8286
|
+
}
|
|
8287
|
+
else {
|
|
8288
|
+
this.basePath = this.normalizeBasePath(this.options.basePath);
|
|
8289
|
+
}
|
|
8290
|
+
this.setContainer(this.options.container);
|
|
8269
8291
|
var progressBarSlot = document.createElement('div');
|
|
8270
8292
|
var bar = new ProgressBar(progressBarSlot);
|
|
8271
8293
|
var parent = this.container.parentElement;
|
|
8272
8294
|
parent.insertBefore(progressBarSlot, parent.firstElementChild);
|
|
8273
8295
|
this.context = new data_context_DataContext({
|
|
8274
|
-
endpoint: options.endpoint,
|
|
8275
|
-
dataTable: options.dataTable,
|
|
8296
|
+
endpoint: this.options.endpoint,
|
|
8297
|
+
dataTable: this.options.dataTable,
|
|
8276
8298
|
onProcessStart: function () { return bar.show(); },
|
|
8277
8299
|
onProcessEnd: function () { return bar.hide(); }
|
|
8278
8300
|
});
|
|
8279
|
-
this.basePath = this.getBasePath();
|
|
8280
8301
|
}
|
|
8281
|
-
EasyDataViewDispatcher.prototype.
|
|
8302
|
+
EasyDataViewDispatcher.prototype.normalizeBasePath = function (basePath) {
|
|
8303
|
+
basePath = this.trimSlashes(basePath);
|
|
8304
|
+
var fullPath = decodeURIComponent(window.location.pathname);
|
|
8305
|
+
var idx = fullPath.toLocaleLowerCase().indexOf(basePath);
|
|
8306
|
+
return idx >= 0 ? fullPath.substring(0, idx + basePath.length) : '/';
|
|
8307
|
+
};
|
|
8308
|
+
EasyDataViewDispatcher.prototype.trimSlashes = function (path) {
|
|
8282
8309
|
return path.replace(/^\/|\/$/g, '');
|
|
8283
8310
|
};
|
|
8284
8311
|
EasyDataViewDispatcher.prototype.setContainer = function (container) {
|
|
8285
8312
|
if (!container) {
|
|
8286
|
-
|
|
8287
|
-
return;
|
|
8313
|
+
throw 'Container is undefined';
|
|
8288
8314
|
}
|
|
8289
8315
|
if (typeof container === 'string') {
|
|
8290
8316
|
if (container.length) {
|
|
8291
|
-
if (container[0] === '
|
|
8292
|
-
this.container = document.getElementById(container.substring(1));
|
|
8293
|
-
}
|
|
8294
|
-
else if (container[0] === '.') {
|
|
8317
|
+
if (container[0] === '.') {
|
|
8295
8318
|
var result = document.getElementsByClassName(container.substring(1));
|
|
8296
8319
|
if (result.length)
|
|
8297
8320
|
this.container = result[0];
|
|
8298
8321
|
}
|
|
8299
8322
|
else {
|
|
8300
|
-
|
|
8301
|
-
|
|
8323
|
+
if (container[0] === '#') {
|
|
8324
|
+
container = container.substring(1);
|
|
8325
|
+
}
|
|
8326
|
+
this.container = document.getElementById(container);
|
|
8327
|
+
}
|
|
8328
|
+
if (!this.container) {
|
|
8329
|
+
throw Error('Unrecognized `container` parameter: ' + container + '\n'
|
|
8330
|
+
+ 'It must be an element ID, a class name (starting with .) or an HTMLElement object itself.');
|
|
8302
8331
|
}
|
|
8303
8332
|
}
|
|
8304
8333
|
}
|
|
@@ -8306,20 +8335,12 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
|
|
|
8306
8335
|
this.container = container;
|
|
8307
8336
|
}
|
|
8308
8337
|
};
|
|
8309
|
-
EasyDataViewDispatcher.prototype.
|
|
8338
|
+
EasyDataViewDispatcher.prototype.getActiveSourceId = function () {
|
|
8310
8339
|
if (this.options.rootEntity)
|
|
8311
8340
|
return this.options.rootEntity;
|
|
8312
|
-
var
|
|
8313
|
-
var
|
|
8314
|
-
|
|
8315
|
-
return typeName && typeName.toLocaleLowerCase() !== this.options.basePath
|
|
8316
|
-
? typeName
|
|
8317
|
-
: null;
|
|
8318
|
-
};
|
|
8319
|
-
EasyDataViewDispatcher.prototype.getBasePath = function () {
|
|
8320
|
-
var decodedUrl = decodeURIComponent(window.location.href);
|
|
8321
|
-
var optBasePathIndex = decodedUrl.toLocaleLowerCase().indexOf(this.options.basePath);
|
|
8322
|
-
return decodedUrl.substring(0, optBasePathIndex + this.options.basePath.length);
|
|
8341
|
+
var path = decodeURIComponent(window.location.pathname);
|
|
8342
|
+
var idIndex = this.basePath.length + 1;
|
|
8343
|
+
return idIndex < path.length ? path.substring(idIndex) : null;
|
|
8323
8344
|
};
|
|
8324
8345
|
EasyDataViewDispatcher.prototype.run = function () {
|
|
8325
8346
|
var _this = this;
|
|
@@ -8332,9 +8353,9 @@ var easy_data_view_dispatcher_EasyDataViewDispatcher = /** @class */ (function (
|
|
|
8332
8353
|
};
|
|
8333
8354
|
EasyDataViewDispatcher.prototype.setActiveView = function () {
|
|
8334
8355
|
this.clear();
|
|
8335
|
-
var
|
|
8336
|
-
if (
|
|
8337
|
-
this.context.
|
|
8356
|
+
var sourceId = this.getActiveSourceId();
|
|
8357
|
+
if (sourceId) {
|
|
8358
|
+
this.context.setActiveSource(sourceId);
|
|
8338
8359
|
window['EDView'] = new entity_data_view_EntityDataView(this.container, this.context, this.basePath, this.options);
|
|
8339
8360
|
}
|
|
8340
8361
|
else {
|
|
@@ -8367,6 +8388,7 @@ function addEasyDataCRUDTexts() {
|
|
|
8367
8388
|
CalendarBtnTitle: 'Open calendar',
|
|
8368
8389
|
TimerBtnTitle: 'Open timer',
|
|
8369
8390
|
AddBtnTitle: 'Add',
|
|
8391
|
+
AddRecordBtnTitle: 'Add record',
|
|
8370
8392
|
EditBtn: 'Edit',
|
|
8371
8393
|
DeleteBtn: 'Delete',
|
|
8372
8394
|
SelectLink: '[ select ]',
|