From 7089e8063401a4a11bdc103f1f5f888d327fc7b7 Mon Sep 17 00:00:00 2001
From: Vasily Chefonov <81791194+vasiliy-chefonov@users.noreply.github.com>
Date: Tue, 16 Nov 2021 13:48:57 +0300
Subject: [PATCH 1/9] Add help text
---
.../packs/core/src/data/data_column.ts | 18 +++++
.../crud/src/form/entity_form_builder.ts | 60 ++++++++-------
easydata.js/packs/ui/assets/css/easy-grid.css | 8 ++
easydata.js/packs/ui/src/grid/easy_grid.ts | 8 +-
.../packs/ui/src/grid/easy_grid_columns.ts | 7 ++
.../src/EasyData.Core/EasyDataResultSet.cs | 74 +++++++++++++++++--
.../Services/EasyDataManagerEF.cs | 3 +-
7 files changed, 142 insertions(+), 36 deletions(-)
diff --git a/easydata.js/packs/core/src/data/data_column.ts b/easydata.js/packs/core/src/data/data_column.ts
index f21a5f65..f6952277 100644
--- a/easydata.js/packs/core/src/data/data_column.ts
+++ b/easydata.js/packs/core/src/data/data_column.ts
@@ -15,34 +15,51 @@ export interface DataColumnStyle
}
export interface DataColumnDescriptor {
+ /** Represents internal column id. */
id: string;
+ /** Represents original internal column id. */
originAttrId?: string;
+ /** The type of data represented by column. */
type?: DataType;
+ /** Name to use for this column in the UI. */
label: string;
isAggr?: boolean;
+ /** The display format for the column. */
dfmt?: string;
gfct?: string;
+ /** The style of the column to display in UI. */
style?: DataColumnStyle;
+ /** Detailed description of the column. */
+ description: string | null;
}
export class DataColumn {
+ /** The type of data represented by column. */
public readonly type: DataType;
+ /** Represents internal column id. */
public readonly id: string;
public readonly isAggr: boolean;
+ /** Represents original internal column id. */
public readonly originAttrId?: string;
+ /** Name to use for this column in the UI. */
public label: string;
+ /** The display format for the column. */
public displayFormat?: string;
public groupFooterColumnTemplate?: string;
+ /** The style of the column to display in UI. */
public style?: DataColumnStyle;
+ /** Column description. */
+ public description: string | null;
+
constructor(desc: DataColumnDescriptor) {
if (!desc)
throw Error("Options are required");
@@ -61,6 +78,7 @@ export class DataColumn {
this.displayFormat = desc.dfmt;
this.groupFooterColumnTemplate = desc.gfct;
this.style = desc.style || {};
+ this.description = desc.description;
}
}
diff --git a/easydata.js/packs/crud/src/form/entity_form_builder.ts b/easydata.js/packs/crud/src/form/entity_form_builder.ts
index df01f2f1..e247638c 100644
--- a/easydata.js/packs/crud/src/form/entity_form_builder.ts
+++ b/easydata.js/packs/crud/src/form/entity_form_builder.ts
@@ -394,35 +394,43 @@ export class EntityEditFormBuilder {
.addChild('label', b => b
.attr('for', attr.id)
.addHtml(`${attr.caption} ${required ? '*' : ''}: `)
- );
+ ).addChild('div');
+
+ let fieldHolder = parent.lastChild as HTMLElement;
if (attr.kind === EntityAttrKind.Lookup) {
- this.setupLookupField(parent, attr, readOnly, value);
- return;
+ this.setupLookupField(fieldHolder, attr, readOnly, value);
+ }
+ else {
+ switch (editor.tag) {
+ case EditorTag.DateTime:
+ this.setupDateTimeField(fieldHolder, attr, readOnly, value);
+ break;
+
+ case EditorTag.List:
+ this.setupListField(fieldHolder, attr, readOnly, editor.values, value);
+ break;
+
+ case EditorTag.File:
+ this.setupFileField(fieldHolder, attr, readOnly, editor.accept);
+ break;
+
+ case EditorTag.Edit:
+ default:
+ if (editor.multiline) {
+ this.setupTextArea(fieldHolder, attr, readOnly, value);
+ }
+ else {
+ this.setupTextField(fieldHolder, attr, readOnly, value);
+ }
+ break;
+ }
}
- switch (editor.tag) {
- case EditorTag.DateTime:
- this.setupDateTimeField(parent, attr, readOnly, value);
- break;
-
- case EditorTag.List:
- this.setupListField(parent, attr, readOnly, editor.values, value);
- break;
-
- case EditorTag.File:
- this.setupFileField(parent, attr, readOnly, editor.accept);
- break;
-
- case EditorTag.Edit:
- default:
- if (editor.multiline) {
- this.setupTextArea(parent, attr, readOnly, value);
- }
- else {
- this.setupTextField(parent, attr, readOnly, value);
- }
- break;
+ if (attr.description) {
+ domel(fieldHolder).addChild('small', b => b
+ .addText(attr.description)
+ );
}
}
@@ -501,4 +509,4 @@ export class EntityEditFormBuilder {
return this.form;
}
-}
+}
\ No newline at end of file
diff --git a/easydata.js/packs/ui/assets/css/easy-grid.css b/easydata.js/packs/ui/assets/css/easy-grid.css
index 00691686..558ffcd8 100644
--- a/easydata.js/packs/ui/assets/css/easy-grid.css
+++ b/easydata.js/packs/ui/assets/css/easy-grid.css
@@ -330,4 +330,12 @@
.eqjs-chart-content canvas {
max-height: 100%;
+}
+
+.question-mark {
+ position: relative;
+ background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAACE4AAAhOAYwxAOwAAAFgSURBVDhPbdK7K4dRHMfxn1sWUVhcihK/MBKlbMqGKAplMMglk7JJRpOy+R8sJotBiUUiSe6XWNxGpYT3++k5Tw/51Kvfc06/c/2enMzv2K5CCxpRgmecYB+vSJIX/5oCTGINnXjBG+owjXE84gzfSOLAZRxiKG6nU4QpnGIWyY79mIEDa+N2LirRhvK4Tx24Qx+iVOMarhhmHICr7MFJ22GcdB47KLajF8fIt0GcYBujcLur2EBIIa7Q5Eze6hY+ETKCdXzA838hxL4jZB1sOZ4Q4k0+wJ1sogtLSMdKlDnYOtbY8ycNsEzDOLAjFd+CZct04wKeLx3brfCM6ZTiFvWu7MvxTGMIt20slbWNbjWOj2oB54hWNv2wNNbRCU0FJhAGO3AQN/B/SRzgy7mHdfxvqytwYI8dJr1Nv635HFzVcnirXk4z3OoidhElPTjEbfrqsiiDZ7uMf98RJ5P5AUhxQvegD107AAAAAElFTkSuQmCC') no-repeat center;
+ width: 20px;
+ height: 20px;
+ margin-left: 5px;
}
\ No newline at end of file
diff --git a/easydata.js/packs/ui/src/grid/easy_grid.ts b/easydata.js/packs/ui/src/grid/easy_grid.ts
index 2a3b7c76..71e11363 100644
--- a/easydata.js/packs/ui/src/grid/easy_grid.ts
+++ b/easydata.js/packs/ui/src/grid/easy_grid.ts
@@ -393,6 +393,12 @@ export class EasyGrid {
.text(column.label);
}
+ if (column.description) {
+ domel('div', colDiv)
+ .addClass('question-mark')
+ .title(column.description);
+ }
+
if (this.options.allowDragDrop) {
eqDragManager.registerDraggableItem({
element: colDiv,
@@ -672,7 +678,7 @@ export class EasyGrid {
let result: any = {}
for (const colId of group.columns) {
let keyVal = row.getValue(colId);
- if (caseInsensitive && typeof(keyVal) === 'string') {
+ if (caseInsensitive) {
keyVal = keyVal.toLowerCase();
}
result[colId] = keyVal;
diff --git a/easydata.js/packs/ui/src/grid/easy_grid_columns.ts b/easydata.js/packs/ui/src/grid/easy_grid_columns.ts
index f46d490f..71babab4 100644
--- a/easydata.js/packs/ui/src/grid/easy_grid_columns.ts
+++ b/easydata.js/packs/ui/src/grid/easy_grid_columns.ts
@@ -39,6 +39,7 @@ function MapAlignment(alignment: ColumnAlignment): GridColumnAlign {
export class GridColumn {
private _label : string = null;
private grid: EasyGrid;
+ private _description: string = null;
public readonly dataColumn: DataColumn;
@@ -77,6 +78,7 @@ export class GridColumn {
}
this.cellRenderer = this.grid.cellRendererStore.getDefaultRenderer(column.type);
+ this._description = column.description;
}
else if (isRowNum) {
this.isRowNum = true;
@@ -99,6 +101,11 @@ export class GridColumn {
this._label = this.label;
}
+ /** Get column description. */
+ public get description(): string {
+ return this._description;
+ }
+
public get type(): DataType {
return this.dataColumn ? this.dataColumn.type : null;
}
diff --git a/easydata.net/src/EasyData.Core/EasyDataResultSet.cs b/easydata.net/src/EasyData.Core/EasyDataResultSet.cs
index 59f56845..3296c96c 100644
--- a/easydata.net/src/EasyData.Core/EasyDataResultSet.cs
+++ b/easydata.net/src/EasyData.Core/EasyDataResultSet.cs
@@ -7,8 +7,8 @@
namespace EasyData
{
- public enum ColumnAlignment
- {
+ public enum ColumnAlignment
+ {
None,
Left,
Center,
@@ -23,22 +23,48 @@ public class EasyDataColStyle
public class EasyDataColDesc
{
+ ///
+ /// Represents internal property id.
+ ///
public string Id { get; set; }
+ ///
+ /// Index of property.
+ ///
public int Index { get; set; }
public bool IsAggr { get; set; }
+ ///
+ /// Name to use for this property in the UI.
+ ///
public string Label { get; set; }
+ ///
+ /// Detailed description of the property.
+ ///
+ public string Description { get; set; }
+
+ ///
+ /// The type of data represented by property.
+ ///
public DataType DataType { get; set; }
+ ///
+ /// Represents internal property id.
+ ///
public string AttrId { get; set; }
+ ///
+ /// The display format for the property.
+ ///
public string DisplayFormat { get; set; }
public string GroupFooterColumnTemplate { get; set; }
+ ///
+ /// The style of the property to display in UI.
+ ///
public EasyDataColStyle Style { get; set; }
@@ -46,34 +72,64 @@ public class EasyDataColDesc
public class EasyDataCol
{
+ ///
+ /// Represents internal property id.
+ ///
[JsonProperty("id")]
- public string Id { get; }
+ public string Id { get; }
+ ///
+ /// Index of property.
+ ///
[JsonIgnore]
- public int Index { get; }
+ public int Index { get; }
[JsonProperty("isAggr")]
- public bool IsAggr { get; }
+ public bool IsAggr { get; }
+ ///
+ /// Name to use for this property in the UI.
+ ///
[JsonProperty("label")]
public string Label { get; set; }
+ ///
+ /// Detailed description of the property.
+ ///
+ [JsonProperty("description")]
+ public string Description { get; set; }
+
+ ///
+ /// The type of data represented by property.
+ ///
[Obsolete("Use DataType instead")]
[JsonIgnore]
public DataType Type => DataType;
+ ///
+ /// The type of data represented by property.
+ ///
[JsonProperty("type")]
public DataType DataType { get; }
+ ///
+ /// Represents original internal property id.
+ ///
[JsonProperty("originAttrId")]
public string OrginAttrId { get; }
+ ///
+ /// The display format for the property.
+ ///
[JsonProperty("dfmt")]
public string DisplayFormat { get; set; }
[JsonProperty("gfct")]
public string GroupFooterColumnTemplate { get; set; }
+ ///
+ /// The style of the property to display in UI.
+ ///
[JsonProperty("style")]
public EasyDataColStyle Style { get; }
@@ -85,6 +141,7 @@ public EasyDataCol(EasyDataColDesc desc)
IsAggr = desc.IsAggr;
OrginAttrId = desc.AttrId;
Label = desc.Label;
+ Description = desc.Description;
DataType = desc.DataType;
DisplayFormat = desc.DisplayFormat;
GroupFooterColumnTemplate = desc.GroupFooterColumnTemplate;
@@ -101,7 +158,8 @@ public EasyDataRow(IEnumerable