From 2128bdeb3048ba99bcbd6e6a0ecbeedc2ee0e7c0 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Fri, 6 Aug 2021 14:37:00 +0200 Subject: [PATCH] new features for ui list --- zero.Core/Utils/IdGenerator.cs | 14 ++++++++------ zero.Web.UI/Sass/Modules/_box.scss | 3 ++- zero.Web.UI/app/core/list.ts | 24 +++++++++++++++++++++++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/zero.Core/Utils/IdGenerator.cs b/zero.Core/Utils/IdGenerator.cs index 4c9b0b7e..ec913e5b 100644 --- a/zero.Core/Utils/IdGenerator.cs +++ b/zero.Core/Utils/IdGenerator.cs @@ -33,14 +33,16 @@ namespace zero.Core.Utils length = 12; } + return CreateRandom(length); + //if (length > 0) //{ - return Convert.ToBase64String(Guid.NewGuid().ToByteArray()) - .Replace("/", String.Empty) - .Replace("+", String.Empty) - .Replace("-", String.Empty) - .ToLowerInvariant() - .Substring(0, length); + //return Convert.ToBase64String(Guid.NewGuid().ToByteArray()) + // .Replace("/", String.Empty) + // .Replace("+", String.Empty) + // .Replace("-", String.Empty) + // .ToLowerInvariant() + // .Substring(0, length); //} //return Guid.NewGuid().ToString(); diff --git a/zero.Web.UI/Sass/Modules/_box.scss b/zero.Web.UI/Sass/Modules/_box.scss index c0178c0e..ac18a05b 100644 --- a/zero.Web.UI/Sass/Modules/_box.scss +++ b/zero.Web.UI/Sass/Modules/_box.scss @@ -42,7 +42,8 @@ .ui-box + .ui-box.is-connected, .ui-tabs + .ui-box.is-connected { - margin-top: -31px; + margin-top: -32px; + border-top: 1px solid var(--color-line-onbg); border-top-left-radius: 0; border-top-right-radius: 0; } diff --git a/zero.Web.UI/app/core/list.ts b/zero.Web.UI/app/core/list.ts index 95e567c5..267edfd3 100644 --- a/zero.Web.UI/app/core/list.ts +++ b/zero.Web.UI/app/core/list.ts @@ -150,6 +150,7 @@ class List * @param {object} [options] - Custom options * @param {string} [options.label] - A custom label for this column (otherwise it's generated via `templateLabel`) * @param {boolean} [options.hideLabel=false] - Hide the column label + * @param {number} [options.index] - Custom position for this column * @param {number} [options.width] - Custom width of the column in px * @param {boolean} [options.canSort=true] - Disable/enable sorting within this column * @param {string} [options.class] - Append HTML class to the generated cells @@ -162,7 +163,14 @@ class List if (!column) { column = new ListColumn(path, options); - this.columns.push(column); + if (options && options.index > -1) + { + this.columns.splice(options.index, 0, column); + } + else + { + this.columns.push(column); + } } else { @@ -173,6 +181,20 @@ class List } + /** + * Removes a list column + * @param {string} path - Model path + */ + removeColumn(path) + { + let column = this.columns.find(x => x.path === path); + if (column != null) + { + this.columns.splice(this.columns.indexOf(column), 1); + } + } + + /** * Add an action to the list header (only used when it is attached to ) * @param {string} key - Alias to refer to