From 53817c276c68150eeaafba887a47e4b1c16cd9b0 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Fri, 5 Jan 2024 19:13:16 +0200 Subject: [PATCH 01/17] Add PackageIcon node to all library projects --- easydata.net/src/Directory.Build.props | 4 ++++ easydata.net/src/images/easydata-icon02.png | Bin 0 -> 6426 bytes 2 files changed, 4 insertions(+) create mode 100644 easydata.net/src/images/easydata-icon02.png diff --git a/easydata.net/src/Directory.Build.props b/easydata.net/src/Directory.Build.props index 2f067ae0..d80a44bd 100644 --- a/easydata.net/src/Directory.Build.props +++ b/easydata.net/src/Directory.Build.props @@ -9,10 +9,14 @@ true Copyright 2020-$([System.DateTime]::Now.Year) (c) Korzh.com. All rights reserved. https://github.com/KorzhCom/EasyData + easydata-icon02.png https://cdn.korzh.com/img/easydata-icon02.png MIT CS1591,CS1574 + + + diff --git a/easydata.net/src/images/easydata-icon02.png b/easydata.net/src/images/easydata-icon02.png new file mode 100644 index 0000000000000000000000000000000000000000..5edd545cb733f5cbfc09e6340cb574cba70e1e91 GIT binary patch literal 6426 zcmZ`;WmFUlv|JXD&IRd)B}7_W!UgG0Y3YuY?xnjyKsx-Sr5lN*ySuwt1O%kv`ToCm z?zuC6=G^;t=1i2DiYy*BB{l#6z>}Ag()h=L|GSv4{$UT)bmSjVxJm1}X*ycDd78Rd z0zO(enpx7z!%VF$H7rdnyq$+EMF9ZvHhHO!pS+flA8-;s_c?z^lcuM)2?Oi|79`_& zu*X+uaVqh2`&dH-(I#^=RhGzqh{#DG3pj_O6c@t}E0NgU;liaHm1s(Oo*t2>;@wf3 z5S6f1TKXk8r*>acta&aWv39RD%XhkTC9Cx;KS$_?%l*?Fx7Ol?!gj;cww#5TwSO}+ zLy#W`#Af@yfgQhq{v$MhL#Q#i-5tolNBRcoD8x{#q;>r(@d<0sesJ!gEDTVO?Ru6C zCdUfOA0__C*za^$&!hEZV(ot)bVx1NQBsp|EhmTRVEIxdyMYqAJLB6U0RTr&c~bXe z=n?UI%J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Wj0cVE{nELy0L@r^SZ4$~EIuYMp#uXBuDW!!@z!-xRO9J-@=CEv zvv*OhRX~V4ZzuXqA84nC3ZQ}z@ZVCi0`0z z=x^Q`nBxVG3;&Y-1q;++(;RMPvCC7AElah{-g>;AOa*Y)4%O5cOvghmz0BGl$s^vA=@IbcB4qS|H=5%jnu)5*KdcL>WX(Ee1Z-B*U%|^4ueQcl0`NO!% zBjPe;MQ~)Cj&|f=`4H-{^qW<4>^8a1P-PRdo-KtLO~>HF#uGR2@zBtAb6)Y5 zndEDs=SvdifXW=R{o)dFjK8w@d21^h{$!^wAkadXkJ5Q3maauC+3!q4h;K*ZN_zU7 zj^4kEKUvgvv9q}=UlEjj!&HkDhkV&rCpQTuZ>$GMg|u6V8GHVHCp1Xu%Yyi@A6{d$ zoZbbM9d~;+t`j2x>b-vq)VZ}cf80LasBTSp3je!l!x*6aIE;ifgeoF1+XPT0cmF$m zn(WR$balDzU`RQq2(bt~VI*@*@OK?8ZHeng+ zy}M2G{fT((LNd&x@1H^URCGJCmjL1Nh~DS-b@3eT@;f>)q_Y-u{ALzZ<-A=S@!S0> zfD)2)w%)7;au=0cR3!*6#7@w@x$MZD6arCAg+1I4%z;HWd}fBT1Bc-!X)^A0JE2F+W-In literal 0 HcmV?d00001 From 31c372329c2056978435f58c1829b0813c2e0a96 Mon Sep 17 00:00:00 2001 From: olton Date: Fri, 5 Jan 2024 19:56:16 +0200 Subject: [PATCH 02/17] ... --- easydata.js/packs/ui/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/easydata.js/packs/ui/package.json b/easydata.js/packs/ui/package.json index 7895a749..2e12a9bf 100644 --- a/easydata.js/packs/ui/package.json +++ b/easydata.js/packs/ui/package.json @@ -36,9 +36,6 @@ ], "peerDependencies": { "@easydata/core": "^1.4.21" - }, - "dependencies": { - }, "files": [ "dist" From d24e768f0d266bc843f5c11cdbc82cb5ef522408 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Sat, 6 Jan 2024 13:47:06 +0200 Subject: [PATCH 03/17] Fix TypeDoc in i18n --- easydata.js/packs/core/src/i18n/i18n.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/easydata.js/packs/core/src/i18n/i18n.ts b/easydata.js/packs/core/src/i18n/i18n.ts index 4dbcdcb5..8e6c1370 100644 --- a/easydata.js/packs/core/src/i18n/i18n.ts +++ b/easydata.js/packs/core/src/i18n/i18n.ts @@ -286,14 +286,14 @@ export namespace i18n { * If the locale does exist yet - it will be added * @param localeInfo a LocaleInfo object that contains the locale settings and textual resources */ - export function updateLocaleInfo(localeId: string, localeData: LocaleInfo) : void { - mapInfo(localeData); + export function updateLocaleInfo(localeId: string, localeInfo: LocaleInfo) : void { + mapInfo(localeInfo); let localeInfoToUpdate = currentLocale; if (localeId) { - if (!localeData.localeId) { - localeData.localeId = localeId; + if (!localeInfo.localeId) { + localeInfo.localeId = localeId; } localeInfoToUpdate = allLocales[localeId]; @@ -302,7 +302,7 @@ export namespace i18n { allLocales[localeId] = localeInfoToUpdate; } } - utils.assignDeep(localeInfoToUpdate, localeData); + utils.assignDeep(localeInfoToUpdate, localeInfo); } /** @@ -473,28 +473,28 @@ export namespace i18n { /** * Converts a numeric value to the string taking into the account the decimal separator - * @param value - the number to convert + * @param num - the number to convert * @param format - the format of the number representation (D - decimal, F - float, C - currency) * @param decimalSeparator - the symbol that represents decimal separator. If not specified the function gets the one from the current locale settings. */ - export function numberToStr(number: number, format?: string, decimalSeparator?: string): string { + export function numberToStr(num: number, format?: string, decimalSeparator?: string): string { if (format && format.length > 0) { const type = format.charAt(0).toUpperCase(); if (type === 'S') { - return formatWithSequence(number, format.slice(1)); + return formatWithSequence(num, format.slice(1)); } else if (['D', 'F', 'C'].indexOf(type) >= 0) { const locale = getCurrentLocale(); - return number.toLocaleString(locale, getNumberFormatOptions(format)); + return num.toLocaleString(locale, getNumberFormatOptions(format)); } else { - return convertWithMask(Math.trunc(number), format); + return convertWithMask(Math.trunc(num), format); } } const localeSettings = getLocaleSettings(); decimalSeparator = decimalSeparator || localeSettings.decimalSeparator; - return number.toString().replace('.', decimalSeparator); + return num.toString().replace('.', decimalSeparator); } export function booleanToStr(bool: boolean, format?: string) { From e257bf20249ff217aa7e870c58f9883222c3c0f5 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Mon, 8 Jan 2024 14:06:07 +0200 Subject: [PATCH 04/17] Add isValid for AggregationSettings class --- easydata.js/packs/core/src/data/aggr_settings.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/easydata.js/packs/core/src/data/aggr_settings.ts b/easydata.js/packs/core/src/data/aggr_settings.ts index 2a698664..bef836ad 100644 --- a/easydata.js/packs/core/src/data/aggr_settings.ts +++ b/easydata.js/packs/core/src/data/aggr_settings.ts @@ -130,7 +130,12 @@ export class AggregationSettings { public isEmpty(): boolean { return !(this.hasAggregates() || this.hasGroups() || - this.hasAggregates() || this.hasRecordCount()); + this.hasGrandTotals() || this.hasRecordCount()); + } + + public isValid() : boolean { + return (this.hasGroups() && (this.hasAggregates() || this.hasRecordCount())) + || (this.hasAggregates && this.hasGrandTotals()); } public drop() { From 95de72442c701550418ecd7dc9486a609192341e Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Tue, 9 Jan 2024 12:07:10 +0200 Subject: [PATCH 05/17] Update utils --- easydata.js/packs/core/src/utils/utils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/easydata.js/packs/core/src/utils/utils.ts b/easydata.js/packs/core/src/utils/utils.ts index 12dfe89a..828d1640 100644 --- a/easydata.js/packs/core/src/utils/utils.ts +++ b/easydata.js/packs/core/src/utils/utils.ts @@ -36,7 +36,7 @@ export namespace utils { export function assign(target: any, ...args: any[]): any { for (let i = 0; i < args.length; i++) { let source = args[i]; - if (source) { + if (source && source.hasOwnProperty) { for (let key in source) { if (source.hasOwnProperty(key)) { target[key] = source[key]; @@ -67,14 +67,15 @@ export namespace utils { } for (let source of sources) { - if (source) { + if (source && source.hasOwnProperty) { for (let key in source) { if (source.hasOwnProperty(key)) { let sourceVal = source[key]; if (sourceVal !== null && typeof sourceVal === 'object') { if (hashSet.has(sourceVal)) { target[key] = hashSet.get(sourceVal); - } else { + } + else { if (Array.isArray(sourceVal)) { target[key] = createArrayFrom(sourceVal); hashSet.set(sourceVal, target[key]); From fd24e8705e8b527dd207d8d3f90715c0b4d150ef Mon Sep 17 00:00:00 2001 From: olton Date: Thu, 11 Jan 2024 00:38:02 +0200 Subject: [PATCH 06/17] fixed global watch command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 46fcd75b..36408da5 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "clean": "lerna clean", "test": "lerna run test", - "watch": "lerna run build --scope=@easydata/* && lerna watch --scope=@easydata/* -- lerna run build --since --include-dependents", + "watch": "lerna run build --scope=@easydata/* && lerna watch --scope=@easydata/* -- lerna run build --scope=%LERNA_PACKAGE_NAME% --include-dependents", "watch:core": "lerna run watch --scope=@easydata/core", "watch:crud": "lerna run watch --scope=@easydata/crud", "watch:ui": "lerna run watch --scope=@easydata/ui", From 64f9339534024957dd7fa08b21f1321e39ccbb33 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Fri, 26 Jan 2024 13:40:57 +0200 Subject: [PATCH 07/17] [fix] HttpResponesError initialization --- easydata.js/packs/core/src/http/http_client.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/easydata.js/packs/core/src/http/http_client.ts b/easydata.js/packs/core/src/http/http_client.ts index 7fa479de..228cf262 100644 --- a/easydata.js/packs/core/src/http/http_client.ts +++ b/easydata.js/packs/core/src/http/http_client.ts @@ -4,8 +4,12 @@ import { HttpMethod } from './http_method'; import { HttpHeaders, HttpRequest, HttpRequestDescriptor, HttpRequestOptions } from './http_request'; export class HttpResponseError extends Error { - constructor(public status: number, message: string) { + public status: number; + + constructor(status: number, message: string) { super(message); + Object.setPrototypeOf(this, HttpResponseError.prototype); + this.status = status; } } From 6f0a83429889f0f38a7af57ad58568de839ba675 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Thu, 1 Feb 2024 17:38:36 +0200 Subject: [PATCH 08/17] [upd] assignDeep doesn't deep copy of HTML elements --- easydata.js/packs/core/src/utils/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/easydata.js/packs/core/src/utils/utils.ts b/easydata.js/packs/core/src/utils/utils.ts index 828d1640..30ad79b3 100644 --- a/easydata.js/packs/core/src/utils/utils.ts +++ b/easydata.js/packs/core/src/utils/utils.ts @@ -71,7 +71,11 @@ export namespace utils { for (let key in source) { if (source.hasOwnProperty(key)) { let sourceVal = source[key]; - if (sourceVal !== null && typeof sourceVal === 'object') { + + //we don't make a deep copy of HTML elements and any other property makred as a 'reference' (ends with 'Ref') + if (sourceVal !== null && typeof sourceVal === 'object' + && key.endsWith('Ref') && !(sourceVal instanceof HTMLElement)) + { if (hashSet.has(sourceVal)) { target[key] = hashSet.get(sourceVal); } From 01f1a167a504474c17fc001d5376edc10bc3e9c1 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Thu, 1 Feb 2024 18:14:39 +0200 Subject: [PATCH 09/17] [fix] Aggregate options were not copied on EasyGrid initialization --- easydata.js/packs/ui/src/grid/easy_grid.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/easydata.js/packs/ui/src/grid/easy_grid.ts b/easydata.js/packs/ui/src/grid/easy_grid.ts index aea7e390..3ffce4ac 100644 --- a/easydata.js/packs/ui/src/grid/easy_grid.ts +++ b/easydata.js/packs/ui/src/grid/easy_grid.ts @@ -144,11 +144,13 @@ export class EasyGrid implements EasyGridBase { } private mergeOptions(options: EasyGridOptions): EasyGridOptions { + const aggrOptions = utils.assignDeep({}, this.defaultDataGridOptions.aggregates, options.aggregates ) const colWidthOptions = utils.assignDeep({}, this.defaultDataGridOptions.columnWidths, options.columnWidths); const pagingOptions = utils.assignDeep({}, this.defaultDataGridOptions.paging, options.paging); const result: EasyGridOptions = utils.assign({}, this.defaultDataGridOptions, options); + result.aggregates = aggrOptions; result.columnWidths = colWidthOptions; result.paging = pagingOptions; From 97416684c327911bcd1f275574654d609442f903 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Thu, 1 Feb 2024 18:29:40 +0200 Subject: [PATCH 10/17] fix potential problems with assignDeep --- easydata.js/packs/core/src/utils/utils.ts | 4 ++++ easydata.js/packs/crud/src/views/entity_data_view.ts | 8 ++++++-- easydata.js/packs/crud/src/widgets/text_filter_widget.ts | 2 +- easydata.js/packs/ui/src/grid/easy_grid.ts | 5 ++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/easydata.js/packs/core/src/utils/utils.ts b/easydata.js/packs/core/src/utils/utils.ts index 30ad79b3..232d2949 100644 --- a/easydata.js/packs/core/src/utils/utils.ts +++ b/easydata.js/packs/core/src/utils/utils.ts @@ -34,6 +34,10 @@ export namespace utils { * @param args - an array of the source objects */ export function assign(target: any, ...args: any[]): any { + if (!target) { + target = {}; + } + for (let i = 0; i < args.length; i++) { let source = args[i]; if (source && source.hasOwnProperty) { diff --git a/easydata.js/packs/crud/src/views/entity_data_view.ts b/easydata.js/packs/crud/src/views/entity_data_view.ts index f5232196..ab260ae0 100644 --- a/easydata.js/packs/crud/src/views/entity_data_view.ts +++ b/easydata.js/packs/crud/src/views/entity_data_view.ts @@ -76,7 +76,7 @@ export class EntityDataView { const gridSlot = document.createElement('div'); this.slot.appendChild(gridSlot); gridSlot.id = 'Grid'; - this.grid = new EasyGrid(dataUtils.assignDeep({ + let gridOptions = { slot: gridSlot, dataTable: result, paging: { @@ -91,7 +91,11 @@ export class EntityDataView { onGetCellRenderer: this.manageCellRenderer.bind(this), onRowDbClick: this.rowDbClickHandler.bind(this), onSyncGridColumn: this.syncGridColumnHandler.bind(this) - }, this.options.grid || {})); + }; + + const sourceOptions = this.options.grid || {}; + gridOptions = dataUtils.assignDeep(gridOptions, sourceOptions); + this.grid = new EasyGrid(gridOptions); if (this.options.showFilterBox) { let filterWidgetSlot: HTMLElement; diff --git a/easydata.js/packs/crud/src/widgets/text_filter_widget.ts b/easydata.js/packs/crud/src/widgets/text_filter_widget.ts index 7ddddb0c..8046c24c 100644 --- a/easydata.js/packs/crud/src/widgets/text_filter_widget.ts +++ b/easydata.js/packs/crud/src/widgets/text_filter_widget.ts @@ -25,7 +25,7 @@ export class TextFilterWidget { private filter: DataFilter, options?: TextFilterWidgetOptions) { - this.options = dataUtils.assignDeep(this.options, options || {}); + this.options = dataUtils.assign(this.options, options || {}); const stringDefRenderer = this.grid.cellRendererStore .getDefaultRendererByType(CellRendererType.STRING); diff --git a/easydata.js/packs/ui/src/grid/easy_grid.ts b/easydata.js/packs/ui/src/grid/easy_grid.ts index 3ffce4ac..81710d90 100644 --- a/easydata.js/packs/ui/src/grid/easy_grid.ts +++ b/easydata.js/packs/ui/src/grid/easy_grid.ts @@ -62,7 +62,7 @@ export class EasyGrid implements EasyGridBase { protected paginationOptions = { maxButtonCount: 10, - useBootstrap: false //true + useBootstrap: false } protected defaultDataGridOptions : EasyGridOptions = { @@ -251,8 +251,7 @@ export class EasyGrid implements EasyGridBase { this.addEventListener('pageChanged', ev => this.activeRowIndex = -1); - - utils.assignDeep(this.paginationOptions, options.pagination); + utils.assign(this.paginationOptions, options.pagination); this.pagination.pageSize = this.options.paging.pageSize || this.pagination.pageSize; From 66e6726cef0b19f7370d8aae330595edd3107755 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Thu, 1 Feb 2024 18:39:04 +0200 Subject: [PATCH 11/17] Version 1.5.0-beta01 --- easydata.js/version.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/easydata.js/version.json b/easydata.js/version.json index d5fc2fe6..5128bfd8 100644 --- a/easydata.js/version.json +++ b/easydata.js/version.json @@ -1,6 +1,6 @@ { - "version": "1.4.21", - "baseVersion": "1.4.21", - "assetVersion": "01_04_21", - "tag": "latest" + "version": "1.5.0-beta01", + "baseVersion": "1.5.0", + "assetVersion": "01_05_00", + "tag": "beta" } From e8d0681c8b9344983510e919f82235c318f53522 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Fri, 2 Feb 2024 11:58:06 +0200 Subject: [PATCH 12/17] [upd] Add PreserveFormatting processing in Excel exporter --- .../src/EasyData.Core/Export/BasicDataExportSettings.cs | 4 ++-- easydata.net/src/EasyData.Core/Export/IDataExportSettings.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/easydata.net/src/EasyData.Core/Export/BasicDataExportSettings.cs b/easydata.net/src/EasyData.Core/Export/BasicDataExportSettings.cs index 0eed1913..b554960a 100644 --- a/easydata.net/src/EasyData.Core/Export/BasicDataExportSettings.cs +++ b/easydata.net/src/EasyData.Core/Export/BasicDataExportSettings.cs @@ -94,12 +94,12 @@ public Func Before public string Description { get; set; } /// - /// Gets or sets value indicating wether title and description will be shown + /// Gets or sets value indicating whether title and description will be shown /// public bool ShowDatasetInfo { get; set; } = true; /// - /// Gets or sets value indicating whether the exporter shoud preserve the formatting in the original value + /// Gets or sets value indicating whether the exporter should preserve the formatting in the original value /// public bool PreserveFormatting { get; set; } = true; diff --git a/easydata.net/src/EasyData.Core/Export/IDataExportSettings.cs b/easydata.net/src/EasyData.Core/Export/IDataExportSettings.cs index 9c72fc47..211a832f 100644 --- a/easydata.net/src/EasyData.Core/Export/IDataExportSettings.cs +++ b/easydata.net/src/EasyData.Core/Export/IDataExportSettings.cs @@ -65,7 +65,7 @@ public interface IDataExportSettings bool ShowDatasetInfo { get; set; } /// - /// Gets or sets value indicating whether the exporter shoud preserve the formatting in the original value + /// Gets or sets value indicating whether the exporter should preserve the formatting in the original value /// bool PreserveFormatting { get; set; } From 7c54ede20de4fc50288f0001dd6a2e536504802b Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Fri, 2 Feb 2024 11:59:51 +0200 Subject: [PATCH 13/17] [new] Add AllowAutoFormatting option in ExcelExporter. It allows you to turn on/off Excel auto-formatting of the textual data --- easydata.net/src/EasyData.Core/EasyDataResultSet.cs | 4 ++-- .../Excel/ExcelDataExporter.cs | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/easydata.net/src/EasyData.Core/EasyDataResultSet.cs b/easydata.net/src/EasyData.Core/EasyDataResultSet.cs index 137b36ab..e8e97877 100644 --- a/easydata.net/src/EasyData.Core/EasyDataResultSet.cs +++ b/easydata.net/src/EasyData.Core/EasyDataResultSet.cs @@ -18,6 +18,8 @@ public enum ColumnAlignment public class EasyDataColStyle { public ColumnAlignment Alignment { get; set; } = ColumnAlignment.None; + + public bool AllowAutoFormatting { get; set; } = false; } @@ -69,8 +71,6 @@ public class EasyDataColDesc /// The style of the property to display in UI. /// public EasyDataColStyle Style { get; set; } - - } public class EasyDataCol diff --git a/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs b/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs index a339177a..887255a2 100644 --- a/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs +++ b/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs @@ -176,9 +176,14 @@ Task WriteRowAsync(EasyDataRow row, bool isExtraRow = false, : Convert.ToDateTime(value); break; case XLDataType.Text: - cell.Value = value != null - ? (XLCellValue)("'" + value) - : Blank.Value; + if (value != null) { + cell.Value = (XLCellValue)(settings.PreserveFormatting && !column.Style.AllowAutoFormatting + ? "'" + value + : value); + } + else { + cell.Value = Blank.Value; + } break; case XLDataType.Number: cell.Value = Convert.ToDouble(value); From 33c49a8af7692acdc07cddf7456bc104f2dd8a31 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Fri, 2 Feb 2024 13:27:27 +0200 Subject: [PATCH 14/17] Fix ExcelDataExporter for PreserveFormatting option --- .../EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs b/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs index 887255a2..9da13b1d 100644 --- a/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs +++ b/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs @@ -177,9 +177,10 @@ Task WriteRowAsync(EasyDataRow row, bool isExtraRow = false, break; case XLDataType.Text: if (value != null) { - cell.Value = (XLCellValue)(settings.PreserveFormatting && !column.Style.AllowAutoFormatting + var strValue = settings.PreserveFormatting && !column.Style.AllowAutoFormatting ? "'" + value - : value); + : value.ToString(); + cell.Value = (XLCellValue)strValue; } else { cell.Value = Blank.Value; From dfdd4bb96ff57d8e1eedfbb59a98ce12739c6e9a Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Sat, 3 Feb 2024 13:26:03 +0200 Subject: [PATCH 15/17] Update to the latest Easydata --- .../Excel/ExcelDataExporter.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs b/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs index 9da13b1d..3a10f569 100644 --- a/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs +++ b/easydata.net/src/EasyData.Exporters.ClosedXML/Excel/ExcelDataExporter.cs @@ -64,7 +64,7 @@ public void Export(IEasyDataResultSet data, Stream stream, IDataExportSettings s } /// - /// Asynchronical version of method. + /// Asynchronous version of method. /// /// The fetched data. /// The stream. @@ -76,12 +76,12 @@ public Task ExportAsync(IEasyDataResultSet data, Stream stream, CancellationToke } /// - /// Asynchronical version of method. + /// Asynchronous version of method. /// /// The fetched data. /// The stream. /// The settings. - /// The cacnellation token. + /// The cancellation token. /// Task. public async Task ExportAsync(IEasyDataResultSet data, Stream stream, IDataExportSettings settings, CancellationToken ct = default) { @@ -129,7 +129,6 @@ public async Task ExportAsync(IEasyDataResultSet data, Stream stream, IDataExpor cellNum++; } - var endHeaderNum = cellNum; var endColId = GetExcelColumnId(data.Cols.Count - 1 + startColNum); From 308e60cfc015034e4af49341c17d949a62021e7c Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Sat, 3 Feb 2024 13:44:41 +0200 Subject: [PATCH 16/17] Version 1.5.0 --- easydata.js/version.json | 2 +- easydata.net/version.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/easydata.js/version.json b/easydata.js/version.json index 5128bfd8..84a58cc3 100644 --- a/easydata.js/version.json +++ b/easydata.js/version.json @@ -1,5 +1,5 @@ { - "version": "1.5.0-beta01", + "version": "1.5.0", "baseVersion": "1.5.0", "assetVersion": "01_05_00", "tag": "beta" diff --git a/easydata.net/version.json b/easydata.net/version.json index dab93b60..276a09dc 100644 --- a/easydata.net/version.json +++ b/easydata.net/version.json @@ -1,5 +1,5 @@ { - "assemblyVersion": "1.4.21.1", - "packageVersion": "1.4.21", - "assetVersion": "01_04_21" + "assemblyVersion": "1.5.0.1", + "packageVersion": "1.5.0", + "assetVersion": "01_05_00" } From fc22caa8478c2732b1d260717e2722d8f2bd3664 Mon Sep 17 00:00:00 2001 From: Sergiy Korzh Date: Sat, 3 Feb 2024 14:13:12 +0200 Subject: [PATCH 17/17] [new] usePluralNames option for RootDataView and EasyDataViewDispatcher --- .../src/views/easy_data_view_dispatcher.ts | 9 +++++--- easydata.js/packs/crud/src/views/options.ts | 1 + .../packs/crud/src/views/root_data_view.ts | 21 +++++++++++++++---- .../MetaDataLoader/DbContextMetaDataLoader.cs | 5 ++--- .../ModelCustomizers/MetadataCustomizer.cs | 4 ++-- .../Pages/Crud.cshtml | 1 + 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/easydata.js/packs/crud/src/views/easy_data_view_dispatcher.ts b/easydata.js/packs/crud/src/views/easy_data_view_dispatcher.ts index 320657f4..561ebf0f 100644 --- a/easydata.js/packs/crud/src/views/easy_data_view_dispatcher.ts +++ b/easydata.js/packs/crud/src/views/easy_data_view_dispatcher.ts @@ -4,12 +4,11 @@ import { ProgressBar } from '../widgets/progress_bar'; import { DataContext } from '../main/data_context'; import { EntityDataView } from './entity_data_view'; import { EasyDataViewDispatcherOptions } from './options'; -import { RootDataView } from './root_data_view'; +import { RootDataView, RootDataViewOptions } from './root_data_view'; export class EasyDataViewDispatcher { private context: DataContext; private basePath: string; - private container: HTMLElement; private options: EasyDataViewDispatcherOptions = { @@ -114,7 +113,11 @@ export class EasyDataViewDispatcher { this.basePath, this.options); } else { - window['EDView'] = new RootDataView(this.container, this.context, this.basePath); + const rootViewOptions: RootDataViewOptions = {}; + if (typeof this.options.usePluralNames !== 'undefined') { + rootViewOptions.usePluralNames = this.options.usePluralNames; + } + window['EDView'] = new RootDataView(this.container, this.context, this.basePath, rootViewOptions); } } diff --git a/easydata.js/packs/crud/src/views/options.ts b/easydata.js/packs/crud/src/views/options.ts index 6c601528..f542cd5f 100644 --- a/easydata.js/packs/crud/src/views/options.ts +++ b/easydata.js/packs/crud/src/views/options.ts @@ -13,4 +13,5 @@ export interface EasyDataViewDispatcherOptions extends EasyDataViewOptions { basePath? : string; rootEntity?: string, container?: HTMLElement | string; + usePluralNames?: boolean; } \ No newline at end of file diff --git a/easydata.js/packs/crud/src/views/root_data_view.ts b/easydata.js/packs/crud/src/views/root_data_view.ts index 72d4836e..df244d8c 100644 --- a/easydata.js/packs/crud/src/views/root_data_view.ts +++ b/easydata.js/packs/crud/src/views/root_data_view.ts @@ -1,18 +1,27 @@ -import { i18n, MetaData } from '@easydata/core'; +import { i18n, utils, MetaData } from '@easydata/core'; import { domel } from '@easydata/ui'; import { setLocation } from '../utils/utils'; import { DataContext } from '../main/data_context'; +export interface RootDataViewOptions { + usePluralNames?: boolean; +} + export class RootDataView { private metaData: MetaData; + private options: RootDataViewOptions = { + usePluralNames: true + } constructor ( private slot: HTMLElement, private context: DataContext, - private basePath: string) { - + private basePath: string, + options?: RootDataViewOptions) + { this.metaData = this.context.getMetaData(); this.slot.innerHTML += `

${i18n.getText('RootViewTitle')}

`; + utils.assign(this.options, options); this.renderEntitySelector(); } @@ -30,6 +39,10 @@ export class RootDataView { .addChild('ul', b => { b.addClass('ed-entity-menu'); entities.forEach(ent => { + const entCaption = this.options.usePluralNames && ent.captionPlural + ? ent.captionPlural + : ent.caption; + b.addChild('li', b => { b.addClass('ed-entity-item') .on('click', () => { @@ -37,7 +50,7 @@ export class RootDataView { }) .addChild('div', b => { b.addClass('ed-entity-item-caption') - .addText(ent.captionPlural || ent.caption); + .addText(entCaption); }); if (ent.description) { diff --git a/easydata.net/src/EasyData.EntityFrameworkCore.Relational/MetaDataLoader/DbContextMetaDataLoader.cs b/easydata.net/src/EasyData.EntityFrameworkCore.Relational/MetaDataLoader/DbContextMetaDataLoader.cs index dc59b7a3..1b5bd234 100644 --- a/easydata.net/src/EasyData.EntityFrameworkCore.Relational/MetaDataLoader/DbContextMetaDataLoader.cs +++ b/easydata.net/src/EasyData.EntityFrameworkCore.Relational/MetaDataLoader/DbContextMetaDataLoader.cs @@ -137,10 +137,9 @@ public virtual void LoadFromDbContext() var entityTypes = GetEntityTypes(); if (Options.KeepDbSetDeclarationOrder) { - // EF Core keeps information about entity types - // in alphabetical order. + // EF Core keeps information about entity types in alphabetical order. // To make it possible to keep the original order - // we reoder the list of entities according to the orer of DbSets + // we reorder the list of entities according to the order of DbSets entityTypes = entityTypes.OrderBy(t => _dbSetTypes.TryGetValue(t.ClrType, out var index) ? index : int.MaxValue); diff --git a/easydata.net/src/EasyData.EntityFrameworkCore.Relational/ModelCustomizers/MetadataCustomizer.cs b/easydata.net/src/EasyData.EntityFrameworkCore.Relational/ModelCustomizers/MetadataCustomizer.cs index d4a79d60..b09dc008 100644 --- a/easydata.net/src/EasyData.EntityFrameworkCore.Relational/ModelCustomizers/MetadataCustomizer.cs +++ b/easydata.net/src/EasyData.EntityFrameworkCore.Relational/ModelCustomizers/MetadataCustomizer.cs @@ -4,7 +4,7 @@ namespace EasyData.EntityFrameworkCore { /// - /// Build entity metadata. + /// Builds entity metadata. /// public class MetadataCustomizer { @@ -21,7 +21,7 @@ public MetadataCustomizer(MetaData metadata) /// /// Gets the customizer for an entity by its type. - /// This is a virtual method that can be overriden in descendants + /// This is a virtual method that can be overridden in descendants /// /// Entity type. /// An instance of IMetaEntityCustomizer<TEntity>. diff --git a/playground/EasyDataAspNetCoreTest01/Pages/Crud.cshtml b/playground/EasyDataAspNetCoreTest01/Pages/Crud.cshtml index 3408a72e..73f5b119 100644 --- a/playground/EasyDataAspNetCoreTest01/Pages/Crud.cshtml +++ b/playground/EasyDataAspNetCoreTest01/Pages/Crud.cshtml @@ -17,6 +17,7 @@ easydata.runDispatcher({ basePath: 'crud', endpoint: '/api/easy-crud', + usePluralNames: false //dataTable: { // elasticChunks: true //}