@gridengine/angular-datagrid-enterprise 0.10.0 → 0.12.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,6 +1,6 @@
|
|
|
1
1
|
export * from '@gridengine/angular-datagrid';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, ChangeDetectionStrategy, Component, computed, effect, makeEnvironmentProviders, provideEnvironmentInitializer, output, inject, ElementRef, HostListener, Directive } from '@angular/core';
|
|
3
|
+
import { input, ChangeDetectionStrategy, Component, computed, effect, makeEnvironmentProviders, provideEnvironmentInitializer, signal, output, inject, ElementRef, HostListener, Directive } from '@angular/core';
|
|
4
4
|
import { validateLicense, resolveFeatures as resolveFeatures$1, TIER_FEATURES } from '@gridengine/license-core';
|
|
5
5
|
export { TIER_FEATURES } from '@gridengine/license-core';
|
|
6
6
|
import { DOCUMENT } from '@angular/common';
|
|
@@ -139,7 +139,7 @@ class GridLicenseWatermark {
|
|
|
139
139
|
<div class="gd-license-watermark" aria-hidden="true">
|
|
140
140
|
{{ label() }} — unlicensed — <span class="gd-license-watermark__url">{{ url() }}</span>
|
|
141
141
|
</div>
|
|
142
|
-
`, isInline: true, styles: [".gd-license-watermark{position:absolute;bottom:
|
|
142
|
+
`, isInline: true, styles: [".gd-license-watermark{position:absolute;bottom:10px;right:10px;z-index:10;display:inline-flex;align-items:center;gap:5px;padding:5px 12px;border-radius:999px;font-family:sans-serif;font-size:12px;font-weight:700;letter-spacing:.02em;color:#7c2d12;background:linear-gradient(135deg,#fde68a,#fbbf24 55%,#f59e0b);border:1px solid #d97706;box-shadow:0 2px 6px #78350f59;pointer-events:none;-webkit-user-select:none;user-select:none}.gd-license-watermark:before{content:\"\\2605\";font-size:12px;line-height:1}.gd-license-watermark__url{text-decoration:underline}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
143
143
|
}
|
|
144
144
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: GridLicenseWatermark, decorators: [{
|
|
145
145
|
type: Component,
|
|
@@ -147,7 +147,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
147
147
|
<div class="gd-license-watermark" aria-hidden="true">
|
|
148
148
|
{{ label() }} — unlicensed — <span class="gd-license-watermark__url">{{ url() }}</span>
|
|
149
149
|
</div>
|
|
150
|
-
`, styles: [".gd-license-watermark{position:absolute;bottom:
|
|
150
|
+
`, styles: [".gd-license-watermark{position:absolute;bottom:10px;right:10px;z-index:10;display:inline-flex;align-items:center;gap:5px;padding:5px 12px;border-radius:999px;font-family:sans-serif;font-size:12px;font-weight:700;letter-spacing:.02em;color:#7c2d12;background:linear-gradient(135deg,#fde68a,#fbbf24 55%,#f59e0b);border:1px solid #d97706;box-shadow:0 2px 6px #78350f59;pointer-events:none;-webkit-user-select:none;user-select:none}.gd-license-watermark:before{content:\"\\2605\";font-size:12px;line-height:1}.gd-license-watermark__url{text-decoration:underline}\n"] }]
|
|
151
151
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: false }] }] } });
|
|
152
152
|
|
|
153
153
|
/**
|
|
@@ -1380,6 +1380,92 @@ class TransactionEngine {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* TransactionController — a reactive (signals) wrapper around `TransactionEngine`
|
|
1385
|
+
* for the open-source `<gd-data-grid>`. Bind `displayRows()` to `[rowData]` and
|
|
1386
|
+
* pipe `(cellValueChanged)` into `onCellValueChanged` to stage inline edits
|
|
1387
|
+
* without mutating the base data; then `commit()` / `rollback()`:
|
|
1388
|
+
*
|
|
1389
|
+
* ```html
|
|
1390
|
+
* <gd-data-grid [rowData]="txn.displayRows()" [columnDefs]="cols" [getRowId]="byId"
|
|
1391
|
+
* (cellValueChanged)="txn.onCellValueChanged($event)" />
|
|
1392
|
+
* <button [disabled]="!txn.isDirty()" (click)="txn.commit()">Save</button>
|
|
1393
|
+
* ```
|
|
1394
|
+
*
|
|
1395
|
+
* `displayRows()` returns shallow clones, so the grid's in-place cell edits
|
|
1396
|
+
* change the copy while the base stays clean (rollback restores it). Use a
|
|
1397
|
+
* field-based `getRowId` so row identity survives cloning.
|
|
1398
|
+
*/
|
|
1399
|
+
class TransactionController {
|
|
1400
|
+
_engine;
|
|
1401
|
+
_rowIdField;
|
|
1402
|
+
_version = signal(0, /* @ts-ignore */
|
|
1403
|
+
...(ngDevMode ? [{ debugName: "_version" }] : /* istanbul ignore next */ []));
|
|
1404
|
+
/** The current merged rows (base + staged changes) as shallow clones. */
|
|
1405
|
+
displayRows;
|
|
1406
|
+
/** Whether there are uncommitted staged changes. */
|
|
1407
|
+
isDirty;
|
|
1408
|
+
constructor(initialRows, options = {}) {
|
|
1409
|
+
this._rowIdField = options.rowIdField ?? 'id';
|
|
1410
|
+
this._engine = new TransactionEngine({
|
|
1411
|
+
initialRows,
|
|
1412
|
+
rowIdField: this._rowIdField,
|
|
1413
|
+
onTransactionCommit: options.onCommit,
|
|
1414
|
+
onTransactionRollback: options.onRollback,
|
|
1415
|
+
});
|
|
1416
|
+
this.displayRows = computed(() => {
|
|
1417
|
+
this._version();
|
|
1418
|
+
return this._engine.getDisplayRows().map((r) => ({ ...r }));
|
|
1419
|
+
}, /* @ts-ignore */
|
|
1420
|
+
...(ngDevMode ? [{ debugName: "displayRows" }] : /* istanbul ignore next */ []));
|
|
1421
|
+
this.isDirty = computed(() => {
|
|
1422
|
+
this._version();
|
|
1423
|
+
return this._engine.isDirty();
|
|
1424
|
+
}, /* @ts-ignore */
|
|
1425
|
+
...(ngDevMode ? [{ debugName: "isDirty" }] : /* istanbul ignore next */ []));
|
|
1426
|
+
}
|
|
1427
|
+
/** Stage an inline edit emitted by the grid's `(cellValueChanged)`. */
|
|
1428
|
+
onCellValueChanged(event) {
|
|
1429
|
+
if (!event.field)
|
|
1430
|
+
return;
|
|
1431
|
+
const id = event.row[this._rowIdField];
|
|
1432
|
+
this._engine.updateRows([{ [this._rowIdField]: id, [event.field]: event.newValue }]);
|
|
1433
|
+
this._bump();
|
|
1434
|
+
}
|
|
1435
|
+
addRows(rows) {
|
|
1436
|
+
this._engine.addRows(rows);
|
|
1437
|
+
this._bump();
|
|
1438
|
+
}
|
|
1439
|
+
updateRows(rows) {
|
|
1440
|
+
this._engine.updateRows(rows);
|
|
1441
|
+
this._bump();
|
|
1442
|
+
}
|
|
1443
|
+
removeRows(ids) {
|
|
1444
|
+
this._engine.removeRows(ids);
|
|
1445
|
+
this._bump();
|
|
1446
|
+
}
|
|
1447
|
+
/** All current staged changes, grouped by kind. */
|
|
1448
|
+
getDirtyRows() {
|
|
1449
|
+
return this._engine.getDirtyRows();
|
|
1450
|
+
}
|
|
1451
|
+
commit() {
|
|
1452
|
+
this._engine.commitTransaction();
|
|
1453
|
+
this._bump();
|
|
1454
|
+
}
|
|
1455
|
+
rollback() {
|
|
1456
|
+
this._engine.rollbackTransaction();
|
|
1457
|
+
this._bump();
|
|
1458
|
+
}
|
|
1459
|
+
/** Replace the base rows (e.g. after a server refresh); staged changes are kept. */
|
|
1460
|
+
resetRows(rows) {
|
|
1461
|
+
this._engine.resetRows(rows);
|
|
1462
|
+
this._bump();
|
|
1463
|
+
}
|
|
1464
|
+
_bump() {
|
|
1465
|
+
this._version.update((v) => v + 1);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1383
1469
|
class MasterDetailEngine {
|
|
1384
1470
|
_getDetailRowData;
|
|
1385
1471
|
_onExpand;
|
|
@@ -2637,5 +2723,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
2637
2723
|
* Generated bundle index. Do not edit.
|
|
2638
2724
|
*/
|
|
2639
2725
|
|
|
2640
|
-
export { AuditTrailEngine, CellPermissionEngine, ClipboardEngine, DEFAULT_MASK, DataGridPro, ExcelImportEngine, FillHandleEngine, FilterPresetEngine, FormEditorEngine, FormulaEngine, GridLicenseWatermark, LicenseManager, MasterDetailEngine, PDFExportEngine, PRODUCT_ID, PURCHASE_URL, RangeSelectionDirective, RangeSelectionEngine, RowLockEngine, SSRMEngine, SavedViewsEngine, TransactionEngine, UndoRedoManager, applyCellPermissions, deserializeFilter, evaluateFilter, parseCSV, parseTSV, provideGridEngineLicense, serializeFilter, toNumber, toPdfColumns, toTimestamp };
|
|
2726
|
+
export { AuditTrailEngine, CellPermissionEngine, ClipboardEngine, DEFAULT_MASK, DataGridPro, ExcelImportEngine, FillHandleEngine, FilterPresetEngine, FormEditorEngine, FormulaEngine, GridLicenseWatermark, LicenseManager, MasterDetailEngine, PDFExportEngine, PRODUCT_ID, PURCHASE_URL, RangeSelectionDirective, RangeSelectionEngine, RowLockEngine, SSRMEngine, SavedViewsEngine, TransactionController, TransactionEngine, UndoRedoManager, applyCellPermissions, deserializeFilter, evaluateFilter, parseCSV, parseTSV, provideGridEngineLicense, serializeFilter, toNumber, toPdfColumns, toTimestamp };
|
|
2641
2727
|
//# sourceMappingURL=gridengine-angular-datagrid-enterprise.mjs.map
|