@forgeroute/ui 0.5.18 → 0.5.20
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/forgeroute-ui-boards.mjs +2 -2
- package/fesm2022/forgeroute-ui-boards.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-chip.mjs +25 -6
- package/fesm2022/forgeroute-ui-chip.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Woi3az70.mjs → forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs} +37 -10
- package/fesm2022/forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-core.mjs +94 -19
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +217 -26
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +19 -2
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-more-menu.mjs +61 -8
- package/fesm2022/forgeroute-ui-more-menu.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs +2 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +870 -57
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +815 -49
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +2 -6
- package/types/forgeroute-ui-chip.d.ts +11 -1
- package/types/forgeroute-ui-core.d.ts +65 -12
- package/types/forgeroute-ui-data-table-core.d.ts +60 -1
- package/types/forgeroute-ui-messaging.d.ts +15 -5
- package/types/forgeroute-ui-more-menu.d.ts +7 -0
- package/types/forgeroute-ui-payments.d.ts +332 -8
- package/types/forgeroute-ui-quickbooks.d.ts +2 -2
- package/types/forgeroute-ui-square.d.ts +1 -1
- package/types/forgeroute-ui-stripe.d.ts +293 -20
- package/types/forgeroute-ui-table-types.d.ts +29 -0
- package/fesm2022/forgeroute-ui-core-ui-labels.es-Woi3az70.mjs.map +0 -1
|
@@ -4,7 +4,7 @@ import { Location, NgTemplateOutlet } from "@angular/common";
|
|
|
4
4
|
import { Router } from "@angular/router";
|
|
5
5
|
import * as i1 from "@angular/forms";
|
|
6
6
|
import { FormsModule } from "@angular/forms";
|
|
7
|
-
import { HttpClient, HttpParams } from "@angular/common/http";
|
|
7
|
+
import { HttpClient, HttpErrorResponse, HttpParams } from "@angular/common/http";
|
|
8
8
|
import { Subject, of } from "rxjs";
|
|
9
9
|
import { catchError, switchMap } from "rxjs/operators";
|
|
10
10
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
@@ -1995,6 +1995,31 @@ var DataTableComponent = class DataTableComponent {
|
|
|
1995
1995
|
...copy.details?.length ? { details: copy.details } : {}
|
|
1996
1996
|
};
|
|
1997
1997
|
}
|
|
1998
|
+
_skipReasonsFor(def, skippedRows, target) {
|
|
1999
|
+
const fn = def.skipReason;
|
|
2000
|
+
if (!fn || !def.field) return [];
|
|
2001
|
+
const out = [];
|
|
2002
|
+
for (const row of skippedRows) {
|
|
2003
|
+
if (String(row[def.field] ?? "") === target) continue;
|
|
2004
|
+
let raw = null;
|
|
2005
|
+
try {
|
|
2006
|
+
raw = fn(row, target);
|
|
2007
|
+
} catch {
|
|
2008
|
+
raw = null;
|
|
2009
|
+
}
|
|
2010
|
+
const reason = typeof raw === "string" ? raw.replace(/\s+/g, " ").trim().slice(0, 300) : "";
|
|
2011
|
+
if (reason) out.push({
|
|
2012
|
+
row,
|
|
2013
|
+
reason
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
return out;
|
|
2017
|
+
}
|
|
2018
|
+
_skipReasonLines(reasons) {
|
|
2019
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2020
|
+
for (const r of reasons) counts.set(r.reason, (counts.get(r.reason) ?? 0) + 1);
|
|
2021
|
+
return [...counts].map(([reason, n]) => `${reason} (${n})`);
|
|
2022
|
+
}
|
|
1998
2023
|
_bulkBlockedReason(def) {
|
|
1999
2024
|
if (def.action) {
|
|
2000
2025
|
if (def.opensPanel) return "";
|
|
@@ -2084,7 +2109,8 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2084
2109
|
targetValue: "",
|
|
2085
2110
|
targetLabel: "",
|
|
2086
2111
|
rows: split.eligible,
|
|
2087
|
-
skippedRows: split.refused
|
|
2112
|
+
skippedRows: split.refused,
|
|
2113
|
+
skippedReasons: []
|
|
2088
2114
|
}, skippedNote, {
|
|
2089
2115
|
title: defaultCopy.title,
|
|
2090
2116
|
confirmLabel: defaultCopy.confirmLabel,
|
|
@@ -2111,7 +2137,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2111
2137
|
const totalSkipped = skippedCount + (r?.skipped ?? 0);
|
|
2112
2138
|
const notAllowed = r?.notAllowed ?? 0;
|
|
2113
2139
|
const msg = this._resultSummary(count, done, totalSkipped, notAllowed);
|
|
2114
|
-
const serverMsg =
|
|
2140
|
+
const serverMsg = this._bulkServerMessage(r);
|
|
2115
2141
|
if (serverMsg && count === 0) this._toast.error(serverMsg);
|
|
2116
2142
|
else this._toast.show(serverMsg ? `${msg} ${serverMsg}` : msg);
|
|
2117
2143
|
this.clearSelection();
|
|
@@ -2124,7 +2150,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2124
2150
|
},
|
|
2125
2151
|
error: (err) => {
|
|
2126
2152
|
this._runningAction.set(null);
|
|
2127
|
-
this._toast.error(
|
|
2153
|
+
this._toast.error(this._actionError(err));
|
|
2128
2154
|
}
|
|
2129
2155
|
});
|
|
2130
2156
|
}
|
|
@@ -2164,14 +2190,33 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2164
2190
|
});
|
|
2165
2191
|
}
|
|
2166
2192
|
async _downloadErrorMessage(err) {
|
|
2193
|
+
const plain = await this._parsedBlobError(err);
|
|
2194
|
+
const host = this._hostErrorText(plain);
|
|
2195
|
+
if (host) return host;
|
|
2196
|
+
const message = plain !== err ? plain?.error?.message : null;
|
|
2197
|
+
if (typeof message === "string" && message.trim()) return message;
|
|
2198
|
+
return actionErrorText(plain, (k) => this.labels.t(k));
|
|
2199
|
+
}
|
|
2200
|
+
async _parsedBlobError(err) {
|
|
2201
|
+
const body = err?.error;
|
|
2202
|
+
if (!(body instanceof Blob)) return err;
|
|
2203
|
+
let json;
|
|
2167
2204
|
try {
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2205
|
+
json = JSON.parse(await body.text());
|
|
2206
|
+
} catch {
|
|
2207
|
+
return err;
|
|
2208
|
+
}
|
|
2209
|
+
if (json === null || typeof json !== "object" || Array.isArray(json)) return err;
|
|
2210
|
+
return err instanceof HttpErrorResponse ? new HttpErrorResponse({
|
|
2211
|
+
error: json,
|
|
2212
|
+
headers: err.headers,
|
|
2213
|
+
status: err.status,
|
|
2214
|
+
statusText: err.statusText,
|
|
2215
|
+
url: err.url ?? void 0
|
|
2216
|
+
}) : {
|
|
2217
|
+
...err,
|
|
2218
|
+
error: json
|
|
2219
|
+
};
|
|
2175
2220
|
}
|
|
2176
2221
|
onBulkActionClick(def) {
|
|
2177
2222
|
if (def.action && def.opensPanel) {
|
|
@@ -2209,7 +2254,8 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2209
2254
|
targetValue: "",
|
|
2210
2255
|
targetLabel: "",
|
|
2211
2256
|
rows: split.deletable,
|
|
2212
|
-
skippedRows: split.blocked
|
|
2257
|
+
skippedRows: split.blocked,
|
|
2258
|
+
skippedReasons: []
|
|
2213
2259
|
}, skippedNote, {
|
|
2214
2260
|
title: deleteDefault.title,
|
|
2215
2261
|
confirmLabel: deleteDefault.confirmLabel,
|
|
@@ -2227,7 +2273,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2227
2273
|
const skipped = skippedCount + (r?.skipped ?? 0);
|
|
2228
2274
|
const notAllowed = r?.notAllowed ?? 0;
|
|
2229
2275
|
const generated = this._resultSummary(deleted, this.labels.t("dataTable.doneDeleted"), skipped, notAllowed);
|
|
2230
|
-
const serverMsg =
|
|
2276
|
+
const serverMsg = this._bulkServerMessage(r);
|
|
2231
2277
|
if (serverMsg && deleted === 0) this._toast.error(serverMsg);
|
|
2232
2278
|
else this._toast.show(serverMsg ? `${generated} ${serverMsg}` : generated);
|
|
2233
2279
|
this.clearSelection();
|
|
@@ -2240,7 +2286,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2240
2286
|
},
|
|
2241
2287
|
error: (err) => {
|
|
2242
2288
|
this._deletingBulk.set(false);
|
|
2243
|
-
this._toast.error(
|
|
2289
|
+
this._toast.error(this._actionError(err));
|
|
2244
2290
|
}
|
|
2245
2291
|
});
|
|
2246
2292
|
});
|
|
@@ -2298,6 +2344,9 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2298
2344
|
variant: "primary"
|
|
2299
2345
|
};
|
|
2300
2346
|
const eligibleSet = new Set(eligibleIds);
|
|
2347
|
+
const skippedRows = selectedRows.filter((i) => !eligibleSet.has(i.id));
|
|
2348
|
+
const skippedReasons = this._skipReasonsFor(def, skippedRows, selectedValue);
|
|
2349
|
+
const reasonLines = this._skipReasonLines(skippedReasons);
|
|
2301
2350
|
const hostCopy = def.confirm ? this._hostConfirm(def, {
|
|
2302
2351
|
count: eligibleIds.length,
|
|
2303
2352
|
skippedAlready: alreadyCount,
|
|
@@ -2309,13 +2358,21 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2309
2358
|
targetValue: selectedValue,
|
|
2310
2359
|
targetLabel: optionLabel,
|
|
2311
2360
|
rows: selectedRows.filter((i) => eligibleSet.has(i.id)),
|
|
2312
|
-
skippedRows
|
|
2361
|
+
skippedRows,
|
|
2362
|
+
skippedReasons
|
|
2313
2363
|
}, skippedNote, {
|
|
2314
2364
|
title: defaultCopy.title,
|
|
2315
2365
|
confirmLabel: defaultCopy.confirmLabel,
|
|
2316
2366
|
variant: "primary"
|
|
2317
2367
|
}) : null;
|
|
2318
|
-
|
|
2368
|
+
const shown = hostCopy ? {
|
|
2369
|
+
...hostCopy,
|
|
2370
|
+
...reasonLines.length ? { details: [...hostCopy.details ?? [], ...reasonLines] } : {}
|
|
2371
|
+
} : {
|
|
2372
|
+
...defaultCopy,
|
|
2373
|
+
...reasonLines.length ? { details: reasonLines } : {}
|
|
2374
|
+
};
|
|
2375
|
+
confirmed = await this._confirmSvc.confirm(shown);
|
|
2319
2376
|
} catch {
|
|
2320
2377
|
confirmed = false;
|
|
2321
2378
|
} finally {
|
|
@@ -2335,7 +2392,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2335
2392
|
const totalSkipped = skippedCount + (r?.skipped ?? 0);
|
|
2336
2393
|
const notAllowed = r?.notAllowed ?? 0;
|
|
2337
2394
|
const msg = this._resultSummary(count, this.labels.t("dataTable.doneUpdated"), totalSkipped, notAllowed);
|
|
2338
|
-
const serverMsg =
|
|
2395
|
+
const serverMsg = this._bulkServerMessage(r);
|
|
2339
2396
|
if (serverMsg && count === 0) this._toast.error(serverMsg);
|
|
2340
2397
|
else this._toast.show(serverMsg ? `${msg} ${serverMsg}` : msg);
|
|
2341
2398
|
this.clearSelection();
|
|
@@ -2349,7 +2406,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2349
2406
|
},
|
|
2350
2407
|
error: (err) => {
|
|
2351
2408
|
this._applyingBulk.set(false);
|
|
2352
|
-
this._toast.error(
|
|
2409
|
+
this._toast.error(this._actionError(err));
|
|
2353
2410
|
}
|
|
2354
2411
|
});
|
|
2355
2412
|
}
|
|
@@ -2414,17 +2471,19 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2414
2471
|
this._rowDeleting.set(false);
|
|
2415
2472
|
this._rowDeleteTarget.set(null);
|
|
2416
2473
|
if (r?.deleted === 0) {
|
|
2417
|
-
this._toast.error(
|
|
2474
|
+
this._toast.error(this._bulkServerMessage(r) || this.labels.t("dataTable.rowNotDeleted", { item: this._itemWord() }));
|
|
2418
2475
|
this.refresh();
|
|
2419
2476
|
return;
|
|
2420
2477
|
}
|
|
2421
|
-
|
|
2478
|
+
const rowMsg = this._bulkServerMessage(r);
|
|
2479
|
+
const rowDone = this.labels.t("dataTable.rowDeleted", { item: this._itemWord() });
|
|
2480
|
+
this._toast.show(rowMsg ? `${rowDone} ${rowMsg}` : rowDone);
|
|
2422
2481
|
this.refresh();
|
|
2423
2482
|
this.rowDeleted.emit(item);
|
|
2424
2483
|
},
|
|
2425
2484
|
error: (err) => {
|
|
2426
2485
|
this._rowDeleting.set(false);
|
|
2427
|
-
this._toast.error(err?.error?.message ?? this.labels.t("dataTable.deleteFailed"));
|
|
2486
|
+
this._toast.error(this._hostErrorText(err) ?? err?.error?.message ?? this.labels.t("dataTable.deleteFailed"));
|
|
2428
2487
|
}
|
|
2429
2488
|
});
|
|
2430
2489
|
}
|
|
@@ -2483,6 +2542,8 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2483
2542
|
this.bulkPanelClick = output();
|
|
2484
2543
|
this.loaded = output();
|
|
2485
2544
|
this.rowDeleted = output();
|
|
2545
|
+
this.rowMenuOpen = output();
|
|
2546
|
+
this.errorTextFn = input(null, ...ngDevMode ? [{ debugName: "errorTextFn" }] : /* istanbul ignore next */ []);
|
|
2486
2547
|
this.reorderable = input(false, ...ngDevMode ? [{ debugName: "reorderable" }] : /* istanbul ignore next */ []);
|
|
2487
2548
|
this.rowReorder = output();
|
|
2488
2549
|
this.config = inject(FORGEROUTE_CONFIG);
|
|
@@ -2751,6 +2812,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2751
2812
|
const allowedFrom = typeof entry === "string" ? void 0 : entry.allowedFrom;
|
|
2752
2813
|
const canChange = typeof entry === "string" ? void 0 : entry.canChange;
|
|
2753
2814
|
const canApply = typeof entry === "string" ? void 0 : entry.canApply;
|
|
2815
|
+
const skipReason = typeof entry === "string" ? void 0 : entry.skipReason;
|
|
2754
2816
|
const listAll = typeof entry === "string" ? void 0 : entry.listAll;
|
|
2755
2817
|
const order = typeof entry === "string" ? void 0 : entry.order;
|
|
2756
2818
|
const custom = typeof entry === "string" ? "" : entry.label?.trim() ?? "";
|
|
@@ -2764,6 +2826,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2764
2826
|
...allowedFrom ? { allowedFrom } : {},
|
|
2765
2827
|
...canChange ? { canChange } : {},
|
|
2766
2828
|
...canApply ? { canApply } : {},
|
|
2829
|
+
...skipReason ? { skipReason } : {},
|
|
2767
2830
|
...listAll === true || Array.isArray(listAll) && listAll.length ? { listAll } : {},
|
|
2768
2831
|
...Array.isArray(order) && order.length ? { order } : {},
|
|
2769
2832
|
...confirm ? { confirm } : {}
|
|
@@ -2900,6 +2963,8 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2900
2963
|
return out;
|
|
2901
2964
|
}, ...ngDevMode ? [{ debugName: "_emptyColumnKeys" }] : /* istanbul ignore next */ []);
|
|
2902
2965
|
this._hasPhoneControls = computed(() => this._phoneSortOptions().length > 1 || this._phoneFilterCols().length > 0 || this._phoneRangeCols().length > 0, ...ngDevMode ? [{ debugName: "_hasPhoneControls" }] : /* istanbul ignore next */ []);
|
|
2966
|
+
this._resolvedActionCache = /* @__PURE__ */ new WeakMap();
|
|
2967
|
+
this._actionListCache = /* @__PURE__ */ new WeakMap();
|
|
2903
2968
|
this._injector = inject(Injector);
|
|
2904
2969
|
this._silentNext = false;
|
|
2905
2970
|
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
@@ -2946,7 +3011,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
2946
3011
|
for (const [key, vals] of Object.entries(cf)) if (vals.length > 0) params = params.set(key, encodeFilterValues(vals));
|
|
2947
3012
|
for (const [key, val] of Object.entries(this._rangeParams())) params = params.set(key, val);
|
|
2948
3013
|
return this.http.get(`${this.config.baseUrl}${this.endpoint()}`, { params }).pipe(catchError((err) => {
|
|
2949
|
-
this._error.set(this.labels.t(loadErrorKey(err), { items: this._itemsWord() }));
|
|
3014
|
+
this._error.set(this._hostErrorText(err) ?? this.labels.t(loadErrorKey(err), { items: this._itemsWord() }));
|
|
2950
3015
|
this._loadFailed.set(true);
|
|
2951
3016
|
return of(null);
|
|
2952
3017
|
}));
|
|
@@ -3296,10 +3361,112 @@ var DataTableComponent = class DataTableComponent {
|
|
|
3296
3361
|
this.imported.emit();
|
|
3297
3362
|
}
|
|
3298
3363
|
_rowActions(col, item) {
|
|
3299
|
-
const actions = col.actionsFn?.(item) ?? [];
|
|
3300
|
-
if (this._canEdit()) return actions;
|
|
3364
|
+
const actions = this._withResolvedReasons(col.actionsFn?.(item) ?? [], item);
|
|
3365
|
+
if (this._canEdit()) return this._stableActionList(col, item, actions);
|
|
3301
3366
|
const visible = actions.filter((a) => a.type === "view" || a.allowReadOnly === true && a.type !== "delete");
|
|
3302
|
-
return visible.length === actions.length ? actions : visible;
|
|
3367
|
+
return this._stableActionList(col, item, visible.length === actions.length ? actions : visible);
|
|
3368
|
+
}
|
|
3369
|
+
_actionShape(a) {
|
|
3370
|
+
return [
|
|
3371
|
+
a.type,
|
|
3372
|
+
a.label,
|
|
3373
|
+
a.icon,
|
|
3374
|
+
a.variant,
|
|
3375
|
+
a.opens,
|
|
3376
|
+
a.modal,
|
|
3377
|
+
a.requiresFull,
|
|
3378
|
+
a.allowReadOnly,
|
|
3379
|
+
a.hidden,
|
|
3380
|
+
a.disabled,
|
|
3381
|
+
a.disabledReason
|
|
3382
|
+
];
|
|
3383
|
+
}
|
|
3384
|
+
_sameShape(a, b) {
|
|
3385
|
+
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
3386
|
+
}
|
|
3387
|
+
_stableActionList(col, item, list) {
|
|
3388
|
+
if (typeof item !== "object" || item === null) return list;
|
|
3389
|
+
let perRow = this._actionListCache.get(item);
|
|
3390
|
+
if (!perRow) {
|
|
3391
|
+
perRow = /* @__PURE__ */ new WeakMap();
|
|
3392
|
+
this._actionListCache.set(item, perRow);
|
|
3393
|
+
}
|
|
3394
|
+
const shapes = list.map((a) => this._actionShape(a));
|
|
3395
|
+
const prev = perRow.get(col);
|
|
3396
|
+
if (prev && prev.list.length === list.length && prev.list.every((a, i) => a === list[i])) {
|
|
3397
|
+
if (prev.shapes.every((sh, i) => this._sameShape(sh, shapes[i]))) return prev.list;
|
|
3398
|
+
const fresh = list.slice();
|
|
3399
|
+
perRow.set(col, {
|
|
3400
|
+
list: fresh,
|
|
3401
|
+
shapes
|
|
3402
|
+
});
|
|
3403
|
+
return fresh;
|
|
3404
|
+
}
|
|
3405
|
+
perRow.set(col, {
|
|
3406
|
+
list,
|
|
3407
|
+
shapes
|
|
3408
|
+
});
|
|
3409
|
+
return list;
|
|
3410
|
+
}
|
|
3411
|
+
_withResolvedReasons(actions, item) {
|
|
3412
|
+
if (!actions.some((a) => typeof a.disabled === "function" || typeof a.disabledReason === "function")) return actions;
|
|
3413
|
+
const rowKey = typeof item === "object" && item !== null ? item : null;
|
|
3414
|
+
let perRow = rowKey ? this._resolvedActionCache.get(rowKey) : void 0;
|
|
3415
|
+
if (rowKey && !perRow) {
|
|
3416
|
+
perRow = /* @__PURE__ */ new Map();
|
|
3417
|
+
this._resolvedActionCache.set(rowKey, perRow);
|
|
3418
|
+
}
|
|
3419
|
+
return actions.map((a) => {
|
|
3420
|
+
if (typeof a.disabled !== "function" && typeof a.disabledReason !== "function") return a;
|
|
3421
|
+
let off;
|
|
3422
|
+
if (typeof a.disabled === "function") try {
|
|
3423
|
+
off = !!a.disabled(item);
|
|
3424
|
+
} catch {
|
|
3425
|
+
off = false;
|
|
3426
|
+
}
|
|
3427
|
+
let reason;
|
|
3428
|
+
if (typeof a.disabledReason === "function") {
|
|
3429
|
+
let raw;
|
|
3430
|
+
try {
|
|
3431
|
+
raw = a.disabledReason(item);
|
|
3432
|
+
} catch {
|
|
3433
|
+
raw = null;
|
|
3434
|
+
}
|
|
3435
|
+
reason = typeof raw === "string" ? raw : void 0;
|
|
3436
|
+
}
|
|
3437
|
+
const held = perRow?.get(a.type);
|
|
3438
|
+
const shape = this._actionShape(a);
|
|
3439
|
+
if (held && held.src === a && held.off === off && held.reason === reason && this._sameShape(held.shape, shape)) return held.out;
|
|
3440
|
+
const resolved = { ...a };
|
|
3441
|
+
if (off !== void 0) resolved.disabled = () => off;
|
|
3442
|
+
if (typeof a.disabledReason === "function") resolved.disabledReason = reason;
|
|
3443
|
+
perRow?.set(a.type, {
|
|
3444
|
+
src: a,
|
|
3445
|
+
off,
|
|
3446
|
+
reason,
|
|
3447
|
+
shape,
|
|
3448
|
+
out: resolved
|
|
3449
|
+
});
|
|
3450
|
+
return resolved;
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3453
|
+
_hostErrorText(err) {
|
|
3454
|
+
const fn = this.errorTextFn();
|
|
3455
|
+
if (!fn) return null;
|
|
3456
|
+
try {
|
|
3457
|
+
const text = fn(err);
|
|
3458
|
+
return typeof text === "string" && text.trim() ? text.trim() : null;
|
|
3459
|
+
} catch {
|
|
3460
|
+
return null;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
_actionError(err) {
|
|
3464
|
+
return this._hostErrorText(err) ?? actionErrorText(err, (k) => this.labels.t(k));
|
|
3465
|
+
}
|
|
3466
|
+
_bulkServerMessage(r) {
|
|
3467
|
+
const message = humanReadableMessage(r?.message);
|
|
3468
|
+
const reason = humanReadableMessage(r?.skippedReason);
|
|
3469
|
+
return [message, reason && reason !== message ? reason : null].filter((x) => !!x).join(" ") || null;
|
|
3303
3470
|
}
|
|
3304
3471
|
async onTableRowAction(type, col, item) {
|
|
3305
3472
|
const action = this._rowActions(col, item).find((a) => a.type === type);
|
|
@@ -3821,6 +3988,13 @@ var DataTableComponent = class DataTableComponent {
|
|
|
3821
3988
|
isRequired: false,
|
|
3822
3989
|
transformFunction: null
|
|
3823
3990
|
},
|
|
3991
|
+
errorTextFn: {
|
|
3992
|
+
classPropertyName: "errorTextFn",
|
|
3993
|
+
publicName: "errorTextFn",
|
|
3994
|
+
isSignal: true,
|
|
3995
|
+
isRequired: false,
|
|
3996
|
+
transformFunction: null
|
|
3997
|
+
},
|
|
3824
3998
|
reorderable: {
|
|
3825
3999
|
classPropertyName: "reorderable",
|
|
3826
4000
|
publicName: "reorderable",
|
|
@@ -3851,6 +4025,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
3851
4025
|
bulkPanelClick: "bulkPanelClick",
|
|
3852
4026
|
loaded: "loaded",
|
|
3853
4027
|
rowDeleted: "rowDeleted",
|
|
4028
|
+
rowMenuOpen: "rowMenuOpen",
|
|
3854
4029
|
rowReorder: "rowReorder"
|
|
3855
4030
|
},
|
|
3856
4031
|
providers: [{
|
|
@@ -4289,6 +4464,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
4289
4464
|
<ui-more-menu
|
|
4290
4465
|
[actions]="rowActions"
|
|
4291
4466
|
[ariaLabel]="rowActionsLabel(item)"
|
|
4467
|
+
(opened)="rowMenuOpen.emit({ item })"
|
|
4292
4468
|
(actionClick)="onTableRowAction($event, col, item)" />
|
|
4293
4469
|
}
|
|
4294
4470
|
</span>
|
|
@@ -4489,6 +4665,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
4489
4665
|
<ui-more-menu
|
|
4490
4666
|
[actions]="cardActions"
|
|
4491
4667
|
[ariaLabel]="rowActionsLabel(item)"
|
|
4668
|
+
(opened)="rowMenuOpen.emit({ item })"
|
|
4492
4669
|
(actionClick)="onTableRowAction($event, ac, item)" />
|
|
4493
4670
|
</span>
|
|
4494
4671
|
}
|
|
@@ -4797,7 +4974,7 @@ var DataTableComponent = class DataTableComponent {
|
|
|
4797
4974
|
type: MoreMenuComponent,
|
|
4798
4975
|
selector: "ui-more-menu",
|
|
4799
4976
|
inputs: ["ariaLabel", "actions"],
|
|
4800
|
-
outputs: ["actionClick"]
|
|
4977
|
+
outputs: ["actionClick", "opened"]
|
|
4801
4978
|
},
|
|
4802
4979
|
{
|
|
4803
4980
|
kind: "component",
|
|
@@ -5459,6 +5636,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
5459
5636
|
<ui-more-menu
|
|
5460
5637
|
[actions]="rowActions"
|
|
5461
5638
|
[ariaLabel]="rowActionsLabel(item)"
|
|
5639
|
+
(opened)="rowMenuOpen.emit({ item })"
|
|
5462
5640
|
(actionClick)="onTableRowAction($event, col, item)" />
|
|
5463
5641
|
}
|
|
5464
5642
|
</span>
|
|
@@ -5659,6 +5837,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
5659
5837
|
<ui-more-menu
|
|
5660
5838
|
[actions]="cardActions"
|
|
5661
5839
|
[ariaLabel]="rowActionsLabel(item)"
|
|
5840
|
+
(opened)="rowMenuOpen.emit({ item })"
|
|
5662
5841
|
(actionClick)="onTableRowAction($event, ac, item)" />
|
|
5663
5842
|
</span>
|
|
5664
5843
|
}
|
|
@@ -6119,6 +6298,18 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
6119
6298
|
type: i0.Output,
|
|
6120
6299
|
args: ["rowDeleted"]
|
|
6121
6300
|
}],
|
|
6301
|
+
rowMenuOpen: [{
|
|
6302
|
+
type: i0.Output,
|
|
6303
|
+
args: ["rowMenuOpen"]
|
|
6304
|
+
}],
|
|
6305
|
+
errorTextFn: [{
|
|
6306
|
+
type: i0.Input,
|
|
6307
|
+
args: [{
|
|
6308
|
+
isSignal: true,
|
|
6309
|
+
alias: "errorTextFn",
|
|
6310
|
+
required: false
|
|
6311
|
+
}]
|
|
6312
|
+
}],
|
|
6122
6313
|
reorderable: [{
|
|
6123
6314
|
type: i0.Input,
|
|
6124
6315
|
args: [{
|