@rxap/material-table-window-system 12.0.9 → 13.0.0-next.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.
@@ -1,622 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@rxap/material-table-system'), require('@rxap/window-system'), require('rxjs/operators'), require('@rxap/data-source/table'), require('@angular/cdk/portal'), require('@rxap/utilities'), require('@angular/material/form-field'), require('@rxap/form-system'), require('@rxap/mixin'), require('@rxap/forms'), require('@rxap/data-source'), require('@angular/material/select')) :
3
- typeof define === 'function' && define.amd ? define('@rxap/material-table-window-system', ['exports', '@angular/core', '@rxap/material-table-system', '@rxap/window-system', 'rxjs/operators', '@rxap/data-source/table', '@angular/cdk/portal', '@rxap/utilities', '@angular/material/form-field', '@rxap/form-system', '@rxap/mixin', '@rxap/forms', '@rxap/data-source', '@angular/material/select'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.rxap = global.rxap || {}, global.rxap['material-table-window-system'] = {}), global.ng.core, global.materialTableSystem, global.i1, global.rxjs.operators, global.table, global.ng.cdk.portal, global.utilities, global.ng.material.formField, global.formSystem, global.mixin, global.forms, global.i2, global.ng.material.select));
5
- }(this, (function (exports, i0, materialTableSystem, i1, operators, table, portal, utilities, i1$1, formSystem, mixin, forms, i2, select) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
19
- });
20
- }
21
- });
22
- }
23
- n['default'] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
30
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
-
32
- /*! *****************************************************************************
33
- Copyright (c) Microsoft Corporation.
34
-
35
- Permission to use, copy, modify, and/or distribute this software for any
36
- purpose with or without fee is hereby granted.
37
-
38
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
- PERFORMANCE OF THIS SOFTWARE.
45
- ***************************************************************************** */
46
- /* global Reflect, Promise */
47
- var extendStatics = function (d, b) {
48
- extendStatics = Object.setPrototypeOf ||
49
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50
- function (d, b) { for (var p in b)
51
- if (Object.prototype.hasOwnProperty.call(b, p))
52
- d[p] = b[p]; };
53
- return extendStatics(d, b);
54
- };
55
- function __extends(d, b) {
56
- if (typeof b !== "function" && b !== null)
57
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
- extendStatics(d, b);
59
- function __() { this.constructor = d; }
60
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
61
- }
62
- var __assign = function () {
63
- __assign = Object.assign || function __assign(t) {
64
- for (var s, i = 1, n = arguments.length; i < n; i++) {
65
- s = arguments[i];
66
- for (var p in s)
67
- if (Object.prototype.hasOwnProperty.call(s, p))
68
- t[p] = s[p];
69
- }
70
- return t;
71
- };
72
- return __assign.apply(this, arguments);
73
- };
74
- function __rest(s, e) {
75
- var t = {};
76
- for (var p in s)
77
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
- t[p] = s[p];
79
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
- t[p[i]] = s[p[i]];
83
- }
84
- return t;
85
- }
86
- function __decorate(decorators, target, key, desc) {
87
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
88
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
89
- r = Reflect.decorate(decorators, target, key, desc);
90
- else
91
- for (var i = decorators.length - 1; i >= 0; i--)
92
- if (d = decorators[i])
93
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
94
- return c > 3 && r && Object.defineProperty(target, key, r), r;
95
- }
96
- function __param(paramIndex, decorator) {
97
- return function (target, key) { decorator(target, key, paramIndex); };
98
- }
99
- function __metadata(metadataKey, metadataValue) {
100
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
101
- return Reflect.metadata(metadataKey, metadataValue);
102
- }
103
- function __awaiter(thisArg, _arguments, P, generator) {
104
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
105
- return new (P || (P = Promise))(function (resolve, reject) {
106
- function fulfilled(value) { try {
107
- step(generator.next(value));
108
- }
109
- catch (e) {
110
- reject(e);
111
- } }
112
- function rejected(value) { try {
113
- step(generator["throw"](value));
114
- }
115
- catch (e) {
116
- reject(e);
117
- } }
118
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
119
- step((generator = generator.apply(thisArg, _arguments || [])).next());
120
- });
121
- }
122
- function __generator(thisArg, body) {
123
- var _ = { label: 0, sent: function () { if (t[0] & 1)
124
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
125
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
126
- function verb(n) { return function (v) { return step([n, v]); }; }
127
- function step(op) {
128
- if (f)
129
- throw new TypeError("Generator is already executing.");
130
- while (_)
131
- try {
132
- 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)
133
- return t;
134
- if (y = 0, t)
135
- op = [op[0] & 2, t.value];
136
- switch (op[0]) {
137
- case 0:
138
- case 1:
139
- t = op;
140
- break;
141
- case 4:
142
- _.label++;
143
- return { value: op[1], done: false };
144
- case 5:
145
- _.label++;
146
- y = op[1];
147
- op = [0];
148
- continue;
149
- case 7:
150
- op = _.ops.pop();
151
- _.trys.pop();
152
- continue;
153
- default:
154
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
155
- _ = 0;
156
- continue;
157
- }
158
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
159
- _.label = op[1];
160
- break;
161
- }
162
- if (op[0] === 6 && _.label < t[1]) {
163
- _.label = t[1];
164
- t = op;
165
- break;
166
- }
167
- if (t && _.label < t[2]) {
168
- _.label = t[2];
169
- _.ops.push(op);
170
- break;
171
- }
172
- if (t[2])
173
- _.ops.pop();
174
- _.trys.pop();
175
- continue;
176
- }
177
- op = body.call(thisArg, _);
178
- }
179
- catch (e) {
180
- op = [6, e];
181
- y = 0;
182
- }
183
- finally {
184
- f = t = 0;
185
- }
186
- if (op[0] & 5)
187
- throw op[1];
188
- return { value: op[0] ? op[1] : void 0, done: true };
189
- }
190
- }
191
- var __createBinding = Object.create ? (function (o, m, k, k2) {
192
- if (k2 === undefined)
193
- k2 = k;
194
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
195
- }) : (function (o, m, k, k2) {
196
- if (k2 === undefined)
197
- k2 = k;
198
- o[k2] = m[k];
199
- });
200
- function __exportStar(m, o) {
201
- for (var p in m)
202
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
203
- __createBinding(o, m, p);
204
- }
205
- function __values(o) {
206
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
207
- if (m)
208
- return m.call(o);
209
- if (o && typeof o.length === "number")
210
- return {
211
- next: function () {
212
- if (o && i >= o.length)
213
- o = void 0;
214
- return { value: o && o[i++], done: !o };
215
- }
216
- };
217
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
218
- }
219
- function __read(o, n) {
220
- var m = typeof Symbol === "function" && o[Symbol.iterator];
221
- if (!m)
222
- return o;
223
- var i = m.call(o), r, ar = [], e;
224
- try {
225
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
226
- ar.push(r.value);
227
- }
228
- catch (error) {
229
- e = { error: error };
230
- }
231
- finally {
232
- try {
233
- if (r && !r.done && (m = i["return"]))
234
- m.call(i);
235
- }
236
- finally {
237
- if (e)
238
- throw e.error;
239
- }
240
- }
241
- return ar;
242
- }
243
- /** @deprecated */
244
- function __spread() {
245
- for (var ar = [], i = 0; i < arguments.length; i++)
246
- ar = ar.concat(__read(arguments[i]));
247
- return ar;
248
- }
249
- /** @deprecated */
250
- function __spreadArrays() {
251
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
252
- s += arguments[i].length;
253
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
254
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
255
- r[k] = a[j];
256
- return r;
257
- }
258
- function __spreadArray(to, from) {
259
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
260
- to[j] = from[i];
261
- return to;
262
- }
263
- function __await(v) {
264
- return this instanceof __await ? (this.v = v, this) : new __await(v);
265
- }
266
- function __asyncGenerator(thisArg, _arguments, generator) {
267
- if (!Symbol.asyncIterator)
268
- throw new TypeError("Symbol.asyncIterator is not defined.");
269
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
270
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
271
- function verb(n) { if (g[n])
272
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
273
- function resume(n, v) { try {
274
- step(g[n](v));
275
- }
276
- catch (e) {
277
- settle(q[0][3], e);
278
- } }
279
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
280
- function fulfill(value) { resume("next", value); }
281
- function reject(value) { resume("throw", value); }
282
- function settle(f, v) { if (f(v), q.shift(), q.length)
283
- resume(q[0][0], q[0][1]); }
284
- }
285
- function __asyncDelegator(o) {
286
- var i, p;
287
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
288
- 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; }
289
- }
290
- function __asyncValues(o) {
291
- if (!Symbol.asyncIterator)
292
- throw new TypeError("Symbol.asyncIterator is not defined.");
293
- var m = o[Symbol.asyncIterator], i;
294
- 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);
295
- 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); }); }; }
296
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
297
- }
298
- function __makeTemplateObject(cooked, raw) {
299
- if (Object.defineProperty) {
300
- Object.defineProperty(cooked, "raw", { value: raw });
301
- }
302
- else {
303
- cooked.raw = raw;
304
- }
305
- return cooked;
306
- }
307
- ;
308
- var __setModuleDefault = Object.create ? (function (o, v) {
309
- Object.defineProperty(o, "default", { enumerable: true, value: v });
310
- }) : function (o, v) {
311
- o["default"] = v;
312
- };
313
- function __importStar(mod) {
314
- if (mod && mod.__esModule)
315
- return mod;
316
- var result = {};
317
- if (mod != null)
318
- for (var k in mod)
319
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
320
- __createBinding(result, mod, k);
321
- __setModuleDefault(result, mod);
322
- return result;
323
- }
324
- function __importDefault(mod) {
325
- return (mod && mod.__esModule) ? mod : { default: mod };
326
- }
327
- function __classPrivateFieldGet(receiver, state, kind, f) {
328
- if (kind === "a" && !f)
329
- throw new TypeError("Private accessor was defined without a getter");
330
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
331
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
332
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
333
- }
334
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
335
- if (kind === "m")
336
- throw new TypeError("Private method is not writable");
337
- if (kind === "a" && !f)
338
- throw new TypeError("Private accessor was defined without a setter");
339
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
340
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
341
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
342
- }
343
-
344
- var WindowTableSelectService = /** @class */ (function () {
345
- function WindowTableSelectService(windowService, injector) {
346
- this.windowService = windowService;
347
- this.injector = injector;
348
- }
349
- WindowTableSelectService.prototype.open = function (component, options, windowConfig) {
350
- if (windowConfig === void 0) { windowConfig = {}; }
351
- var _a, _b, _c, _d, _e;
352
- var providers = [
353
- {
354
- provide: materialTableSystem.RXAP_MATERIAL_TABLE_SYSTEM_SELECT_ROW_OPTIONS,
355
- useValue: {
356
- multiple: (_a = options.multiple) !== null && _a !== void 0 ? _a : false,
357
- selected: (_b = options.selected) !== null && _b !== void 0 ? _b : []
358
- }
359
- },
360
- {
361
- provide: i1.RXAP_WINDOW_SETTINGS,
362
- useValue: {
363
- title: (_c = options.title) !== null && _c !== void 0 ? _c : $localize(templateObject_1 || (templateObject_1 = __makeTemplateObject([":@@rxap.window-table-system.select-table.title:Select Options"], [":@@rxap.window-table-system.select-table.title:Select Options"]))),
364
- },
365
- },
366
- ];
367
- if (options.data) {
368
- providers.push({
369
- provide: materialTableSystem.TABLE_DATA_SOURCE,
370
- useValue: new table.TableDataSource(options.data),
371
- });
372
- }
373
- else {
374
- providers.push({
375
- provide: materialTableSystem.TABLE_DATA_SOURCE,
376
- useValue: null
377
- });
378
- }
379
- providers.push({
380
- provide: materialTableSystem.TABLE_REMOTE_METHOD,
381
- useValue: null
382
- });
383
- providers.push({
384
- provide: materialTableSystem.RXAP_TABLE_METHOD,
385
- useValue: null
386
- });
387
- var windowRef = this.windowService.open(Object.assign(Object.assign({}, windowConfig), { viewContainerRef: options.viewContainerRef, injector: i0.Injector.create({
388
- parent: (_e = (_d = options.injector) !== null && _d !== void 0 ? _d : windowConfig.injector) !== null && _e !== void 0 ? _e : this.injector,
389
- providers: providers
390
- }), component: component }));
391
- windowRef.attachedRef$
392
- .pipe(operators.take(1), operators.tap(function (attachedRef) {
393
- if (attachedRef instanceof i0.ComponentRef) {
394
- windowRef.setFooterPortal(new portal.ComponentPortal(materialTableSystem.TableSelectControlsComponent, options.viewContainerRef, attachedRef.injector));
395
- }
396
- else {
397
- throw new Error('FATAL: the attached ref was not an instance of Component ref');
398
- }
399
- }))
400
- .subscribe();
401
- var promise = windowRef.closed$
402
- .pipe(operators.take(1), operators.map(function (selected) { return selected !== null && selected !== void 0 ? selected : []; }))
403
- .toPromise();
404
- // add the windowRef to the promise instance
405
- // The windowRef instance can be used to cancel the window
406
- // If the calling component / directive is destroyed the created window should
407
- // be also destroyed
408
- promise.windowRef = windowRef;
409
- return promise;
410
- };
411
- return WindowTableSelectService;
412
- }());
413
- WindowTableSelectService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectService, deps: [{ token: i1.WindowService }, { token: i0.INJECTOR }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
414
- WindowTableSelectService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectService, providedIn: 'root' });
415
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectService, decorators: [{
416
- type: i0.Injectable,
417
- args: [{ providedIn: 'root' }]
418
- }], ctorParameters: function () {
419
- return [{ type: i1__namespace.WindowService, decorators: [{
420
- type: i0.Inject,
421
- args: [i1.WindowService]
422
- }] }, { type: i0__namespace.Injector, decorators: [{
423
- type: i0.Inject,
424
- args: [i0.INJECTOR]
425
- }] }];
426
- } });
427
- var templateObject_1;
428
-
429
- var WindowTableSelectModule = /** @class */ (function () {
430
- function WindowTableSelectModule() {
431
- }
432
- return WindowTableSelectModule;
433
- }());
434
- WindowTableSelectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
435
- WindowTableSelectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectModule, exports: [materialTableSystem.TableSelectControlsComponentModule] });
436
- WindowTableSelectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectModule, providers: [WindowTableSelectService], imports: [materialTableSystem.TableSelectControlsComponentModule] });
437
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: WindowTableSelectModule, decorators: [{
438
- type: i0.NgModule,
439
- args: [{
440
- exports: [materialTableSystem.TableSelectControlsComponentModule],
441
- providers: [WindowTableSelectService]
442
- }]
443
- }] });
444
-
445
- exports.ExtractDatasourceMixin = /** @class */ (function () {
446
- function ExtractDatasourceMixin() {
447
- }
448
- // TODO : mv to rxap and replace in InputSelectOptionsDirective
449
- ExtractDatasourceMixin.prototype.extractDatasource = function (dataSourceName, control) {
450
- if (control === void 0) { control = this.control; }
451
- var useDataSourceValue = this.extractDataSourceValue(dataSourceName, control);
452
- var dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, this.metadata, this.injector);
453
- var settings = useDataSourceValue.settings;
454
- if (settings === null || settings === void 0 ? void 0 : settings.transformer) {
455
- dataSource = new i2.PipeDataSource(dataSource, operators.map(settings.transformer));
456
- }
457
- return this.dataSource = dataSource;
458
- };
459
- ExtractDatasourceMixin.prototype.extractDataSourceValue = function (dataSourceName, control) {
460
- if (control === void 0) { control = this.control; }
461
- var formDefinition = this.extractFormDefinition(control);
462
- var useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
463
- if (!useDataSourceValueMap.has(dataSourceName)) {
464
- throw new Error("The data source with the name 'options' is not defined");
465
- }
466
- return useDataSourceValueMap.get(dataSourceName);
467
- };
468
- ExtractDatasourceMixin.prototype.extractDataSourceTransformer = function (dataSourceName, control) {
469
- if (control === void 0) { control = this.control; }
470
- var _a;
471
- var useDataSourceValue = this.extractDataSourceValue(dataSourceName, control);
472
- var settings = useDataSourceValue.settings;
473
- return (_a = settings === null || settings === void 0 ? void 0 : settings.transformer) !== null && _a !== void 0 ? _a : (function (v) { return v; });
474
- };
475
- return ExtractDatasourceMixin;
476
- }());
477
- exports.ExtractDatasourceMixin = __decorate([
478
- mixin.Mixin(formSystem.ExtractFormDefinitionMixin, formSystem.ExtractDataSourcesMixin)
479
- ], exports.ExtractDatasourceMixin);
480
- exports.OpenTableSelectDirective = /** @class */ (function () {
481
- function OpenTableSelectDirective(formField, dataSourceLoader, injector, viewContainerRef) {
482
- this.formField = formField;
483
- this.dataSourceLoader = dataSourceLoader;
484
- this.injector = injector;
485
- this.viewContainerRef = viewContainerRef;
486
- this.type = 'button';
487
- this._windowRef = null;
488
- }
489
- OpenTableSelectDirective.prototype.ngOnInit = function () {
490
- var _a;
491
- var control = (_a = this.formField._control.ngControl) === null || _a === void 0 ? void 0 : _a.control;
492
- if (!control) {
493
- throw new Error('Could not extract the control from the form field');
494
- }
495
- if (!(control instanceof forms.RxapFormControl)) {
496
- throw new Error('The control is not an instance of RxapFormControl');
497
- }
498
- this.extractDatasource('options', this.control = control);
499
- this.tableSelectDataSource = new i2.PipeDataSource(this.dataSource, operators.map(function (source) {
500
- if (!Array.isArray(source)) {
501
- throw new Error('Only control options data source are supported as source data source for a select table');
502
- }
503
- return source.map(function (item) { return item.value; });
504
- }));
505
- };
506
- OpenTableSelectDirective.prototype.onClick = function () {
507
- var _a, _b;
508
- return __awaiter(this, void 0, void 0, function () {
509
- var selected$, selected;
510
- return __generator(this, function (_c) {
511
- switch (_c.label) {
512
- case 0:
513
- selected$ = this.openMethod.call({
514
- data: this.tableSelectDataSource,
515
- selected: utilities.coerceArray(this.control.value),
516
- multiple: this.isMultiple(),
517
- injector: this.injector,
518
- viewContainerRef: this.viewContainerRef
519
- });
520
- // set the component windowRef. If the component is destroyed
521
- // before the promise is resolved. The window is closed in
522
- // the ngOnDestroy hook
523
- this._windowRef = (_a = selected$.windowRef) !== null && _a !== void 0 ? _a : null;
524
- return [4 /*yield*/, selected$];
525
- case 1:
526
- selected = _c.sent();
527
- this._windowRef = null;
528
- if (i0.isDevMode()) {
529
- console.log('table select returns', selected);
530
- }
531
- if (selected && Array.isArray(selected)) {
532
- if (this.isMultiple()) {
533
- this.control.setValue(selected);
534
- }
535
- else {
536
- this.control.setValue((_b = selected[0]) !== null && _b !== void 0 ? _b : null);
537
- }
538
- }
539
- return [2 /*return*/];
540
- }
541
- });
542
- });
543
- };
544
- OpenTableSelectDirective.prototype.ngOnDestroy = function () {
545
- var _a;
546
- (_a = this._windowRef) === null || _a === void 0 ? void 0 : _a.complete();
547
- };
548
- OpenTableSelectDirective.prototype.isMultiple = function () {
549
- var formFieldControl = this.formField._control;
550
- if (formFieldControl instanceof select.MatSelect) {
551
- return formFieldControl.multiple;
552
- }
553
- return false;
554
- };
555
- return OpenTableSelectDirective;
556
- }());
557
- exports.OpenTableSelectDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: exports.OpenTableSelectDirective, deps: [{ token: i1$1.MAT_FORM_FIELD }, { token: i2.DataSourceLoader }, { token: i0.INJECTOR }, { token: i0.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
558
- exports.OpenTableSelectDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: exports.OpenTableSelectDirective, selector: "[rxapOpenTableSelect]", inputs: { openMethod: ["rxapOpenTableSelect", "openMethod"] }, host: { listeners: { "click": "onClick()" }, properties: { "type": "this.type" } }, ngImport: i0__namespace });
559
- exports.OpenTableSelectDirective = __decorate([
560
- mixin.Mixin(exports.ExtractDatasourceMixin),
561
- __metadata("design:paramtypes", [i1$1.MatFormField,
562
- i2.DataSourceLoader,
563
- i0.Injector,
564
- i0.ViewContainerRef])
565
- ], exports.OpenTableSelectDirective);
566
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: exports.OpenTableSelectDirective, decorators: [{
567
- type: i0.Directive,
568
- args: [{
569
- selector: '[rxapOpenTableSelect]'
570
- }]
571
- }], ctorParameters: function () {
572
- return [{ type: i1__namespace$1.MatFormField, decorators: [{
573
- type: i0.Inject,
574
- args: [i1$1.MAT_FORM_FIELD]
575
- }] }, { type: i2__namespace.DataSourceLoader, decorators: [{
576
- type: i0.Inject,
577
- args: [i2.DataSourceLoader]
578
- }] }, { type: i0__namespace.Injector, decorators: [{
579
- type: i0.Inject,
580
- args: [i0.INJECTOR]
581
- }] }, { type: i0__namespace.ViewContainerRef, decorators: [{
582
- type: i0.Inject,
583
- args: [i0.ViewContainerRef]
584
- }] }];
585
- }, propDecorators: { type: [{
586
- type: i0.HostBinding,
587
- args: ['type']
588
- }], openMethod: [{
589
- type: i0.Input,
590
- args: ['rxapOpenTableSelect']
591
- }], onClick: [{
592
- type: i0.HostListener,
593
- args: ['click']
594
- }] } });
595
- var OpenTableSelectDirectiveModule = /** @class */ (function () {
596
- function OpenTableSelectDirectiveModule() {
597
- }
598
- return OpenTableSelectDirectiveModule;
599
- }());
600
- OpenTableSelectDirectiveModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OpenTableSelectDirectiveModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
601
- OpenTableSelectDirectiveModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OpenTableSelectDirectiveModule, declarations: [exports.OpenTableSelectDirective], exports: [exports.OpenTableSelectDirective] });
602
- OpenTableSelectDirectiveModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OpenTableSelectDirectiveModule });
603
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: OpenTableSelectDirectiveModule, decorators: [{
604
- type: i0.NgModule,
605
- args: [{
606
- declarations: [exports.OpenTableSelectDirective],
607
- exports: [exports.OpenTableSelectDirective]
608
- }]
609
- }] });
610
-
611
- /**
612
- * Generated bundle index. Do not edit.
613
- */
614
-
615
- exports.OpenTableSelectDirectiveModule = OpenTableSelectDirectiveModule;
616
- exports.WindowTableSelectModule = WindowTableSelectModule;
617
- exports.WindowTableSelectService = WindowTableSelectService;
618
-
619
- Object.defineProperty(exports, '__esModule', { value: true });
620
-
621
- })));
622
- //# sourceMappingURL=rxap-material-table-window-system.umd.js.map