fit-ui 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Controls/ColorPicker/transparent.jpg +0 -0
- package/dist/Documentation.html +2 -2
- package/dist/Fit.UI.css +82 -0
- package/dist/Fit.UI.js +252 -1
- package/dist/Fit.UI.min.css +1 -1
- package/dist/Fit.UI.min.js +1 -1
- package/dist/Resources/CKEditor/contents.css +208 -208
- package/dist/Resources/CKEditor/plugins/autocomplete/skins/default.css +38 -38
- package/dist/Resources/CKEditor/plugins/dialog/styles/dialog.css +18 -18
- package/dist/Resources/CKEditor/plugins/emoji/skins/default.css +237 -237
- package/dist/Resources/CKEditor/plugins/tableselection/styles/tableselection.css +36 -36
- package/dist/Resources/CKEditor/skins/moono-lisa/dialog.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/dialog_ie.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/dialog_ie8.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/dialog_iequirks.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/editor.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/editor_gecko.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/editor_ie.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/editor_ie8.css +4 -4
- package/dist/Resources/CKEditor/skins/moono-lisa/editor_iequirks.css +4 -4
- package/dist/Resources/CKEditor/styles.js +137 -137
- package/package.json +1 -1
- package/types/index.d.ts +282 -0
package/dist/Fit.UI.css
CHANGED
|
@@ -3351,6 +3351,88 @@ div.FitUiControlCheckBox[data-enabled="true"][data-valid="false"][data-showinval
|
|
|
3351
3351
|
border-color: red;
|
|
3352
3352
|
}
|
|
3353
3353
|
|
|
3354
|
+
div.FitUiControlColorPicker
|
|
3355
|
+
{
|
|
3356
|
+
height: 2em; /* Equal height for all controls */
|
|
3357
|
+
width: 200px;
|
|
3358
|
+
|
|
3359
|
+
border: 0.065em solid #BBBBBB;
|
|
3360
|
+
border-radius: 2px;
|
|
3361
|
+
|
|
3362
|
+
background-image: url("Controls/ColorPicker/transparent.jpg");
|
|
3363
|
+
background-repeat: repeat;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
div.FitUiControlColorPicker input[type="color"],
|
|
3367
|
+
div.FitUiControlColorPicker span
|
|
3368
|
+
{
|
|
3369
|
+
cursor: pointer;
|
|
3370
|
+
}
|
|
3371
|
+
div.FitUiControlColorPicker[data-enabled="false"] input[type="color"],
|
|
3372
|
+
div.FitUiControlColorPicker[data-enabled="false"] span
|
|
3373
|
+
{
|
|
3374
|
+
cursor: default;
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
div.FitUiControlColorPicker input[type="color"]
|
|
3378
|
+
{
|
|
3379
|
+
width: 100%;
|
|
3380
|
+
height: 100%;
|
|
3381
|
+
opacity: 0; /* Hide ugly native picker - selected color is applied as background-color to outer control element */
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
/* Focused indicator */
|
|
3385
|
+
div.FitUiControlColorPicker[data-focused="true"]
|
|
3386
|
+
{
|
|
3387
|
+
border-color: #4484C7;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
/* Error indicator */
|
|
3391
|
+
div.FitUiControlColorPicker[data-enabled="true"][data-valid="false"][data-showinvalid="true"]
|
|
3392
|
+
{
|
|
3393
|
+
outline: none;
|
|
3394
|
+
}
|
|
3395
|
+
div.FitUiControlColorPicker[data-enabled="true"][data-valid="false"][data-showinvalid="true"][data-focused="false"]
|
|
3396
|
+
{
|
|
3397
|
+
border-color: red;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
/* Disabled indicator */
|
|
3401
|
+
div.FitUiControlColorPicker[data-enabled="false"]
|
|
3402
|
+
{
|
|
3403
|
+
opacity: 0.7;
|
|
3404
|
+
}
|
|
3405
|
+
div.FitUiControlColorPicker[data-enabled="false"] span
|
|
3406
|
+
{
|
|
3407
|
+
opacity: 0.5;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
/* Label for HEX color code */
|
|
3411
|
+
div.FitUiControlColorPicker span:first-of-type
|
|
3412
|
+
{
|
|
3413
|
+
position: absolute;
|
|
3414
|
+
top: 50%;
|
|
3415
|
+
transform: translateY(-50%);
|
|
3416
|
+
left: 0;
|
|
3417
|
+
width: 100%; /* Allow user to start text selection far away from value */
|
|
3418
|
+
padding-left: 0.25em;
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
/* Clear button */
|
|
3422
|
+
div.FitUiControlColorPicker span:last-of-type
|
|
3423
|
+
{
|
|
3424
|
+
position: absolute;
|
|
3425
|
+
top: 50%;
|
|
3426
|
+
transform: translateY(calc(-50% - 0.05em));
|
|
3427
|
+
right: 0.2em;
|
|
3428
|
+
font-size: 1.4em;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/* Hide label and clear button when no color is selected */
|
|
3432
|
+
div.FitUiControlColorPicker[data-transparent="true"] span:last-of-type
|
|
3433
|
+
{
|
|
3434
|
+
display: none;
|
|
3435
|
+
}
|
|
3354
3436
|
div.FitUiControlContextMenu.FitUiControlTreeView
|
|
3355
3437
|
{
|
|
3356
3438
|
border: 0.065em solid #BBBBBB;
|
package/dist/Fit.UI.js
CHANGED
|
@@ -682,7 +682,7 @@ Fit._internal =
|
|
|
682
682
|
{
|
|
683
683
|
Core:
|
|
684
684
|
{
|
|
685
|
-
VersionInfo: { Major: 3, Minor:
|
|
685
|
+
VersionInfo: { Major: 3, Minor: 2, Patch: 0 } // Do NOT modify format - version numbers are programmatically changed when releasing new versions - MUST be on a separate line!
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
688
|
|
|
@@ -5758,6 +5758,40 @@ Fit.Color.HexToRgb = function(hex)
|
|
|
5758
5758
|
return "rgb(" + rgb.Red + ", " + rgb.Green + ", " + rgb.Blue + ")";
|
|
5759
5759
|
}
|
|
5760
5760
|
|
|
5761
|
+
/// <function container="Fit.Color" name="GetContrastColor" access="public" static="true" returns="string">
|
|
5762
|
+
/// <description> Get "black" or "white" depending on which is best suited in combination with specified color </description>
|
|
5763
|
+
/// <param name="hex" type="string"> HEX color string, e.g. #C0C0C0 (hash symbol is optional) </param>
|
|
5764
|
+
/// <param name="threshold" type="number" default="undefined">
|
|
5765
|
+
/// Returns "black" when brightness is above threshold, "white" otherwise.
|
|
5766
|
+
/// 0 = all black, 255 = all white. Value defaults to 128.
|
|
5767
|
+
/// </param>
|
|
5768
|
+
/// </function>
|
|
5769
|
+
Fit.Color.GetContrastColor = function(hex, threshold)
|
|
5770
|
+
{
|
|
5771
|
+
Fit.Validation.ExpectString(hex);
|
|
5772
|
+
Fit.Validation.ExpectInteger(threshold, true);
|
|
5773
|
+
|
|
5774
|
+
// Validate input
|
|
5775
|
+
if (/^#?[A-Za-z0-9]{6}$/.test(hex) === false)
|
|
5776
|
+
{
|
|
5777
|
+
throw "Invalid HEX color";
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
// Remove hash from color code
|
|
5781
|
+
hex = hex.replace(/^#/, "");
|
|
5782
|
+
|
|
5783
|
+
// Convert HEX to RGB
|
|
5784
|
+
var r = parseInt(hex.substring(0, 2), 16);
|
|
5785
|
+
var g = parseInt(hex.substring(2, 4), 16);
|
|
5786
|
+
var b = parseInt(hex.substring(4, 6), 16);
|
|
5787
|
+
|
|
5788
|
+
// Calculate luminance (perceived brightness)
|
|
5789
|
+
var luminance = (0.299 * r + 0.587 * g + 0.114 * b); // 0 = all black, 255 = all white
|
|
5790
|
+
|
|
5791
|
+
// Return black if the color is light, white otherwise
|
|
5792
|
+
return luminance > (threshold || 128) ? "black" : "white";
|
|
5793
|
+
}
|
|
5794
|
+
|
|
5761
5795
|
/// <container name="Fit.ColorTypeDefs.RgbColor">
|
|
5762
5796
|
/// <description> RGB color object </description>
|
|
5763
5797
|
/// <member name="Red" type="integer"> </member>
|
|
@@ -12449,6 +12483,223 @@ Fit.Controls.CheckBox = function(ctlId)
|
|
|
12449
12483
|
init();
|
|
12450
12484
|
}
|
|
12451
12485
|
|
|
12486
|
+
/// <container name="Fit.Controls.ColorPicker" extends="Fit.Controls.ControlBase">
|
|
12487
|
+
/// ColorPicker control which allows for color selection.
|
|
12488
|
+
/// Extending from Fit.Controls.ControlBase.
|
|
12489
|
+
/// </container>
|
|
12490
|
+
|
|
12491
|
+
/// <function container="Fit.Controls.ColorPicker" name="ColorPicker" access="public">
|
|
12492
|
+
/// <description> Create instance of ColorPicker control </description>
|
|
12493
|
+
/// <param name="ctlId" type="string" default="undefined"> Unique control ID that can be used to access control using Fit.Controls.Find(..) </param>
|
|
12494
|
+
/// </function>
|
|
12495
|
+
Fit.Controls.ColorPicker = function(ctlId)
|
|
12496
|
+
{
|
|
12497
|
+
Fit.Validation.ExpectStringValue(ctlId, true);
|
|
12498
|
+
Fit.Core.Extend(this, Fit.Controls.ControlBase).Apply(ctlId);
|
|
12499
|
+
|
|
12500
|
+
var me = this;
|
|
12501
|
+
var colorPicker = null; // Native color picker control: <input type="color">
|
|
12502
|
+
var lblValue = null; // Label showing selected HEX color code
|
|
12503
|
+
var orgColor = ""; // Holds initial value used to determine IsDirty state
|
|
12504
|
+
var prevColor = ""; // Holds latest change made by user - used to determine whether OnChange needs to be fired
|
|
12505
|
+
var cmdClear = null; // Clear button to remove color selection (transparency)
|
|
12506
|
+
var defaultColor = "#FFD6D6"; // Color (use upper case!) that is unlikely to be used - OnChange won't fire if we click on the initially selected color, so this color cannot be selected without selecting another color first
|
|
12507
|
+
|
|
12508
|
+
// ============================================
|
|
12509
|
+
// Init
|
|
12510
|
+
// ============================================
|
|
12511
|
+
|
|
12512
|
+
function init()
|
|
12513
|
+
{
|
|
12514
|
+
me.AddCssClass("FitUiControlColorPicker");
|
|
12515
|
+
transparent(true);
|
|
12516
|
+
|
|
12517
|
+
colorPicker = document.createElement("input");
|
|
12518
|
+
colorPicker.type = "color";
|
|
12519
|
+
colorPicker.value = defaultColor;
|
|
12520
|
+
colorPicker.oninput = function() // Contrary to OnChange, OnInput fires continuously
|
|
12521
|
+
{
|
|
12522
|
+
if (me === null)
|
|
12523
|
+
{
|
|
12524
|
+
// Fix for Chrome which fires OnChange and OnBlur (in both capturering and bubbling phase)
|
|
12525
|
+
// if control has focus while being removed from DOM, e.g. if used in a dialog closed using ESC.
|
|
12526
|
+
// More details here: https://bugs.chromium.org/p/chromium/issues/detail?id=866242
|
|
12527
|
+
return;
|
|
12528
|
+
}
|
|
12529
|
+
|
|
12530
|
+
transparent(false);
|
|
12531
|
+
fireOnChange();
|
|
12532
|
+
}
|
|
12533
|
+
me._internal.AddDomElement(colorPicker);
|
|
12534
|
+
|
|
12535
|
+
lblValue = document.createElement("span");
|
|
12536
|
+
lblValue.tabIndex = -1;
|
|
12537
|
+
lblValue.onclick = function(e)
|
|
12538
|
+
{
|
|
12539
|
+
if (window.getSelection().isCollapsed === true) // No selection - open picker - otherwise user is likely trying to copy color which color picker will prevent
|
|
12540
|
+
{
|
|
12541
|
+
colorPicker.click();
|
|
12542
|
+
}
|
|
12543
|
+
}
|
|
12544
|
+
me._internal.AddDomElement(lblValue);
|
|
12545
|
+
|
|
12546
|
+
cmdClear = document.createElement("span");
|
|
12547
|
+
cmdClear.tabIndex = -1;
|
|
12548
|
+
cmdClear.innerHTML = "×";
|
|
12549
|
+
cmdClear.onclick = function()
|
|
12550
|
+
{
|
|
12551
|
+
colorPicker.focus(); // Move focus to color picker - clear button will be hidden when transparent
|
|
12552
|
+
transparent(true);
|
|
12553
|
+
|
|
12554
|
+
colorPicker.value = defaultColor;
|
|
12555
|
+
prevColor = defaultColor;
|
|
12556
|
+
|
|
12557
|
+
fireOnChange();
|
|
12558
|
+
}
|
|
12559
|
+
me._internal.AddDomElement(cmdClear);
|
|
12560
|
+
}
|
|
12561
|
+
|
|
12562
|
+
// ============================================
|
|
12563
|
+
// Public - overrides
|
|
12564
|
+
// ============================================
|
|
12565
|
+
|
|
12566
|
+
// See documentation on ControlBase
|
|
12567
|
+
this.Focused = function(focus)
|
|
12568
|
+
{
|
|
12569
|
+
Fit.Validation.ExpectBoolean(focus, true);
|
|
12570
|
+
|
|
12571
|
+
if (Fit.Validation.IsSet(focus) === true && focus !== me.Focused())
|
|
12572
|
+
{
|
|
12573
|
+
if (focus === true)
|
|
12574
|
+
{
|
|
12575
|
+
colorPicker.focus();
|
|
12576
|
+
}
|
|
12577
|
+
else
|
|
12578
|
+
{
|
|
12579
|
+
Fit.Dom.GetFocused().blur(); // Multiple elements can hold focus - we have ensured control is the one having focus (me.Focused() above)
|
|
12580
|
+
}
|
|
12581
|
+
}
|
|
12582
|
+
|
|
12583
|
+
return Fit.Dom.Contained(me.GetDomElement(), Fit.Dom.GetFocused());
|
|
12584
|
+
}
|
|
12585
|
+
|
|
12586
|
+
// See documentation on ControlBase
|
|
12587
|
+
this.Value = function(val, preserveDirtyState)
|
|
12588
|
+
{
|
|
12589
|
+
Fit.Validation.ExpectString(val, true);
|
|
12590
|
+
Fit.Validation.ExpectBoolean(preserveDirtyState, true);
|
|
12591
|
+
|
|
12592
|
+
if (Fit.Validation.IsSet(val) === true)
|
|
12593
|
+
{
|
|
12594
|
+
val = val.toUpperCase();
|
|
12595
|
+
|
|
12596
|
+
if (me.Value() !== val)
|
|
12597
|
+
{
|
|
12598
|
+
var changed = false;
|
|
12599
|
+
|
|
12600
|
+
if (val === "")
|
|
12601
|
+
{
|
|
12602
|
+
transparent(true);
|
|
12603
|
+
changed = true;
|
|
12604
|
+
}
|
|
12605
|
+
else if (isValidColor(val) === true)
|
|
12606
|
+
{
|
|
12607
|
+
transparent(false);
|
|
12608
|
+
colorPicker.value = val;
|
|
12609
|
+
changed = true;
|
|
12610
|
+
}
|
|
12611
|
+
|
|
12612
|
+
if (changed === true)
|
|
12613
|
+
{
|
|
12614
|
+
orgColor = (preserveDirtyState !== true ? val : orgColor);
|
|
12615
|
+
fireOnChange();
|
|
12616
|
+
}
|
|
12617
|
+
}
|
|
12618
|
+
}
|
|
12619
|
+
|
|
12620
|
+
return (transparent() ? "" : colorPicker.value.toUpperCase());
|
|
12621
|
+
}
|
|
12622
|
+
|
|
12623
|
+
// See documentation on ControlBase
|
|
12624
|
+
this.IsDirty = function()
|
|
12625
|
+
{
|
|
12626
|
+
return (orgColor !== me.Value());
|
|
12627
|
+
}
|
|
12628
|
+
|
|
12629
|
+
// See documentation on ControlBase
|
|
12630
|
+
this.Clear = function()
|
|
12631
|
+
{
|
|
12632
|
+
me.Value("");
|
|
12633
|
+
}
|
|
12634
|
+
|
|
12635
|
+
// See documentation on ControlBase
|
|
12636
|
+
this.Dispose = Fit.Core.CreateOverride(this.Dispose, function()
|
|
12637
|
+
{
|
|
12638
|
+
me = colorPicker = lblValue = orgColor = prevColor = cmdClear = defaultColor = null;
|
|
12639
|
+
base();
|
|
12640
|
+
});
|
|
12641
|
+
|
|
12642
|
+
// ============================================
|
|
12643
|
+
// Public
|
|
12644
|
+
// ============================================
|
|
12645
|
+
|
|
12646
|
+
this.ShowValue = function(val)
|
|
12647
|
+
{
|
|
12648
|
+
Fit.Validation.ExpectBoolean(val, true);
|
|
12649
|
+
|
|
12650
|
+
if (Fit.Validation.IsSet(val) === true)
|
|
12651
|
+
{
|
|
12652
|
+
lblValue.style.display = (val === false ? "none" : "");
|
|
12653
|
+
}
|
|
12654
|
+
|
|
12655
|
+
return lblValue.style.display === "";
|
|
12656
|
+
}
|
|
12657
|
+
|
|
12658
|
+
// ============================================
|
|
12659
|
+
// Private
|
|
12660
|
+
// ============================================
|
|
12661
|
+
|
|
12662
|
+
function transparent(val)
|
|
12663
|
+
{
|
|
12664
|
+
if (Fit.Validation.IsSet(val) === true)
|
|
12665
|
+
{
|
|
12666
|
+
me._internal.Data("transparent", val ? "true" : "false");
|
|
12667
|
+
}
|
|
12668
|
+
|
|
12669
|
+
return me._internal.Data("transparent") === "true";
|
|
12670
|
+
}
|
|
12671
|
+
|
|
12672
|
+
function isValidColor(val)
|
|
12673
|
+
{
|
|
12674
|
+
return /^#[A-F0-9]{6}$/.test(val);
|
|
12675
|
+
}
|
|
12676
|
+
|
|
12677
|
+
function fireOnChange()
|
|
12678
|
+
{
|
|
12679
|
+
var newVal = me.Value();
|
|
12680
|
+
var compareValue = prevColor.toUpperCase(); // Value() returns uppercase value for color picker - preVal might be in lower case if assigned before input type was changed
|
|
12681
|
+
|
|
12682
|
+
if (newVal !== compareValue)
|
|
12683
|
+
{
|
|
12684
|
+
prevColor = newVal;
|
|
12685
|
+
me._internal.FireOnChange();
|
|
12686
|
+
|
|
12687
|
+
var contrastColor = me.Value() !== "" ? Fit.Color.GetContrastColor(me.Value(), 120) : "black";
|
|
12688
|
+
|
|
12689
|
+
// Update control's background color
|
|
12690
|
+
me.GetDomElement().style.background = me.Value();
|
|
12691
|
+
|
|
12692
|
+
// Update label showing color code
|
|
12693
|
+
lblValue.innerHTML = me.Value();
|
|
12694
|
+
lblValue.style.color = contrastColor;
|
|
12695
|
+
|
|
12696
|
+
// Update clear button's contract color
|
|
12697
|
+
cmdClear.style.color = contrastColor;
|
|
12698
|
+
}
|
|
12699
|
+
}
|
|
12700
|
+
|
|
12701
|
+
init();
|
|
12702
|
+
}
|
|
12452
12703
|
/// <container name="Fit.Controls.ContextMenu" extends="Fit.Controls.Component">
|
|
12453
12704
|
/// ContextMenu control allowing for quick access to select features.
|
|
12454
12705
|
/// </container>
|