@apipass/inputs 0.2.7 → 0.2.8-alpha.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.
@@ -2069,6 +2069,242 @@ DebouceInputDirective.ɵdir = ɵɵdefineDirective({ type: DebouceInputDirective,
2069
2069
  type: Output
2070
2070
  }] }); })();
2071
2071
 
2072
+ const _c0$6 = ["trigger"];
2073
+ const _c1$4 = ["input"];
2074
+ function SelectInterpolationComponent_ng_template_9_li_4_Template(rf, ctx) { if (rf & 1) {
2075
+ const _r7 = ɵɵgetCurrentView();
2076
+ ɵɵelementStart(0, "li", 15);
2077
+ ɵɵlistener("click", function SelectInterpolationComponent_ng_template_9_li_4_Template_li_click_0_listener() { ɵɵrestoreView(_r7); const i_r5 = ctx.$implicit; const ctx_r6 = ɵɵnextContext(2); return ctx_r6.selectItem(i_r5); })("mousedown", function SelectInterpolationComponent_ng_template_9_li_4_Template_li_mousedown_0_listener() { ɵɵrestoreView(_r7); const i_r5 = ctx.$implicit; const ctx_r8 = ɵɵnextContext(2); return ctx_r8.selectItem(i_r5); });
2078
+ ɵɵtext(1);
2079
+ ɵɵelementEnd();
2080
+ } if (rf & 2) {
2081
+ const i_r5 = ctx.$implicit;
2082
+ ɵɵadvance(1);
2083
+ ɵɵtextInterpolate1(" ", i_r5.text, " ");
2084
+ } }
2085
+ function SelectInterpolationComponent_ng_template_9_Template(rf, ctx) { if (rf & 1) {
2086
+ const _r10 = ɵɵgetCurrentView();
2087
+ ɵɵelementStart(0, "ul", 10);
2088
+ ɵɵelementStart(1, "li", 11);
2089
+ ɵɵelementStart(2, "mat-form-field", 12);
2090
+ ɵɵelementStart(3, "input", 13);
2091
+ ɵɵlistener("ngModelChange", function SelectInterpolationComponent_ng_template_9_Template_input_ngModelChange_3_listener($event) { ɵɵrestoreView(_r10); const ctx_r9 = ɵɵnextContext(); return ctx_r9.searchText = $event; })("blur", function SelectInterpolationComponent_ng_template_9_Template_input_blur_3_listener($event) { ɵɵrestoreView(_r10); const ctx_r11 = ɵɵnextContext(); return ctx_r11.onBlur($event); });
2092
+ ɵɵelementEnd();
2093
+ ɵɵelementEnd();
2094
+ ɵɵelementEnd();
2095
+ ɵɵtemplate(4, SelectInterpolationComponent_ng_template_9_li_4_Template, 2, 1, "li", 14);
2096
+ ɵɵpipe(5, "selectFilter");
2097
+ ɵɵelementEnd();
2098
+ } if (rf & 2) {
2099
+ const ctx_r3 = ɵɵnextContext();
2100
+ ɵɵadvance(3);
2101
+ ɵɵproperty("placeholder", ctx_r3.findPlaceHolder)("ngModel", ctx_r3.searchText);
2102
+ ɵɵadvance(1);
2103
+ ɵɵproperty("ngForOf", ɵɵpipeBind3(5, 3, ctx_r3.items, ctx_r3.searchText, "text"));
2104
+ } }
2105
+ const _c2$2 = function (a0) { return { "select-open": a0 }; };
2106
+ const _c3$2 = function () { return { standalone: true }; };
2107
+ const _c4$1 = function (a0, a1) { return { "fa-caret-down": a0, "fa-caret-up": a1 }; };
2108
+ class SelectInterpolationComponent {
2109
+ constructor(sso) {
2110
+ this.sso = sso;
2111
+ this.edited = false;
2112
+ this.selectedItemLabel = '';
2113
+ this.searchText = '';
2114
+ this.opened = false;
2115
+ this.disabled = false;
2116
+ this.items = [];
2117
+ this.placeHolder = 'Select';
2118
+ this.findPlaceHolder = 'Find item';
2119
+ this.onSelect = new EventEmitter();
2120
+ this.tabindex = '0';
2121
+ this.onTouchedCallback = () => {
2122
+ };
2123
+ this.onChangeCallback = () => {
2124
+ };
2125
+ this.scrollStrategy = this.sso.block();
2126
+ }
2127
+ onBlur(target) {
2128
+ if (this.selectedItemLabel) {
2129
+ if (this.edited) {
2130
+ this.writeValue(this.selectedItemLabel);
2131
+ this.selectedItem = new CustomSelectItem(this.selectedItemLabel, this.selectedItemLabel);
2132
+ this.onSelect.next(this.selectedItem);
2133
+ }
2134
+ }
2135
+ else {
2136
+ this.writeValue(undefined);
2137
+ this.onSelect.next(undefined);
2138
+ }
2139
+ if (target && target.relatedTarget && target.relatedTarget.classList.contains('search-input-item')) {
2140
+ return;
2141
+ }
2142
+ this.setTriggerRect();
2143
+ this.opened = false;
2144
+ }
2145
+ ngAfterViewInit() {
2146
+ setTimeout(() => {
2147
+ this.setInitialState();
2148
+ this.setTriggerRect();
2149
+ }, 300);
2150
+ }
2151
+ setInitialState() {
2152
+ setTimeout(() => {
2153
+ if (this.value && this.items) {
2154
+ const selectedItem = this.items.find(item => item.id === this.value);
2155
+ this.selectedItemLabel = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.text) || this.value;
2156
+ }
2157
+ });
2158
+ }
2159
+ setTriggerRect() {
2160
+ setTimeout(() => {
2161
+ var _a;
2162
+ this._triggerRect = (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.nativeElement.getBoundingClientRect();
2163
+ });
2164
+ }
2165
+ selectItem(item) {
2166
+ this.opened = false;
2167
+ this.edited = false;
2168
+ this.selectedItem = item;
2169
+ this.value = item.id;
2170
+ this.selectedItemLabel = item.text;
2171
+ this.searchText = '';
2172
+ this.onSelect.next(item);
2173
+ }
2174
+ keyPress() {
2175
+ this.setTriggerRect();
2176
+ this.opened = false;
2177
+ this.edited = true;
2178
+ this.searchText = '';
2179
+ }
2180
+ clicked() {
2181
+ this.setTriggerRect();
2182
+ this.opened = true;
2183
+ this.searchText = '';
2184
+ }
2185
+ get value() {
2186
+ return this.innerValue;
2187
+ }
2188
+ set value(value) {
2189
+ this.innerValue = value;
2190
+ this.onChangeCallback(value);
2191
+ }
2192
+ writeValue(value) {
2193
+ if (value !== this.value) {
2194
+ this.value = value;
2195
+ }
2196
+ }
2197
+ registerOnChange(fn) {
2198
+ this.onChangeCallback = fn;
2199
+ }
2200
+ registerOnTouched(fn) {
2201
+ this.onTouchedCallback = fn;
2202
+ }
2203
+ setDisabledState(isDisabled) {
2204
+ this.disabled = isDisabled;
2205
+ }
2206
+ arrowClick(event) {
2207
+ var _a;
2208
+ event.stopPropagation();
2209
+ this.setTriggerRect();
2210
+ if (this.opened) {
2211
+ this.opened = false;
2212
+ }
2213
+ else {
2214
+ this.opened = true;
2215
+ this.searchText = '';
2216
+ (_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement.focus();
2217
+ }
2218
+ }
2219
+ onDrop($event) {
2220
+ this.searchText = '';
2221
+ if (!this.value) {
2222
+ this.value = '';
2223
+ }
2224
+ this.edited = true;
2225
+ this.value += `{{${$event.data}}}`;
2226
+ this.selectedItemLabel = this.value;
2227
+ this.onBlur(undefined);
2228
+ }
2229
+ }
2230
+ SelectInterpolationComponent.ɵfac = function SelectInterpolationComponent_Factory(t) { return new (t || SelectInterpolationComponent)(ɵɵdirectiveInject(ScrollStrategyOptions)); };
2231
+ SelectInterpolationComponent.ɵcmp = ɵɵdefineComponent({ type: SelectInterpolationComponent, selectors: [["select-interpolation"]], viewQuery: function SelectInterpolationComponent_Query(rf, ctx) { if (rf & 1) {
2232
+ ɵɵviewQuery(_c0$6, true);
2233
+ ɵɵviewQuery(_c1$4, true, ElementRef);
2234
+ } if (rf & 2) {
2235
+ var _t;
2236
+ ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.trigger = _t.first);
2237
+ ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.input = _t.first);
2238
+ } }, hostVars: 1, hostBindings: function SelectInterpolationComponent_HostBindings(rf, ctx) { if (rf & 1) {
2239
+ ɵɵlistener("blur", function SelectInterpolationComponent_blur_HostBindingHandler($event) { return ctx.onBlur($event.target); });
2240
+ } if (rf & 2) {
2241
+ ɵɵattribute("tabindex", ctx.tabindex);
2242
+ } }, inputs: { disabled: "disabled", items: "items", placeHolder: "placeHolder", findPlaceHolder: "findPlaceHolder" }, outputs: { onSelect: "onSelect" }, features: [ɵɵProvidersFeature([{
2243
+ provide: NG_VALUE_ACCESSOR,
2244
+ useExisting: forwardRef(() => SelectInterpolationComponent),
2245
+ multi: true
2246
+ }])], decls: 10, vars: 17, consts: [[1, "custom-select-input"], ["trigger", ""], ["cdkOverlayOrigin", "", "appearance", "fill", "autocomplete", "off", 1, "custom-select-component", 3, "ngClass"], ["origin", "cdkOverlayOrigin"], ["matInput", "", "dndDropzone", "", "autocomplete", "off", 3, "placeholder", "ngModel", "ngModelOptions", "disabled", "focus", "blur", "ngModelChange", "keyup", "click", "dndDrop"], ["input", ""], [1, "open-icon", 3, "click"], [1, "fas", 3, "ngClass"], [1, "custom-select-component"], ["cdkConnectedOverlay", "", 3, "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOrigin", "cdkConnectedOverlayOpen", "cdkConnectedOverlayMinWidth"], [1, "ul-ac"], [1, "li-search", "search-input-item"], ["appearance", "fill", 1, "apipass-input-text", "search-input-item"], ["matInput", "", "aria-autocomplete", "none", "autocomplete", "off", 1, "search-input-item", 3, "placeholder", "ngModel", "ngModelChange", "blur"], ["class", "clickable", 3, "click", "mousedown", 4, "ngFor", "ngForOf"], [1, "clickable", 3, "click", "mousedown"]], template: function SelectInterpolationComponent_Template(rf, ctx) { if (rf & 1) {
2247
+ ɵɵelementStart(0, "div", 0, 1);
2248
+ ɵɵelementStart(2, "mat-form-field", 2, 3);
2249
+ ɵɵelementStart(4, "input", 4, 5);
2250
+ ɵɵlistener("focus", function SelectInterpolationComponent_Template_input_focus_4_listener() { return ctx.opened = true; })("blur", function SelectInterpolationComponent_Template_input_blur_4_listener($event) { return ctx.onBlur($event); })("ngModelChange", function SelectInterpolationComponent_Template_input_ngModelChange_4_listener($event) { return ctx.selectedItemLabel = $event; })("keyup", function SelectInterpolationComponent_Template_input_keyup_4_listener() { return ctx.keyPress(); })("click", function SelectInterpolationComponent_Template_input_click_4_listener() { return ctx.clicked(); })("dndDrop", function SelectInterpolationComponent_Template_input_dndDrop_4_listener($event) { return ctx.onDrop($event); });
2251
+ ɵɵelementEnd();
2252
+ ɵɵelementStart(6, "span", 6);
2253
+ ɵɵlistener("click", function SelectInterpolationComponent_Template_span_click_6_listener($event) { return ctx.arrowClick($event); });
2254
+ ɵɵelement(7, "i", 7);
2255
+ ɵɵelementEnd();
2256
+ ɵɵelementEnd();
2257
+ ɵɵelementEnd();
2258
+ ɵɵelementStart(8, "div", 8);
2259
+ ɵɵtemplate(9, SelectInterpolationComponent_ng_template_9_Template, 6, 7, "ng-template", 9);
2260
+ ɵɵelementEnd();
2261
+ } if (rf & 2) {
2262
+ const _r1 = ɵɵreference(3);
2263
+ ɵɵadvance(2);
2264
+ ɵɵproperty("ngClass", ɵɵpureFunction1(11, _c2$2, ctx.opened));
2265
+ ɵɵadvance(2);
2266
+ ɵɵproperty("placeholder", ctx.placeHolder)("ngModel", ctx.selectedItemLabel)("ngModelOptions", ɵɵpureFunction0(13, _c3$2))("disabled", ctx.disabled);
2267
+ ɵɵadvance(3);
2268
+ ɵɵproperty("ngClass", ɵɵpureFunction2(14, _c4$1, !ctx.opened, ctx.opened));
2269
+ ɵɵadvance(2);
2270
+ ɵɵproperty("cdkConnectedOverlayPanelClass", "custom-select-overlay-panel")("cdkConnectedOverlayScrollStrategy", ctx.scrollStrategy)("cdkConnectedOverlayOrigin", _r1)("cdkConnectedOverlayOpen", ctx.opened)("cdkConnectedOverlayMinWidth", ctx._triggerRect == null ? null : ctx._triggerRect.width);
2271
+ } }, directives: [MatFormField, CdkOverlayOrigin, NgClass, MatInput, DefaultValueAccessor, DndDropzoneDirective, NgControlStatus, NgModel, CdkConnectedOverlay, NgForOf], pipes: [SelectFilterPipe], styles: [".custom-select-component[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%], .custom-select-overlay-panel{cursor:pointer}.custom-select-component[_ngcontent-%COMP%] input[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] input[_ngcontent-%COMP%], .custom-select-overlay-panel input{background:#fff!important;height:48px}.custom-select-component[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%], .custom-select-overlay-panel .ul-ac{background:#fff;border:1px solid #ccc;box-sizing:border-box;list-style:none;margin-top:-1px;max-height:16rem;overflow:auto;padding:0;position:relative;width:100%}.custom-select-component[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%], .custom-select-overlay-panel .ul-ac li{cursor:pointer;font-size:12px;overflow:hidden;padding:10px;text-align:left;text-overflow:ellipsis;white-space:nowrap}.custom-select-component[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:hover, .custom-select-input[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:hover, .custom-select-overlay-panel .ul-ac li:hover{background:#bbbcbc}.custom-select-component[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .mat-form-field-flex[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .mat-form-field-flex[_ngcontent-%COMP%], .custom-select-overlay-panel .ul-ac li .mat-form-field-flex{height:37px!important}.custom-select-component[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .mat-form-field-flex[_ngcontent-%COMP%] input[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .ul-ac[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .mat-form-field-flex[_ngcontent-%COMP%] input[_ngcontent-%COMP%], .custom-select-overlay-panel .ul-ac li .mat-form-field-flex input{height:auto}.custom-select-component[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%], .custom-select-overlay-panel .selected{background-color:#898a8a!important}.custom-select-component[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%] .fa[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .selected[_ngcontent-%COMP%] .fa[_ngcontent-%COMP%], .custom-select-overlay-panel .selected .fa{color:#fff!important}.custom-select-component[_ngcontent-%COMP%] .remove-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .remove-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .custom-select-overlay-panel .remove-icon i{color:red;margin-right:10px}.custom-select-component[_ngcontent-%COMP%] .open-icon[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .open-icon[_ngcontent-%COMP%], .custom-select-overlay-panel .open-icon{cursor:pointer}.custom-select-component[_ngcontent-%COMP%] .open-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .open-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .custom-select-overlay-panel .open-icon i{color:rgba(0,0,0,.54)}.custom-select-component[_ngcontent-%COMP%] .li-search[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .li-search[_ngcontent-%COMP%], .custom-select-overlay-panel .li-search{border-bottom:1px solid #ccc!important;cursor:default!important}.custom-select-component[_ngcontent-%COMP%] .li-search[_ngcontent-%COMP%]:hover, .custom-select-input[_ngcontent-%COMP%] .li-search[_ngcontent-%COMP%]:hover, .custom-select-overlay-panel .li-search:hover{background:#fff!important}.custom-select-component[_ngcontent-%COMP%] .select-open[_ngcontent-%COMP%] .mat-form-field-flex[_ngcontent-%COMP%], .custom-select-input[_ngcontent-%COMP%] .select-open[_ngcontent-%COMP%] .mat-form-field-flex[_ngcontent-%COMP%], .custom-select-overlay-panel .select-open .mat-form-field-flex{border-radius:6px 6px 0 0!important}"] });
2272
+ /*@__PURE__*/ (function () { ɵsetClassMetadata(SelectInterpolationComponent, [{
2273
+ type: Component,
2274
+ args: [{
2275
+ selector: 'select-interpolation',
2276
+ templateUrl: 'select-interpolation.component.html',
2277
+ styleUrls: ['select-interpolation.component.scss'],
2278
+ providers: [{
2279
+ provide: NG_VALUE_ACCESSOR,
2280
+ useExisting: forwardRef(() => SelectInterpolationComponent),
2281
+ multi: true
2282
+ }]
2283
+ }]
2284
+ }], function () { return [{ type: ScrollStrategyOptions }]; }, { disabled: [{
2285
+ type: Input
2286
+ }], items: [{
2287
+ type: Input
2288
+ }], placeHolder: [{
2289
+ type: Input
2290
+ }], findPlaceHolder: [{
2291
+ type: Input
2292
+ }], onSelect: [{
2293
+ type: Output
2294
+ }], trigger: [{
2295
+ type: ViewChild,
2296
+ args: ['trigger']
2297
+ }], input: [{
2298
+ type: ViewChild,
2299
+ args: ['input', { read: ElementRef }]
2300
+ }], tabindex: [{
2301
+ type: HostBinding,
2302
+ args: ['attr.tabindex']
2303
+ }], onBlur: [{
2304
+ type: HostListener,
2305
+ args: ['blur', ['$event.target']]
2306
+ }] }); })();
2307
+
2072
2308
  class InputsModule {
2073
2309
  }
2074
2310
  InputsModule.ɵmod = ɵɵdefineNgModule({ type: InputsModule });
@@ -2100,6 +2336,7 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
2100
2336
  InputAvatarComponent,
2101
2337
  InputFileComponent,
2102
2338
  CustomSelectComponent,
2339
+ SelectInterpolationComponent,
2103
2340
  FieldComponent,
2104
2341
  AceEditorComponent,
2105
2342
  AceEditorDirective,
@@ -2126,6 +2363,7 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
2126
2363
  InputAvatarComponent,
2127
2364
  InputFileComponent,
2128
2365
  CustomSelectComponent,
2366
+ SelectInterpolationComponent,
2129
2367
  FieldComponent,
2130
2368
  AceEditorComponent,
2131
2369
  AceEditorDirective,
@@ -2162,6 +2400,7 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
2162
2400
  InputAvatarComponent,
2163
2401
  InputFileComponent,
2164
2402
  CustomSelectComponent,
2403
+ SelectInterpolationComponent,
2165
2404
  FieldComponent,
2166
2405
  AceEditorComponent,
2167
2406
  AceEditorDirective,
@@ -2177,6 +2416,7 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
2177
2416
  InputAvatarComponent,
2178
2417
  InputFileComponent,
2179
2418
  CustomSelectComponent,
2419
+ SelectInterpolationComponent,
2180
2420
  FieldComponent,
2181
2421
  AceEditorComponent,
2182
2422
  AceEditorDirective,
@@ -2190,5 +2430,5 @@ InputsModule.ɵinj = ɵɵdefineInjector({ factory: function InputsModule_Factory
2190
2430
  * Generated bundle index. Do not edit.
2191
2431
  */
2192
2432
 
2193
- export { AceEditorComponent, AceEditorDirective, CustomSelectComponent, CustomSelectItem, DebouceInputDirective, FieldComponent, InputAvatarComponent, InputBooleanComponent, InputFileComponent, InputNumberComponent, InputPasswordComponent, InputTextComponent, InputsModule, SelectBoxComponent, SelectEnumComponent };
2433
+ export { AceEditorComponent, AceEditorDirective, CustomSelectComponent, CustomSelectItem, DebouceInputDirective, FieldComponent, InputAvatarComponent, InputBooleanComponent, InputFileComponent, InputNumberComponent, InputPasswordComponent, InputTextComponent, InputsModule, SelectBoxComponent, SelectEnumComponent, SelectInterpolationComponent };
2194
2434
  //# sourceMappingURL=apipass-inputs.js.map