diff --git a/src/UniversalDashboard.MaterialUI/UniversalDashboard.MaterialUI.psm1 b/src/UniversalDashboard.MaterialUI/UniversalDashboard.MaterialUI.psm1 index 6529852a..17b06c99 100644 --- a/src/UniversalDashboard.MaterialUI/UniversalDashboard.MaterialUI.psm1 +++ b/src/UniversalDashboard.MaterialUI/UniversalDashboard.MaterialUI.psm1 @@ -2,21 +2,18 @@ $JsFile = Get-ChildItem "$PSScriptRoot\index.*.bundle.js" $JsFiles = Get-ChildItem "$PSScriptRoot\*.bundle.js" $Maps = Get-ChildItem "$PSScriptRoot\*.bundle.map" -$CSSFile = Get-ChildItem "$PSScriptRoot\*.css" -# Register our style sheet with UD -[UniversalDashboard.Services.AssetService]::Instance.RegisterStyleSheet($CSSFile.FullName) $JsFiles | ForEach-Object { - [UniversalDashboard.Services.AssetService]::Instance.RegisterScript($_.FullName) + [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($_.FullName) } $Maps | ForEach-Object { - [UniversalDashboard.Services.AssetService]::Instance.RegisterScript($_.FullName) | Out-Null + [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($_.FullName) | Out-Null } -$MUAssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterScript($JSFile.FullName) -[UniversalDashboard.Services.AssetService]::Instance.RegisterFramework("MaterialUI", $MUAssetId) +$MUAssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($JSFile.FullName) +[UniversalDashboard.Services.AssetService]::Instance.RegisterFramework("MaterialUI", $JSFile.FullName) # Load out controls Get-ChildItem (Join-Path $PSScriptRoot "Scripts") -File -Filter "*.ps1" | ForEach-Object { diff --git a/src/UniversalDashboard.MaterialUI/package-lock.json b/src/UniversalDashboard.MaterialUI/package-lock.json index 2d7fda1e..3bd20c90 100644 --- a/src/UniversalDashboard.MaterialUI/package-lock.json +++ b/src/UniversalDashboard.MaterialUI/package-lock.json @@ -4150,7 +4150,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4171,12 +4172,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4191,17 +4194,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4318,7 +4324,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4330,6 +4337,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4344,6 +4352,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4351,12 +4360,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4375,6 +4386,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4455,7 +4467,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4467,6 +4480,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4552,7 +4566,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4588,6 +4603,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4607,6 +4623,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4650,12 +4667,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/src/UniversalDashboard.Materialize/Components/ud-input-field.jsx b/src/UniversalDashboard.Materialize/Components/ud-input-field.jsx index c1c446ef..e6305e52 100644 --- a/src/UniversalDashboard.Materialize/Components/ud-input-field.jsx +++ b/src/UniversalDashboard.Materialize/Components/ud-input-field.jsx @@ -2,6 +2,22 @@ import React from 'react'; import {Input as RInput} from 'react-materialize'; import {DebounceInput} from 'react-debounce-input'; + // taken from https://davidwalsh.name/javascript-debounce-function + function debounce(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; + } + export default class UdInputField extends React.Component { constructor() { @@ -76,7 +92,7 @@ export default class UdInputField extends React.Component { setupDatePicker() { var comp = this; - $(this.datetime).pickadate({ + this.picker = $(this.datetime).pickadate({ selectYears: 100, clearText: this.props.clearText, okText: this.props.okText, @@ -117,6 +133,19 @@ export default class UdInputField extends React.Component { if (this.props.type === 'date') { this.setupDatePicker(); + + // Dirty hack to get this to work in Chrome + $("#" + this.props.name).unbind("click"); + $("#" + this.props.name).unbind("focus"); + $("#" + this.props.name).on("click", debounce(function(event) { + event.preventDefault() + this.picker.pickadate('picker').open() + }.bind(this), 100)); + + $("#" + this.props.name).on("focus", debounce(function(event) { + event.preventDefault() + this.picker.pickadate('picker').open() + }.bind(this), 100)); } if (this.props.type === 'time') { @@ -146,6 +175,9 @@ export default class UdInputField extends React.Component { } } + + + componentDidUpdate() { this.updateTextField(); diff --git a/src/UniversalDashboard.Materialize/Scripts/button.ps1 b/src/UniversalDashboard.Materialize/Scripts/button.ps1 index f7898dad..319ca300 100644 --- a/src/UniversalDashboard.Materialize/Scripts/button.ps1 +++ b/src/UniversalDashboard.Materialize/Scripts/button.ps1 @@ -14,7 +14,13 @@ function New-UDButton { [UniversalDashboard.Models.FontAwesomeIcons]$Icon, [Parameter()] [ValidateSet('left', 'right')] - [String]$IconAlignment = 'left' + [String]$IconAlignment = 'left', + [Parameter()] + [UniversalDashboard.Models.DashboardColor]$BackgroundColor, + [Parameter()] + [UniversalDashboard.Models.DashboardColor]$FontColor, + [Parameter()] + [Switch]$Disabled ) $btnClass = 'btn' @@ -26,9 +32,19 @@ function New-UDButton { $btnClass = 'btn-flat' } + if ($Disabled) { + $btnClass += ' disabled' + } + + $style = @{ + backgroundColor = $BackgroundColor.HtmlColor + color = $FontColor.HtmlColor + } + New-UDElement -Id $Id -Tag "a" -Attributes @{ className = "$btnClass" onClick = $OnClick + style = $style } -Content { if ($Icon -ne $null) { $faClass = $Icon.ToString().Replace('_', '-') diff --git a/src/UniversalDashboard.Materialize/UniversalDashboard.Materialize.psm1 b/src/UniversalDashboard.Materialize/UniversalDashboard.Materialize.psm1 index 1d52a1a0..cc5ecfe9 100644 --- a/src/UniversalDashboard.Materialize/UniversalDashboard.Materialize.psm1 +++ b/src/UniversalDashboard.Materialize/UniversalDashboard.Materialize.psm1 @@ -3,17 +3,17 @@ $IndexJs = Get-ChildItem "$PSScriptRoot\index.*.bundle.js" $JsFiles = Get-ChildItem "$PSScriptRoot\*.bundle.js" $Maps = Get-ChildItem "$PSScriptRoot\*.map" -$AssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterScript($IndexJs.FullName) +$AssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($IndexJs.FullName) [UniversalDashboard.Services.AssetService]::Instance.RegisterFramework("Materialize", $AssetId) foreach($item in $JsFiles) { - [UniversalDashboard.Services.AssetService]::Instance.RegisterScript($item.FullName) | Out-Null + [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($item.FullName) | Out-Null } foreach($item in $Maps) { - [UniversalDashboard.Services.AssetService]::Instance.RegisterScript($item.FullName) | Out-Null + [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($item.FullName) | Out-Null } Get-ChildItem (Join-Path $PSScriptRoot "scripts") -File | ForEach-Object { diff --git a/src/UniversalDashboard.Materialize/package-lock.json b/src/UniversalDashboard.Materialize/package-lock.json index 7fa0d7dc..ecdb0e48 100644 --- a/src/UniversalDashboard.Materialize/package-lock.json +++ b/src/UniversalDashboard.Materialize/package-lock.json @@ -2966,7 +2966,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -2987,12 +2988,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3007,17 +3010,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3134,7 +3140,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3146,6 +3153,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3160,6 +3168,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3167,12 +3176,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3191,6 +3202,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3271,7 +3283,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3283,6 +3296,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3368,7 +3382,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3404,6 +3419,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3423,6 +3439,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3466,12 +3483,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/src/UniversalDashboard/Cmdlets/NewElementCommand.cs b/src/UniversalDashboard/Cmdlets/NewElementCommand.cs index 1940d1e0..856b9fba 100644 --- a/src/UniversalDashboard/Cmdlets/NewElementCommand.cs +++ b/src/UniversalDashboard/Cmdlets/NewElementCommand.cs @@ -107,7 +107,7 @@ protected override void EndProcessing() } } - AssetService.Instance.RegisterScript(path); + AssetService.Instance.RegisterAsset(path); var element = new Element { diff --git a/src/UniversalDashboard/Cmdlets/ShowModalCommand.cs b/src/UniversalDashboard/Cmdlets/ShowModalCommand.cs index fd8beed3..221a2341 100644 --- a/src/UniversalDashboard/Cmdlets/ShowModalCommand.cs +++ b/src/UniversalDashboard/Cmdlets/ShowModalCommand.cs @@ -22,6 +22,10 @@ public class ShowModalCommand : PSCmdlet public DashboardColor BackgroundColor { get; set; } [Parameter()] public DashboardColor FontColor { get; set; } + [Parameter()] + public string Height { get; set; } + [Parameter()] + public string Width { get; set; } protected override void EndProcessing() { @@ -33,7 +37,9 @@ protected override void EndProcessing() Header = Header?.Invoke().Select(m => m.BaseObject).ToArray(), Content = Content?.Invoke().Select(m => m.BaseObject).ToArray(), BackgroundColor = BackgroundColor?.HtmlColor, - FontColor = FontColor?.HtmlColor + FontColor = FontColor?.HtmlColor, + Height = Height, + Width = Width }; var hub = this.GetVariableValue("DashboardHub") as IHubContext; diff --git a/src/UniversalDashboard/Controllers/DashboardController.cs b/src/UniversalDashboard/Controllers/DashboardController.cs index 27862e6a..dd12041b 100644 --- a/src/UniversalDashboard/Controllers/DashboardController.cs +++ b/src/UniversalDashboard/Controllers/DashboardController.cs @@ -80,16 +80,16 @@ public IActionResult Theme() stringBuilder.AppendLine(System.IO.File.ReadAllText(materializeCss)); stringBuilder.AppendLine(System.IO.File.ReadAllText(siteCss)); - foreach(var item in AssetService.Instance.Stylesheets) + foreach(var item in AssetService.Instance.Assets.Where(m => m.EndsWith(".css", StringComparison.OrdinalIgnoreCase))) { try { - var content = System.IO.File.ReadAllText(item.Value); + var content = System.IO.File.ReadAllText(item); stringBuilder.AppendLine(content); } catch (Exception ex) { - stringBuilder.AppendLine($"/* Failed to load style sheet {item.Value}. {ex.Message} */"); + stringBuilder.AppendLine($"/* Failed to load style sheet {item}. {ex.Message} */"); } } diff --git a/src/UniversalDashboard/Controllers/JavaScriptController.cs b/src/UniversalDashboard/Controllers/JavaScriptController.cs index 9ab465ac..0c61d4d3 100644 --- a/src/UniversalDashboard/Controllers/JavaScriptController.cs +++ b/src/UniversalDashboard/Controllers/JavaScriptController.cs @@ -10,13 +10,13 @@ public class JavaScriptController : Controller { private readonly Logger Log = LogManager.GetLogger(nameof(JavaScriptController)); - [Route("{id}")] - public IActionResult Index(Guid id) + [Route("{asset}")] + public IActionResult Index(string asset) { - var filePath = AssetService.Instance.GetScript(id); + var filePath = AssetService.Instance.FindAsset(asset); if (filePath == null) { - Log.Warn($"Unknown element script: {id}"); + Log.Warn($"Unknown element script: {asset}"); return StatusCode(404); } diff --git a/src/UniversalDashboard/Models/Dashboard.cs b/src/UniversalDashboard/Models/Dashboard.cs index a5368318..650f6246 100644 --- a/src/UniversalDashboard/Models/Dashboard.cs +++ b/src/UniversalDashboard/Models/Dashboard.cs @@ -55,6 +55,6 @@ public class Dashboard [JsonProperty("navigation")] public SideNav Navigation { get; set; } [JsonProperty("frameworkAssetId")] - public Guid FrameworkAssetId { get; set; } + public string FrameworkAssetId { get; set; } } } diff --git a/src/UniversalDashboard/Models/Modal.cs b/src/UniversalDashboard/Models/Modal.cs index 6488bf7f..269fd2a7 100644 --- a/src/UniversalDashboard/Models/Modal.cs +++ b/src/UniversalDashboard/Models/Modal.cs @@ -9,5 +9,7 @@ public class Modal public object[] Footer { get; set; } public string FontColor { get; set; } public string BackgroundColor { get; set; } + public string Height { get; set; } + public string Width { get; set; } } } diff --git a/src/UniversalDashboard/Services/AssetService.cs b/src/UniversalDashboard/Services/AssetService.cs index 503e1b99..933cf192 100644 --- a/src/UniversalDashboard/Services/AssetService.cs +++ b/src/UniversalDashboard/Services/AssetService.cs @@ -8,9 +8,9 @@ namespace UniversalDashboard.Services { public class AssetService { - public Dictionary Scripts; - public Dictionary Stylesheets; - public Dictionary Frameworks; + public Dictionary Frameworks; + + public List Assets; private static AssetService _instance; @@ -28,67 +28,50 @@ public static AssetService Instance private AssetService() { - Scripts = new Dictionary(); - Stylesheets = new Dictionary(); - Frameworks = new Dictionary(); + Assets = new List(); + Frameworks = new Dictionary(); } - public Guid RegisterScript(string script) - { - var id = script.ToGuid(); - if (!Scripts.ContainsKey(id)) - { - Scripts.Add(id, script); - } - - return id; + public string RegisterAsset(string asset) { + var fileInfo = new FileInfo(asset); + Assets.Add(asset); + return fileInfo.Name; } + + public string RegisterScript(string asset) { - public void RegisterFramework(string name, Guid assetId) - { - if (!Frameworks.ContainsKey(name)) - { - Frameworks.Add(name, assetId); - } + var fileInfo = new FileInfo(asset); + Assets.Add(asset); + return fileInfo.Name; } - public string GetScript(Guid id) - { - if (Scripts.ContainsKey(id)) - { - return Scripts[id]; - } - return null; + public string RegisterStylesheet(string asset) { + var fileInfo = new FileInfo(asset); + Assets.Add(asset); + return fileInfo.Name; } - public void RegisterStyleSheet(string stylesheet) + public void RegisterFramework(string name, string rootAsset) { - var id = stylesheet.ToGuid(); - if (!Stylesheets.ContainsKey(id)) + if (Frameworks.ContainsKey(name)) { - Stylesheets.Add(id, stylesheet); + Frameworks.Remove(name); } + + Frameworks.Add(name, rootAsset); } public void ClearRegistration() { - Scripts.Clear(); - Stylesheets.Clear(); + Assets.Clear(); + Frameworks.Clear(); } public string FindAsset(string fileName) { try { - var file = Scripts.Values.FirstOrDefault(m => new FileInfo(m).Name.Equals(fileName, StringComparison.OrdinalIgnoreCase)); - if (file != null) - { - return file; - } - - file = Stylesheets.Values.FirstOrDefault(m => new FileInfo(m).Name.Equals(fileName, StringComparison.OrdinalIgnoreCase)); - - return file; + return Assets.FirstOrDefault(m => new FileInfo(m).Name.Equals(fileName, StringComparison.OrdinalIgnoreCase)); } catch { diff --git a/src/client/package-lock.json b/src/client/package-lock.json index 8488db0b..5e7e98c5 100644 --- a/src/client/package-lock.json +++ b/src/client/package-lock.json @@ -4055,7 +4055,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4076,12 +4077,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4096,17 +4099,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4223,7 +4229,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4235,6 +4242,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4249,6 +4257,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4256,12 +4265,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4280,6 +4291,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4360,7 +4372,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4372,6 +4385,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4457,7 +4471,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4493,6 +4508,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4512,6 +4528,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4555,12 +4572,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -7958,6 +7977,15 @@ } } }, + "react-chartjs-2": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/react-chartjs-2/-/react-chartjs-2-2.7.4.tgz", + "integrity": "sha512-lXTpBaDlk9rIMjRONjZd76dIUhEm3vOp2jOrJrsFG/UpFI5VqX8Xw83apVHTnUGJ968f8i/i/syLddls4NHy2g==", + "requires": { + "lodash": "^4.17.4", + "prop-types": "^15.5.8" + } + }, "react-color": { "version": "2.13.8", "resolved": "https://registry.npmjs.org/react-color/-/react-color-2.13.8.tgz", diff --git a/src/client/src/app/basics/lazy-element.jsx b/src/client/src/app/basics/lazy-element.jsx index 7dfb5fff..f553bdbf 100644 --- a/src/client/src/app/basics/lazy-element.jsx +++ b/src/client/src/app/basics/lazy-element.jsx @@ -16,7 +16,7 @@ export default class LazyElement extends React.Component { script.onload = function() { this.setState({loading:false}); }.bind(this) - script.src = getApiPath() + "/api/internal/javascript/" + this.props.component.assetId; + script.src = getApiPath() + "/" + this.props.component.assetId; document.head.appendChild(script); } diff --git a/src/client/src/app/ud-element.jsx b/src/client/src/app/ud-element.jsx index 777f0e4c..e3783fc9 100644 --- a/src/client/src/app/ud-element.jsx +++ b/src/client/src/app/ud-element.jsx @@ -235,10 +235,16 @@ class UDElementContent extends React.Component { if (this.state.tag === 'select') { val = new Array(); - for(var item in this.refs.element.selectedOptions) { - if (isNaN(item)) continue; - var value = this.refs.element.selectedOptions[item].value; - val.push(value); + + if (this.refs.element.selectedOptions) { + for(var item in this.refs.element.selectedOptions) { + if (isNaN(item)) continue; + var value = this.refs.element.selectedOptions[item].value; + val.push(value); + } + } + else { + val.push(this.refs.element.value); } if (val.length === 1) { diff --git a/src/client/src/app/ud-modal.jsx b/src/client/src/app/ud-modal.jsx index b8eb8bea..df845bd9 100644 --- a/src/client/src/app/ud-modal.jsx +++ b/src/client/src/app/ud-modal.jsx @@ -12,7 +12,9 @@ export default class UdModal extends React.Component { content: null, footer: null, backgroundColor: null, - fontColor: null + fontColor: null, + height: null, + width: null } this.loading = true; @@ -57,7 +59,7 @@ export default class UdModal extends React.Component { } render() { - var className = "modal"; + var className = "modal ud-modal"; if (this.state.bottomSheet) { className += " bottom-sheet" } @@ -86,7 +88,7 @@ export default class UdModal extends React.Component { } return ( -
this.modal = modal} style={{color: this.state.fontColor, backgroundColor: this.state.backgroundColor}}> +
this.modal = modal} style={{height: this.state.height, width: this.state.width, color: this.state.fontColor, backgroundColor: this.state.backgroundColor}}>
{header} {content}