ngx-kit 7.1.0 → 7.3.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/angle-selector/README.md +34 -34
- package/box-shadow/README.md +33 -33
- package/color-picker/README.md +52 -52
- package/{shared → core}/README.md +117 -117
- package/data-table/README.md +120 -120
- package/date-picker/README.md +74 -74
- package/dialog/README.md +122 -92
- package/drag-resize/README.md +53 -55
- package/fesm2022/ngx-kit-angle-selector.mjs +9 -26
- package/fesm2022/ngx-kit-angle-selector.mjs.map +1 -1
- package/fesm2022/ngx-kit-box-shadow.mjs +330 -356
- package/fesm2022/ngx-kit-box-shadow.mjs.map +1 -1
- package/fesm2022/ngx-kit-color-picker.mjs +132 -272
- package/fesm2022/ngx-kit-color-picker.mjs.map +1 -1
- package/fesm2022/{ngx-kit-shared.mjs → ngx-kit-core.mjs} +908 -277
- package/fesm2022/ngx-kit-core.mjs.map +1 -0
- package/fesm2022/ngx-kit-data-table.mjs +1 -1
- package/fesm2022/ngx-kit-data-table.mjs.map +1 -1
- package/fesm2022/ngx-kit-date-picker.mjs +34 -22
- package/fesm2022/ngx-kit-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-dialog.mjs +430 -331
- package/fesm2022/ngx-kit-dialog.mjs.map +1 -1
- package/fesm2022/ngx-kit-drag-resize.mjs +193 -140
- package/fesm2022/ngx-kit-drag-resize.mjs.map +1 -1
- package/fesm2022/ngx-kit-drawer-menu.mjs +3 -3
- package/fesm2022/ngx-kit-drawer-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-dropzone.mjs.map +1 -1
- package/fesm2022/ngx-kit-form-field.mjs +9 -3
- package/fesm2022/ngx-kit-form-field.mjs.map +1 -1
- package/fesm2022/ngx-kit-gallery.mjs +3 -3
- package/fesm2022/ngx-kit-gallery.mjs.map +1 -1
- package/fesm2022/ngx-kit-gradient-picker.mjs +20 -38
- package/fesm2022/ngx-kit-gradient-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-grid-layout.mjs +32 -30
- package/fesm2022/ngx-kit-grid-layout.mjs.map +1 -1
- package/fesm2022/ngx-kit-image-editor.mjs +3 -3
- package/fesm2022/ngx-kit-image-editor.mjs.map +1 -1
- package/fesm2022/ngx-kit-menu.mjs +1 -1
- package/fesm2022/ngx-kit-menu.mjs.map +1 -1
- package/fesm2022/ngx-kit-message.mjs +2 -2
- package/fesm2022/ngx-kit-message.mjs.map +1 -1
- package/fesm2022/ngx-kit-notify.mjs +1 -1
- package/fesm2022/ngx-kit-notify.mjs.map +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs +1 -1
- package/fesm2022/ngx-kit-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-kit-virtual-scroll.mjs +2 -2
- package/fesm2022/ngx-kit-virtual-scroll.mjs.map +1 -1
- package/gallery/README.md +71 -71
- package/gradient-picker/README.md +41 -41
- package/grid-layout/README.md +64 -64
- package/image-editor/README.md +44 -44
- package/menu/README.md +85 -85
- package/message/README.md +70 -70
- package/notify/README.md +56 -56
- package/package.json +5 -9
- package/time-picker/README.md +89 -89
- package/types/ngx-kit-angle-selector.d.ts +13 -16
- package/types/ngx-kit-box-shadow.d.ts +37 -95
- package/types/ngx-kit-color-picker.d.ts +61 -58
- package/types/{ngx-kit-shared.d.ts → ngx-kit-core.d.ts} +194 -34
- package/types/ngx-kit-data-table.d.ts +2 -2
- package/types/ngx-kit-date-picker.d.ts +15 -12
- package/types/ngx-kit-dialog.d.ts +208 -107
- package/types/ngx-kit-drag-resize.d.ts +74 -47
- package/types/ngx-kit-form-field.d.ts +26 -23
- package/types/ngx-kit-gradient-picker.d.ts +4 -7
- package/types/ngx-kit-menu.d.ts +1 -1
- package/types/ngx-kit-time-picker.d.ts +1 -1
- package/virtual-scroll/README.md +199 -199
- package/fesm2022/ngx-kit-shared.mjs.map +0 -1
- package/fesm2022/ngx-kit-webflow.mjs +0 -709
- package/fesm2022/ngx-kit-webflow.mjs.map +0 -1
- package/types/ngx-kit-webflow.d.ts +0 -286
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, EventEmitter, Output, Input, Component, inject, forwardRef, ChangeDetectionStrategy, ElementRef, HostListener, Directive } from '@angular/core';
|
|
2
|
+
import { Pipe, EventEmitter, Output, Input, Component, InjectionToken, inject, input, model, output, signal, effect, forwardRef, ChangeDetectionStrategy, ElementRef, HostListener, Directive } from '@angular/core';
|
|
3
|
+
import * as i1$2 from 'ngx-kit/core';
|
|
4
|
+
import { CSS_COLOR_NAMES, SliderComponent, SaturationComponent } from 'ngx-kit/core';
|
|
3
5
|
import * as i1 from '@angular/forms';
|
|
4
6
|
import { FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
5
7
|
import * as i1$1 from '@angular/common';
|
|
6
8
|
import { CommonModule } from '@angular/common';
|
|
7
|
-
import * as i1$2 from 'ngx-kit/shared';
|
|
8
|
-
import { SliderComponent, SaturationComponent, BrowserService } from 'ngx-kit/shared';
|
|
9
9
|
|
|
10
10
|
var ColorFormats;
|
|
11
11
|
(function (ColorFormats) {
|
|
@@ -461,158 +461,6 @@ function rgbToCmykString(r, g, b) {
|
|
|
461
461
|
return `cmyk(${Math.round(c)}%, ${Math.round(m)}%, ${Math.round(y)}%, ${Math.round(k)}%)`;
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
// List of all CSS color names and their hex values (W3C + extended)
|
|
465
|
-
const colorNames = {
|
|
466
|
-
aliceblue: '#f0f8ff',
|
|
467
|
-
antiquewhite: '#faebd7',
|
|
468
|
-
aqua: '#00ffff',
|
|
469
|
-
aquamarine: '#7fffd4',
|
|
470
|
-
azure: '#f0ffff',
|
|
471
|
-
beige: '#f5f5dc',
|
|
472
|
-
bisque: '#ffe4c4',
|
|
473
|
-
black: '#000000',
|
|
474
|
-
blanchedalmond: '#ffebcd',
|
|
475
|
-
blue: '#0000ff',
|
|
476
|
-
blueviolet: '#8a2be2',
|
|
477
|
-
brown: '#a52a2a',
|
|
478
|
-
burlywood: '#deb887',
|
|
479
|
-
cadetblue: '#5f9ea0',
|
|
480
|
-
chartreuse: '#7fff00',
|
|
481
|
-
chocolate: '#d2691e',
|
|
482
|
-
coral: '#ff7f50',
|
|
483
|
-
cornflowerblue: '#6495ed',
|
|
484
|
-
cornsilk: '#fff8dc',
|
|
485
|
-
crimson: '#dc143c',
|
|
486
|
-
cyan: '#00ffff',
|
|
487
|
-
darkblue: '#00008b',
|
|
488
|
-
darkcyan: '#008b8b',
|
|
489
|
-
darkgoldenrod: '#b8860b',
|
|
490
|
-
darkgray: '#a9a9a9',
|
|
491
|
-
darkgreen: '#006400',
|
|
492
|
-
darkgrey: '#a9a9a9',
|
|
493
|
-
darkkhaki: '#bdb76b',
|
|
494
|
-
darkmagenta: '#8b008b',
|
|
495
|
-
darkolivegreen: '#556b2f',
|
|
496
|
-
darkorange: '#ff8c00',
|
|
497
|
-
darkorchid: '#9932cc',
|
|
498
|
-
darkred: '#8b0000',
|
|
499
|
-
darksalmon: '#e9967a',
|
|
500
|
-
darkseagreen: '#8fbc8f',
|
|
501
|
-
darkslateblue: '#483d8b',
|
|
502
|
-
darkslategray: '#2f4f4f',
|
|
503
|
-
darkslategrey: '#2f4f4f',
|
|
504
|
-
darkturquoise: '#00ced1',
|
|
505
|
-
darkviolet: '#9400d3',
|
|
506
|
-
deeppink: '#ff1493',
|
|
507
|
-
deepskyblue: '#00bfff',
|
|
508
|
-
dimgray: '#696969',
|
|
509
|
-
dimgrey: '#696969',
|
|
510
|
-
dodgerblue: '#1e90ff',
|
|
511
|
-
firebrick: '#b22222',
|
|
512
|
-
floralwhite: '#fffaf0',
|
|
513
|
-
forestgreen: '#228b22',
|
|
514
|
-
fuchsia: '#ff00ff',
|
|
515
|
-
gainsboro: '#dcdcdc',
|
|
516
|
-
ghostwhite: '#f8f8ff',
|
|
517
|
-
gold: '#ffd700',
|
|
518
|
-
goldenrod: '#daa520',
|
|
519
|
-
gray: '#808080',
|
|
520
|
-
green: '#008000',
|
|
521
|
-
greenyellow: '#adff2f',
|
|
522
|
-
grey: '#808080',
|
|
523
|
-
honeydew: '#f0fff0',
|
|
524
|
-
hotpink: '#ff69b4',
|
|
525
|
-
indianred: '#cd5c5c',
|
|
526
|
-
indigo: '#4b0082',
|
|
527
|
-
ivory: '#fffff0',
|
|
528
|
-
khaki: '#f0e68c',
|
|
529
|
-
lavender: '#e6e6fa',
|
|
530
|
-
lavenderblush: '#fff0f5',
|
|
531
|
-
lawngreen: '#7cfc00',
|
|
532
|
-
lemonchiffon: '#fffacd',
|
|
533
|
-
lightblue: '#add8e6',
|
|
534
|
-
lightcoral: '#f08080',
|
|
535
|
-
lightcyan: '#e0ffff',
|
|
536
|
-
lightgoldenrodyellow: '#fafad2',
|
|
537
|
-
lightgray: '#d3d3d3',
|
|
538
|
-
lightgreen: '#90ee90',
|
|
539
|
-
lightgrey: '#d3d3d3',
|
|
540
|
-
lightpink: '#ffb6c1',
|
|
541
|
-
lightsalmon: '#ffa07a',
|
|
542
|
-
lightseagreen: '#20b2aa',
|
|
543
|
-
lightskyblue: '#87cefa',
|
|
544
|
-
lightslategray: '#778899',
|
|
545
|
-
lightslategrey: '#778899',
|
|
546
|
-
lightsteelblue: '#b0c4de',
|
|
547
|
-
lightyellow: '#ffffe0',
|
|
548
|
-
lime: '#00ff00',
|
|
549
|
-
limegreen: '#32cd32',
|
|
550
|
-
linen: '#faf0e6',
|
|
551
|
-
magenta: '#ff00ff',
|
|
552
|
-
maroon: '#800000',
|
|
553
|
-
mediumaquamarine: '#66cdaa',
|
|
554
|
-
mediumblue: '#0000cd',
|
|
555
|
-
mediumorchid: '#ba55d3',
|
|
556
|
-
mediumpurple: '#9370db',
|
|
557
|
-
mediumseagreen: '#3cb371',
|
|
558
|
-
mediumslateblue: '#7b68ee',
|
|
559
|
-
mediumspringgreen: '#00fa9a',
|
|
560
|
-
mediumturquoise: '#48d1cc',
|
|
561
|
-
mediumvioletred: '#c71585',
|
|
562
|
-
midnightblue: '#191970',
|
|
563
|
-
mintcream: '#f5fffa',
|
|
564
|
-
mistyrose: '#ffe4e1',
|
|
565
|
-
moccasin: '#ffe4b5',
|
|
566
|
-
navajowhite: '#ffdead',
|
|
567
|
-
navy: '#000080',
|
|
568
|
-
oldlace: '#fdf5e6',
|
|
569
|
-
olive: '#808000',
|
|
570
|
-
olivedrab: '#6b8e23',
|
|
571
|
-
orange: '#ffa500',
|
|
572
|
-
orangered: '#ff4500',
|
|
573
|
-
orchid: '#da70d6',
|
|
574
|
-
palegoldenrod: '#eee8aa',
|
|
575
|
-
palegreen: '#98fb98',
|
|
576
|
-
paleturquoise: '#afeeee',
|
|
577
|
-
palevioletred: '#db7093',
|
|
578
|
-
papayawhip: '#ffefd5',
|
|
579
|
-
peachpuff: '#ffdab9',
|
|
580
|
-
peru: '#cd853f',
|
|
581
|
-
pink: '#ffc0cb',
|
|
582
|
-
plum: '#dda0dd',
|
|
583
|
-
powderblue: '#b0e0e6',
|
|
584
|
-
purple: '#800080',
|
|
585
|
-
rebeccapurple: '#663399',
|
|
586
|
-
red: '#ff0000',
|
|
587
|
-
rosybrown: '#bc8f8f',
|
|
588
|
-
royalblue: '#4169e1',
|
|
589
|
-
saddlebrown: '#8b4513',
|
|
590
|
-
salmon: '#fa8072',
|
|
591
|
-
sandybrown: '#f4a460',
|
|
592
|
-
seagreen: '#2e8b57',
|
|
593
|
-
seashell: '#fff5ee',
|
|
594
|
-
sienna: '#a0522d',
|
|
595
|
-
silver: '#c0c0c0',
|
|
596
|
-
skyblue: '#87ceeb',
|
|
597
|
-
slateblue: '#6a5acd',
|
|
598
|
-
slategray: '#708090',
|
|
599
|
-
slategrey: '#708090',
|
|
600
|
-
snow: '#fffafa',
|
|
601
|
-
springgreen: '#00ff7f',
|
|
602
|
-
steelblue: '#4682b4',
|
|
603
|
-
tan: '#d2b48c',
|
|
604
|
-
teal: '#008080',
|
|
605
|
-
thistle: '#d8bfd8',
|
|
606
|
-
tomato: '#ff6347',
|
|
607
|
-
turquoise: '#40e0d0',
|
|
608
|
-
violet: '#ee82ee',
|
|
609
|
-
wheat: '#f5deb3',
|
|
610
|
-
white: '#ffffff',
|
|
611
|
-
whitesmoke: '#f5f5f5',
|
|
612
|
-
yellow: '#ffff00',
|
|
613
|
-
yellowgreen: '#9acd32',
|
|
614
|
-
};
|
|
615
|
-
|
|
616
464
|
class NgxColor {
|
|
617
465
|
_rgb = { r: 0, g: 0, b: 0, a: 1 };
|
|
618
466
|
_name = '';
|
|
@@ -649,8 +497,8 @@ class NgxColor {
|
|
|
649
497
|
}
|
|
650
498
|
if (typeof input === 'string') {
|
|
651
499
|
const name = input.trim().toLowerCase();
|
|
652
|
-
if (
|
|
653
|
-
this._rgb = hexToRgb(
|
|
500
|
+
if (CSS_COLOR_NAMES[name]) {
|
|
501
|
+
this._rgb = hexToRgb(CSS_COLOR_NAMES[name]);
|
|
654
502
|
this._name = name;
|
|
655
503
|
return;
|
|
656
504
|
}
|
|
@@ -689,7 +537,7 @@ class NgxColor {
|
|
|
689
537
|
if (this._name)
|
|
690
538
|
return this._name;
|
|
691
539
|
const hex = this.toHexString();
|
|
692
|
-
for (const [n, h] of Object.entries(
|
|
540
|
+
for (const [n, h] of Object.entries(CSS_COLOR_NAMES)) {
|
|
693
541
|
if (h.toLowerCase() === hex.toLowerCase())
|
|
694
542
|
return n;
|
|
695
543
|
}
|
|
@@ -1068,55 +916,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
1068
916
|
type: Output
|
|
1069
917
|
}] } });
|
|
1070
918
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
919
|
+
const PRESETS_COLORS = [
|
|
920
|
+
'#000000',
|
|
921
|
+
'#ffffff',
|
|
922
|
+
'#4a4a4a',
|
|
923
|
+
'#b0b0b0',
|
|
924
|
+
'#3b82f6',
|
|
925
|
+
'#6366f1',
|
|
926
|
+
'#a855f7',
|
|
927
|
+
'#ec4899',
|
|
928
|
+
'#ef4444',
|
|
929
|
+
'#f97316',
|
|
930
|
+
'#f59e0b',
|
|
931
|
+
'#8b5e3c',
|
|
932
|
+
'#22c55e',
|
|
933
|
+
'#14b8a6',
|
|
934
|
+
'#06b6d4',
|
|
935
|
+
'#0ea5e9',
|
|
936
|
+
];
|
|
937
|
+
|
|
938
|
+
class NgxInputColorConfig {
|
|
939
|
+
/**
|
|
940
|
+
* show preset colors
|
|
941
|
+
* - It will not display preset colors in simple mode.
|
|
942
|
+
*/
|
|
943
|
+
showPresets = true;
|
|
944
|
+
presetColors = PRESETS_COLORS;
|
|
1083
945
|
/** Minifi UI */
|
|
1084
946
|
simpleMode = false;
|
|
1085
947
|
outputType = 'HEX';
|
|
1086
|
-
/**
|
|
1087
|
-
* default inspectors
|
|
1088
|
-
* - ColorInspector.Picker
|
|
1089
|
-
* - ColorInspector.RGB
|
|
1090
|
-
* - ColorInspector.HSL
|
|
1091
|
-
*
|
|
1092
|
-
* @alias defaultInspector
|
|
1093
|
-
*/
|
|
1094
948
|
defaultInspector = ColorInspector.Picker;
|
|
1095
949
|
useAlphaChannel = true;
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
const NGX_INPUT_COLOR_CONFIG_DEFAULT = new NgxInputColorConfig();
|
|
953
|
+
const NGX_INPUT_COLOR_CONFIG = new InjectionToken('ngx-input-color-config', {
|
|
954
|
+
factory: () => NGX_INPUT_COLOR_CONFIG_DEFAULT,
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
class NgxInputColorComponent {
|
|
958
|
+
configs = inject(NGX_INPUT_COLOR_CONFIG);
|
|
959
|
+
/** Minifi UI */
|
|
960
|
+
simpleMode = input(this.configs.simpleMode ?? false, /* @ts-ignore */
|
|
961
|
+
...(ngDevMode ? [{ debugName: "simpleMode" }] : /* istanbul ignore next */ []));
|
|
962
|
+
outputType = input(this.configs.outputType ?? 'HEX', /* @ts-ignore */
|
|
963
|
+
...(ngDevMode ? [{ debugName: "outputType" }] : /* istanbul ignore next */ []));
|
|
964
|
+
defaultInspector = model(this.configs.defaultInspector ?? ColorInspector.Picker, /* @ts-ignore */
|
|
965
|
+
...(ngDevMode ? [{ debugName: "defaultInspector" }] : /* istanbul ignore next */ []));
|
|
966
|
+
useAlphaChannel = input(this.configs.useAlphaChannel ?? true, /* @ts-ignore */
|
|
967
|
+
...(ngDevMode ? [{ debugName: "useAlphaChannel" }] : /* istanbul ignore next */ []));
|
|
968
|
+
showPresets = input(this.configs.showPresets ?? true, /* @ts-ignore */
|
|
969
|
+
...(ngDevMode ? [{ debugName: "showPresets" }] : /* istanbul ignore next */ []));
|
|
970
|
+
presetColors = input(this.configs.presetColors ?? [], /* @ts-ignore */
|
|
971
|
+
...(ngDevMode ? [{ debugName: "presetColors" }] : /* istanbul ignore next */ []));
|
|
1103
972
|
/** Emitted when the color value changes */
|
|
1104
|
-
|
|
973
|
+
colorChange = output();
|
|
1105
974
|
/** @ignore */
|
|
1106
975
|
format = ColorFormats.HSVA;
|
|
1107
976
|
/** @ignore */
|
|
1108
977
|
isDarkColor = true;
|
|
1109
978
|
/** @ignore */
|
|
1110
|
-
rgbaColor = 'rgba(0, 0, 0, 1)'
|
|
979
|
+
rgbaColor = signal('rgba(0, 0, 0, 1)', /* @ts-ignore */
|
|
980
|
+
...(ngDevMode ? [{ debugName: "rgbaColor" }] : /* istanbul ignore next */ []));
|
|
1111
981
|
/** @ignore */
|
|
1112
|
-
hexColor = '#000000'
|
|
1113
|
-
|
|
982
|
+
hexColor = signal('#000000', /* @ts-ignore */
|
|
983
|
+
...(ngDevMode ? [{ debugName: "hexColor" }] : /* istanbul ignore next */ []));
|
|
984
|
+
outputColor = signal('', /* @ts-ignore */
|
|
985
|
+
...(ngDevMode ? [{ debugName: "outputColor" }] : /* istanbul ignore next */ []));
|
|
1114
986
|
/** @ignore */
|
|
1115
|
-
name = 'black'
|
|
987
|
+
name = signal('black', /* @ts-ignore */
|
|
988
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
1116
989
|
/** @ignore */
|
|
1117
|
-
isSupportedEyeDrop;
|
|
990
|
+
isSupportedEyeDrop = 'EyeDropper' in (window ?? {});
|
|
1118
991
|
/** @ignore */
|
|
1119
|
-
color = new NgxColor()
|
|
992
|
+
color = signal(new NgxColor(), /* @ts-ignore */
|
|
993
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1120
994
|
/** @ignore */
|
|
1121
995
|
isDisabled = false;
|
|
1122
996
|
/**@ignore */
|
|
@@ -1125,14 +999,15 @@ class NgxInputColorComponent {
|
|
|
1125
999
|
_onTouched = () => { };
|
|
1126
1000
|
/**@ignore */
|
|
1127
1001
|
_onValidateChange = () => { };
|
|
1128
|
-
constructor(
|
|
1129
|
-
|
|
1130
|
-
|
|
1002
|
+
constructor() {
|
|
1003
|
+
effect(() => {
|
|
1004
|
+
const useAlphaChannel = this.useAlphaChannel() == true;
|
|
1005
|
+
if (!useAlphaChannel) {
|
|
1006
|
+
this.color().removeAlphaChannel();
|
|
1007
|
+
this.emitChange();
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1131
1010
|
}
|
|
1132
|
-
/** @ignore */
|
|
1133
|
-
ngOnInit() { }
|
|
1134
|
-
/** @ignore */
|
|
1135
|
-
ngOnDestroy() { }
|
|
1136
1011
|
get ColorFormats() {
|
|
1137
1012
|
return ColorFormats;
|
|
1138
1013
|
}
|
|
@@ -1157,7 +1032,7 @@ class NgxInputColorComponent {
|
|
|
1157
1032
|
}
|
|
1158
1033
|
/** @ignore */
|
|
1159
1034
|
validate(control) {
|
|
1160
|
-
if (this.color && this.color.isValid === false) {
|
|
1035
|
+
if (this.color() && this.color().isValid === false) {
|
|
1161
1036
|
return { invalid: true };
|
|
1162
1037
|
}
|
|
1163
1038
|
return null;
|
|
@@ -1179,12 +1054,14 @@ class NgxInputColorComponent {
|
|
|
1179
1054
|
if (this.isSupportedEyeDrop) {
|
|
1180
1055
|
let t = new EyeDropper().open();
|
|
1181
1056
|
t.then(async (result) => {
|
|
1182
|
-
this.hexColor
|
|
1183
|
-
this.initColor(new NgxColor(this.hexColor));
|
|
1184
|
-
this.cd.detectChanges();
|
|
1057
|
+
this.hexColor.set(result.sRGBHex);
|
|
1058
|
+
this.initColor(new NgxColor(this.hexColor()));
|
|
1185
1059
|
});
|
|
1186
1060
|
}
|
|
1187
1061
|
}
|
|
1062
|
+
selectColor(c) {
|
|
1063
|
+
this.initColor(new NgxColor(c));
|
|
1064
|
+
}
|
|
1188
1065
|
/**
|
|
1189
1066
|
* call from directive
|
|
1190
1067
|
/* @ignore
|
|
@@ -1192,26 +1069,22 @@ class NgxInputColorComponent {
|
|
|
1192
1069
|
async initColor(c) {
|
|
1193
1070
|
if (!c)
|
|
1194
1071
|
return;
|
|
1195
|
-
this.color
|
|
1196
|
-
this.rgbaColor
|
|
1197
|
-
this.hexColor
|
|
1198
|
-
this.outputColor
|
|
1199
|
-
this.isDarkColor = this.color.isDark();
|
|
1200
|
-
this.name
|
|
1072
|
+
this.color.set(c);
|
|
1073
|
+
this.rgbaColor.set(this.color().toRgbString());
|
|
1074
|
+
this.hexColor.set(this.color().toHexString());
|
|
1075
|
+
this.outputColor.set(await this.color().getOutputResult(this.outputType()));
|
|
1076
|
+
this.isDarkColor = this.color().isDark();
|
|
1077
|
+
this.name.set(await this.color().name());
|
|
1201
1078
|
this.emitChange();
|
|
1202
1079
|
}
|
|
1203
1080
|
/** @ignore */
|
|
1204
|
-
stopPropagation(ev) {
|
|
1205
|
-
ev.stopPropagation();
|
|
1206
|
-
}
|
|
1207
|
-
/** @ignore */
|
|
1208
1081
|
async emitChange() {
|
|
1209
|
-
this.outputColor
|
|
1210
|
-
this._onChange(this.outputColor);
|
|
1211
|
-
this.
|
|
1082
|
+
this.outputColor.set(await this.color().getOutputResult(this.outputType()));
|
|
1083
|
+
this._onChange(this.outputColor());
|
|
1084
|
+
this.colorChange.emit(this.outputColor());
|
|
1212
1085
|
}
|
|
1213
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxInputColorComponent, deps: [
|
|
1214
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxInputColorComponent, isStandalone: true, selector: "ngx-input-color", inputs: {
|
|
1086
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxInputColorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1087
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NgxInputColorComponent, isStandalone: true, selector: "ngx-input-color", inputs: { simpleMode: { classPropertyName: "simpleMode", publicName: "simpleMode", isSignal: true, isRequired: false, transformFunction: null }, outputType: { classPropertyName: "outputType", publicName: "outputType", isSignal: true, isRequired: false, transformFunction: null }, defaultInspector: { classPropertyName: "defaultInspector", publicName: "defaultInspector", isSignal: true, isRequired: false, transformFunction: null }, useAlphaChannel: { classPropertyName: "useAlphaChannel", publicName: "useAlphaChannel", isSignal: true, isRequired: false, transformFunction: null }, showPresets: { classPropertyName: "showPresets", publicName: "showPresets", isSignal: true, isRequired: false, transformFunction: null }, presetColors: { classPropertyName: "presetColors", publicName: "presetColors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { defaultInspector: "defaultInspectorChange", colorChange: "colorChange" }, providers: [
|
|
1215
1088
|
{
|
|
1216
1089
|
provide: NG_VALUE_ACCESSOR,
|
|
1217
1090
|
useExisting: forwardRef(() => NgxInputColorComponent),
|
|
@@ -1222,7 +1095,7 @@ class NgxInputColorComponent {
|
|
|
1222
1095
|
multi: true,
|
|
1223
1096
|
useExisting: NgxInputColorComponent,
|
|
1224
1097
|
},
|
|
1225
|
-
], ngImport: i0, template: "<div
|
|
1098
|
+
], ngImport: i0, template: "<div class=\"ngx-input-color-picker\" [class.simple-mode]=\"simpleMode()\">\n @if (!simpleMode()) {\n <div\n class=\"ngx-color-preview\"\n [ngStyle]=\"{ '--ngx-selected-color': rgbaColor() }\"\n [class.is-dark-color]=\"isDarkColor\">\n <div class=\"rgbacode\">{{ outputColor() | uppercase }}</div>\n @if (outputType() !== 'HEX') {\n <div class=\"hexacode\">{{ hexColor() | uppercase }}</div>\n }\n <div class=\"colorname\">{{ name() }}</div>\n <div class=\"color\"></div>\n </div>\n }\n <div class=\"ngx-c-inner\">\n <div class=\"top-actions\">\n <select [(ngModel)]=\"defaultInspector\" name=\"inspector\">\n @for (inspector of ColorInspector | enumToArray; track inspector) {\n <option [value]=\"inspector\">\n {{ ColorInspector[+inspector] }}\n </option>\n }\n </select>\n @if (isSupportedEyeDrop) {\n <button type=\"button\" (click)=\"openEyeDrop()\" class=\"ngx-btn-eyedroper\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <defs>\n <style>\n .fa-secondary {\n opacity: 0.4;\n }\n </style>\n </defs>\n <path\n class=\"fa-primary\"\n d=\"M482.8 29.23C521.7 68.21 521.7 131.4 482.8 170.4L381.2 271.9L390.6 281.4C403.1 293.9 403.1 314.1 390.6 326.6C378.1 339.1 357.9 339.1 345.4 326.6L185.4 166.6C172.9 154.1 172.9 133.9 185.4 121.4C197.9 108.9 218.1 108.9 230.6 121.4L240.1 130.8L341.6 29.23C380.6-9.744 443.8-9.744 482.8 29.23L482.8 29.23zM132.1 416H96V379.9C96 375.6 97.69 371.6 100.7 368.6L149.3 320H234.7L143.4 411.3C140.4 414.3 136.4 416 132.1 416H132.1z\" />\n <path\n class=\"fa-secondary\"\n d=\"M244 225.3L100.7 368.6C97.69 371.6 96 375.6 96 379.9V416H132.1C136.4 416 140.4 414.3 143.4 411.3L286.7 268L332 313.3L188.7 456.6C173.7 471.6 153.3 480 132.1 480H89.69L49.75 506.6C37.06 515.1 20.16 513.4 9.372 502.6C-1.414 491.8-3.087 474.9 5.374 462.2L32 422.3V379.9C32 358.7 40.43 338.3 55.43 323.3L198.7 180L244 225.3z\" />\n </svg>\n </button>\n }\n </div>\n @switch (+defaultInspector()) {\n @case (ColorInspector.Picker) {\n <app-picker\n [color]=\"color()\"\n (colorChange)=\"initColor($event)\"\n [simpleMode]=\"simpleMode()\"\n [useAlphaChannel]=\"useAlphaChannel()\"></app-picker>\n }\n @case (ColorInspector.HSL) {\n <app-hsl\n [color]=\"color()\"\n (colorChange)=\"initColor($event)\"\n [useAlphaChannel]=\"useAlphaChannel()\"></app-hsl>\n }\n @case (ColorInspector.RGB) {\n <app-rgb\n [color]=\"color()\"\n (colorChange)=\"initColor($event)\"\n [useAlphaChannel]=\"useAlphaChannel()\"></app-rgb>\n }\n @case (ColorInspector.CMYK) {\n <app-cmyk [color]=\"color()\" (colorChange)=\"initColor($event)\"></app-cmyk>\n }\n }\n @if (showPresets() && !simpleMode()) {\n <div class=\"presets-colors\">\n @for (item of presetColors(); track $index) {\n <button type=\"button\" [style.background]=\"item\" (click)=\"selectColor(item)\"></button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{--ngx-color-bg: light-dark(#fff, #222);--ngx-color-text: light-dark(#000, #fff)}.ngx-input-color-picker{width:270px;max-width:100%;overflow:hidden;direction:ltr;font-family:arial,tahoma;border:1px rgba(134,134,134,.3490196078) solid}.ngx-input-color-picker .ngx-c-inner{padding:12px;background:var(--ngx-color-bg);color:var(--ngx-color-text);border-radius:15px;margin-top:-15px;position:relative}.ngx-input-color-picker *{box-sizing:border-box}.ngx-input-color-picker.simple-mode{width:220px;--ngx-thumb-size: 24px}.ngx-input-color-picker.simple-mode .ngx-c-inner{padding:12px;margin:0}.ngx-color-preview{min-height:100px;padding:10px 36px;line-height:1.6;font-size:14px;font-family:arial,tahoma;font-weight:700;position:relative;color:#353535;background-color:#fff}.ngx-color-preview.is-dark-color{color:#fff}.ngx-color-preview:after,.ngx-color-preview:before{content:\" \";position:absolute;inset:0}.ngx-color-preview:before{background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0px}.ngx-color-preview:after{background:var(--ngx-selected-color)}.ngx-color-preview .rgbacode,.ngx-color-preview .colorname,.ngx-color-preview .color{text-shadow:0 0 1px #000000;position:relative;z-index:1}.button-groups{display:flex;border-radius:4px;overflow:hidden;border:1px #d3d3d3 solid}.button-groups button{cursor:pointer;background:#f9f9f9;outline:none;border:none;transition:all .3s;border-left:1px #d3d3d3 solid;padding:10px 12px;flex:auto}.button-groups button:hover{background:#8db6e4}.button-groups button:first-child{border-left-width:0}.ngx-btn-eyedroper{padding:2px;min-width:0;width:45px;cursor:pointer;background-color:transparent;outline:none;transition:all .3s;border:none;border-radius:6px}.ngx-btn-eyedroper svg{width:18px;fill:var(--ngx-color-text)}.top-actions{display:flex;justify-content:space-between;align-items:center;padding:0 0 12px}.top-actions select{outline:none;border:none;border-radius:4px;padding:5px 10px;background:none;color:var(--ngx-color-text)}.top-actions select:focus{cursor:pointer;background:#e5f0ff;color:#06f}.top-actions select option{padding:10px 20px;background:var(--ngx-color-bg);color:var(--ngx-color-text);transition:all .3s}.top-actions select option:hover{background:#f0f0f048}.presets-colors{display:flex;align-items:center;flex-wrap:wrap;max-height:200px;overflow:auto;gap:5px;margin-top:10px}.presets-colors button{all:unset;width:26px;height:26px;border-radius:100%;cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: PickerComponent, selector: "app-picker", inputs: ["simpleMode", "color", "useAlphaChannel"], outputs: ["colorChange"] }, { kind: "component", type: CmykComponent, selector: "app-cmyk", inputs: ["color"], outputs: ["colorChange"] }, { kind: "component", type: HslComponent, selector: "app-hsl", inputs: ["color", "useAlphaChannel"], outputs: ["colorChange"] }, { kind: "component", type: RgbComponent, selector: "app-rgb", inputs: ["color", "useAlphaChannel"], outputs: ["colorChange"] }, { kind: "pipe", type: i1$1.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: EnumToArrayPipe, name: "enumToArray" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1226
1099
|
}
|
|
1227
1100
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxInputColorComponent, decorators: [{
|
|
1228
1101
|
type: Component,
|
|
@@ -1237,9 +1110,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
1237
1110
|
multi: true,
|
|
1238
1111
|
useExisting: NgxInputColorComponent,
|
|
1239
1112
|
},
|
|
1240
|
-
], changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1241
|
-
'[class.dark]': 'theme=="dark"',
|
|
1242
|
-
}, imports: [
|
|
1113
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1243
1114
|
CommonModule,
|
|
1244
1115
|
FormsModule,
|
|
1245
1116
|
EnumToArrayPipe,
|
|
@@ -1247,22 +1118,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
1247
1118
|
CmykComponent,
|
|
1248
1119
|
HslComponent,
|
|
1249
1120
|
RgbComponent,
|
|
1250
|
-
], template: "<div
|
|
1251
|
-
}], ctorParameters: () => [{ type: i0.
|
|
1252
|
-
type: Input,
|
|
1253
|
-
args: ['theme']
|
|
1254
|
-
}], simpleMode: [{
|
|
1255
|
-
type: Input
|
|
1256
|
-
}], outputType: [{
|
|
1257
|
-
type: Input
|
|
1258
|
-
}], defaultInspector: [{
|
|
1259
|
-
type: Input
|
|
1260
|
-
}], setUseAlphaChannel: [{
|
|
1261
|
-
type: Input,
|
|
1262
|
-
args: ['useAlphaChannel']
|
|
1263
|
-
}], change: [{
|
|
1264
|
-
type: Output
|
|
1265
|
-
}] } });
|
|
1121
|
+
], template: "<div class=\"ngx-input-color-picker\" [class.simple-mode]=\"simpleMode()\">\n @if (!simpleMode()) {\n <div\n class=\"ngx-color-preview\"\n [ngStyle]=\"{ '--ngx-selected-color': rgbaColor() }\"\n [class.is-dark-color]=\"isDarkColor\">\n <div class=\"rgbacode\">{{ outputColor() | uppercase }}</div>\n @if (outputType() !== 'HEX') {\n <div class=\"hexacode\">{{ hexColor() | uppercase }}</div>\n }\n <div class=\"colorname\">{{ name() }}</div>\n <div class=\"color\"></div>\n </div>\n }\n <div class=\"ngx-c-inner\">\n <div class=\"top-actions\">\n <select [(ngModel)]=\"defaultInspector\" name=\"inspector\">\n @for (inspector of ColorInspector | enumToArray; track inspector) {\n <option [value]=\"inspector\">\n {{ ColorInspector[+inspector] }}\n </option>\n }\n </select>\n @if (isSupportedEyeDrop) {\n <button type=\"button\" (click)=\"openEyeDrop()\" class=\"ngx-btn-eyedroper\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <defs>\n <style>\n .fa-secondary {\n opacity: 0.4;\n }\n </style>\n </defs>\n <path\n class=\"fa-primary\"\n d=\"M482.8 29.23C521.7 68.21 521.7 131.4 482.8 170.4L381.2 271.9L390.6 281.4C403.1 293.9 403.1 314.1 390.6 326.6C378.1 339.1 357.9 339.1 345.4 326.6L185.4 166.6C172.9 154.1 172.9 133.9 185.4 121.4C197.9 108.9 218.1 108.9 230.6 121.4L240.1 130.8L341.6 29.23C380.6-9.744 443.8-9.744 482.8 29.23L482.8 29.23zM132.1 416H96V379.9C96 375.6 97.69 371.6 100.7 368.6L149.3 320H234.7L143.4 411.3C140.4 414.3 136.4 416 132.1 416H132.1z\" />\n <path\n class=\"fa-secondary\"\n d=\"M244 225.3L100.7 368.6C97.69 371.6 96 375.6 96 379.9V416H132.1C136.4 416 140.4 414.3 143.4 411.3L286.7 268L332 313.3L188.7 456.6C173.7 471.6 153.3 480 132.1 480H89.69L49.75 506.6C37.06 515.1 20.16 513.4 9.372 502.6C-1.414 491.8-3.087 474.9 5.374 462.2L32 422.3V379.9C32 358.7 40.43 338.3 55.43 323.3L198.7 180L244 225.3z\" />\n </svg>\n </button>\n }\n </div>\n @switch (+defaultInspector()) {\n @case (ColorInspector.Picker) {\n <app-picker\n [color]=\"color()\"\n (colorChange)=\"initColor($event)\"\n [simpleMode]=\"simpleMode()\"\n [useAlphaChannel]=\"useAlphaChannel()\"></app-picker>\n }\n @case (ColorInspector.HSL) {\n <app-hsl\n [color]=\"color()\"\n (colorChange)=\"initColor($event)\"\n [useAlphaChannel]=\"useAlphaChannel()\"></app-hsl>\n }\n @case (ColorInspector.RGB) {\n <app-rgb\n [color]=\"color()\"\n (colorChange)=\"initColor($event)\"\n [useAlphaChannel]=\"useAlphaChannel()\"></app-rgb>\n }\n @case (ColorInspector.CMYK) {\n <app-cmyk [color]=\"color()\" (colorChange)=\"initColor($event)\"></app-cmyk>\n }\n }\n @if (showPresets() && !simpleMode()) {\n <div class=\"presets-colors\">\n @for (item of presetColors(); track $index) {\n <button type=\"button\" [style.background]=\"item\" (click)=\"selectColor(item)\"></button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [":host{--ngx-color-bg: light-dark(#fff, #222);--ngx-color-text: light-dark(#000, #fff)}.ngx-input-color-picker{width:270px;max-width:100%;overflow:hidden;direction:ltr;font-family:arial,tahoma;border:1px rgba(134,134,134,.3490196078) solid}.ngx-input-color-picker .ngx-c-inner{padding:12px;background:var(--ngx-color-bg);color:var(--ngx-color-text);border-radius:15px;margin-top:-15px;position:relative}.ngx-input-color-picker *{box-sizing:border-box}.ngx-input-color-picker.simple-mode{width:220px;--ngx-thumb-size: 24px}.ngx-input-color-picker.simple-mode .ngx-c-inner{padding:12px;margin:0}.ngx-color-preview{min-height:100px;padding:10px 36px;line-height:1.6;font-size:14px;font-family:arial,tahoma;font-weight:700;position:relative;color:#353535;background-color:#fff}.ngx-color-preview.is-dark-color{color:#fff}.ngx-color-preview:after,.ngx-color-preview:before{content:\" \";position:absolute;inset:0}.ngx-color-preview:before{background-image:linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%);background-size:16px 16px;background-position:0 0,0 8px,8px -8px,-8px 0px}.ngx-color-preview:after{background:var(--ngx-selected-color)}.ngx-color-preview .rgbacode,.ngx-color-preview .colorname,.ngx-color-preview .color{text-shadow:0 0 1px #000000;position:relative;z-index:1}.button-groups{display:flex;border-radius:4px;overflow:hidden;border:1px #d3d3d3 solid}.button-groups button{cursor:pointer;background:#f9f9f9;outline:none;border:none;transition:all .3s;border-left:1px #d3d3d3 solid;padding:10px 12px;flex:auto}.button-groups button:hover{background:#8db6e4}.button-groups button:first-child{border-left-width:0}.ngx-btn-eyedroper{padding:2px;min-width:0;width:45px;cursor:pointer;background-color:transparent;outline:none;transition:all .3s;border:none;border-radius:6px}.ngx-btn-eyedroper svg{width:18px;fill:var(--ngx-color-text)}.top-actions{display:flex;justify-content:space-between;align-items:center;padding:0 0 12px}.top-actions select{outline:none;border:none;border-radius:4px;padding:5px 10px;background:none;color:var(--ngx-color-text)}.top-actions select:focus{cursor:pointer;background:#e5f0ff;color:#06f}.top-actions select option{padding:10px 20px;background:var(--ngx-color-bg);color:var(--ngx-color-text);transition:all .3s}.top-actions select option:hover{background:#f0f0f048}.presets-colors{display:flex;align-items:center;flex-wrap:wrap;max-height:200px;overflow:auto;gap:5px;margin-top:10px}.presets-colors button{all:unset;width:26px;height:26px;border-radius:100%;cursor:pointer}\n"] }]
|
|
1122
|
+
}], ctorParameters: () => [], propDecorators: { simpleMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "simpleMode", required: false }] }], outputType: [{ type: i0.Input, args: [{ isSignal: true, alias: "outputType", required: false }] }], defaultInspector: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultInspector", required: false }] }, { type: i0.Output, args: ["defaultInspectorChange"] }], useAlphaChannel: [{ type: i0.Input, args: [{ isSignal: true, alias: "useAlphaChannel", required: false }] }], showPresets: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPresets", required: false }] }], presetColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "presetColors", required: false }] }], colorChange: [{ type: i0.Output, args: ["colorChange"] }] } });
|
|
1266
1123
|
|
|
1267
1124
|
class NgxInputColor {
|
|
1268
1125
|
el;
|
|
@@ -1270,18 +1127,22 @@ class NgxInputColor {
|
|
|
1270
1127
|
viewContainerRef;
|
|
1271
1128
|
overlayService;
|
|
1272
1129
|
setInputBackgroundColor = true;
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
}
|
|
1130
|
+
configs = inject(NGX_INPUT_COLOR_CONFIG);
|
|
1131
|
+
/** Minifi UI */
|
|
1132
|
+
simpleMode = input(this.configs.simpleMode ?? false, /* @ts-ignore */
|
|
1133
|
+
...(ngDevMode ? [{ debugName: "simpleMode" }] : /* istanbul ignore next */ []));
|
|
1134
|
+
outputType = input(this.configs.outputType ?? 'HEX', /* @ts-ignore */
|
|
1135
|
+
...(ngDevMode ? [{ debugName: "outputType" }] : /* istanbul ignore next */ []));
|
|
1136
|
+
defaultInspector = model(this.configs.defaultInspector ?? ColorInspector.Picker, /* @ts-ignore */
|
|
1137
|
+
...(ngDevMode ? [{ debugName: "defaultInspector" }] : /* istanbul ignore next */ []));
|
|
1138
|
+
useAlphaChannel = input(this.configs.useAlphaChannel ?? true, /* @ts-ignore */
|
|
1139
|
+
...(ngDevMode ? [{ debugName: "useAlphaChannel" }] : /* istanbul ignore next */ []));
|
|
1140
|
+
showPresets = input(this.configs.showPresets ?? true, /* @ts-ignore */
|
|
1141
|
+
...(ngDevMode ? [{ debugName: "showPresets" }] : /* istanbul ignore next */ []));
|
|
1142
|
+
presetColors = input(this.configs.presetColors ?? [], /* @ts-ignore */
|
|
1143
|
+
...(ngDevMode ? [{ debugName: "presetColors" }] : /* istanbul ignore next */ []));
|
|
1144
|
+
/** Emitted when the color value changes */
|
|
1145
|
+
colorChange = output();
|
|
1285
1146
|
/**
|
|
1286
1147
|
* Input target.
|
|
1287
1148
|
*
|
|
@@ -1345,6 +1206,13 @@ class NgxInputColor {
|
|
|
1345
1206
|
this.renderer = renderer;
|
|
1346
1207
|
this.viewContainerRef = viewContainerRef;
|
|
1347
1208
|
this.overlayService = overlayService;
|
|
1209
|
+
effect(() => {
|
|
1210
|
+
const useAlphaChannel = this.useAlphaChannel() == true;
|
|
1211
|
+
if (!this.useAlphaChannel && this.color) {
|
|
1212
|
+
this.color.removeAlphaChannel();
|
|
1213
|
+
void this.color.getOutputResult(this.outputType()).then((value) => this.emitChange(value));
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1348
1216
|
}
|
|
1349
1217
|
ngAfterViewInit() {
|
|
1350
1218
|
/**
|
|
@@ -1373,7 +1241,7 @@ class NgxInputColor {
|
|
|
1373
1241
|
}
|
|
1374
1242
|
event.preventDefault();
|
|
1375
1243
|
event.stopPropagation();
|
|
1376
|
-
this.
|
|
1244
|
+
this.toggle();
|
|
1377
1245
|
}
|
|
1378
1246
|
/**
|
|
1379
1247
|
* Called by Angular Forms.
|
|
@@ -1500,7 +1368,7 @@ class NgxInputColor {
|
|
|
1500
1368
|
this.notifyValidatorChange();
|
|
1501
1369
|
}
|
|
1502
1370
|
}
|
|
1503
|
-
|
|
1371
|
+
toggle() {
|
|
1504
1372
|
if (this.disabled) {
|
|
1505
1373
|
return;
|
|
1506
1374
|
}
|
|
@@ -1515,15 +1383,17 @@ class NgxInputColor {
|
|
|
1515
1383
|
alignment: 'start',
|
|
1516
1384
|
placement: 'auto',
|
|
1517
1385
|
configure: (instance, ref) => {
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1386
|
+
ref.componentRef?.setInput('defaultInspector', this.defaultInspector());
|
|
1387
|
+
ref.componentRef?.setInput('defaultInspector', this.defaultInspector());
|
|
1388
|
+
ref.componentRef?.setInput('simpleMode', this.simpleMode());
|
|
1389
|
+
ref.componentRef?.setInput('outputType', this.outputType());
|
|
1390
|
+
ref.componentRef?.setInput('setUseAlphaChannel', this.useAlphaChannel());
|
|
1391
|
+
ref.componentRef?.setInput('showPresets', this.showPresets());
|
|
1392
|
+
ref.componentRef?.setInput('presetColors', this.presetColors());
|
|
1523
1393
|
if (this.color?.isValid) {
|
|
1524
1394
|
instance.writeValue(this.color);
|
|
1525
1395
|
}
|
|
1526
|
-
instance.
|
|
1396
|
+
instance.colorChange.subscribe((value) => {
|
|
1527
1397
|
this.color = new NgxColor(value);
|
|
1528
1398
|
void this.emitChange(value);
|
|
1529
1399
|
});
|
|
@@ -1625,7 +1495,7 @@ class NgxInputColor {
|
|
|
1625
1495
|
return value instanceof HTMLInputElement;
|
|
1626
1496
|
}
|
|
1627
1497
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxInputColor, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i1$2.OverlayService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1628
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1498
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.4", type: NgxInputColor, isStandalone: true, selector: "[ngxInputColor]", inputs: { setInputBackgroundColor: { classPropertyName: "setInputBackgroundColor", publicName: "setInputBackgroundColor", isSignal: false, isRequired: false, transformFunction: null }, simpleMode: { classPropertyName: "simpleMode", publicName: "simpleMode", isSignal: true, isRequired: false, transformFunction: null }, outputType: { classPropertyName: "outputType", publicName: "outputType", isSignal: true, isRequired: false, transformFunction: null }, defaultInspector: { classPropertyName: "defaultInspector", publicName: "defaultInspector", isSignal: true, isRequired: false, transformFunction: null }, useAlphaChannel: { classPropertyName: "useAlphaChannel", publicName: "useAlphaChannel", isSignal: true, isRequired: false, transformFunction: null }, showPresets: { classPropertyName: "showPresets", publicName: "showPresets", isSignal: true, isRequired: false, transformFunction: null }, presetColors: { classPropertyName: "presetColors", publicName: "presetColors", isSignal: true, isRequired: false, transformFunction: null }, ngxInputColor: { classPropertyName: "ngxInputColor", publicName: "ngxInputColor", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { defaultInspector: "defaultInspectorChange", colorChange: "colorChange", change: "change" }, host: { listeners: { "click": "onHostClick($event)" } }, providers: [
|
|
1629
1499
|
{
|
|
1630
1500
|
provide: NG_VALUE_ACCESSOR,
|
|
1631
1501
|
useExisting: forwardRef(() => NgxInputColor),
|
|
@@ -1636,12 +1506,13 @@ class NgxInputColor {
|
|
|
1636
1506
|
useExisting: forwardRef(() => NgxInputColor),
|
|
1637
1507
|
multi: true,
|
|
1638
1508
|
},
|
|
1639
|
-
], ngImport: i0 });
|
|
1509
|
+
], exportAs: ["ngxInputColor"], ngImport: i0 });
|
|
1640
1510
|
}
|
|
1641
1511
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NgxInputColor, decorators: [{
|
|
1642
1512
|
type: Directive,
|
|
1643
1513
|
args: [{
|
|
1644
1514
|
selector: '[ngxInputColor]',
|
|
1515
|
+
exportAs: 'ngxInputColor',
|
|
1645
1516
|
providers: [
|
|
1646
1517
|
{
|
|
1647
1518
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -1657,18 +1528,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
1657
1528
|
}]
|
|
1658
1529
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i1$2.OverlayService }], propDecorators: { setInputBackgroundColor: [{
|
|
1659
1530
|
type: Input
|
|
1660
|
-
}], defaultInspector: [{
|
|
1661
|
-
type: Input
|
|
1662
|
-
}], simpleMode: [{
|
|
1663
|
-
type: Input
|
|
1664
|
-
}], outputType: [{
|
|
1665
|
-
type: Input
|
|
1666
|
-
}], theme: [{
|
|
1667
|
-
type: Input
|
|
1668
|
-
}], setUseAlphaChannel: [{
|
|
1669
|
-
type: Input,
|
|
1670
|
-
args: ['useAlphaChannel']
|
|
1671
|
-
}], ngxInputColor: [{
|
|
1531
|
+
}], simpleMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "simpleMode", required: false }] }], outputType: [{ type: i0.Input, args: [{ isSignal: true, alias: "outputType", required: false }] }], defaultInspector: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultInspector", required: false }] }, { type: i0.Output, args: ["defaultInspectorChange"] }], useAlphaChannel: [{ type: i0.Input, args: [{ isSignal: true, alias: "useAlphaChannel", required: false }] }], showPresets: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPresets", required: false }] }], presetColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "presetColors", required: false }] }], colorChange: [{ type: i0.Output, args: ["colorChange"] }], ngxInputColor: [{
|
|
1672
1532
|
type: Input,
|
|
1673
1533
|
args: ['ngxInputColor']
|
|
1674
1534
|
}], change: [{
|