diff --git a/easydata.js/packs/core/package.json b/easydata.js/packs/core/package.json index dc1d0c8c..595a8e90 100644 --- a/easydata.js/packs/core/package.json +++ b/easydata.js/packs/core/package.json @@ -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": { @@ -30,7 +30,7 @@ "files": [ "dist" ], - "dependencies": { - "tsx": "^4.19.4" + "devDependencies": { + "tsx": "^4.21.0" } } \ No newline at end of file diff --git a/easydata.js/packs/core/src/meta/dto/value_editor_dto.ts b/easydata.js/packs/core/src/meta/dto/value_editor_dto.ts index 63f0e5c8..dd2bbf92 100644 --- a/easydata.js/packs/core/src/meta/dto/value_editor_dto.ts +++ b/easydata.js/packs/core/src/meta/dto/value_editor_dto.ts @@ -23,4 +23,6 @@ export interface ValueEditorDTO { accept?: string; /** The multiline. */ multiline?: boolean; + /** The parent attribute to depend on. */ + dependsOnAttr?: string; } \ No newline at end of file diff --git a/easydata.js/packs/core/src/meta/value_editor.ts b/easydata.js/packs/core/src/meta/value_editor.ts index 4c2a6337..75065673 100644 --- a/easydata.js/packs/core/src/meta/value_editor.ts +++ b/easydata.js/packs/core/src/meta/value_editor.ts @@ -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; @@ -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 + ','; } diff --git a/easydata.js/packs/crud/package.json b/easydata.js/packs/crud/package.json index e336fa2a..9ccf4395 100644 --- a/easydata.js/packs/crud/package.json +++ b/easydata.js/packs/crud/package.json @@ -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", @@ -36,5 +36,7 @@ }, "files": [ "dist" - ] -} \ No newline at end of file + ], + "devDependencies": { + "tsx": "^4.21.0" + }} \ No newline at end of file diff --git a/easydata.js/packs/ui/package.json b/easydata.js/packs/ui/package.json index 850ee435..0c8e4c24 100644 --- a/easydata.js/packs/ui/package.json +++ b/easydata.js/packs/ui/package.json @@ -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", @@ -39,5 +39,8 @@ }, "files": [ "dist" - ] + ], + "devDependencies": { + "tsx": "^4.21.0" + } } \ No newline at end of file diff --git a/easydata.js/packs/ui/src/datetimepicker/default_date_time_picker.ts b/easydata.js/packs/ui/src/datetimepicker/default_date_time_picker.ts index 330a8d26..1b190335 100644 --- a/easydata.js/packs/ui/src/datetimepicker/default_date_time_picker.ts +++ b/easydata.js/packs/ui/src/datetimepicker/default_date_time_picker.ts @@ -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; }) diff --git a/easydata.js/version.json b/easydata.js/version.json index d4848a86..aca75a96 100644 --- a/easydata.js/version.json +++ b/easydata.js/version.json @@ -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" } diff --git a/easydata.net/src/EasyData.Core/ValueEditors/ValueEditor.cs b/easydata.net/src/EasyData.Core/ValueEditors/ValueEditor.cs index 2d16ad6f..08c312e8 100644 --- a/easydata.net/src/EasyData.Core/ValueEditors/ValueEditor.cs +++ b/easydata.net/src/EasyData.Core/ValueEditors/ValueEditor.cs @@ -253,6 +253,14 @@ public virtual string XmlDefinition /// The data type of edited values. public virtual DataType ResultType { get; set; } = DataType.Unknown; + /// + /// 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. + /// + /// The ID of attribute which value editor depends on. + public virtual string DependsOnAttrId { get; set; } + /// /// Check current editor in model and adds it into Editors list if necessary. /// @@ -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); + } } /// @@ -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;