@den4ik92/ng2-smart-table 19.0.4 → 19.0.5
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/fesm2022/den4ik92-ng2-smart-table.mjs +241 -110
- package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
- package/lib/components/table-columns-editor/column-editor.directive.d.ts +18 -0
- package/lib/components/table-columns-editor/table-columns-editor.component.d.ts +19 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { output, Component, Input,
|
|
2
|
+
import { output, Component, Input, input, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
|
|
4
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
|
+
import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
|
|
3
6
|
import { Subject } from 'rxjs';
|
|
4
7
|
import * as i1 from '@angular/forms';
|
|
5
8
|
import { FormsModule, UntypedFormControl, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
@@ -171,6 +174,242 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
171
174
|
type: Input
|
|
172
175
|
}] } });
|
|
173
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Extending object that entered in first argument.
|
|
179
|
+
*
|
|
180
|
+
* Returns extended object or false if have no target object or incorrect type.
|
|
181
|
+
*
|
|
182
|
+
* If you wish to clone source object (without modify it), just use empty new
|
|
183
|
+
* object as first argument, like this:
|
|
184
|
+
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
185
|
+
*/
|
|
186
|
+
const deepExtend = function (...objects) {
|
|
187
|
+
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
if (arguments.length < 2) {
|
|
191
|
+
return arguments[0];
|
|
192
|
+
}
|
|
193
|
+
const target = arguments[0];
|
|
194
|
+
// convert arguments to array and cut off target object
|
|
195
|
+
const args = Array.prototype.slice.call(arguments, 1);
|
|
196
|
+
let val, src;
|
|
197
|
+
args.forEach((obj) => {
|
|
198
|
+
// skip argument if it is array or isn't object
|
|
199
|
+
if (typeof obj !== 'object' || Array.isArray(obj)) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
Object.keys(obj).forEach(function (key) {
|
|
203
|
+
src = target[key]; // source value
|
|
204
|
+
val = obj[key]; // new value
|
|
205
|
+
// recursion prevention
|
|
206
|
+
if (val === target) {
|
|
207
|
+
return;
|
|
208
|
+
/**
|
|
209
|
+
* if new value isn't object then just overwrite by new value
|
|
210
|
+
* instead of extending.
|
|
211
|
+
*/
|
|
212
|
+
}
|
|
213
|
+
else if (typeof val !== 'object' || val === null) {
|
|
214
|
+
target[key] = val;
|
|
215
|
+
return;
|
|
216
|
+
// just clone arrays (and recursive clone objects inside)
|
|
217
|
+
}
|
|
218
|
+
else if (Array.isArray(val)) {
|
|
219
|
+
target[key] = [...val];
|
|
220
|
+
return;
|
|
221
|
+
// overwrite by new value if source isn't object or array
|
|
222
|
+
}
|
|
223
|
+
else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
|
|
224
|
+
target[key] = deepExtend({}, val);
|
|
225
|
+
return;
|
|
226
|
+
// source value and new value is objects both, extending...
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
target[key] = deepExtend(src, val);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
return target;
|
|
235
|
+
};
|
|
236
|
+
class Deferred {
|
|
237
|
+
constructor() {
|
|
238
|
+
this.promise = new Promise((resolve, reject) => {
|
|
239
|
+
this.resolve = resolve;
|
|
240
|
+
this.reject = reject;
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
|
|
245
|
+
function getDeepFromObject(object = {}, name, defaultValue = null) {
|
|
246
|
+
try {
|
|
247
|
+
let level = deepExtend({}, object);
|
|
248
|
+
const keys = name.split('.');
|
|
249
|
+
if (keys.length === 1) {
|
|
250
|
+
return level[keys[0]] ?? defaultValue;
|
|
251
|
+
}
|
|
252
|
+
keys.forEach((k) => {
|
|
253
|
+
if (level && typeof level[k] !== 'undefined') {
|
|
254
|
+
level = level[k];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return defaultValue;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function getPageForRowIndex(index, perPage) {
|
|
263
|
+
// we need to add 1 to convert 0-based index to 1-based page number.
|
|
264
|
+
return Math.floor(index / perPage) + 1;
|
|
265
|
+
}
|
|
266
|
+
function cloneArrayOfObject(array) {
|
|
267
|
+
return array.map((obj) => Object.assign({}, obj));
|
|
268
|
+
}
|
|
269
|
+
function setLocalStorage(key, value) {
|
|
270
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
271
|
+
}
|
|
272
|
+
function getLocalStorage(key) {
|
|
273
|
+
const valueString = localStorage.getItem(key);
|
|
274
|
+
if (!valueString) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
return JSON.parse(valueString);
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
class TableColumnsEditorComponent {
|
|
286
|
+
constructor() {
|
|
287
|
+
this.infoText = "You can drag and drop columns as you wish and also disable unnecessary ones.";
|
|
288
|
+
this.grid = input.required();
|
|
289
|
+
this.close = input.required();
|
|
290
|
+
this.currentState = [];
|
|
291
|
+
this.stateHasChanged = signal(false);
|
|
292
|
+
effect(() => {
|
|
293
|
+
this.currentState = cloneArrayOfObject(this.grid().currentColumnsSortState).filter((column) => !column.sortDisabled);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
resetChanges() {
|
|
297
|
+
this.currentState = cloneArrayOfObject(this.grid().currentColumnsSortState);
|
|
298
|
+
this.stateHasChanged.set(false);
|
|
299
|
+
}
|
|
300
|
+
drop(event) {
|
|
301
|
+
moveItemInArray(this.currentState, event.previousIndex, event.currentIndex);
|
|
302
|
+
this.updateChangedState();
|
|
303
|
+
}
|
|
304
|
+
setVisibility(index) {
|
|
305
|
+
this.currentState[index].hide = !this.currentState[index].hide;
|
|
306
|
+
this.updateChangedState();
|
|
307
|
+
}
|
|
308
|
+
setAndUpdate() {
|
|
309
|
+
this.grid().applyColumnsSortState(this.currentState);
|
|
310
|
+
this.close()();
|
|
311
|
+
this.stateHasChanged.set(false);
|
|
312
|
+
}
|
|
313
|
+
updateChangedState() {
|
|
314
|
+
this.stateHasChanged.set(JSON.stringify(this.grid().currentColumnsSortState) !== JSON.stringify(this.currentState));
|
|
315
|
+
}
|
|
316
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
317
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TableColumnsEditorComponent, isStandalone: true, selector: "ngx-table-columns-editor", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, close: { classPropertyName: "close", publicName: "close", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h5>Table columns setup</h5>\n <svg\n width=\"14px\"\n height=\"14px\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\"\n fill=\"#1C274C\"\n />\n <path\n d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\"\n fill=\"#1C274C\"\n />\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\"\n fill=\"#1C274C\"\n />\n </svg>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h5{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"], dependencies: [{ kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }] }); }
|
|
318
|
+
}
|
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, decorators: [{
|
|
320
|
+
type: Component,
|
|
321
|
+
args: [{ selector: "ngx-table-columns-editor", imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h5>Table columns setup</h5>\n <svg\n width=\"14px\"\n height=\"14px\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\"\n fill=\"#1C274C\"\n />\n <path\n d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\"\n fill=\"#1C274C\"\n />\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\"\n fill=\"#1C274C\"\n />\n </svg>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h5{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"] }]
|
|
322
|
+
}], ctorParameters: () => [] });
|
|
323
|
+
|
|
324
|
+
class SmartTableColumnEditorDirective {
|
|
325
|
+
constructor() {
|
|
326
|
+
this.tableComponent = input.required();
|
|
327
|
+
this.grid = computed(() => {
|
|
328
|
+
return this.tableComponent().grid;
|
|
329
|
+
});
|
|
330
|
+
this.overlay = inject(Overlay);
|
|
331
|
+
this.elementRef = inject(ElementRef);
|
|
332
|
+
}
|
|
333
|
+
ngOnDestroy() {
|
|
334
|
+
this.overlayRef?.dispose();
|
|
335
|
+
}
|
|
336
|
+
showDropdown() {
|
|
337
|
+
this.overlayRef = this.overlay.create(this.getOverlayConfig());
|
|
338
|
+
const componentPortal = new ComponentPortal(TableColumnsEditorComponent);
|
|
339
|
+
const dropdownRef = this.overlayRef.attach(componentPortal);
|
|
340
|
+
dropdownRef.setInput("grid", this.grid());
|
|
341
|
+
dropdownRef.setInput("close", this.hide.bind(this));
|
|
342
|
+
this.overlayRef?.backdropClick().subscribe(() => this.hide());
|
|
343
|
+
}
|
|
344
|
+
hide() {
|
|
345
|
+
this.overlayRef?.detach();
|
|
346
|
+
this.overlayRef?.dispose();
|
|
347
|
+
}
|
|
348
|
+
buttonClick() {
|
|
349
|
+
this.showDropdown();
|
|
350
|
+
}
|
|
351
|
+
getOverlayConfig() {
|
|
352
|
+
const positionStrategy = this.overlay
|
|
353
|
+
.position()
|
|
354
|
+
.flexibleConnectedTo(this.elementRef)
|
|
355
|
+
.withPush(false)
|
|
356
|
+
.withPositions([
|
|
357
|
+
{
|
|
358
|
+
originX: "center",
|
|
359
|
+
originY: "bottom",
|
|
360
|
+
overlayX: "end",
|
|
361
|
+
overlayY: "top",
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
originX: "center",
|
|
365
|
+
originY: "bottom",
|
|
366
|
+
overlayX: "center",
|
|
367
|
+
overlayY: "top",
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
originX: "center",
|
|
371
|
+
originY: "bottom",
|
|
372
|
+
overlayX: "start",
|
|
373
|
+
overlayY: "top",
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
originX: "center",
|
|
377
|
+
originY: "top",
|
|
378
|
+
overlayX: "start",
|
|
379
|
+
overlayY: "bottom",
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
originX: "center",
|
|
383
|
+
originY: "top",
|
|
384
|
+
overlayX: "center",
|
|
385
|
+
overlayY: "bottom",
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
originX: "center",
|
|
389
|
+
originY: "top",
|
|
390
|
+
overlayX: "start",
|
|
391
|
+
overlayY: "bottom",
|
|
392
|
+
},
|
|
393
|
+
]);
|
|
394
|
+
return new OverlayConfig({
|
|
395
|
+
positionStrategy: positionStrategy,
|
|
396
|
+
hasBackdrop: true,
|
|
397
|
+
backdropClass: "cdk-overlay-transparent-backdrop",
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
401
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: SmartTableColumnEditorDirective, isStandalone: true, selector: "[smartTableColumnEditor]", inputs: { tableComponent: { classPropertyName: "tableComponent", publicName: "tableComponent", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "buttonClick()" } }, ngImport: i0 }); }
|
|
402
|
+
}
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, decorators: [{
|
|
404
|
+
type: Directive,
|
|
405
|
+
args: [{
|
|
406
|
+
selector: "[smartTableColumnEditor]",
|
|
407
|
+
host: {
|
|
408
|
+
"(click)": "buttonClick()",
|
|
409
|
+
},
|
|
410
|
+
}]
|
|
411
|
+
}] });
|
|
412
|
+
|
|
174
413
|
class Row {
|
|
175
414
|
constructor(index, data, _dataSet) {
|
|
176
415
|
this.index = index;
|
|
@@ -361,114 +600,6 @@ class LocalPager {
|
|
|
361
600
|
}
|
|
362
601
|
}
|
|
363
602
|
|
|
364
|
-
/**
|
|
365
|
-
* Extending object that entered in first argument.
|
|
366
|
-
*
|
|
367
|
-
* Returns extended object or false if have no target object or incorrect type.
|
|
368
|
-
*
|
|
369
|
-
* If you wish to clone source object (without modify it), just use empty new
|
|
370
|
-
* object as first argument, like this:
|
|
371
|
-
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
372
|
-
*/
|
|
373
|
-
const deepExtend = function (...objects) {
|
|
374
|
-
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
|
|
375
|
-
return false;
|
|
376
|
-
}
|
|
377
|
-
if (arguments.length < 2) {
|
|
378
|
-
return arguments[0];
|
|
379
|
-
}
|
|
380
|
-
const target = arguments[0];
|
|
381
|
-
// convert arguments to array and cut off target object
|
|
382
|
-
const args = Array.prototype.slice.call(arguments, 1);
|
|
383
|
-
let val, src;
|
|
384
|
-
args.forEach((obj) => {
|
|
385
|
-
// skip argument if it is array or isn't object
|
|
386
|
-
if (typeof obj !== 'object' || Array.isArray(obj)) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
Object.keys(obj).forEach(function (key) {
|
|
390
|
-
src = target[key]; // source value
|
|
391
|
-
val = obj[key]; // new value
|
|
392
|
-
// recursion prevention
|
|
393
|
-
if (val === target) {
|
|
394
|
-
return;
|
|
395
|
-
/**
|
|
396
|
-
* if new value isn't object then just overwrite by new value
|
|
397
|
-
* instead of extending.
|
|
398
|
-
*/
|
|
399
|
-
}
|
|
400
|
-
else if (typeof val !== 'object' || val === null) {
|
|
401
|
-
target[key] = val;
|
|
402
|
-
return;
|
|
403
|
-
// just clone arrays (and recursive clone objects inside)
|
|
404
|
-
}
|
|
405
|
-
else if (Array.isArray(val)) {
|
|
406
|
-
target[key] = [...val];
|
|
407
|
-
return;
|
|
408
|
-
// overwrite by new value if source isn't object or array
|
|
409
|
-
}
|
|
410
|
-
else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
|
|
411
|
-
target[key] = deepExtend({}, val);
|
|
412
|
-
return;
|
|
413
|
-
// source value and new value is objects both, extending...
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
target[key] = deepExtend(src, val);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
return target;
|
|
422
|
-
};
|
|
423
|
-
class Deferred {
|
|
424
|
-
constructor() {
|
|
425
|
-
this.promise = new Promise((resolve, reject) => {
|
|
426
|
-
this.resolve = resolve;
|
|
427
|
-
this.reject = reject;
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
// getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
|
|
432
|
-
function getDeepFromObject(object = {}, name, defaultValue = null) {
|
|
433
|
-
try {
|
|
434
|
-
let level = deepExtend({}, object);
|
|
435
|
-
const keys = name.split('.');
|
|
436
|
-
if (keys.length === 1) {
|
|
437
|
-
return level[keys[0]] ?? defaultValue;
|
|
438
|
-
}
|
|
439
|
-
keys.forEach((k) => {
|
|
440
|
-
if (level && typeof level[k] !== 'undefined') {
|
|
441
|
-
level = level[k];
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
catch {
|
|
446
|
-
return defaultValue;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
function getPageForRowIndex(index, perPage) {
|
|
450
|
-
// we need to add 1 to convert 0-based index to 1-based page number.
|
|
451
|
-
return Math.floor(index / perPage) + 1;
|
|
452
|
-
}
|
|
453
|
-
function cloneArrayOfObject(array) {
|
|
454
|
-
return array.map((obj) => Object.assign({}, obj));
|
|
455
|
-
}
|
|
456
|
-
function setLocalStorage(key, value) {
|
|
457
|
-
localStorage.setItem(key, JSON.stringify(value));
|
|
458
|
-
}
|
|
459
|
-
function getLocalStorage(key) {
|
|
460
|
-
const valueString = localStorage.getItem(key);
|
|
461
|
-
if (!valueString) {
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
try {
|
|
465
|
-
return JSON.parse(valueString);
|
|
466
|
-
}
|
|
467
|
-
catch {
|
|
468
|
-
return null;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
603
|
class LocalDataSource extends DataSource {
|
|
473
604
|
constructor(data = []) {
|
|
474
605
|
super();
|
|
@@ -3528,5 +3659,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
|
3528
3659
|
* Generated bundle index. Do not edit.
|
|
3529
3660
|
*/
|
|
3530
3661
|
|
|
3531
|
-
export { Cell, Column, DataSource, DefaultEditor, DefaultFilter, Deferred, LocalDataSource, Ng2SmartTableComponent, Row, SmartTableOnChangedEventName };
|
|
3662
|
+
export { Cell, Column, DataSource, DefaultEditor, DefaultFilter, Deferred, LocalDataSource, Ng2SmartTableComponent, Row, SmartTableColumnEditorDirective, SmartTableOnChangedEventName };
|
|
3532
3663
|
//# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map
|