@unnilouis.org/vs-chipdropdown 9.1.2 → 16.2.1

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.
Files changed (36) hide show
  1. package/README.md +13 -76
  2. package/esm2022/lib/vs-chipdd-cmp/vs-chipdd-cmp.component.mjs +266 -0
  3. package/esm2022/lib/vs-chipdropdown.component.mjs +19 -0
  4. package/esm2022/lib/vs-chipdropdown.module.mjs +61 -0
  5. package/esm2022/lib/vs-chipdropdown.service.mjs +45 -0
  6. package/esm2022/public-api.mjs +8 -0
  7. package/esm2022/unnilouis.org-vs-chipdropdown.mjs +5 -0
  8. package/fesm2022/unnilouis.org-vs-chipdropdown.mjs +391 -0
  9. package/fesm2022/unnilouis.org-vs-chipdropdown.mjs.map +1 -0
  10. package/{unnilouis.org-vs-chipdropdown.d.ts → index.d.ts} +1 -0
  11. package/lib/vs-chipdd-cmp/vs-chipdd-cmp.component.d.ts +6 -10
  12. package/lib/vs-chipdropdown.component.d.ts +4 -4
  13. package/lib/vs-chipdropdown.module.d.ts +18 -1
  14. package/lib/vs-chipdropdown.service.d.ts +3 -0
  15. package/package.json +21 -13
  16. package/bundles/unnilouis.org-vs-chipdropdown.umd.js +0 -767
  17. package/bundles/unnilouis.org-vs-chipdropdown.umd.js.map +0 -1
  18. package/bundles/unnilouis.org-vs-chipdropdown.umd.min.js +0 -16
  19. package/bundles/unnilouis.org-vs-chipdropdown.umd.min.js.map +0 -1
  20. package/esm2015/lib/vs-chipdd-cmp/vs-chipdd-cmp.component.js +0 -438
  21. package/esm2015/lib/vs-chipdropdown.component.js +0 -19
  22. package/esm2015/lib/vs-chipdropdown.module.js +0 -41
  23. package/esm2015/lib/vs-chipdropdown.service.js +0 -49
  24. package/esm2015/public-api.js +0 -8
  25. package/esm2015/unnilouis.org-vs-chipdropdown.js +0 -5
  26. package/esm5/lib/vs-chipdd-cmp/vs-chipdd-cmp.component.js +0 -454
  27. package/esm5/lib/vs-chipdropdown.component.js +0 -17
  28. package/esm5/lib/vs-chipdropdown.module.js +0 -44
  29. package/esm5/lib/vs-chipdropdown.service.js +0 -52
  30. package/esm5/public-api.js +0 -8
  31. package/esm5/unnilouis.org-vs-chipdropdown.js +0 -5
  32. package/fesm2015/unnilouis.org-vs-chipdropdown.js +0 -540
  33. package/fesm2015/unnilouis.org-vs-chipdropdown.js.map +0 -1
  34. package/fesm5/unnilouis.org-vs-chipdropdown.js +0 -560
  35. package/fesm5/unnilouis.org-vs-chipdropdown.js.map +0 -1
  36. package/unnilouis.org-vs-chipdropdown.metadata.json +0 -1
@@ -1,767 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@angular/material/autocomplete'), require('rxjs/operators'), require('rxjs'), require('@angular/forms'), require('@angular/cdk/keycodes'), require('@ngx-translate/http-loader'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/common'), require('@angular/material/grid-list'), require('@angular/material/chips'), require('@angular/material/icon'), require('@ngx-translate/core')) :
3
- typeof define === 'function' && define.amd ? define('@unnilouis.org/vs-chipdropdown', ['exports', '@angular/core', '@angular/common/http', '@angular/material/autocomplete', 'rxjs/operators', 'rxjs', '@angular/forms', '@angular/cdk/keycodes', '@ngx-translate/http-loader', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/common', '@angular/material/grid-list', '@angular/material/chips', '@angular/material/icon', '@ngx-translate/core'], factory) :
4
- (global = global || self, factory((global.unnilouis = global.unnilouis || {}, global.unnilouis.org = global.unnilouis.org || {}, global.unnilouis.org['vs-chipdropdown'] = {}), global.ng.core, global.ng.common.http, global.ng.material.autocomplete, global.rxjs.operators, global.rxjs, global.ng.forms, global.ng.cdk.keycodes, global.httpLoader, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.common, global.ng.material.gridList, global.ng.material.chips, global.ng.material.icon, global.core$1));
5
- }(this, (function (exports, core, http, autocomplete, operators, rxjs, forms, keycodes, httpLoader, formField, input, select, common, gridList, chips, icon, core$1) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign = function() {
37
- __assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign.apply(this, arguments);
45
- };
46
-
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- }
58
-
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63
- return c > 3 && r && Object.defineProperty(target, key, r), r;
64
- }
65
-
66
- function __param(paramIndex, decorator) {
67
- return function (target, key) { decorator(target, key, paramIndex); }
68
- }
69
-
70
- function __metadata(metadataKey, metadataValue) {
71
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
- }
73
-
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
- return new (P || (P = Promise))(function (resolve, reject) {
77
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
- step((generator = generator.apply(thisArg, _arguments || [])).next());
81
- });
82
- }
83
-
84
- function __generator(thisArg, body) {
85
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
86
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
87
- function verb(n) { return function (v) { return step([n, v]); }; }
88
- function step(op) {
89
- if (f) throw new TypeError("Generator is already executing.");
90
- while (_) try {
91
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
92
- if (y = 0, t) op = [op[0] & 2, t.value];
93
- switch (op[0]) {
94
- case 0: case 1: t = op; break;
95
- case 4: _.label++; return { value: op[1], done: false };
96
- case 5: _.label++; y = op[1]; op = [0]; continue;
97
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
100
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
101
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
102
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
103
- if (t[2]) _.ops.pop();
104
- _.trys.pop(); continue;
105
- }
106
- op = body.call(thisArg, _);
107
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
108
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
109
- }
110
- }
111
-
112
- function __createBinding(o, m, k, k2) {
113
- if (k2 === undefined) k2 = k;
114
- o[k2] = m[k];
115
- }
116
-
117
- function __exportStar(m, exports) {
118
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
119
- }
120
-
121
- function __values(o) {
122
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
123
- if (m) return m.call(o);
124
- if (o && typeof o.length === "number") return {
125
- next: function () {
126
- if (o && i >= o.length) o = void 0;
127
- return { value: o && o[i++], done: !o };
128
- }
129
- };
130
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
131
- }
132
-
133
- function __read(o, n) {
134
- var m = typeof Symbol === "function" && o[Symbol.iterator];
135
- if (!m) return o;
136
- var i = m.call(o), r, ar = [], e;
137
- try {
138
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
139
- }
140
- catch (error) { e = { error: error }; }
141
- finally {
142
- try {
143
- if (r && !r.done && (m = i["return"])) m.call(i);
144
- }
145
- finally { if (e) throw e.error; }
146
- }
147
- return ar;
148
- }
149
-
150
- function __spread() {
151
- for (var ar = [], i = 0; i < arguments.length; i++)
152
- ar = ar.concat(__read(arguments[i]));
153
- return ar;
154
- }
155
-
156
- function __spreadArrays() {
157
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
158
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
159
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
160
- r[k] = a[j];
161
- return r;
162
- };
163
-
164
- function __await(v) {
165
- return this instanceof __await ? (this.v = v, this) : new __await(v);
166
- }
167
-
168
- function __asyncGenerator(thisArg, _arguments, generator) {
169
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
170
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
171
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
172
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
173
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
174
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
175
- function fulfill(value) { resume("next", value); }
176
- function reject(value) { resume("throw", value); }
177
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
178
- }
179
-
180
- function __asyncDelegator(o) {
181
- var i, p;
182
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
183
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
184
- }
185
-
186
- function __asyncValues(o) {
187
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
188
- var m = o[Symbol.asyncIterator], i;
189
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
190
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
191
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
192
- }
193
-
194
- function __makeTemplateObject(cooked, raw) {
195
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
196
- return cooked;
197
- };
198
-
199
- function __importStar(mod) {
200
- if (mod && mod.__esModule) return mod;
201
- var result = {};
202
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
203
- result.default = mod;
204
- return result;
205
- }
206
-
207
- function __importDefault(mod) {
208
- return (mod && mod.__esModule) ? mod : { default: mod };
209
- }
210
-
211
- function __classPrivateFieldGet(receiver, privateMap) {
212
- if (!privateMap.has(receiver)) {
213
- throw new TypeError("attempted to get private field on non-instance");
214
- }
215
- return privateMap.get(receiver);
216
- }
217
-
218
- function __classPrivateFieldSet(receiver, privateMap, value) {
219
- if (!privateMap.has(receiver)) {
220
- throw new TypeError("attempted to set private field on non-instance");
221
- }
222
- privateMap.set(receiver, value);
223
- return value;
224
- }
225
-
226
- var VsChipdropdownService = /** @class */ (function () {
227
- function VsChipdropdownService(http) {
228
- this.http = http;
229
- }
230
- VsChipdropdownService.prototype.postApi = function (Apiurl, json, params) {
231
- if (json === void 0) { json = {}; }
232
- var getToken = localStorage.getItem("sessionData");
233
- var tokenValue = JSON.parse(getToken);
234
- var token = tokenValue.token;
235
- console.log("params", params);
236
- var paradata = '';
237
- if (params !== undefined && params !== null && params !== '') {
238
- paradata = params;
239
- }
240
- var headers = { Authorization: "Token " + token };
241
- return this.http.post(Apiurl + paradata, json, {
242
- headers: headers,
243
- });
244
- };
245
- VsChipdropdownService.prototype.GetApi = function (Apiurl, params) {
246
- if (params === void 0) { params = ''; }
247
- var getToken = localStorage.getItem("sessionData");
248
- var tokenValue = JSON.parse(getToken);
249
- var token = tokenValue.token;
250
- console.log("params", params);
251
- var paradata = '';
252
- if (params !== undefined && params !== null && params !== '') {
253
- paradata = params;
254
- }
255
- var headers = { Authorization: "Token " + token };
256
- return this.http.get(Apiurl + paradata, {
257
- headers: headers,
258
- });
259
- };
260
- VsChipdropdownService.ctorParameters = function () { return [
261
- { type: http.HttpClient }
262
- ]; };
263
- VsChipdropdownService.ɵprov = core.ɵɵdefineInjectable({ factory: function VsChipdropdownService_Factory() { return new VsChipdropdownService(core.ɵɵinject(http.HttpClient)); }, token: VsChipdropdownService, providedIn: "root" });
264
- VsChipdropdownService = __decorate([
265
- core.Injectable({
266
- providedIn: 'root'
267
- })
268
- ], VsChipdropdownService);
269
- return VsChipdropdownService;
270
- }());
271
-
272
- var VsChipdropdownComponent = /** @class */ (function () {
273
- function VsChipdropdownComponent() {
274
- }
275
- VsChipdropdownComponent.prototype.ngOnInit = function () {
276
- };
277
- VsChipdropdownComponent = __decorate([
278
- core.Component({
279
- selector: 'lib-vs-chipdropdown',
280
- template: "\n <p>\n vs-chipdropdown works!\n </p>\n "
281
- })
282
- ], VsChipdropdownComponent);
283
- return VsChipdropdownComponent;
284
- }());
285
-
286
- var VsChipddCmpComponent = /** @class */ (function () {
287
- function VsChipddCmpComponent(service, fb) {
288
- this.service = service;
289
- this.fb = fb;
290
- this.Backendapi = true;
291
- this.dataEvent = new core.EventEmitter();
292
- this.separatorsKeysCodes = [keycodes.ENTER, keycodes.COMMA];
293
- this.has_next = false;
294
- this.currentpage = 1;
295
- this.Dropdowndata = [];
296
- this.has_previous = false;
297
- this.chipSelectedId = [];
298
- this.chipSelectedObj = [];
299
- this.isOptionSelected = false;
300
- this.Outputdata = [];
301
- this.formkeyarr = [];
302
- }
303
- VsChipddCmpComponent.prototype.ngOnInit = function () {
304
- // if (this.formGroup) {
305
- // this.DropdownForm = this.formGroup;
306
- // } else {
307
- // this.DropdownForm = this.fb.group({
308
- // value: '',
309
- // });
310
- // }
311
- // this.dupngonit();
312
- // if (this.InputFields?.defaultvalue) {
313
- // this.DropdownForm.get("value").patchValue(this.InputFields?.defaultvalue)
314
- // this.chipSelectedObj = this.InputFields?.defaultvalue
315
- // if (this.chipSelectedObj.length > 0) {
316
- // for (let foundemp of this.chipSelectedObj) {
317
- // if (this.InputFields?.Outputkey) {
318
- // this.chipSelectedId.push(foundemp[this.InputFields?.Outputkey])
319
- // }
320
- // else {
321
- // this.chipSelectedId.push(foundemp.id)
322
- // }
323
- // }
324
- // this.selected()
325
- // }
326
- // }
327
- // if (this.InputFields?.fronentdata) {
328
- // this.Dropdowndata = this.InputFields?.data
329
- // }
330
- // else {
331
- // this.getdropdown('')
332
- // }
333
- };
334
- VsChipddCmpComponent.prototype.looop = function () {
335
- var e_1, _a;
336
- var _b, _c, _d, _e;
337
- try {
338
- for (var _f = __values(this.chipSelectedObj), _g = _f.next(); !_g.done; _g = _f.next()) {
339
- var foundemp = _g.value;
340
- if (!(foundemp instanceof Number)) {
341
- if ((_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.Outputkey) {
342
- this.chipSelectedId.push(foundemp[(_c = this.InputFields) === null || _c === void 0 ? void 0 : _c.Outputkey]);
343
- }
344
- else {
345
- this.chipSelectedId.push(foundemp.id);
346
- }
347
- if ((_d = this.InputFields) === null || _d === void 0 ? void 0 : _d.formkey) {
348
- this.formkeyarr.push(foundemp[(_e = this.InputFields) === null || _e === void 0 ? void 0 : _e.formkey]);
349
- }
350
- }
351
- }
352
- }
353
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
354
- finally {
355
- try {
356
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
357
- }
358
- finally { if (e_1) throw e_1.error; }
359
- }
360
- };
361
- VsChipddCmpComponent.prototype.dupngonit = function () {
362
- var _a, _b, _c, _d, _e, _f, _g, _h;
363
- if (this.formGroup) {
364
- this.DropdownForm = this.formGroup;
365
- if (!this.DropdownForm.contains((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.formcontrolname)) {
366
- this.DropdownForm.addControl(this.dynamciformcontrolparent(), new forms.FormControl({ value: [], disabled: (_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.disabled }));
367
- }
368
- else {
369
- ((_c = this.InputFields) === null || _c === void 0 ? void 0 : _c.disabled) ? this.DropdownForm.get('chipvalue').disable() : '';
370
- }
371
- }
372
- else {
373
- this.DropdownForm = this.fb.group({
374
- chipvalue: [], disabled: (_d = this.InputFields) === null || _d === void 0 ? void 0 : _d.disabled
375
- });
376
- }
377
- console.log('this.DropdownForm', this.DropdownForm.value);
378
- // this.chipSelectedObj =
379
- // this.DropdownForm.get(this.dynamciformcontrolparent()).value &&
380
- // this.DropdownForm.get(this.dynamciformcontrolparent()).value.length !== 0
381
- // ? this.DropdownForm.get(this.dynamciformcontrolparent()).value
382
- // : [];
383
- // console.log('this.chipSelectedObj', this.chipSelectedObj);
384
- if ((_e = this.InputFields) === null || _e === void 0 ? void 0 : _e.defaultvalue) {
385
- // this.DropdownForm.get(this.dynamciformcontrolparent()).patchValue(
386
- // this.InputFields?.formkey
387
- // ? this.InputFields?.defaultvalue[this.InputFields?.formkey]
388
- // : this.InputFields?.defaultvalue
389
- // );
390
- // this.DropdownForm.get(this.dynamciformcontrolparent()).patchValue(this.InputFields?.defaultvalue);
391
- this.chipSelectedObj = (_f = this.InputFields) === null || _f === void 0 ? void 0 : _f.defaultvalue;
392
- this.chipSelectedId = [];
393
- this.formkeyarr = [];
394
- if (this.chipSelectedObj.length > 0) {
395
- this.looop();
396
- this.selected();
397
- }
398
- }
399
- if (this.DropdownForm.get(this.dynamciformcontrolparent()).value &&
400
- this.DropdownForm.get(this.dynamciformcontrolparent()).value.length !== 0) {
401
- this.chipSelectedObj = this.DropdownForm.get(this.dynamciformcontrolparent()).value;
402
- console.log('test', this.chipSelectedObj = this.DropdownForm.get(this.dynamciformcontrolparent()).value);
403
- this.chipSelectedId = [];
404
- this.formkeyarr = [];
405
- this.looop();
406
- this.selected();
407
- }
408
- if ((_g = this.InputFields) === null || _g === void 0 ? void 0 : _g.fronentdata) {
409
- this.Dropdowndata = (_h = this.InputFields) === null || _h === void 0 ? void 0 : _h.data;
410
- }
411
- this.dropdownsearch();
412
- // else {
413
- // this.getdropdown('')
414
- // }
415
- };
416
- VsChipddCmpComponent.prototype.ngOnChanges = function (changes) {
417
- if (changes.InputFields && changes.InputFields.currentValue) {
418
- console.log('Summary Log Changes');
419
- this.currentpage = 1;
420
- this.dupngonit();
421
- }
422
- if (changes.ResetForm && changes.ResetForm.currentValue) {
423
- console.log('hitted');
424
- // this.DropdownForm.reset();
425
- this.currentpage = 1;
426
- this.dupngonit();
427
- this.chipSelectedId = [];
428
- this.formkeyarr = [];
429
- this.chipSelectedObj = [];
430
- this.dataEvent.emit([]);
431
- }
432
- };
433
- // public displaydevelopclient(clt: any, key: string) {
434
- // return key[clt];
435
- // }
436
- VsChipddCmpComponent.prototype.autocompleteAppScroll = function () {
437
- var _this = this;
438
- var _a;
439
- if (!((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.fronentdata)) {
440
- setTimeout(function () {
441
- if (_this.matAutocompleteApp &&
442
- _this.autocompleteTrigger &&
443
- _this.matAutocompleteApp.panel) {
444
- rxjs.fromEvent(_this.matAutocompleteApp.panel.nativeElement, 'scroll')
445
- .pipe(operators.map(function (x) { return _this.matAutocompleteApp.panel.nativeElement.scrollTop; }), operators.takeUntil(_this.autocompleteTrigger.panelClosingActions))
446
- .subscribe(function (x) {
447
- var scrollTop = _this.matAutocompleteApp.panel.nativeElement.scrollTop;
448
- var scrollHeight = _this.matAutocompleteApp.panel.nativeElement.scrollHeight;
449
- var elementHeight = _this.matAutocompleteApp.panel.nativeElement.clientHeight;
450
- var atBottom = scrollHeight - 1 <= scrollTop + elementHeight;
451
- if (atBottom) {
452
- if (_this.has_next === true) {
453
- var value = _this.DropInput.nativeElement.value;
454
- var params = _this.searchparams(value);
455
- _this.currentpage = _this.currentpage + 1;
456
- if (_this.currentpage > 1) {
457
- _this.service
458
- .GetApi(_this.InputFields.url + '?page=' + _this.currentpage, params)
459
- .subscribe(function (results) {
460
- var datas = results['data'];
461
- var datapagination = results['pagination'];
462
- _this.Dropdowndata = _this.Dropdowndata.concat(datas);
463
- console.log('this.Dropdowndata', _this.Dropdowndata);
464
- if (_this.Dropdowndata.length >= 0) {
465
- _this.has_next = datapagination.has_next;
466
- _this.has_previous = datapagination.has_previous;
467
- _this.currentpage = datapagination.index;
468
- }
469
- });
470
- }
471
- }
472
- }
473
- });
474
- }
475
- });
476
- }
477
- };
478
- VsChipddCmpComponent.prototype.dropdownsearch = function () {
479
- var _this = this;
480
- var _a, _b;
481
- var controlName = this.dynamciformcontrolparent();
482
- var control = this.DropdownForm.get(controlName);
483
- if (control) {
484
- if (!((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.fronentdata)) {
485
- if (!((_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.url)) {
486
- return false;
487
- }
488
- this.DropdownForm.get(this.dynamciformcontrolparent())
489
- .valueChanges.pipe(operators.debounceTime(300), operators.distinctUntilChanged(),
490
- // tap(() => {
491
- // this.DrodownLoading = true;
492
- // console.log('inside tap');
493
- // }),
494
- operators.switchMap(function (value) {
495
- if (_this.isOptionSelected) {
496
- _this.isOptionSelected = false;
497
- return [];
498
- }
499
- var params = _this.searchparams(value);
500
- _this.currentpage = 1;
501
- console.log("hiteeeedddddddddddddd>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
502
- return _this.service
503
- .GetApi(_this.InputFields.url + '?page=' + _this.currentpage, params)
504
- .pipe(operators.finalize(function () {
505
- _this.DrodownLoading = false;
506
- }));
507
- }))
508
- .subscribe(function (results) {
509
- _this.dataEvent.emit('');
510
- var datas = results['data'];
511
- _this.Dropdowndata = datas;
512
- });
513
- }
514
- else {
515
- // this.Dropdowndata = this.InputFields?.data
516
- this.DropdownForm.get(this.dynamciformcontrolparent()).valueChanges.subscribe(function (value) {
517
- var _a;
518
- _this.Dropdowndata = (_a = _this.InputFields) === null || _a === void 0 ? void 0 : _a.data.filter(function (item) { var _a, _b; return (_b = item[(_a = _this.InputFields) === null || _a === void 0 ? void 0 : _a.displaykey]) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value === null || value === void 0 ? void 0 : value.toLowerCase()); });
519
- });
520
- }
521
- }
522
- // if (control && !this.InputFields?.fronentdata) {
523
- // this.DropdownForm.get(this.dynamciformcontrolparent())
524
- // .valueChanges.pipe(
525
- // debounceTime(200),
526
- // distinctUntilChanged(),
527
- // tap(() => {
528
- // this.DrodownLoading = true;
529
- // console.log('inside tap');
530
- // }),
531
- // switchMap((value) => {
532
- // let params = this.searchparams(value);
533
- // this.currentpage = 1;
534
- // return this.service
535
- // .GetApi(
536
- // this.InputFields.url + '?page=' + this.currentpage,
537
- // params
538
- // )
539
- // .pipe(
540
- // finalize(() => {
541
- // this.DrodownLoading = false;
542
- // })
543
- // );
544
- // })
545
- // )
546
- // .subscribe((results: any[]) => {
547
- // let datas = results['data'];
548
- // this.Dropdowndata = datas;
549
- // });
550
- // }
551
- };
552
- VsChipddCmpComponent.prototype.getdropdown = function (value) {
553
- var _this = this;
554
- this.currentpage = 1;
555
- if (this.InputFields.url) {
556
- var params = this.searchparams(value);
557
- this.service
558
- .GetApi(this.InputFields.url + '?page=' + this.currentpage, params)
559
- .subscribe(function (results) {
560
- var datas = results['data'];
561
- var datapagination = results['pagination'];
562
- _this.Dropdowndata = datas;
563
- setTimeout(function () {
564
- _this.trigger.openPanel();
565
- }, 0);
566
- if (_this.Dropdowndata.length >= 0) {
567
- _this.has_next = datapagination.has_next;
568
- _this.has_previous = datapagination.has_previous;
569
- _this.currentpage = datapagination.index;
570
- }
571
- });
572
- }
573
- };
574
- VsChipddCmpComponent.prototype.dynamciformcontrolparent = function () {
575
- var _a, _b;
576
- return ((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.formcontrolname) && this.formGroup
577
- ? (_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.formcontrolname : 'chipvalue';
578
- };
579
- VsChipddCmpComponent.prototype.selected = function () {
580
- var _a, _b;
581
- this.Outputdata = this.chipSelectedObj;
582
- if ((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.Outputkey) {
583
- this.Outputdata = this.chipSelectedId;
584
- }
585
- if (this.formGroup && ((_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.formcontrolname)) {
586
- this.DropdownForm.get(this.dynamciformcontrolparent()).patchValue(this.formkeyarr);
587
- }
588
- console.log(this.formkeyarr);
589
- console.log('this.DropdownForm.get', this.DropdownForm.value);
590
- this.dataEvent.emit(this.Outputdata);
591
- // let data = this.DropdownForm.value.value
592
- // if (this.InputFields?.wholedata) {
593
- // this.dataEvent.emit(this.chipSelectedObj);
594
- // if (this.InputFields?.formgroup && this.InputFields?.formcontrolname) {
595
- // this.InputFields?.formgroup
596
- // .get(this.InputFields?.formcontrolname)
597
- // .patchValue(this.chipSelectedObj);
598
- // }
599
- // }
600
- // else {
601
- // if (this.InputFields?.Outputkey) {
602
- // this.dataEvent.emit(this.chipSelectedId);
603
- // if (this.InputFields?.formgroup && this.InputFields?.formcontrolname) {
604
- // this.InputFields?.formgroup
605
- // .get(this.InputFields?.formcontrolname)
606
- // .patchValue(this.chipSelectedId);
607
- // }
608
- // }
609
- // else {
610
- // this.dataEvent.emit(this.chipSelectedObj);
611
- // if (this.InputFields?.formgroup && this.InputFields?.formcontrolname) {
612
- // this.InputFields?.formgroup
613
- // .get(this.InputFields?.formcontrolname)
614
- // .patchValue(this.chipSelectedObj);
615
- // }
616
- // }
617
- // }
618
- };
619
- VsChipddCmpComponent.prototype.searchparams = function (value) {
620
- var params = '';
621
- if (this.InputFields.params) {
622
- params = this.InputFields.params;
623
- }
624
- var inpValue = value;
625
- inpValue
626
- ? (params += '&' + this.InputFields.searchkey + '=' + inpValue)
627
- : '';
628
- return params;
629
- };
630
- VsChipddCmpComponent.prototype.removechip = function (obj) {
631
- var index = this.chipSelectedObj.indexOf(obj);
632
- if (index >= 0) {
633
- this.chipSelectedObj.splice(index, 1);
634
- console.log(this.chipSelectedObj);
635
- this.chipSelectedId.splice(index, 1);
636
- console.log(this.chipSelectedId);
637
- this.formkeyarr.splice(index, 1);
638
- console.log('this.formkeyarr', this.formkeyarr);
639
- this.DropInput.nativeElement.value = '';
640
- this.selected();
641
- }
642
- };
643
- VsChipddCmpComponent.prototype.venSelected = function (datas) {
644
- var data = !datas && datas === '' ? datas : datas.option.value;
645
- this.isOptionSelected = true;
646
- this.DropInput.nativeElement.value = '';
647
- console.log('event.option.value', data);
648
- this.selectvenByName(data[this.comparekey(data)]);
649
- console.log('chipSelectedvenid', this.chipSelectedObj);
650
- };
651
- VsChipddCmpComponent.prototype.selectvenByName = function (ven) {
652
- var _this = this;
653
- var _a, _b, _c, _d;
654
- var foundemp1 = this.chipSelectedObj.filter(function (e) { return e[_this.comparekey(e)] == ven; });
655
- if (foundemp1.length) {
656
- return;
657
- }
658
- var foundemp = this.Dropdowndata.filter(function (e) { return e[_this.comparekey(e)] == ven; });
659
- if (foundemp.length) {
660
- this.chipSelectedObj.push(foundemp[0]);
661
- if ((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.Outputkey) {
662
- this.chipSelectedId.push(foundemp[0][(_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.Outputkey]);
663
- }
664
- else {
665
- this.chipSelectedId.push(foundemp[0].id);
666
- }
667
- if ((_c = this.InputFields) === null || _c === void 0 ? void 0 : _c.formkey) {
668
- this.formkeyarr.push(foundemp[0][(_d = this.InputFields) === null || _d === void 0 ? void 0 : _d.formkey]);
669
- }
670
- this.selected();
671
- }
672
- };
673
- VsChipddCmpComponent.prototype.comparekey = function (e) {
674
- var _a, _b;
675
- if ((_a = this.InputFields) === null || _a === void 0 ? void 0 : _a.comparekey) {
676
- return (_b = this.InputFields) === null || _b === void 0 ? void 0 : _b.comparekey;
677
- }
678
- else {
679
- if (e === null || e === void 0 ? void 0 : e.id) {
680
- return 'id';
681
- }
682
- else {
683
- return this.InputFields.displaykey;
684
- }
685
- }
686
- };
687
- VsChipddCmpComponent.ctorParameters = function () { return [
688
- { type: VsChipdropdownService },
689
- { type: forms.FormBuilder }
690
- ]; };
691
- __decorate([
692
- core.Input()
693
- ], VsChipddCmpComponent.prototype, "InputFields", void 0);
694
- __decorate([
695
- core.Input()
696
- ], VsChipddCmpComponent.prototype, "ResetForm", void 0);
697
- __decorate([
698
- core.Input()
699
- ], VsChipddCmpComponent.prototype, "Backendapi", void 0);
700
- __decorate([
701
- core.ViewChild('autoCompleteInput', {
702
- static: false,
703
- read: autocomplete.MatAutocompleteTrigger,
704
- })
705
- ], VsChipddCmpComponent.prototype, "trigger", void 0);
706
- __decorate([
707
- core.ViewChild(autocomplete.MatAutocompleteTrigger)
708
- ], VsChipddCmpComponent.prototype, "autocompleteTrigger", void 0);
709
- __decorate([
710
- core.ViewChild('scrolll')
711
- ], VsChipddCmpComponent.prototype, "matAutocompleteApp", void 0);
712
- __decorate([
713
- core.Output()
714
- ], VsChipddCmpComponent.prototype, "dataEvent", void 0);
715
- __decorate([
716
- core.ViewChild('DropInput')
717
- ], VsChipddCmpComponent.prototype, "DropInput", void 0);
718
- __decorate([
719
- core.Input()
720
- ], VsChipddCmpComponent.prototype, "formGroup", void 0);
721
- VsChipddCmpComponent = __decorate([
722
- core.Component({
723
- selector: 'lib-vs-chipdd-cmp',
724
- template: "<div>\r\n <form [formGroup]=\"DropdownForm\" id=\"matChip-size\">\r\n <!-- class=\"mat-chipScroll\" -->\r\n <mat-form-field\r\n appearance=\"outline\"\r\n (click)=\"!this.InputFields?.fronentdata ? this.getdropdown('') : ''\"\r\n >\r\n <mat-label>{{ InputFields?.label | translate }}</mat-label>\r\n <!-- class=\"chip-container\" -->\r\n <mat-chip-list multiple #chipListvendor>\r\n <!-- class=\"mat-chipEx\" -->\r\n <mat-chip\r\n *ngFor=\"let obj of chipSelectedObj\"\r\n [removable]=\"true\"\r\n (removed)=\"removechip(obj)\"\r\n >\r\n {{ obj[InputFields?.displaykey] }}\r\n <mat-icon matChipRemove>cancel</mat-icon>\r\n </mat-chip>\r\n <!-- class=\"matformfieldinputstyle\" -->\r\n <input\r\n #DropInput\r\n [matAutocomplete]=\"scrolll\"\r\n [matChipInputFor]=\"chipListvendor\"\r\n [matChipInputSeparatorKeyCodes]=\"separatorsKeysCodes\"\r\n [matChipInputAddOnBlur]=\"true\"\r\n #autoCompleteInput=\"matAutocompleteTrigger\"\r\n [formControlName]=\"this.dynamciformcontrolparent()\"\r\n />\r\n </mat-chip-list>\r\n <mat-autocomplete\r\n #scrolll=\"matAutocomplete\"\r\n (opened)=\"autocompleteAppScroll()\"\r\n >\r\n <ng-container>\r\n <mat-option\r\n *ngFor=\"let dropvalues of Dropdowndata\"\r\n [value]=\"\r\n this.InputFields?.formkey\r\n ? dropvalues[this.InputFields?.formkey]\r\n : dropvalues\r\n \"\r\n (onSelectionChange)=\"venSelected(dropvalues)\"\r\n >\r\n {{ dropvalues[InputFields?.displaykey] }}\r\n </mat-option>\r\n </ng-container>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </form>\r\n</div>\r\n<!-- (click)=\"selected()\"\r\n -->\r\n<!-- (optionSelected)=\"venSelected($event)\"\r\n -->\r\n",
725
- styles: [""]
726
- })
727
- ], VsChipddCmpComponent);
728
- return VsChipddCmpComponent;
729
- }());
730
-
731
- // import {VsSharedModuleModule} from '@unnilouis.org/vs-shared-module'
732
- var VsChipdropdownModule = /** @class */ (function () {
733
- function VsChipdropdownModule() {
734
- }
735
- VsChipdropdownModule = __decorate([
736
- core.NgModule({
737
- declarations: [VsChipdropdownComponent, VsChipddCmpComponent],
738
- imports: [formField.MatFormFieldModule, input.MatInputModule, select.MatSelectModule, autocomplete.MatAutocompleteModule, forms.FormsModule, forms.ReactiveFormsModule, common.CommonModule, gridList.MatGridListModule, chips.MatChipsModule, icon.MatIconModule,
739
- core$1.TranslateModule,
740
- http.HttpClientModule,
741
- core$1.TranslateModule.forRoot({
742
- loader: {
743
- provide: core$1.TranslateLoader,
744
- useFactory: httpTranslateLoader,
745
- deps: [http.HttpClient],
746
- },
747
- }),],
748
- // imports: [VsSharedModuleModule],
749
- exports: [VsChipddCmpComponent]
750
- })
751
- ], VsChipdropdownModule);
752
- return VsChipdropdownModule;
753
- }());
754
- function httpTranslateLoader(http) {
755
- return new httpLoader.TranslateHttpLoader(http);
756
- }
757
-
758
- exports.VsChipddCmpComponent = VsChipddCmpComponent;
759
- exports.VsChipdropdownComponent = VsChipdropdownComponent;
760
- exports.VsChipdropdownModule = VsChipdropdownModule;
761
- exports.VsChipdropdownService = VsChipdropdownService;
762
- exports.httpTranslateLoader = httpTranslateLoader;
763
-
764
- Object.defineProperty(exports, '__esModule', { value: true });
765
-
766
- })));
767
- //# sourceMappingURL=unnilouis.org-vs-chipdropdown.umd.js.map