Skip to content
Merged
8 changes: 4 additions & 4 deletions easydata.js/packs/core/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@easydata/core",
"version": "1.5.10",
"version": "1.5.11",
"description": "EasyData.JS core functions, classes, and data structures",
"types": "./dist/types/public_api.d.ts",
"types": "./dist/public_api.d.ts",
"main": "./dist/easydata.core.cjs.js",
"module": "./dist/easydata.core.esm.js",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"files": [
"dist"
],
"dependencies": {
"tsx": "^4.19.4"
"devDependencies": {
"tsx": "^4.21.0"
}
}
2 changes: 2 additions & 0 deletions easydata.js/packs/core/src/meta/dto/value_editor_dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export interface ValueEditorDTO {
accept?: string;
/** The multiline. */
multiline?: boolean;
/** The parent attribute to depend on. */
dependsOnAttr?: string;
}
29 changes: 18 additions & 11 deletions easydata.js/packs/core/src/meta/value_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ export class ValueEditor {
public accept?: string;

/**
* The accept
* Gets or sets a value indicating whether the value editor is multiline.
*/
public multiline?: boolean;

/**
* The values.
*/
public values?: {id: string, text: string}[];

/** The parent attribute to depend on. */
public dependsOnAttr?: string;

/**
* Gets or sets the list of values.
*/
public values?: { id: string, text: string }[];

/** Extra parameters */
public extraParams?: any;
Expand Down Expand Up @@ -77,29 +81,32 @@ export class ValueEditor {
this.resType = data.subType;
}
if (data.name) {
this.name = data.name;
}
if (data.values){
this.name = data.name;
}
if (data.values) {
this.values = data.values;
}
if (data.dependsOnAttr) {
this.dependsOnAttr = data.dependsOnAttr;
}
}
}

public getValueText(value: string | string[]): string {

let result = "";

if (!this.values)
return result;

if (Array.isArray(value)) {
for(let item of this.values) {
for (let item of this.values) {
if (value.indexOf(item.id) >= 0) {
result += item.text + ',';
}
}
} else {
for(let item of this.values) {
for (let item of this.values) {
if (item.id === value) {
result += item.text + ',';
}
Expand Down
8 changes: 5 additions & 3 deletions easydata.js/packs/crud/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@easydata/crud",
"version": "1.5.10",
"version": "1.5.11",
"description": "EasyData.JS UI widgets and views for CRUD manipulations",
"types": "./dist/types/public_api.d.ts",
"main": "./dist/easydata.crud.cjs.js",
Expand Down Expand Up @@ -36,5 +36,7 @@
},
"files": [
"dist"
]
}
],
"devDependencies": {
"tsx": "^4.21.0"
}}
7 changes: 5 additions & 2 deletions easydata.js/packs/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@easydata/ui",
"version": "1.5.10",
"version": "1.5.11",
"description": "EasyData.JS: DOM manipulation functions and UI widgets",
"types": "./dist/types/public_api.d.ts",
"main": "./dist/easydata.ui.cjs.js",
Expand Down Expand Up @@ -39,5 +39,8 @@
},
"files": [
"dist"
]
],
"devDependencies": {
"tsx": "^4.21.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class DefaultDateTimePicker extends DateTimePicker {
.text(i18n.getText('ButtonNow'))
.on('click', () => {
this.setDateTime(new Date());
this.refresh();
this.dateTimeChanged();
return false;
})
Expand Down
6 changes: 3 additions & 3 deletions easydata.js/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "1.5.10",
"baseVersion": "1.5.10",
"assetVersion": "01_05_10",
"version": "1.5.11",
"baseVersion": "1.5.11",
"assetVersion": "01_05_11",
"tag": "latest"
}
16 changes: 16 additions & 0 deletions easydata.net/src/EasyData.Core/ValueEditors/ValueEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ public virtual string XmlDefinition
/// <value>The data type of edited values.</value>
public virtual DataType ResultType { get; set; } = DataType.Unknown;

/// <summary>
/// Gets or sets the ID of attribute which value editor depends on.
/// If DependsOnAttrId is not empty then the corresponding value editor will be updated when value of the attribute with specified ID is changed.
/// This allows to implement cascading editors when values in one editor depend on the value selected in another editor.
/// </summary>
/// <value>The ID of attribute which value editor depends on.</value>
public virtual string DependsOnAttrId { get; set; }

/// <summary>
/// Check current editor in model and adds it into Editors list if necessary.
/// </summary>
Expand Down Expand Up @@ -333,6 +341,11 @@ protected virtual async Task WritePropertiesToJsonAsync(JsonWriter writer, BitOp
await writer.WritePropertyNameAsync("dval", ct).ConfigureAwait(false);
await writer.WriteValueAsync(DefaultValue, ct).ConfigureAwait(false);
}

if (!string.IsNullOrEmpty(DependsOnAttrId)) {
await writer.WritePropertyNameAsync("dependsOnAttr", ct).ConfigureAwait(false);
await writer.WriteValueAsync(DependsOnAttrId, ct).ConfigureAwait(false);
}
}

/// <summary>
Expand Down Expand Up @@ -377,6 +390,9 @@ protected virtual async Task ReadOnePropFromJsonAsync(JsonReader reader, string
case "dval":
DefaultValue = await reader.ReadAsStringAsync(ct).ConfigureAwait(false);
break;
case "dependsOnAttr":
DependsOnAttrId = await reader.ReadAsStringAsync(ct).ConfigureAwait(false);
break;
default:
await reader.SkipAsync(ct).ConfigureAwait(false);
break;
Expand Down
Loading