@joster-dev/chaos-control 0.1.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/README.md +86 -0
- package/esm2022/joster-dev-chaos-control.mjs +5 -0
- package/esm2022/lib/chaos-control.module.mjs +67 -0
- package/esm2022/lib/chaos-control.service.mjs +14 -0
- package/esm2022/lib/components/choice/choice.component.mjs +52 -0
- package/esm2022/lib/components/color/color.component.mjs +77 -0
- package/esm2022/lib/components/file/file.component.mjs +131 -0
- package/esm2022/lib/components/index.mjs +8 -0
- package/esm2022/lib/components/number/number.component.mjs +134 -0
- package/esm2022/lib/components/readonly/readonly.component.mjs +14 -0
- package/esm2022/lib/components/select/select.component.mjs +69 -0
- package/esm2022/lib/components/text/text.component.mjs +162 -0
- package/esm2022/lib/directives/border-radius.directive.mjs +41 -0
- package/esm2022/lib/directives/control.directive.mjs +46 -0
- package/esm2022/lib/directives/index.mjs +4 -0
- package/esm2022/lib/directives/item.directive.mjs +115 -0
- package/esm2022/lib/models/index.mjs +7 -0
- package/esm2022/lib/models/is-item.function.mjs +8 -0
- package/esm2022/lib/models/is-items.function.mjs +5 -0
- package/esm2022/lib/models/is-number.function.mjs +5 -0
- package/esm2022/lib/models/is-primitive.function.mjs +7 -0
- package/esm2022/lib/models/item.interface.mjs +2 -0
- package/esm2022/lib/models/primitive.type.mjs +2 -0
- package/esm2022/public-api.mjs +6 -0
- package/fesm2022/joster-dev-chaos-control.mjs +894 -0
- package/fesm2022/joster-dev-chaos-control.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/LICENSE +9 -0
- package/lib/chaos-control.module.d.ts +20 -0
- package/lib/chaos-control.service.d.ts +6 -0
- package/lib/components/choice/choice.component.d.ts +15 -0
- package/lib/components/color/color.component.d.ts +22 -0
- package/lib/components/file/file.component.d.ts +31 -0
- package/lib/components/index.d.ts +7 -0
- package/lib/components/number/number.component.d.ts +33 -0
- package/lib/components/readonly/readonly.component.d.ts +8 -0
- package/lib/components/select/select.component.d.ts +23 -0
- package/lib/components/text/text.component.d.ts +41 -0
- package/lib/directives/border-radius.directive.d.ts +12 -0
- package/lib/directives/control.directive.d.ts +18 -0
- package/lib/directives/index.d.ts +3 -0
- package/lib/directives/item.directive.d.ts +35 -0
- package/lib/models/index.d.ts +6 -0
- package/lib/models/is-item.function.d.ts +2 -0
- package/lib/models/is-items.function.d.ts +2 -0
- package/lib/models/is-number.function.d.ts +1 -0
- package/lib/models/is-primitive.function.d.ts +2 -0
- package/lib/models/item.interface.d.ts +6 -0
- package/lib/models/primitive.type.d.ts +1 -0
- package/package.json +57 -0
- package/public-api.d.ts +4 -0
- package/src/lib/atomic.scss +87 -0
- package/src/lib/styles.scss +83 -0
- package/src/lib/variables.scss +3 -0
|
@@ -0,0 +1,894 @@
|
|
|
1
|
+
import * as i2 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Directive, Input, Self, Component, EventEmitter, Output, ViewChild, HostListener, NgModule, Injectable } from '@angular/core';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { Validators, FormsModule } from '@angular/forms';
|
|
7
|
+
import { RouterModule } from '@angular/router';
|
|
8
|
+
import * as i3 from '@joster-dev/icon';
|
|
9
|
+
import { IconModule } from '@joster-dev/icon';
|
|
10
|
+
import { Subject } from 'rxjs';
|
|
11
|
+
import { debounceTime } from 'rxjs/operators';
|
|
12
|
+
|
|
13
|
+
class BorderRadiusDirective {
|
|
14
|
+
get borderRadiusRight() {
|
|
15
|
+
return this._borderRadiusRight;
|
|
16
|
+
}
|
|
17
|
+
set borderRadiusRight(value) {
|
|
18
|
+
if (value === '')
|
|
19
|
+
value = true;
|
|
20
|
+
if (value == null)
|
|
21
|
+
value = false;
|
|
22
|
+
this._borderRadiusRight = value;
|
|
23
|
+
}
|
|
24
|
+
get borderRadiusLeft() {
|
|
25
|
+
return this._borderRadiusLeft;
|
|
26
|
+
}
|
|
27
|
+
set borderRadiusLeft(value) {
|
|
28
|
+
if (value === '')
|
|
29
|
+
value = true;
|
|
30
|
+
if (value == null)
|
|
31
|
+
value = false;
|
|
32
|
+
this._borderRadiusLeft = value;
|
|
33
|
+
}
|
|
34
|
+
constructor() {
|
|
35
|
+
this._borderRadiusRight = true;
|
|
36
|
+
this._borderRadiusLeft = true;
|
|
37
|
+
}
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BorderRadiusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
39
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: BorderRadiusDirective, selector: "[joBorderRadius]", inputs: { borderRadiusRight: "borderRadiusRight", borderRadiusLeft: "borderRadiusLeft" }, ngImport: i0 }); }
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: BorderRadiusDirective, decorators: [{
|
|
42
|
+
type: Directive,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: '[joBorderRadius]'
|
|
45
|
+
}]
|
|
46
|
+
}], ctorParameters: () => [], propDecorators: { borderRadiusRight: [{
|
|
47
|
+
type: Input
|
|
48
|
+
}], borderRadiusLeft: [{
|
|
49
|
+
type: Input
|
|
50
|
+
}] } });
|
|
51
|
+
|
|
52
|
+
class ControlDirective extends BorderRadiusDirective {
|
|
53
|
+
get required() {
|
|
54
|
+
return this._required;
|
|
55
|
+
}
|
|
56
|
+
set required(value) {
|
|
57
|
+
if (value === '')
|
|
58
|
+
value = true;
|
|
59
|
+
if (value == null)
|
|
60
|
+
value = false;
|
|
61
|
+
if (typeof value !== 'boolean')
|
|
62
|
+
throw new Error('required input must be: boolean');
|
|
63
|
+
this._required = value;
|
|
64
|
+
this.validation.next();
|
|
65
|
+
}
|
|
66
|
+
constructor() {
|
|
67
|
+
super();
|
|
68
|
+
this._required = false;
|
|
69
|
+
this.isDisabled = false;
|
|
70
|
+
this.validation = new Subject();
|
|
71
|
+
}
|
|
72
|
+
ngOnDestroy() {
|
|
73
|
+
this.validation.complete();
|
|
74
|
+
}
|
|
75
|
+
onTouched() { }
|
|
76
|
+
registerOnTouched(fn) {
|
|
77
|
+
this.onTouched = fn;
|
|
78
|
+
}
|
|
79
|
+
setDisabledState(isDisabled) {
|
|
80
|
+
this.isDisabled = isDisabled;
|
|
81
|
+
}
|
|
82
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
83
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: ControlDirective, selector: "[joControl]", inputs: { required: "required" }, usesInheritance: true, ngImport: i0 }); }
|
|
84
|
+
}
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ControlDirective, decorators: [{
|
|
86
|
+
type: Directive,
|
|
87
|
+
args: [{
|
|
88
|
+
selector: '[joControl]'
|
|
89
|
+
}]
|
|
90
|
+
}], ctorParameters: () => [], propDecorators: { required: [{
|
|
91
|
+
type: Input
|
|
92
|
+
}] } });
|
|
93
|
+
|
|
94
|
+
function isNumber(value) {
|
|
95
|
+
return typeof value === 'number'
|
|
96
|
+
&& !isNaN(value);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function isPrimitive(value) {
|
|
100
|
+
return typeof value === 'boolean'
|
|
101
|
+
|| isNumber(value)
|
|
102
|
+
|| typeof value === 'string';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function isItem(item) {
|
|
106
|
+
return typeof (item) === 'object'
|
|
107
|
+
&& item !== null
|
|
108
|
+
&& isPrimitive(item.key)
|
|
109
|
+
&& typeof item.value === 'string';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isItems(value) {
|
|
113
|
+
return Array.isArray(value) && value.every(item => isItem(item));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
class ItemDirective extends ControlDirective {
|
|
117
|
+
get items() {
|
|
118
|
+
return this._items;
|
|
119
|
+
}
|
|
120
|
+
set items(value) {
|
|
121
|
+
if (!isItems(value))
|
|
122
|
+
throw new Error('[items] expects: { key: boolean | number | string, value: string }[]');
|
|
123
|
+
this._items = value;
|
|
124
|
+
this.validation.next();
|
|
125
|
+
}
|
|
126
|
+
get limit() {
|
|
127
|
+
return this._limit;
|
|
128
|
+
}
|
|
129
|
+
set limit(value) {
|
|
130
|
+
if (value == null)
|
|
131
|
+
value = 0;
|
|
132
|
+
if (!isNumber(value) || value < 0 || !Number.isInteger(value))
|
|
133
|
+
throw new Error('limit expects: positive integer');
|
|
134
|
+
this._limit = value;
|
|
135
|
+
this.validation.next();
|
|
136
|
+
}
|
|
137
|
+
get isMultiple() {
|
|
138
|
+
return this._isMultiple;
|
|
139
|
+
}
|
|
140
|
+
set isMultiple(value) {
|
|
141
|
+
if (value === '')
|
|
142
|
+
value = true;
|
|
143
|
+
if (value == null)
|
|
144
|
+
value = false;
|
|
145
|
+
if (typeof value !== 'boolean')
|
|
146
|
+
throw new Error('multiple expects: boolean');
|
|
147
|
+
this._isMultiple = value;
|
|
148
|
+
}
|
|
149
|
+
set model(value) {
|
|
150
|
+
this._model = value;
|
|
151
|
+
this.onChange(value.length === 0
|
|
152
|
+
? null
|
|
153
|
+
: this.isMultiple
|
|
154
|
+
? this._model
|
|
155
|
+
: this._model[0]);
|
|
156
|
+
}
|
|
157
|
+
constructor(ngControl) {
|
|
158
|
+
super();
|
|
159
|
+
this.ngControl = ngControl;
|
|
160
|
+
this._items = [];
|
|
161
|
+
this._limit = 0;
|
|
162
|
+
this._isMultiple = false;
|
|
163
|
+
this._model = [];
|
|
164
|
+
this.validation
|
|
165
|
+
.pipe(debounceTime(100))
|
|
166
|
+
.subscribe(() => this.validate());
|
|
167
|
+
ngControl.valueAccessor = this;
|
|
168
|
+
}
|
|
169
|
+
onChange(_value) { }
|
|
170
|
+
registerOnChange(fn) {
|
|
171
|
+
this.onChange = fn;
|
|
172
|
+
}
|
|
173
|
+
writeValue(value) {
|
|
174
|
+
if (value == null)
|
|
175
|
+
value = [];
|
|
176
|
+
if (!Array.isArray(value))
|
|
177
|
+
value = [value];
|
|
178
|
+
if (value.every(item => isPrimitive(item)))
|
|
179
|
+
this._model = value;
|
|
180
|
+
}
|
|
181
|
+
invalidValidator(items, isMultiple) {
|
|
182
|
+
return (control) => (isMultiple
|
|
183
|
+
? Array.isArray(control.value) && control.value.every((key) => !items.map(item => item.key).includes(key))
|
|
184
|
+
: ![undefined, null].includes(control.value) && !items.map(item => item.key).includes(control.value))
|
|
185
|
+
? { invalid: control.value }
|
|
186
|
+
: null;
|
|
187
|
+
}
|
|
188
|
+
limitValidator(limit) {
|
|
189
|
+
return (control) => control.value !== null && limit !== 0 && control.value.length > limit
|
|
190
|
+
? { limit: { value: control.value } }
|
|
191
|
+
: null;
|
|
192
|
+
}
|
|
193
|
+
validate() {
|
|
194
|
+
const validators = [
|
|
195
|
+
this.invalidValidator(this._items, this._isMultiple),
|
|
196
|
+
];
|
|
197
|
+
if (this._isMultiple)
|
|
198
|
+
validators.push(this.limitValidator(this._limit));
|
|
199
|
+
if (this.required === true)
|
|
200
|
+
validators.push(Validators.required);
|
|
201
|
+
if (this.ngControl.control === null)
|
|
202
|
+
throw new Error('expected control to be defined');
|
|
203
|
+
this.ngControl.control.setValidators(validators);
|
|
204
|
+
this.ngControl.control.updateValueAndValidity();
|
|
205
|
+
}
|
|
206
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ItemDirective, deps: [{ token: i1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
207
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.5", type: ItemDirective, selector: "[joItem]", inputs: { items: "items", limit: "limit", isMultiple: "isMultiple" }, usesInheritance: true, ngImport: i0 }); }
|
|
208
|
+
}
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ItemDirective, decorators: [{
|
|
210
|
+
type: Directive,
|
|
211
|
+
args: [{
|
|
212
|
+
selector: '[joItem]'
|
|
213
|
+
}]
|
|
214
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
215
|
+
type: Self
|
|
216
|
+
}] }], propDecorators: { items: [{
|
|
217
|
+
type: Input
|
|
218
|
+
}], limit: [{
|
|
219
|
+
type: Input
|
|
220
|
+
}], isMultiple: [{
|
|
221
|
+
type: Input
|
|
222
|
+
}] } });
|
|
223
|
+
|
|
224
|
+
class ChoiceComponent extends ItemDirective {
|
|
225
|
+
constructor(ngControl) {
|
|
226
|
+
super(ngControl);
|
|
227
|
+
this.ngControl = ngControl;
|
|
228
|
+
this._isColumn = false;
|
|
229
|
+
this.id = `${Math.random().toString(36).substr(2, 9)}`;
|
|
230
|
+
}
|
|
231
|
+
get isColumn() {
|
|
232
|
+
return this._isColumn;
|
|
233
|
+
}
|
|
234
|
+
set isColumn(value) {
|
|
235
|
+
if (value === '')
|
|
236
|
+
value = true;
|
|
237
|
+
if (value == null)
|
|
238
|
+
value = false;
|
|
239
|
+
if (typeof value !== 'boolean')
|
|
240
|
+
throw new Error('isColumn expects: boolean');
|
|
241
|
+
this._isColumn = value;
|
|
242
|
+
}
|
|
243
|
+
onClick(item) {
|
|
244
|
+
this._model = this._model
|
|
245
|
+
.filter(key => this._items.map(item => item.key).includes(key));
|
|
246
|
+
if (this._model.includes(item.key)) {
|
|
247
|
+
if (this.required === true && this._model.length === 1)
|
|
248
|
+
return;
|
|
249
|
+
this.model = this._model.filter(key => key !== item.key);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (!this.isMultiple && this._model.length === 1) {
|
|
253
|
+
this.model = [item.key];
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this.model = [...this._model, item.key];
|
|
257
|
+
}
|
|
258
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChoiceComponent, deps: [{ token: i1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
259
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: ChoiceComponent, selector: "jo-choice", inputs: { isColumn: "isColumn" }, usesInheritance: true, ngImport: i0, template: "<div class=\"d-flex justify-content-between\">\r\n <label\r\n id=\"choice_{{id}}\"\r\n [class.required]=\"required\"\r\n >\r\n <ng-content></ng-content>\r\n </label>\r\n <div>\r\n <ng-content select=\"[rightAligned]\"></ng-content>\r\n </div>\r\n</div>\r\n\r\n<div\r\n class=\"d-flex flex-wrap align-items-start\"\r\n role=\"group\"\r\n attr.aria-labelledby=\"choice_{{id}}\"\r\n [class.flex-column]=\"isColumn\"\r\n>\r\n <button\r\n *ngFor=\"let item of items; let idx = index\"\r\n type=\"button\"\r\n class=\"d-flex align-items-center text-left\"\r\n role=\"menuitemcheckbox\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n (click)=\"onClick(item)\"\r\n (blur)=\"onTouched()\"\r\n >\r\n <div\r\n class=\"button margin-right-1 {{isMultiple ? 'br-20' : 'br-50'}}\"\r\n [class.active]=\"_model.includes(item.key)\"\r\n [class.disabled]=\"isDisabled\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n >\r\n <icon\r\n *ngIf=\"_model.includes(item.key)\"\r\n size=\"1em\"\r\n [type]=\"isMultiple ? 'check' : 'dot'\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </div>\r\n {{item.value}}\r\n </button>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['invalid']\">\r\n invalid model\r\n </li>\r\n</ul> -->", styles: [":host{display:block}:host>.d-flex>button{border-color:transparent;border-width:.075em}:host>.d-flex>button>.button{position:relative;text-align:left}:host>.d-flex>button>.button>icon{position:absolute;top:0;left:0}.br-20{border-radius:20%}.br-50{border-radius:50%}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.IconComponent, selector: "icon[type]", inputs: ["type", "fill", "fillRotate", "fillOpacity", "stroke", "strokeRotate", "spin"] }] }); }
|
|
260
|
+
}
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChoiceComponent, decorators: [{
|
|
262
|
+
type: Component,
|
|
263
|
+
args: [{ selector: 'jo-choice', template: "<div class=\"d-flex justify-content-between\">\r\n <label\r\n id=\"choice_{{id}}\"\r\n [class.required]=\"required\"\r\n >\r\n <ng-content></ng-content>\r\n </label>\r\n <div>\r\n <ng-content select=\"[rightAligned]\"></ng-content>\r\n </div>\r\n</div>\r\n\r\n<div\r\n class=\"d-flex flex-wrap align-items-start\"\r\n role=\"group\"\r\n attr.aria-labelledby=\"choice_{{id}}\"\r\n [class.flex-column]=\"isColumn\"\r\n>\r\n <button\r\n *ngFor=\"let item of items; let idx = index\"\r\n type=\"button\"\r\n class=\"d-flex align-items-center text-left\"\r\n role=\"menuitemcheckbox\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n (click)=\"onClick(item)\"\r\n (blur)=\"onTouched()\"\r\n >\r\n <div\r\n class=\"button margin-right-1 {{isMultiple ? 'br-20' : 'br-50'}}\"\r\n [class.active]=\"_model.includes(item.key)\"\r\n [class.disabled]=\"isDisabled\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n >\r\n <icon\r\n *ngIf=\"_model.includes(item.key)\"\r\n size=\"1em\"\r\n [type]=\"isMultiple ? 'check' : 'dot'\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </div>\r\n {{item.value}}\r\n </button>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['invalid']\">\r\n invalid model\r\n </li>\r\n</ul> -->", styles: [":host{display:block}:host>.d-flex>button{border-color:transparent;border-width:.075em}:host>.d-flex>button>.button{position:relative;text-align:left}:host>.d-flex>button>.button>icon{position:absolute;top:0;left:0}.br-20{border-radius:20%}.br-50{border-radius:50%}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n"] }]
|
|
264
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
265
|
+
type: Self
|
|
266
|
+
}] }], propDecorators: { isColumn: [{
|
|
267
|
+
type: Input
|
|
268
|
+
}] } });
|
|
269
|
+
|
|
270
|
+
class ColorComponent extends ControlDirective {
|
|
271
|
+
get model() {
|
|
272
|
+
return this._model;
|
|
273
|
+
}
|
|
274
|
+
set model(value) {
|
|
275
|
+
this._model = value;
|
|
276
|
+
this.onChange(this._model !== null && this.fullHex.test(this._model)
|
|
277
|
+
? this._model
|
|
278
|
+
: null);
|
|
279
|
+
}
|
|
280
|
+
constructor(ngControl) {
|
|
281
|
+
super();
|
|
282
|
+
this.ngControl = ngControl;
|
|
283
|
+
this.partialHex = /^[0-9A-Fa-f]{1,6}$/;
|
|
284
|
+
this.fullHex = /^[0-9A-Fa-f]{6}$/;
|
|
285
|
+
this._model = null;
|
|
286
|
+
this.id = `_${Math.random().toString(36).substring(2, 11)}`;
|
|
287
|
+
this.validation
|
|
288
|
+
.pipe(debounceTime(100))
|
|
289
|
+
.subscribe(() => this.validate());
|
|
290
|
+
ngControl.valueAccessor = this;
|
|
291
|
+
}
|
|
292
|
+
onChangeColor(event) {
|
|
293
|
+
const ele = event.target;
|
|
294
|
+
this.model = ele.value.substring(1).toUpperCase();
|
|
295
|
+
}
|
|
296
|
+
onChange(_model) { }
|
|
297
|
+
registerOnChange(fn) {
|
|
298
|
+
this.onChange = fn;
|
|
299
|
+
}
|
|
300
|
+
onBeforeinput(e) {
|
|
301
|
+
const event = e;
|
|
302
|
+
if (event.data === null)
|
|
303
|
+
return;
|
|
304
|
+
const ele = event.target;
|
|
305
|
+
const tooLong = event.data.length + (ele.selectionStart || 0) > 6;
|
|
306
|
+
const valid = this.partialHex.test(event.data);
|
|
307
|
+
if (tooLong || !valid)
|
|
308
|
+
event.preventDefault();
|
|
309
|
+
}
|
|
310
|
+
writeValue(value) {
|
|
311
|
+
if (value === undefined || typeof value !== 'string' || !this.partialHex.test(value))
|
|
312
|
+
value = null;
|
|
313
|
+
if (value === null || this.partialHex.test(value))
|
|
314
|
+
this._model = value;
|
|
315
|
+
}
|
|
316
|
+
invalidValidator() {
|
|
317
|
+
return (control) => control.value !== null && (typeof control.value !== 'string' || !this.fullHex.test(control.value))
|
|
318
|
+
? { invalid: control.value }
|
|
319
|
+
: null;
|
|
320
|
+
}
|
|
321
|
+
validate() {
|
|
322
|
+
const validators = [
|
|
323
|
+
this.invalidValidator()
|
|
324
|
+
];
|
|
325
|
+
if (this.required === true)
|
|
326
|
+
validators.push(Validators.required);
|
|
327
|
+
this.ngControl.control?.setValidators(validators);
|
|
328
|
+
this.ngControl.control?.updateValueAndValidity();
|
|
329
|
+
}
|
|
330
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ColorComponent, deps: [{ token: i1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
331
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: ColorComponent, selector: "jo-color", usesInheritance: true, ngImport: i0, template: "<label\r\n [for]=\"id\"\r\n [class.required]=\"required\"\r\n>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-stretch\">\r\n <button\r\n class=\"d-flex align-items-center\"\r\n title=\"Color\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n [disabled]=\"isDisabled\"\r\n (click)=\"colorInput.click()\"\r\n >\r\n <icon\r\n size=\"1em\"\r\n type=\"square\"\r\n [fill]=\"fullHex.test(_model || '') ? _model : [null, 'current']\"\r\n fillRotate=\"90\"\r\n [stroke]=\"fullHex.test(_model || '') ? _model : ['current']\"\r\n ></icon>\r\n </button>\r\n <input\r\n [(ngModel)]=\"model\"\r\n spellcheck=\"false\"\r\n size=\"5\"\r\n type=\"text\"\r\n [class.active]=\"ngControl.control?.value !== null\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [id]=\"id\"\r\n (beforeinput)=\"onBeforeinput($event)\"\r\n (blur)=\"onTouched()\"\r\n />\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['invalid']\">\r\n invalid model\r\n </li>\r\n</ul> -->\r\n\r\n<input\r\n #colorInput\r\n type=\"color\"\r\n (change)=\"onChangeColor($event)\"\r\n/>", styles: [":host{display:block}input[type=color]{margin-top:-2em;padding:0;position:absolute;visibility:hidden;transition:none}:host>div>input{border-left:0}:host>div>button{border-right:0}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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: i3.IconComponent, selector: "icon[type]", inputs: ["type", "fill", "fillRotate", "fillOpacity", "stroke", "strokeRotate", "spin"] }] }); }
|
|
332
|
+
}
|
|
333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ColorComponent, decorators: [{
|
|
334
|
+
type: Component,
|
|
335
|
+
args: [{ selector: 'jo-color', template: "<label\r\n [for]=\"id\"\r\n [class.required]=\"required\"\r\n>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-stretch\">\r\n <button\r\n class=\"d-flex align-items-center\"\r\n title=\"Color\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n [disabled]=\"isDisabled\"\r\n (click)=\"colorInput.click()\"\r\n >\r\n <icon\r\n size=\"1em\"\r\n type=\"square\"\r\n [fill]=\"fullHex.test(_model || '') ? _model : [null, 'current']\"\r\n fillRotate=\"90\"\r\n [stroke]=\"fullHex.test(_model || '') ? _model : ['current']\"\r\n ></icon>\r\n </button>\r\n <input\r\n [(ngModel)]=\"model\"\r\n spellcheck=\"false\"\r\n size=\"5\"\r\n type=\"text\"\r\n [class.active]=\"ngControl.control?.value !== null\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [id]=\"id\"\r\n (beforeinput)=\"onBeforeinput($event)\"\r\n (blur)=\"onTouched()\"\r\n />\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['invalid']\">\r\n invalid model\r\n </li>\r\n</ul> -->\r\n\r\n<input\r\n #colorInput\r\n type=\"color\"\r\n (change)=\"onChangeColor($event)\"\r\n/>", styles: [":host{display:block}input[type=color]{margin-top:-2em;padding:0;position:absolute;visibility:hidden;transition:none}:host>div>input{border-left:0}:host>div>button{border-right:0}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }]
|
|
336
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
337
|
+
type: Self
|
|
338
|
+
}] }] });
|
|
339
|
+
|
|
340
|
+
class FileComponent extends ControlDirective {
|
|
341
|
+
get acceptedTypes() {
|
|
342
|
+
return this._acceptedTypes;
|
|
343
|
+
}
|
|
344
|
+
set acceptedTypes(value) {
|
|
345
|
+
if (!Array.isArray(value) || !value.every(item => typeof item === 'string'))
|
|
346
|
+
throw new Error(`acceptedTypes expects: string[]`);
|
|
347
|
+
this._acceptedTypes = value;
|
|
348
|
+
this.validation.next();
|
|
349
|
+
}
|
|
350
|
+
get sizeLimitMb() {
|
|
351
|
+
return this._sizeLimitMb;
|
|
352
|
+
}
|
|
353
|
+
set sizeLimitMb(value) {
|
|
354
|
+
if (!isNumber(value) || value < 0)
|
|
355
|
+
throw new Error('sizeLimitMb expects: positive number');
|
|
356
|
+
this._sizeLimitMb = value;
|
|
357
|
+
this.validation.next();
|
|
358
|
+
}
|
|
359
|
+
get multiple() {
|
|
360
|
+
return this._multiple;
|
|
361
|
+
}
|
|
362
|
+
set multiple(value) {
|
|
363
|
+
this._multiple = value === true;
|
|
364
|
+
this.validation.next();
|
|
365
|
+
}
|
|
366
|
+
constructor(ngControl) {
|
|
367
|
+
super();
|
|
368
|
+
this.ngControl = ngControl;
|
|
369
|
+
this._acceptedTypes = [];
|
|
370
|
+
this._sizeLimitMb = 0;
|
|
371
|
+
this._multiple = false;
|
|
372
|
+
this.showSize = false;
|
|
373
|
+
this.model = null;
|
|
374
|
+
this.id = `${Math.random().toString(36).substr(2, 9)}`;
|
|
375
|
+
this.validation
|
|
376
|
+
.pipe(debounceTime(100))
|
|
377
|
+
.subscribe(() => this.validate());
|
|
378
|
+
ngControl.valueAccessor = this;
|
|
379
|
+
}
|
|
380
|
+
get fileNames() {
|
|
381
|
+
if (this.ngControl.value instanceof FileList)
|
|
382
|
+
return Object.values(this.ngControl.value).map(file => file.name).join(', ');
|
|
383
|
+
if (this.ngControl.value instanceof File)
|
|
384
|
+
return this.ngControl.value.name;
|
|
385
|
+
return '';
|
|
386
|
+
}
|
|
387
|
+
get sizeLimit() {
|
|
388
|
+
return this.sizeLimitMb < 1
|
|
389
|
+
? `${this.sizeLimitMb * 1000} KB`
|
|
390
|
+
: `${this.sizeLimitMb} MB`;
|
|
391
|
+
}
|
|
392
|
+
onFileChange(event) {
|
|
393
|
+
const target = event.target;
|
|
394
|
+
this.onChange(target.files?.length
|
|
395
|
+
? target.files
|
|
396
|
+
: null);
|
|
397
|
+
}
|
|
398
|
+
onChange(_model) { }
|
|
399
|
+
registerOnChange(fn) {
|
|
400
|
+
this.onChange = fn;
|
|
401
|
+
}
|
|
402
|
+
writeValue(value) {
|
|
403
|
+
if (value === undefined)
|
|
404
|
+
value = null;
|
|
405
|
+
if (value !== null && !(value instanceof FileList))
|
|
406
|
+
throw new Error('control value must be: File or null');
|
|
407
|
+
// todo
|
|
408
|
+
// this.model = value;
|
|
409
|
+
}
|
|
410
|
+
acceptedTypesValidator(acceptedTypes) {
|
|
411
|
+
return (control) => control.value !== null
|
|
412
|
+
&& control.value instanceof FileList
|
|
413
|
+
&& !Object.values(control.value).map(item => item.type.toLowerCase())
|
|
414
|
+
.every(type => acceptedTypes.includes(type.toLowerCase()))
|
|
415
|
+
? { acceptedTypes: { value: control.value } }
|
|
416
|
+
: null;
|
|
417
|
+
}
|
|
418
|
+
invalidValidator(multiple) {
|
|
419
|
+
return (control) => control.value !== null
|
|
420
|
+
&& (!(control.value instanceof FileList) || (control.value.length > 1 && !multiple))
|
|
421
|
+
? { invalid: { value: control.value } }
|
|
422
|
+
: null;
|
|
423
|
+
}
|
|
424
|
+
sizeLimitMbValidator(sizeLimitMb) {
|
|
425
|
+
return (control) => control.value instanceof FileList
|
|
426
|
+
&& Object.values(control.value).map(item => item.size / 1024 / 1024)
|
|
427
|
+
.reduce((acc, cur) => acc + cur, 0) > sizeLimitMb
|
|
428
|
+
? { sizeLimitMb: { value: control.value } }
|
|
429
|
+
: null;
|
|
430
|
+
}
|
|
431
|
+
validate() {
|
|
432
|
+
const validators = [
|
|
433
|
+
this.invalidValidator(this.multiple)
|
|
434
|
+
];
|
|
435
|
+
if (this.acceptedTypes.length > 0)
|
|
436
|
+
validators.push(this.acceptedTypesValidator(this.acceptedTypes));
|
|
437
|
+
if (this.sizeLimitMb > 0)
|
|
438
|
+
validators.push(this.sizeLimitMbValidator(this.sizeLimitMb));
|
|
439
|
+
if (this.required === true)
|
|
440
|
+
validators.push(Validators.required);
|
|
441
|
+
this.ngControl.control?.setValidators(validators);
|
|
442
|
+
this.ngControl.control?.updateValueAndValidity();
|
|
443
|
+
}
|
|
444
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FileComponent, deps: [{ token: i1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
445
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: FileComponent, selector: "jo-file", inputs: { acceptedTypes: "acceptedTypes", sizeLimitMb: "sizeLimitMb", multiple: "multiple", showSize: "showSize" }, usesInheritance: true, ngImport: i0, template: "<label [class.required]=\"required\">\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-center\">\r\n <div>\r\n <button\r\n class=\"white-space-nowrap\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n [class.active]=\"ngControl.value !== null\"\r\n [disabled]=\"isDisabled\"\r\n (click)=\"fileInput.click()\"\r\n >\r\n <icon\r\n type=\"folder\"\r\n size=\"1em\"\r\n class=\"margin-right-1\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n Choose {{multiple ? 'Files' : 'File'}}\r\n </button>\r\n </div>\r\n <div\r\n *ngIf=\"ngControl.value\"\r\n id=\"filename\"\r\n >\r\n {{fileNames}}\r\n </div>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['acceptedTypes']\">\r\n valid types are {{acceptedTypes.join(', ')}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['sizeLimitMb']\">\r\n max file size is {{sizeLimit}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['invalid']\">\r\n invalid model\r\n </li>\r\n</ul> -->\r\n\r\n<input\r\n [(ngModel)]=\"model\"\r\n #fileInput\r\n type=\"file\"\r\n [accept]=\"acceptedTypes.join()\"\r\n [multiple]=\"multiple\"\r\n [id]=\"id\"\r\n (change)=\"onFileChange($event)\"\r\n/>\r\n", styles: ["input[type=file]{display:none}#filename{margin-left:.5em}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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: i3.IconComponent, selector: "icon[type]", inputs: ["type", "fill", "fillRotate", "fillOpacity", "stroke", "strokeRotate", "spin"] }] }); }
|
|
446
|
+
}
|
|
447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: FileComponent, decorators: [{
|
|
448
|
+
type: Component,
|
|
449
|
+
args: [{ selector: 'jo-file', template: "<label [class.required]=\"required\">\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-center\">\r\n <div>\r\n <button\r\n class=\"white-space-nowrap\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n [class.active]=\"ngControl.value !== null\"\r\n [disabled]=\"isDisabled\"\r\n (click)=\"fileInput.click()\"\r\n >\r\n <icon\r\n type=\"folder\"\r\n size=\"1em\"\r\n class=\"margin-right-1\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n Choose {{multiple ? 'Files' : 'File'}}\r\n </button>\r\n </div>\r\n <div\r\n *ngIf=\"ngControl.value\"\r\n id=\"filename\"\r\n >\r\n {{fileNames}}\r\n </div>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['acceptedTypes']\">\r\n valid types are {{acceptedTypes.join(', ')}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['sizeLimitMb']\">\r\n max file size is {{sizeLimit}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['invalid']\">\r\n invalid model\r\n </li>\r\n</ul> -->\r\n\r\n<input\r\n [(ngModel)]=\"model\"\r\n #fileInput\r\n type=\"file\"\r\n [accept]=\"acceptedTypes.join()\"\r\n [multiple]=\"multiple\"\r\n [id]=\"id\"\r\n (change)=\"onFileChange($event)\"\r\n/>\r\n", styles: ["input[type=file]{display:none}#filename{margin-left:.5em}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }]
|
|
450
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
451
|
+
type: Self
|
|
452
|
+
}] }], propDecorators: { acceptedTypes: [{
|
|
453
|
+
type: Input
|
|
454
|
+
}], sizeLimitMb: [{
|
|
455
|
+
type: Input
|
|
456
|
+
}], multiple: [{
|
|
457
|
+
type: Input
|
|
458
|
+
}], showSize: [{
|
|
459
|
+
type: Input
|
|
460
|
+
}] } });
|
|
461
|
+
|
|
462
|
+
class NumberComponent extends ControlDirective {
|
|
463
|
+
get min() {
|
|
464
|
+
return this._min;
|
|
465
|
+
}
|
|
466
|
+
set min(value) {
|
|
467
|
+
if (!isNumber(value))
|
|
468
|
+
throw new Error('[min] expects: number');
|
|
469
|
+
this._min = value;
|
|
470
|
+
this.validation.next();
|
|
471
|
+
}
|
|
472
|
+
get max() {
|
|
473
|
+
return this._max;
|
|
474
|
+
}
|
|
475
|
+
set max(value) {
|
|
476
|
+
if (!isNumber(value))
|
|
477
|
+
throw new Error('[max] expects: number');
|
|
478
|
+
this._max = value;
|
|
479
|
+
this.validation.next();
|
|
480
|
+
}
|
|
481
|
+
get step() {
|
|
482
|
+
return this._step;
|
|
483
|
+
}
|
|
484
|
+
set step(value) {
|
|
485
|
+
if (!isNumber(value))
|
|
486
|
+
throw new Error('[step] expects: number');
|
|
487
|
+
this._step = value;
|
|
488
|
+
this.mustBeInteger = Number.isInteger(this._step);
|
|
489
|
+
}
|
|
490
|
+
constructor(ngControl) {
|
|
491
|
+
super();
|
|
492
|
+
this.ngControl = ngControl;
|
|
493
|
+
this._min = 0;
|
|
494
|
+
this._max = 9;
|
|
495
|
+
this._step = 1;
|
|
496
|
+
this.mustBeInteger = true;
|
|
497
|
+
this.sizePadding = 5;
|
|
498
|
+
this._model = null;
|
|
499
|
+
this.validation.subscribe(() => this.validate());
|
|
500
|
+
this.validation.next();
|
|
501
|
+
ngControl.valueAccessor = this;
|
|
502
|
+
}
|
|
503
|
+
get model() {
|
|
504
|
+
return this._model;
|
|
505
|
+
}
|
|
506
|
+
set model(value) {
|
|
507
|
+
this._model = value;
|
|
508
|
+
this.onChange(this._model);
|
|
509
|
+
}
|
|
510
|
+
get isDisabledAdd() {
|
|
511
|
+
return this.isDisabled === true
|
|
512
|
+
|| this.model !== null
|
|
513
|
+
&& this.model + this.step > this.max;
|
|
514
|
+
}
|
|
515
|
+
get isDisabledSubtract() {
|
|
516
|
+
return this.isDisabled === true
|
|
517
|
+
|| this._model !== null
|
|
518
|
+
&& this._model - this.step < this.min;
|
|
519
|
+
}
|
|
520
|
+
get maxDigitSize() {
|
|
521
|
+
return Math.max(this._step.toString().length, this._max.toString().length, this._min.toString().length);
|
|
522
|
+
}
|
|
523
|
+
onBeforeinput(e) {
|
|
524
|
+
const event = e;
|
|
525
|
+
if (event.data === null)
|
|
526
|
+
return;
|
|
527
|
+
const isDigit = /\d/.test(event.data);
|
|
528
|
+
const isMinus = event.data === '-';
|
|
529
|
+
const isMinusAllowed = this.min < 0;
|
|
530
|
+
const isBlockedNonDigit = !isDigit && !(isMinus && isMinusAllowed);
|
|
531
|
+
const isPastMax = Number((this._model || '') + event.data) > this.max;
|
|
532
|
+
if (isBlockedNonDigit || isPastMax)
|
|
533
|
+
event.preventDefault();
|
|
534
|
+
}
|
|
535
|
+
add(e) {
|
|
536
|
+
if (this.model === null) {
|
|
537
|
+
this.model = this.max;
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
e.stepUp();
|
|
541
|
+
this.model = e.valueAsNumber;
|
|
542
|
+
}
|
|
543
|
+
subtract(e) {
|
|
544
|
+
if (this.model === null) {
|
|
545
|
+
this.model = this.min;
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
e.stepDown();
|
|
549
|
+
this.model = e.valueAsNumber;
|
|
550
|
+
}
|
|
551
|
+
onChange(_model) { }
|
|
552
|
+
registerOnChange(fn) {
|
|
553
|
+
this.onChange = fn;
|
|
554
|
+
}
|
|
555
|
+
writeValue(value) {
|
|
556
|
+
if (value === undefined)
|
|
557
|
+
value = null;
|
|
558
|
+
if (typeof value === 'string')
|
|
559
|
+
value = parseFloat(value);
|
|
560
|
+
if (value === null || isNumber(value))
|
|
561
|
+
this._model = value;
|
|
562
|
+
}
|
|
563
|
+
validate() {
|
|
564
|
+
const validators = [
|
|
565
|
+
Validators.min(this.min),
|
|
566
|
+
Validators.max(this.max)
|
|
567
|
+
];
|
|
568
|
+
if (this.required === true)
|
|
569
|
+
validators.push(Validators.required);
|
|
570
|
+
this.ngControl.control?.setValidators(validators);
|
|
571
|
+
this.ngControl.control?.updateValueAndValidity();
|
|
572
|
+
}
|
|
573
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: NumberComponent, deps: [{ token: i1.NgControl, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
574
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: NumberComponent, selector: "jo-number", inputs: { min: "min", max: "max", step: "step" }, usesInheritance: true, ngImport: i0, template: "<label [class.required]=\"required\">\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-stretch\">\r\n <input\r\n [(ngModel)]=\"model\"\r\n #numberInput\r\n class=\"d-flex align-items-center\"\r\n type=\"number\"\r\n [size]=\"maxDigitSize + sizePadding\"\r\n [class.active]=\"_model !== null\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n (beforeinput)=\"onBeforeinput($event)\"\r\n />\r\n <button\r\n class=\"d-flex align-items-center\"\r\n title=\"Subtract\"\r\n type=\"button\"\r\n [disabled]=\"isDisabledSubtract\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n (blur)=\"onTouched()\"\r\n (click)=\"subtract(numberInput)\"\r\n >\r\n <icon\r\n type=\"minus\"\r\n size=\"1em\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </button>\r\n <button\r\n class=\"d-flex align-items-center\"\r\n title=\"Add\"\r\n type=\"button\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [disabled]=\"isDisabledAdd\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n (blur)=\"onTouched()\"\r\n (click)=\"add(numberInput)\"\r\n >\r\n <icon\r\n type=\"plus\"\r\n size=\"1em\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </button>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['min']\">\r\n minimum number is {{min}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['max']\">\r\n maximum number is {{max}}\r\n </li>\r\n</ul> -->", styles: ["input[type=number]{-moz-appearance:textfield}input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}:host>div>input{border-right:0}:host>div>button:not(:last-child){border-right:0;border-left:0}:host>div>button:last-child{border-left:0}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"], dependencies: [{ kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.IconComponent, selector: "icon[type]", inputs: ["type", "fill", "fillRotate", "fillOpacity", "stroke", "strokeRotate", "spin"] }] }); }
|
|
575
|
+
}
|
|
576
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: NumberComponent, decorators: [{
|
|
577
|
+
type: Component,
|
|
578
|
+
args: [{ selector: 'jo-number', template: "<label [class.required]=\"required\">\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-stretch\">\r\n <input\r\n [(ngModel)]=\"model\"\r\n #numberInput\r\n class=\"d-flex align-items-center\"\r\n type=\"number\"\r\n [size]=\"maxDigitSize + sizePadding\"\r\n [class.active]=\"_model !== null\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n (beforeinput)=\"onBeforeinput($event)\"\r\n />\r\n <button\r\n class=\"d-flex align-items-center\"\r\n title=\"Subtract\"\r\n type=\"button\"\r\n [disabled]=\"isDisabledSubtract\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n (blur)=\"onTouched()\"\r\n (click)=\"subtract(numberInput)\"\r\n >\r\n <icon\r\n type=\"minus\"\r\n size=\"1em\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </button>\r\n <button\r\n class=\"d-flex align-items-center\"\r\n title=\"Add\"\r\n type=\"button\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [disabled]=\"isDisabledAdd\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n (blur)=\"onTouched()\"\r\n (click)=\"add(numberInput)\"\r\n >\r\n <icon\r\n type=\"plus\"\r\n size=\"1em\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </button>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['min']\">\r\n minimum number is {{min}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['max']\">\r\n maximum number is {{max}}\r\n </li>\r\n</ul> -->", styles: ["input[type=number]{-moz-appearance:textfield}input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}:host>div>input{border-right:0}:host>div>button:not(:last-child){border-right:0;border-left:0}:host>div>button:last-child{border-left:0}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }]
|
|
579
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
580
|
+
type: Self
|
|
581
|
+
}] }], propDecorators: { min: [{
|
|
582
|
+
type: Input
|
|
583
|
+
}], max: [{
|
|
584
|
+
type: Input
|
|
585
|
+
}], step: [{
|
|
586
|
+
type: Input
|
|
587
|
+
}] } });
|
|
588
|
+
|
|
589
|
+
class ReadonlyComponent {
|
|
590
|
+
constructor() { }
|
|
591
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ReadonlyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
592
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: ReadonlyComponent, selector: "jo-readonly", inputs: { model: "model" }, ngImport: i0, template: "<label>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"readonly\">\r\n {{model}}\r\n</div>\r\n", styles: [":host>div{color:inherit;background:transparent;border-width:.15em;border-color:transparent;border-style:solid;padding:.5em}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }); }
|
|
593
|
+
}
|
|
594
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ReadonlyComponent, decorators: [{
|
|
595
|
+
type: Component,
|
|
596
|
+
args: [{ selector: 'jo-readonly', template: "<label>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"readonly\">\r\n {{model}}\r\n</div>\r\n", styles: [":host>div{color:inherit;background:transparent;border-width:.15em;border-color:transparent;border-style:solid;padding:.5em}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }]
|
|
597
|
+
}], ctorParameters: () => [], propDecorators: { model: [{
|
|
598
|
+
type: Input
|
|
599
|
+
}] } });
|
|
600
|
+
|
|
601
|
+
class TextComponent extends ControlDirective {
|
|
602
|
+
get placeholder() {
|
|
603
|
+
return this._placeholder;
|
|
604
|
+
}
|
|
605
|
+
set placeholder(v) {
|
|
606
|
+
const value = v;
|
|
607
|
+
if (typeof value !== 'string')
|
|
608
|
+
throw new Error('[placeholder] expects: string');
|
|
609
|
+
this._placeholder = value;
|
|
610
|
+
}
|
|
611
|
+
get minLength() {
|
|
612
|
+
return this._minLength;
|
|
613
|
+
}
|
|
614
|
+
set minLength(value) {
|
|
615
|
+
if (typeof value === 'string')
|
|
616
|
+
value = parseInt(value, 10);
|
|
617
|
+
if (value === undefined)
|
|
618
|
+
value = null;
|
|
619
|
+
if (!isNumber(value) || value < 0 || !Number.isInteger(value) || value === null)
|
|
620
|
+
throw new Error('[minLength] expects: positive integer');
|
|
621
|
+
this._minLength = value;
|
|
622
|
+
this.validation.next();
|
|
623
|
+
}
|
|
624
|
+
get maxLength() {
|
|
625
|
+
return this._maxLength;
|
|
626
|
+
}
|
|
627
|
+
set maxLength(value) {
|
|
628
|
+
if (typeof value === 'string')
|
|
629
|
+
value = parseInt(value, 10);
|
|
630
|
+
if (value === undefined)
|
|
631
|
+
value = null;
|
|
632
|
+
if (!isNumber(value) || value < 0 || !Number.isInteger(value) || value === null)
|
|
633
|
+
throw new Error('[maxLength] expects: positive integer');
|
|
634
|
+
this._maxLength = value;
|
|
635
|
+
this.validation.next();
|
|
636
|
+
}
|
|
637
|
+
set isGrow(value) {
|
|
638
|
+
if (value === '')
|
|
639
|
+
value = true;
|
|
640
|
+
if (value == null)
|
|
641
|
+
value = false;
|
|
642
|
+
if (typeof value !== 'boolean')
|
|
643
|
+
throw new Error('[isGrow] expects: boolean');
|
|
644
|
+
this._isGrow = value;
|
|
645
|
+
}
|
|
646
|
+
get model() {
|
|
647
|
+
return this._model;
|
|
648
|
+
}
|
|
649
|
+
set model(value) {
|
|
650
|
+
if (value === '')
|
|
651
|
+
value = null;
|
|
652
|
+
this._model = value;
|
|
653
|
+
this.onChange(this._model);
|
|
654
|
+
setTimeout(() => this.setTextareaHeight());
|
|
655
|
+
}
|
|
656
|
+
constructor(ngControl, renderer) {
|
|
657
|
+
super();
|
|
658
|
+
this.ngControl = ngControl;
|
|
659
|
+
this.renderer = renderer;
|
|
660
|
+
this._placeholder = '';
|
|
661
|
+
this._minLength = null;
|
|
662
|
+
this._maxLength = null;
|
|
663
|
+
this.isSpellCheck = false;
|
|
664
|
+
this._isGrow = false;
|
|
665
|
+
this.rows = 3;
|
|
666
|
+
this.onBlur = new EventEmitter();
|
|
667
|
+
this.onFocus = new EventEmitter();
|
|
668
|
+
this._model = null;
|
|
669
|
+
this.id = `_${Math.random().toString(36).substring(2, 11)}`;
|
|
670
|
+
this.resizeSubject = new Subject();
|
|
671
|
+
this.validation.subscribe(() => this.validate());
|
|
672
|
+
ngControl.valueAccessor = this;
|
|
673
|
+
this.resizeSubject
|
|
674
|
+
.pipe(debounceTime(300))
|
|
675
|
+
.subscribe(() => this._isGrow && this.setTextareaHeight());
|
|
676
|
+
}
|
|
677
|
+
ngOnDestroy() {
|
|
678
|
+
super.ngOnDestroy();
|
|
679
|
+
this.resizeSubject.complete();
|
|
680
|
+
}
|
|
681
|
+
onWindowResize() {
|
|
682
|
+
this.resizeSubject.next();
|
|
683
|
+
}
|
|
684
|
+
setTextareaHeight() {
|
|
685
|
+
if (!this.textareaElement || !this.textareaHiddenElement)
|
|
686
|
+
return;
|
|
687
|
+
const textarea = this.textareaElement.nativeElement;
|
|
688
|
+
const textareaHidden = this.textareaHiddenElement.nativeElement;
|
|
689
|
+
this.renderer.setStyle(textareaHidden, 'width', `calc(${textarea.scrollWidth}px - 1em)`);
|
|
690
|
+
this.renderer.setStyle(textareaHidden, 'height', 'auto');
|
|
691
|
+
this.renderer.setStyle(textarea, 'height', `${textareaHidden.scrollHeight}px`);
|
|
692
|
+
}
|
|
693
|
+
onChange(_model) { }
|
|
694
|
+
registerOnChange(fn) {
|
|
695
|
+
this.onChange = fn;
|
|
696
|
+
}
|
|
697
|
+
writeValue(v) {
|
|
698
|
+
let value = v;
|
|
699
|
+
if (value === '' || value === undefined)
|
|
700
|
+
value = null;
|
|
701
|
+
if (isNumber(value))
|
|
702
|
+
value = value.toString();
|
|
703
|
+
if (value === null || typeof value === 'string') {
|
|
704
|
+
this._model = value;
|
|
705
|
+
setTimeout(() => this.setTextareaHeight());
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
validate() {
|
|
709
|
+
const validators = [];
|
|
710
|
+
if (this._minLength != null)
|
|
711
|
+
validators.push(Validators.minLength(this._minLength));
|
|
712
|
+
if (this._maxLength != null)
|
|
713
|
+
validators.push(Validators.maxLength(this._maxLength));
|
|
714
|
+
if (this.required === true)
|
|
715
|
+
validators.push(Validators.required);
|
|
716
|
+
this.ngControl.control?.setValidators(validators);
|
|
717
|
+
this.ngControl.control?.updateValueAndValidity();
|
|
718
|
+
}
|
|
719
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TextComponent, deps: [{ token: i1.NgControl, self: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
720
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: TextComponent, selector: "jo-text", inputs: { placeholder: "placeholder", minLength: "minLength", maxLength: "maxLength", isSpellCheck: "isSpellCheck", isGrow: "isGrow", rows: "rows" }, outputs: { onBlur: "onBlur", onFocus: "onFocus" }, host: { listeners: { "window:resize": "onWindowResize()" } }, viewQueries: [{ propertyName: "textareaElement", first: true, predicate: ["textarea"], descendants: true }, { propertyName: "textareaHiddenElement", first: true, predicate: ["textareaHidden"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<label\r\n [for]=\"id\"\r\n [class.required]=\"required\"\r\n>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex\">\r\n <input\r\n *ngIf=\"!_isGrow\"\r\n type=\"text\"\r\n [(ngModel)]=\"model\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n class=\"flex-1\"\r\n [minlength]=\"_minLength\"\r\n [maxlength]=\"_maxLength\"\r\n [class.active]=\"_model !== null\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [id]=\"id\"\r\n [spellcheck]=\"isSpellCheck\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouched(); onBlur.emit($event)\"\r\n (focus)=\"onFocus.emit($event)\"\r\n />\r\n <textarea\r\n *ngIf=\"_isGrow\"\r\n #textarea\r\n [(ngModel)]=\"model\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n class=\"flex-1\"\r\n [rows]=\"rows\"\r\n [minlength]=\"_minLength\"\r\n [maxlength]=\"_maxLength\"\r\n [class.active]=\"_model !== null\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [id]=\"id\"\r\n [spellcheck]=\"isSpellCheck\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouched(); onBlur.emit($event)\"\r\n (focus)=\"onFocus.emit($event)\"\r\n ></textarea>\r\n</div>\r\n\r\n<div\r\n *ngIf=\"_isGrow\"\r\n class=\"d-flex\"\r\n>\r\n <textarea\r\n #textareaHidden\r\n [ngModel]=\"model\"\r\n class=\"hidden flex-1\"\r\n [rows]=\"rows\"\r\n ></textarea>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['minlength']\">\r\n minimum length is {{minLength}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['maxLength']\">\r\n maximum length is {{maxLength}}\r\n </li>\r\n</ul> -->", styles: [":host{display:block}textarea{font-family:inherit;cursor:text;overflow:hidden;resize:none;width:100%}textarea.hidden{padding:0;position:absolute;visibility:hidden;transition:none}input[type=text]{font-family:inherit;width:100%}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
721
|
+
}
|
|
722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: TextComponent, decorators: [{
|
|
723
|
+
type: Component,
|
|
724
|
+
args: [{ selector: 'jo-text', template: "<label\r\n [for]=\"id\"\r\n [class.required]=\"required\"\r\n>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex\">\r\n <input\r\n *ngIf=\"!_isGrow\"\r\n type=\"text\"\r\n [(ngModel)]=\"model\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n class=\"flex-1\"\r\n [minlength]=\"_minLength\"\r\n [maxlength]=\"_maxLength\"\r\n [class.active]=\"_model !== null\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [id]=\"id\"\r\n [spellcheck]=\"isSpellCheck\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouched(); onBlur.emit($event)\"\r\n (focus)=\"onFocus.emit($event)\"\r\n />\r\n <textarea\r\n *ngIf=\"_isGrow\"\r\n #textarea\r\n [(ngModel)]=\"model\"\r\n [class.border-radius-right]=\"borderRadiusRight\"\r\n [class.border-radius-left]=\"borderRadiusLeft\"\r\n class=\"flex-1\"\r\n [rows]=\"rows\"\r\n [minlength]=\"_minLength\"\r\n [maxlength]=\"_maxLength\"\r\n [class.active]=\"_model !== null\"\r\n [class.invalid]=\"ngControl.control?.invalid\"\r\n [disabled]=\"isDisabled\"\r\n [id]=\"id\"\r\n [spellcheck]=\"isSpellCheck\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouched(); onBlur.emit($event)\"\r\n (focus)=\"onFocus.emit($event)\"\r\n ></textarea>\r\n</div>\r\n\r\n<div\r\n *ngIf=\"_isGrow\"\r\n class=\"d-flex\"\r\n>\r\n <textarea\r\n #textareaHidden\r\n [ngModel]=\"model\"\r\n class=\"hidden flex-1\"\r\n [rows]=\"rows\"\r\n ></textarea>\r\n</div>\r\n\r\n<!-- <ul *ngIf=\"ngControl.control?.errors\">\r\n <li *ngIf=\"ngControl.control?.errors?.['minlength']\">\r\n minimum length is {{minLength}}\r\n </li>\r\n <li *ngIf=\"ngControl.control?.errors?.['maxLength']\">\r\n maximum length is {{maxLength}}\r\n </li>\r\n</ul> -->", styles: [":host{display:block}textarea{font-family:inherit;cursor:text;overflow:hidden;resize:none;width:100%}textarea.hidden{padding:0;position:absolute;visibility:hidden;transition:none}input[type=text]{font-family:inherit;width:100%}\n", ".d-flex{display:flex}.align-items-start{align-items:flex-start}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}.justify-content-between{justify-content:space-between}.flex-wrap{flex-wrap:wrap}.flex-column{flex-direction:column}.flex-1{flex:1}.flex-2{flex:2}.flex-3{flex:3}.align-self-center{align-self:center}.margin-right-1{margin-right:.5em}.margin-right-2{margin-right:1em}.margin-left-1{margin-left:.5em}.margin-left-2{margin-left:1em}.border-radius-right{border-top-right-radius:.5em;border-bottom-right-radius:.5em}.border-radius-left{border-top-left-radius:.5em;border-bottom-left-radius:.5em}.white-space-nowrap{white-space:nowrap}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }]
|
|
725
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
726
|
+
type: Self
|
|
727
|
+
}] }, { type: i0.Renderer2 }], propDecorators: { placeholder: [{
|
|
728
|
+
type: Input
|
|
729
|
+
}], minLength: [{
|
|
730
|
+
type: Input
|
|
731
|
+
}], maxLength: [{
|
|
732
|
+
type: Input
|
|
733
|
+
}], isSpellCheck: [{
|
|
734
|
+
type: Input
|
|
735
|
+
}], isGrow: [{
|
|
736
|
+
type: Input
|
|
737
|
+
}], rows: [{
|
|
738
|
+
type: Input
|
|
739
|
+
}], onBlur: [{
|
|
740
|
+
type: Output
|
|
741
|
+
}], onFocus: [{
|
|
742
|
+
type: Output
|
|
743
|
+
}], textareaElement: [{
|
|
744
|
+
type: ViewChild,
|
|
745
|
+
args: ['textarea']
|
|
746
|
+
}], textareaHiddenElement: [{
|
|
747
|
+
type: ViewChild,
|
|
748
|
+
args: ['textareaHidden']
|
|
749
|
+
}], onWindowResize: [{
|
|
750
|
+
type: HostListener,
|
|
751
|
+
args: ['window:resize']
|
|
752
|
+
}] } });
|
|
753
|
+
|
|
754
|
+
class SelectComponent extends ItemDirective {
|
|
755
|
+
set searchTerm(value) {
|
|
756
|
+
this._searchTerm = value;
|
|
757
|
+
}
|
|
758
|
+
get showDropdown() {
|
|
759
|
+
return this._showDropdown;
|
|
760
|
+
}
|
|
761
|
+
set showDropdown(value) {
|
|
762
|
+
this._showDropdown = value;
|
|
763
|
+
if (this._showDropdown === false)
|
|
764
|
+
return;
|
|
765
|
+
const hostBoundingRect = this.hostElement.nativeElement.getBoundingClientRect();
|
|
766
|
+
this.isDropdownCloseToBottom = window.innerHeight < hostBoundingRect.bottom + parseInt(this.dropdownMaxHeight, 10);
|
|
767
|
+
}
|
|
768
|
+
constructor(ngControl, hostElement) {
|
|
769
|
+
super(ngControl);
|
|
770
|
+
this.ngControl = ngControl;
|
|
771
|
+
this.hostElement = hostElement;
|
|
772
|
+
this.dropdownMaxHeight = '200px';
|
|
773
|
+
this._searchTerm = '';
|
|
774
|
+
this._showDropdown = false;
|
|
775
|
+
this.isDropdownCloseToBottom = false;
|
|
776
|
+
}
|
|
777
|
+
onGlobalClick(event) {
|
|
778
|
+
if (!this.hostElement.nativeElement.contains(event.target))
|
|
779
|
+
this._showDropdown = false;
|
|
780
|
+
}
|
|
781
|
+
onClickSearch() {
|
|
782
|
+
this.showDropdown = !this.showDropdown;
|
|
783
|
+
}
|
|
784
|
+
onFocusSearch() {
|
|
785
|
+
this.showDropdown = !this.showDropdown;
|
|
786
|
+
}
|
|
787
|
+
onClick(item) {
|
|
788
|
+
this._model = this._model.filter(key => this._items.map(item => item.key).includes(key));
|
|
789
|
+
if (this._model.includes(item.key)) {
|
|
790
|
+
if (this.required === true && this._model.length === 1)
|
|
791
|
+
return;
|
|
792
|
+
this.model = this._model.filter(key => key !== item.key);
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
if (!this.isMultiple && this._model.length === 1) {
|
|
796
|
+
this.model = [item.key];
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
this.model = [...this._model, item.key];
|
|
800
|
+
}
|
|
801
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: SelectComponent, deps: [{ token: i1.NgControl, self: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
802
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.5", type: SelectComponent, selector: "jo-select", inputs: { dropdownMaxHeight: "dropdownMaxHeight" }, host: { listeners: { "document:mousedown": "onGlobalClick($event)" } }, usesInheritance: true, ngImport: i0, template: "<label>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-stretch\">\r\n <jo-text\r\n [borderRadiusLeft]=\"borderRadiusLeft\"\r\n [borderRadiusRight]=\"false\"\r\n [(ngModel)]=\"searchTerm\"\r\n [isGrow]=\"false\"\r\n class=\"flex-1\"\r\n (onFocus)=\"onFocusSearch()\"\r\n ></jo-text>\r\n <button\r\n class=\"d-flex\"\r\n [disabled]=\"isDisabled\"\r\n (click)=\"onClickSearch()\"\r\n >\r\n <icon\r\n size=\"1em\"\r\n type=\"chevron\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n [stroke]=\"['current']\"\r\n ></icon>\r\n </button>\r\n</div>\r\n\r\n<div\r\n class=\"drop {{isDropdownCloseToBottom ? 'up' : 'down'}}\"\r\n [hidden]=\"!showDropdown\"\r\n [style.max-height]=\"dropdownMaxHeight\"\r\n>\r\n <!-- <jo-button *ngIf=\"items.length === 0\">\r\n No Results\r\n </jo-button> -->\r\n <button\r\n *ngFor=\"let item of items; let idx = index\"\r\n class=\"d-flex\"\r\n [class.active]=\"_model.includes(item.key)\"\r\n [disabled]=\"isDisabled\"\r\n [class.invalid]=\"!ngControl.control?.invalid\"\r\n [class.border-radius-right]=\"borderRadiusRight && idx === items.length - 1\"\r\n [class.border-radius-left]=\"borderRadiusLeft && idx === 0\"\r\n (click)=\"onClick(item)\"\r\n (blur)=\"onTouched()\"\r\n >\r\n <icon-stack\r\n class=\"margin-right-1\"\r\n size=\"1em\"\r\n >\r\n <icon [type]=\"isMultiple ? 'squircle' : 'circle'\"></icon>\r\n <icon\r\n *ngIf=\"_model.includes(item.key)\"\r\n [type]=\"isMultiple ? 'check' : 'dot'\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </icon-stack>\r\n {{item.value}}\r\n </button>\r\n</div>", styles: [":host{position:relative;display:block}.drop{max-height:200px;overflow-y:auto}.drop.down{top:100%}.drop.up{bottom:100%}icon[type=chevron]{transform:rotate(180deg)}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: i3.IconComponent, selector: "icon[type]", inputs: ["type", "fill", "fillRotate", "fillOpacity", "stroke", "strokeRotate", "spin"] }, { kind: "component", type: i3.IconStackComponent, selector: "icon-stack" }, { kind: "component", type: TextComponent, selector: "jo-text", inputs: ["placeholder", "minLength", "maxLength", "isSpellCheck", "isGrow", "rows"], outputs: ["onBlur", "onFocus"] }] }); }
|
|
803
|
+
}
|
|
804
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: SelectComponent, decorators: [{
|
|
805
|
+
type: Component,
|
|
806
|
+
args: [{ selector: 'jo-select', template: "<label>\r\n <ng-content></ng-content>\r\n</label>\r\n\r\n<div class=\"d-flex align-items-stretch\">\r\n <jo-text\r\n [borderRadiusLeft]=\"borderRadiusLeft\"\r\n [borderRadiusRight]=\"false\"\r\n [(ngModel)]=\"searchTerm\"\r\n [isGrow]=\"false\"\r\n class=\"flex-1\"\r\n (onFocus)=\"onFocusSearch()\"\r\n ></jo-text>\r\n <button\r\n class=\"d-flex\"\r\n [disabled]=\"isDisabled\"\r\n (click)=\"onClickSearch()\"\r\n >\r\n <icon\r\n size=\"1em\"\r\n type=\"chevron\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n [stroke]=\"['current']\"\r\n ></icon>\r\n </button>\r\n</div>\r\n\r\n<div\r\n class=\"drop {{isDropdownCloseToBottom ? 'up' : 'down'}}\"\r\n [hidden]=\"!showDropdown\"\r\n [style.max-height]=\"dropdownMaxHeight\"\r\n>\r\n <!-- <jo-button *ngIf=\"items.length === 0\">\r\n No Results\r\n </jo-button> -->\r\n <button\r\n *ngFor=\"let item of items; let idx = index\"\r\n class=\"d-flex\"\r\n [class.active]=\"_model.includes(item.key)\"\r\n [disabled]=\"isDisabled\"\r\n [class.invalid]=\"!ngControl.control?.invalid\"\r\n [class.border-radius-right]=\"borderRadiusRight && idx === items.length - 1\"\r\n [class.border-radius-left]=\"borderRadiusLeft && idx === 0\"\r\n (click)=\"onClick(item)\"\r\n (blur)=\"onTouched()\"\r\n >\r\n <icon-stack\r\n class=\"margin-right-1\"\r\n size=\"1em\"\r\n >\r\n <icon [type]=\"isMultiple ? 'squircle' : 'circle'\"></icon>\r\n <icon\r\n *ngIf=\"_model.includes(item.key)\"\r\n [type]=\"isMultiple ? 'check' : 'dot'\"\r\n [fill]=\"[null, 'current']\"\r\n fillRotate=\"90\"\r\n ></icon>\r\n </icon-stack>\r\n {{item.value}}\r\n </button>\r\n</div>", styles: [":host{position:relative;display:block}.drop{max-height:200px;overflow-y:auto}.drop.down{top:100%}.drop.up{bottom:100%}icon[type=chevron]{transform:rotate(180deg)}\n", "label{display:block;padding-bottom:.5em;font-weight:700}label:empty{display:none}label.required:after{content:\"*\"}ul{list-style:none;margin:0;padding:0}ul>li{padding-top:.25em}a:not(.jo-ignore),button:not(.jo-ignore),.button,input,textarea{color:inherit;background:transparent;border-width:.15em;border-style:outset;border-color:currentColor;padding:.5em;margin:0;font-size:1em;line-height:1em}a:not(.jo-ignore):active,a:not(.jo-ignore).active,button:not(.jo-ignore):active,button:not(.jo-ignore).active,.button:active,.button.active,input:active,input.active,textarea:active,textarea.active{border-style:inset}a:not(.jo-ignore):disabled,a:not(.jo-ignore).disabled,button:not(.jo-ignore):disabled,button:not(.jo-ignore).disabled,.button:disabled,.button.disabled,input:disabled,input.disabled,textarea:disabled,textarea.disabled{cursor:not-allowed;border-style:solid;box-shadow:none;opacity:.5}a,button,.button{cursor:pointer}@keyframes invalid-border{0%,to{border-style:inset}50%{border-style:outset}}\n"] }]
|
|
807
|
+
}], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
|
|
808
|
+
type: Self
|
|
809
|
+
}] }, { type: i0.ElementRef }], propDecorators: { dropdownMaxHeight: [{
|
|
810
|
+
type: Input
|
|
811
|
+
}], onGlobalClick: [{
|
|
812
|
+
type: HostListener,
|
|
813
|
+
args: ['document:mousedown', ['$event']]
|
|
814
|
+
}] } });
|
|
815
|
+
|
|
816
|
+
class ChaosControlModule {
|
|
817
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
818
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlModule, declarations: [ReadonlyComponent,
|
|
819
|
+
ChoiceComponent,
|
|
820
|
+
ColorComponent,
|
|
821
|
+
FileComponent,
|
|
822
|
+
NumberComponent,
|
|
823
|
+
TextComponent,
|
|
824
|
+
ControlDirective,
|
|
825
|
+
ItemDirective,
|
|
826
|
+
SelectComponent,
|
|
827
|
+
BorderRadiusDirective], imports: [CommonModule,
|
|
828
|
+
FormsModule,
|
|
829
|
+
IconModule,
|
|
830
|
+
RouterModule], exports: [ReadonlyComponent,
|
|
831
|
+
ChoiceComponent,
|
|
832
|
+
ColorComponent,
|
|
833
|
+
FileComponent,
|
|
834
|
+
NumberComponent,
|
|
835
|
+
TextComponent,
|
|
836
|
+
SelectComponent] }); }
|
|
837
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlModule, imports: [CommonModule,
|
|
838
|
+
FormsModule,
|
|
839
|
+
IconModule,
|
|
840
|
+
RouterModule] }); }
|
|
841
|
+
}
|
|
842
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlModule, decorators: [{
|
|
843
|
+
type: NgModule,
|
|
844
|
+
args: [{
|
|
845
|
+
declarations: [
|
|
846
|
+
ReadonlyComponent,
|
|
847
|
+
ChoiceComponent,
|
|
848
|
+
ColorComponent,
|
|
849
|
+
FileComponent,
|
|
850
|
+
NumberComponent,
|
|
851
|
+
TextComponent,
|
|
852
|
+
ControlDirective,
|
|
853
|
+
ItemDirective,
|
|
854
|
+
SelectComponent,
|
|
855
|
+
BorderRadiusDirective,
|
|
856
|
+
],
|
|
857
|
+
imports: [
|
|
858
|
+
CommonModule,
|
|
859
|
+
FormsModule,
|
|
860
|
+
IconModule,
|
|
861
|
+
RouterModule,
|
|
862
|
+
],
|
|
863
|
+
exports: [
|
|
864
|
+
ReadonlyComponent,
|
|
865
|
+
ChoiceComponent,
|
|
866
|
+
ColorComponent,
|
|
867
|
+
FileComponent,
|
|
868
|
+
NumberComponent,
|
|
869
|
+
TextComponent,
|
|
870
|
+
SelectComponent,
|
|
871
|
+
]
|
|
872
|
+
}]
|
|
873
|
+
}] });
|
|
874
|
+
|
|
875
|
+
class ChaosControlService {
|
|
876
|
+
constructor() { }
|
|
877
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
878
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlService, providedIn: 'root' }); }
|
|
879
|
+
}
|
|
880
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ChaosControlService, decorators: [{
|
|
881
|
+
type: Injectable,
|
|
882
|
+
args: [{
|
|
883
|
+
providedIn: 'root'
|
|
884
|
+
}]
|
|
885
|
+
}], ctorParameters: () => [] });
|
|
886
|
+
|
|
887
|
+
// Public API Surface of chaos-control
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Generated bundle index. Do not edit.
|
|
891
|
+
*/
|
|
892
|
+
|
|
893
|
+
export { ChaosControlModule, ChaosControlService, ChoiceComponent, ColorComponent, FileComponent, NumberComponent, ReadonlyComponent, SelectComponent, TextComponent, isItem, isItems, isNumber, isPrimitive };
|
|
894
|
+
//# sourceMappingURL=joster-dev-chaos-control.mjs.map
|