Skip to content

Commit 0b42377

Browse files
authored
Merge pull request #140 from KorzhCom/dev
Version 1.4.7
2 parents 52d8495 + 1258a8f commit 0b42377

File tree

9 files changed

+53
-17
lines changed

9 files changed

+53
-17
lines changed

easydata.js/packs/core/src/event/event_emitter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface EqEventTypeRec {
1111
}
1212

1313
/**
14-
* Represents EasyQuery event type
14+
* Represents EasyQuery event
1515
*/
1616
export interface EqEvent {
1717

@@ -35,7 +35,6 @@ export interface EqEvent {
3535
* The representation of event emitter.
3636
*/
3737
export class EventEmitter {
38-
3938
/**
4039
* The array of events.
4140
*/
@@ -175,5 +174,4 @@ export class EventEmitter {
175174

176175
return null;
177176
}
178-
179177
}

easydata.js/packs/ui/src/grid/easy_grid.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ interface PaginationInfo {
3232
const DEFAULT_ROW_HEIGHT = 36;
3333
const DEFAULT_ROW_COUNT = 15;
3434

35+
/** Represents a grid widget with columns rows, paging, custom rendering and more */
3536
export class EasyGrid {
3637
protected eventEmitter: EventEmitter;
3738

@@ -115,6 +116,7 @@ export class EasyGrid {
115116

116117
public readonly options: EasyGridOptions;
117118

119+
/** Creates and initializes all internal properties of the grid object */
118120
constructor(options: EasyGridOptions) {
119121
if (options && options.paging) {
120122
options.paging = utils.assign(this.defaultDataGridOptions.paging,
@@ -214,6 +216,7 @@ export class EasyGrid {
214216

215217
private rowsOnPagePromise: Promise<number> = null;
216218

219+
/** Initializes grid widget according to the options passed in the parameter */
217220
protected init(options: EasyGridOptions) {
218221
if (options.onInit) {
219222
this.addEventListener('init', options.onInit);
@@ -284,6 +287,10 @@ export class EasyGrid {
284287
this.fireEvent('init');
285288
}
286289

290+
/** Fires a grid event. You can pass either an event type
291+
* (like 'init', 'rowClick', 'pageChanged', etc )
292+
* or a ready-to-use grid event object
293+
* */
287294
public fireEvent(event: GridEvent | GridEventType) {
288295
if (typeof event === "string") {
289296
this.eventEmitter.fire(event);
@@ -293,24 +300,30 @@ export class EasyGrid {
293300
}
294301
}
295302

303+
/** Allows to set the data (represented by a EasyDataTable object)
304+
* or to replace the existing one associated with the grid */
296305
public setData(data: EasyDataTable) {
297306
this.dataTable = data;
298307
this.clear();
299308
this.refresh();
300309
}
301310

311+
/** Returns the EasyDataTable object associated with the grid via `setData()` call */
302312
public getData(): EasyDataTable {
303313
return this.dataTable;
304314
}
305315

316+
/** Gets the list of grid columns */
306317
public getColumns(): GridColumnList {
307318
return this.columns;
308319
}
309320

321+
/** This function is called when the grid is destroyed */
310322
public destroy() {
311323
this.slot.innerHTML = "";
312324
}
313325

326+
/** Clears the current DOM object and re-renders everything from the scratch */
314327
public refresh() {
315328
this.clearDOM();
316329
this.render();
@@ -320,6 +333,7 @@ export class EasyGrid {
320333
this.slot.innerHTML = '';
321334
}
322335

336+
/** Clears all DOM object in the grid and return it to its initial state */
323337
public clear() {
324338
this.pagination.page = 1;
325339
this.clearDOM();
@@ -329,6 +343,7 @@ export class EasyGrid {
329343

330344
private firstRender = true;
331345

346+
/** Renders the grid */
332347
protected render() {
333348
if (!this.hasData() && !this.options.showPlusButton)
334349
return;
@@ -998,6 +1013,7 @@ export class EasyGrid {
9981013
return cellElement;
9991014
}
10001015

1016+
/** Sets current grid pages (if paging is used) */
10011017
public setPage(page: number) {
10021018
this.pagination.page = page;
10031019
this.fireEvent({ type: "pageChanged", page: page });
@@ -1314,10 +1330,12 @@ export class EasyGrid {
13141330
return null;
13151331
}
13161332

1333+
/** Makes the grid focused for keyboard events */
13171334
public focus() {
13181335
this.bodyViewportDiv.focus();
13191336
}
13201337

1338+
/** Resizes columns according to the data they represent */
13211339
public resizeColumns() {
13221340
if (this.options.columnWidths.autoResize === AutoResizeColumns.Never) return;
13231341

easydata.js/version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"version": "1.4.6",
3-
"baseVersion": "1.4.6",
4-
"assetVersion": "01_04_06",
2+
"version": "1.4.7",
3+
"baseVersion": "1.4.7",
4+
"assetVersion": "01_04_07",
55
"tag": "latest"
66
}

easydata.net/src/EasyData.Exporters.Default/Csv/CsvDataExporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Task ExportAsync(IEasyDataResultSet data, Stream stream, CancellationToke
6969
/// <returns>Task.</returns>
7070
public async Task ExportAsync(IEasyDataResultSet data, Stream stream, IDataExportSettings settings, CancellationToken ct = default)
7171
{
72-
using (var writer = new StreamWriter(stream, new UTF8Encoding(false))) {
72+
using (var writer = new StreamWriter(stream, new UTF8Encoding(false), 2048, true)) {
7373
await ExportAsync(data, writer, settings, ct).ConfigureAwait(false);
7474
}
7575
}

easydata.net/src/EasyData.Exporters.Default/Html/HtmlDataExporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public Task ExportAsync(IEasyDataResultSet data, Stream stream, CancellationToke
7474
/// <returns>Task.</returns>
7575
public async Task ExportAsync(IEasyDataResultSet data, Stream stream, IDataExportSettings settings, CancellationToken ct = default)
7676
{
77-
using (var writer = new StreamWriter(stream, new UTF8Encoding(false))) {
77+
using (var writer = new StreamWriter(stream, new UTF8Encoding(false), 2048, true)) {
7878
await ExportAsync(data, writer, settings, ct).ConfigureAwait(false);
7979
}
8080
}

easydata.net/test/EasyData.EntityFrameworkCore.Relational.Tests/DbContextMetaDataLoaderTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,20 @@ public void TestFilters()
7070
var attr = entity.FindAttribute(a => a.Id.Contains("Phone"));
7171
attr.Should().BeNull();
7272
}
73+
74+
[Fact]
75+
public void SkipUnknownTypes()
76+
{
77+
var meta = new MetaData();
78+
var loaderOptions = new DbContextMetaDataLoaderOptions();
79+
80+
meta.LoadFromDbContext(_dbContext, loaderOptions);
81+
82+
var entity = meta.FindEntity(ent => ent.ClrType.Equals(typeof(Customer)));
83+
entity.Should().NotBeNull();
84+
85+
var attr = entity.FindAttributeByExpression("Customer.TimeCreated");
86+
attr.Should().BeNull();
87+
}
7388
}
7489
}

easydata.net/test/EasyData.EntityFrameworkCore.Relational.Tests/EasyData.EntityFrameworkCore.Relational.Tests.csproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Faker.Net" Version="1.5.150" />
11-
<PackageReference Include="FluentAssertions" Version="5.10.3" />
12-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqLite" Version="3.1.9" />
1310
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
1411
<PackageReference Include="xunit" Version="2.4.0" />
1512
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
1613
<PackageReference Include="coverlet.collector" Version="1.2.0" />
17-
</ItemGroup>
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqLite" Version="5.0.17" />
15+
<PackageReference Include="NodaTime" Version="3.1.0" />
16+
<PackageReference Include="EntityFrameworkCore.Sqlite.NodaTime" Version="5.1.0" />
17+
<PackageReference Include="Faker.Net" Version="1.5.150" />
18+
<PackageReference Include="FluentAssertions" Version="5.10.3" />
19+
</ItemGroup>
1820

1921
<ItemGroup>
2022
<ProjectReference Include="..\..\src\EasyData.EntityFrameworkCore.Relational\EasyData.EntityFrameworkCore.Relational.csproj" />

easydata.net/test/EasyData.EntityFrameworkCore.Relational.Tests/TestData/TestDbContext.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
using System.Collections.Generic;
33
using System.ComponentModel.DataAnnotations;
44
using System.ComponentModel.DataAnnotations.Schema;
5-
using System.Text;
5+
6+
using NodaTime;
67

78
using Microsoft.EntityFrameworkCore;
89

@@ -45,7 +46,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
4546
public static TestDbContext Create()
4647
{
4748
return new TestDbContext(new DbContextOptionsBuilder()
48-
.UseSqlite("Data Source = :memory:")
49+
.UseSqlite("Data Source = :memory:", opts => opts.UseNodaTime())
4950
.Options);
5051
}
5152
}
@@ -74,6 +75,8 @@ public class Customer
7475
[Column("CustomerID")]
7576
public string Id { get; set; }
7677

78+
public Instant TimeCreated { get; set; }
79+
7780
[Display(Name = "Company Name")]
7881
public string CompanyName { get; set; }
7982

easydata.net/version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"assemblyVersion": "1.4.6.1",
3-
"packageVersion": "1.4.6",
4-
"assetVersion": "01_04_06"
2+
"assemblyVersion": "1.4.7.3",
3+
"packageVersion": "1.4.7",
4+
"assetVersion": "01_04_07"
55
}

0 commit comments

Comments
 (0)