persian-data-grid 0.5.0 → 0.6.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.
- package/OFL.txt +93 -0
- package/README.md +179 -22
- package/dist/ERPTableGroupRow-J5Z2LRC5.cjs +131 -0
- package/dist/ERPTableGroupRow-J5Z2LRC5.cjs.map +1 -0
- package/dist/ERPTableGroupRow-PSAPAHGL.js +125 -0
- package/dist/ERPTableGroupRow-PSAPAHGL.js.map +1 -0
- package/dist/GridPlugin-CJCaYnlw.d.ts +57 -0
- package/dist/GridPlugin-oxhq8AsM.d.cts +57 -0
- package/dist/GridPresenceService-GEH6535Q.js +3 -0
- package/dist/GridPresenceService-GEH6535Q.js.map +1 -0
- package/dist/GridPresenceService-RDN5FXHQ.cjs +12 -0
- package/dist/GridPresenceService-RDN5FXHQ.cjs.map +1 -0
- package/dist/GridSession-B-9lLcoB.d.cts +2492 -0
- package/dist/GridSession-Bc7UIawO.d.ts +2492 -0
- package/dist/GridSyncService-KTLB4KP3.js +3 -0
- package/dist/GridSyncService-KTLB4KP3.js.map +1 -0
- package/dist/GridSyncService-TAPAHABV.cjs +12 -0
- package/dist/GridSyncService-TAPAHABV.cjs.map +1 -0
- package/dist/PdfRenderer-1HFh6UeR.d.ts +22 -0
- package/dist/PdfRenderer-CBg7hWNS.d.cts +22 -0
- package/dist/RemoteApi-CCQxiSf1.d.cts +28 -0
- package/dist/RemoteApi-CCQxiSf1.d.ts +28 -0
- package/dist/SelectImpl-NM4O4IGW.js +447 -0
- package/dist/SelectImpl-NM4O4IGW.js.map +1 -0
- package/dist/SelectImpl-W2EI4T7O.cjs +453 -0
- package/dist/SelectImpl-W2EI4T7O.cjs.map +1 -0
- package/dist/UITableController-Cuwq481K.d.cts +632 -0
- package/dist/UITableController-DU8RopUM.d.ts +632 -0
- package/dist/VazirmatnPdfRenderer-BCMpC1zy.d.cts +96 -0
- package/dist/VazirmatnPdfRenderer-Dz_G-m3c.d.ts +96 -0
- package/dist/adapters/arian-erp.cjs +77 -0
- package/dist/adapters/arian-erp.cjs.map +1 -0
- package/dist/adapters/arian-erp.d.cts +60 -0
- package/dist/adapters/arian-erp.d.ts +60 -0
- package/dist/adapters/arian-erp.js +71 -0
- package/dist/adapters/arian-erp.js.map +1 -0
- package/dist/appendAtEnd-RHIQRG2W.cjs +35 -0
- package/dist/appendAtEnd-RHIQRG2W.cjs.map +1 -0
- package/dist/appendAtEnd-TJEABLGD.js +33 -0
- package/dist/appendAtEnd-TJEABLGD.js.map +1 -0
- package/dist/applyImportedRows-BO6yxoAN.d.cts +135 -0
- package/dist/applyImportedRows-D4zVY8uD.d.ts +135 -0
- package/dist/applyRowVisibilityHandler-KS6TMCBN.js +83 -0
- package/dist/applyRowVisibilityHandler-KS6TMCBN.js.map +1 -0
- package/dist/applyRowVisibilityHandler-LXCOGESZ.cjs +85 -0
- package/dist/applyRowVisibilityHandler-LXCOGESZ.cjs.map +1 -0
- package/dist/broadcastChannelTransport-FHUMV76O.cjs +12 -0
- package/dist/broadcastChannelTransport-FHUMV76O.cjs.map +1 -0
- package/dist/broadcastChannelTransport-MIH53VNZ.js +3 -0
- package/dist/broadcastChannelTransport-MIH53VNZ.js.map +1 -0
- package/dist/callbackRemoteApi-BlXO5NJz.d.ts +30 -0
- package/dist/callbackRemoteApi-DgnXH-i0.d.cts +30 -0
- package/dist/cellRenderContext-DB7V_mlu.d.ts +42 -0
- package/dist/cellRenderContext-DG5BOlxK.d.cts +42 -0
- package/dist/chunk-2BJCRYOS.cjs +936 -0
- package/dist/chunk-2BJCRYOS.cjs.map +1 -0
- package/dist/chunk-3Y3KKGEC.js +3 -0
- package/dist/chunk-3Y3KKGEC.js.map +1 -0
- package/dist/chunk-5ALMNLUR.cjs +1408 -0
- package/dist/chunk-5ALMNLUR.cjs.map +1 -0
- package/dist/chunk-5HKVMPBD.js +937 -0
- package/dist/chunk-5HKVMPBD.js.map +1 -0
- package/dist/chunk-633KP74Z.js +189 -0
- package/dist/chunk-633KP74Z.js.map +1 -0
- package/dist/chunk-6XBXZPBW.js +298 -0
- package/dist/chunk-6XBXZPBW.js.map +1 -0
- package/dist/chunk-77UXAJII.js +112 -0
- package/dist/chunk-77UXAJII.js.map +1 -0
- package/dist/chunk-ASPTRYRD.cjs +21 -0
- package/dist/chunk-ASPTRYRD.cjs.map +1 -0
- package/dist/chunk-AU3RDJYQ.js +243 -0
- package/dist/chunk-AU3RDJYQ.js.map +1 -0
- package/dist/chunk-BHDRUZH5.cjs +33 -0
- package/dist/chunk-BHDRUZH5.cjs.map +1 -0
- package/dist/chunk-BLYVOV3G.cjs +191 -0
- package/dist/chunk-BLYVOV3G.cjs.map +1 -0
- package/dist/chunk-CILNIWYW.cjs +100 -0
- package/dist/chunk-CILNIWYW.cjs.map +1 -0
- package/dist/chunk-DFFP7SJ6.cjs +257 -0
- package/dist/chunk-DFFP7SJ6.cjs.map +1 -0
- package/dist/chunk-DXRCYW42.cjs +568 -0
- package/dist/chunk-DXRCYW42.cjs.map +1 -0
- package/dist/chunk-EBV6HGZB.cjs +33 -0
- package/dist/chunk-EBV6HGZB.cjs.map +1 -0
- package/dist/chunk-EHHHC5JV.js +832 -0
- package/dist/chunk-EHHHC5JV.js.map +1 -0
- package/dist/chunk-F4PYOYHR.js +112 -0
- package/dist/chunk-F4PYOYHR.js.map +1 -0
- package/dist/chunk-GQEDLUMB.js +168 -0
- package/dist/chunk-GQEDLUMB.js.map +1 -0
- package/dist/chunk-H2LESGMX.cjs +319 -0
- package/dist/chunk-H2LESGMX.cjs.map +1 -0
- package/dist/chunk-HTNJT2QU.js +11674 -0
- package/dist/chunk-HTNJT2QU.js.map +1 -0
- package/dist/chunk-IIISFUW4.cjs +11786 -0
- package/dist/chunk-IIISFUW4.cjs.map +1 -0
- package/dist/chunk-IMPCRWYP.cjs +251 -0
- package/dist/chunk-IMPCRWYP.cjs.map +1 -0
- package/dist/chunk-IPPIXOVQ.js +317 -0
- package/dist/chunk-IPPIXOVQ.js.map +1 -0
- package/dist/chunk-J4XJ4UBC.js +1404 -0
- package/dist/chunk-J4XJ4UBC.js.map +1 -0
- package/dist/chunk-J7CPPFXT.cjs +89 -0
- package/dist/chunk-J7CPPFXT.cjs.map +1 -0
- package/dist/chunk-JOICD47Q.cjs +41 -0
- package/dist/chunk-JOICD47Q.cjs.map +1 -0
- package/dist/chunk-KHMG6EI2.js +13 -0
- package/dist/chunk-KHMG6EI2.js.map +1 -0
- package/dist/chunk-KMRURD5J.cjs +15 -0
- package/dist/chunk-KMRURD5J.cjs.map +1 -0
- package/dist/chunk-KRJG3KMP.cjs +174 -0
- package/dist/chunk-KRJG3KMP.cjs.map +1 -0
- package/dist/chunk-KUBVDIF7.cjs +653 -0
- package/dist/chunk-KUBVDIF7.cjs.map +1 -0
- package/dist/chunk-KYAOSBQN.js +31 -0
- package/dist/chunk-KYAOSBQN.js.map +1 -0
- package/dist/chunk-LJ7LMEXO.js +36 -0
- package/dist/chunk-LJ7LMEXO.js.map +1 -0
- package/dist/chunk-MT3KLB2Q.cjs +944 -0
- package/dist/chunk-MT3KLB2Q.cjs.map +1 -0
- package/dist/chunk-MU3RY46O.js +932 -0
- package/dist/chunk-MU3RY46O.js.map +1 -0
- package/dist/chunk-MUQQKPWR.js +84 -0
- package/dist/chunk-MUQQKPWR.js.map +1 -0
- package/dist/chunk-N7SJTINL.cjs +4 -0
- package/dist/chunk-N7SJTINL.cjs.map +1 -0
- package/dist/chunk-NTV2UUAJ.cjs +149 -0
- package/dist/chunk-NTV2UUAJ.cjs.map +1 -0
- package/dist/chunk-PJQWHF6T.js +31 -0
- package/dist/chunk-PJQWHF6T.js.map +1 -0
- package/dist/chunk-PQY54EL5.js +248 -0
- package/dist/chunk-PQY54EL5.js.map +1 -0
- package/dist/chunk-PXCHPZTP.cjs +839 -0
- package/dist/chunk-PXCHPZTP.cjs.map +1 -0
- package/dist/chunk-Q7TBBUTX.cjs +110 -0
- package/dist/chunk-Q7TBBUTX.cjs.map +1 -0
- package/dist/chunk-QQMU44KJ.js +612 -0
- package/dist/chunk-QQMU44KJ.js.map +1 -0
- package/dist/chunk-QZN7R2WP.cjs +114 -0
- package/dist/chunk-QZN7R2WP.cjs.map +1 -0
- package/dist/chunk-RKVSJU46.js +35 -0
- package/dist/chunk-RKVSJU46.js.map +1 -0
- package/dist/chunk-RM6ZWNT3.js +561 -0
- package/dist/chunk-RM6ZWNT3.js.map +1 -0
- package/dist/chunk-SX4VQXAA.cjs +114 -0
- package/dist/chunk-SX4VQXAA.cjs.map +1 -0
- package/dist/chunk-SZ7BLAY3.js +92 -0
- package/dist/chunk-SZ7BLAY3.js.map +1 -0
- package/dist/chunk-TN4MG6FY.js +112 -0
- package/dist/chunk-TN4MG6FY.js.map +1 -0
- package/dist/chunk-UC7PHDM6.cjs +331 -0
- package/dist/chunk-UC7PHDM6.cjs.map +1 -0
- package/dist/chunk-UXVLYUUW.js +108 -0
- package/dist/chunk-UXVLYUUW.js.map +1 -0
- package/dist/chunk-VVGYRZ7S.cjs +38 -0
- package/dist/chunk-VVGYRZ7S.cjs.map +1 -0
- package/dist/chunk-W5256BJ4.js +56 -0
- package/dist/chunk-W5256BJ4.js.map +1 -0
- package/dist/chunk-WUMOSOEK.cjs +62 -0
- package/dist/chunk-WUMOSOEK.cjs.map +1 -0
- package/dist/chunk-XLRE2J25.js +140 -0
- package/dist/chunk-XLRE2J25.js.map +1 -0
- package/dist/chunk-Y6W5V2CI.js +19 -0
- package/dist/chunk-Y6W5V2CI.js.map +1 -0
- package/dist/chunk-Z4QPZ3Z3.cjs +114 -0
- package/dist/chunk-Z4QPZ3Z3.cjs.map +1 -0
- package/dist/createEngineGridQuery-Dmq3i5v3.d.cts +884 -0
- package/dist/createEngineGridQuery-Mt1hc33m.d.ts +884 -0
- package/dist/date-picker-jalali.cjs +263 -0
- package/dist/date-picker-jalali.cjs.map +1 -0
- package/dist/date-picker-jalali.d.cts +62 -0
- package/dist/date-picker-jalali.d.ts +62 -0
- package/dist/date-picker-jalali.js +256 -0
- package/dist/date-picker-jalali.js.map +1 -0
- package/dist/finance.cjs +205 -0
- package/dist/finance.cjs.map +1 -0
- package/dist/finance.d.cts +90 -0
- package/dist/finance.d.ts +90 -0
- package/dist/finance.js +157 -0
- package/dist/finance.js.map +1 -0
- package/dist/foldedColumn-IHDT4ARZ.cjs +66 -0
- package/dist/foldedColumn-IHDT4ARZ.cjs.map +1 -0
- package/dist/foldedColumn-TFURUKFG.js +64 -0
- package/dist/foldedColumn-TFURUKFG.js.map +1 -0
- package/dist/headless.cjs +729 -0
- package/dist/headless.cjs.map +1 -0
- package/dist/headless.d.cts +504 -0
- package/dist/headless.d.ts +504 -0
- package/dist/headless.js +226 -0
- package/dist/headless.js.map +1 -0
- package/dist/index-DN8M8Jkq.d.cts +14 -0
- package/dist/index-DmzL-F_o.d.ts +14 -0
- package/dist/index.cjs +8002 -11409
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +437 -2305
- package/dist/index.d.ts +437 -2305
- package/dist/index.js +7244 -11083
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.cjs +12 -0
- package/dist/locales/ar.cjs.map +1 -0
- package/dist/locales/ar.d.cts +6 -0
- package/dist/locales/ar.d.ts +6 -0
- package/dist/locales/ar.js +3 -0
- package/dist/locales/ar.js.map +1 -0
- package/dist/locales/en.cjs +12 -0
- package/dist/locales/en.cjs.map +1 -0
- package/dist/locales/en.d.cts +6 -0
- package/dist/locales/en.d.ts +6 -0
- package/dist/locales/en.js +3 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/locales/fa.cjs +12 -0
- package/dist/locales/fa.cjs.map +1 -0
- package/dist/locales/fa.d.cts +6 -0
- package/dist/locales/fa.d.ts +6 -0
- package/dist/locales/fa.js +3 -0
- package/dist/locales/fa.js.map +1 -0
- package/dist/locales/index.cjs +51 -0
- package/dist/locales/index.cjs.map +1 -0
- package/dist/locales/index.d.cts +5 -0
- package/dist/locales/index.d.ts +5 -0
- package/dist/locales/index.js +6 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/memoryRecords-AWDKUJ2F.cjs +50 -0
- package/dist/memoryRecords-AWDKUJ2F.cjs.map +1 -0
- package/dist/memoryRecords-OJTGXLRH.js +47 -0
- package/dist/memoryRecords-OJTGXLRH.js.map +1 -0
- package/dist/pagedFooterTotals-DXCGDO6F.cjs +27 -0
- package/dist/pagedFooterTotals-DXCGDO6F.cjs.map +1 -0
- package/dist/pagedFooterTotals-ORWKUNE7.js +25 -0
- package/dist/pagedFooterTotals-ORWKUNE7.js.map +1 -0
- package/dist/pagedKit-MFGAJFSK.cjs +134 -0
- package/dist/pagedKit-MFGAJFSK.cjs.map +1 -0
- package/dist/pagedKit-WYWY4LRV.js +127 -0
- package/dist/pagedKit-WYWY4LRV.js.map +1 -0
- package/dist/pagedSearch-HCPJW7VM.js +38 -0
- package/dist/pagedSearch-HCPJW7VM.js.map +1 -0
- package/dist/pagedSearch-U3WCG4GN.cjs +42 -0
- package/dist/pagedSearch-U3WCG4GN.cjs.map +1 -0
- package/dist/plugins/csv.cjs +124 -0
- package/dist/plugins/csv.cjs.map +1 -0
- package/dist/plugins/csv.d.cts +44 -0
- package/dist/plugins/csv.d.ts +44 -0
- package/dist/plugins/csv.js +120 -0
- package/dist/plugins/csv.js.map +1 -0
- package/dist/plugins/excel.cjs +52 -0
- package/dist/plugins/excel.cjs.map +1 -0
- package/dist/plugins/excel.d.cts +14 -0
- package/dist/plugins/excel.d.ts +14 -0
- package/dist/plugins/excel.js +7 -0
- package/dist/plugins/excel.js.map +1 -0
- package/dist/plugins/pdf/fonts/vazirmatn.cjs +50 -0
- package/dist/plugins/pdf/fonts/vazirmatn.cjs.map +1 -0
- package/dist/plugins/pdf/fonts/vazirmatn.d.cts +24 -0
- package/dist/plugins/pdf/fonts/vazirmatn.d.ts +24 -0
- package/dist/plugins/pdf/fonts/vazirmatn.js +39 -0
- package/dist/plugins/pdf/fonts/vazirmatn.js.map +1 -0
- package/dist/plugins/pdf.cjs +24 -0
- package/dist/plugins/pdf.cjs.map +1 -0
- package/dist/plugins/pdf.d.cts +21 -0
- package/dist/plugins/pdf.d.ts +21 -0
- package/dist/plugins/pdf.js +7 -0
- package/dist/plugins/pdf.js.map +1 -0
- package/dist/presence.cjs +56 -0
- package/dist/presence.cjs.map +1 -0
- package/dist/presence.d.cts +17 -0
- package/dist/presence.d.ts +17 -0
- package/dist/presence.js +54 -0
- package/dist/presence.js.map +1 -0
- package/dist/rebuildRowVisibility-66EAZ356.cjs +21 -0
- package/dist/rebuildRowVisibility-66EAZ356.cjs.map +1 -0
- package/dist/rebuildRowVisibility-6TYM5BP2.js +19 -0
- package/dist/rebuildRowVisibility-6TYM5BP2.js.map +1 -0
- package/dist/styles.css +1440 -0
- package/dist/sync.cjs +148 -0
- package/dist/sync.cjs.map +1 -0
- package/dist/sync.d.cts +17 -0
- package/dist/sync.d.ts +17 -0
- package/dist/sync.js +146 -0
- package/dist/sync.js.map +1 -0
- package/dist/types-D__47BKv.d.cts +23 -0
- package/dist/types-D__47BKv.d.ts +23 -0
- package/package.json +184 -28
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkKMRURD5J_cjs = require('./chunk-KMRURD5J.cjs');
|
|
4
|
+
var chunkNTV2UUAJ_cjs = require('./chunk-NTV2UUAJ.cjs');
|
|
5
|
+
|
|
6
|
+
// application/handlers/cellCommandsHandler.ts
|
|
7
|
+
function logError(audit, error, context) {
|
|
8
|
+
if (error instanceof chunkKMRURD5J_cjs.DomainError) {
|
|
9
|
+
audit.log({
|
|
10
|
+
type: error.code,
|
|
11
|
+
message: error.message,
|
|
12
|
+
payload: { details: error.details, context }
|
|
13
|
+
});
|
|
14
|
+
} else if (error instanceof Error) {
|
|
15
|
+
audit.log({
|
|
16
|
+
type: "INVARIANT_VIOLATION",
|
|
17
|
+
message: error.message,
|
|
18
|
+
payload: { stack: error.stack, context }
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
audit.log({
|
|
22
|
+
type: "INVARIANT_VIOLATION",
|
|
23
|
+
message: "Unexpected error",
|
|
24
|
+
payload: { error, context }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function applyRemoteVisibilityRules(dynamic, input) {
|
|
29
|
+
const {
|
|
30
|
+
table,
|
|
31
|
+
rowId,
|
|
32
|
+
changedColumnId,
|
|
33
|
+
newValue,
|
|
34
|
+
clearDependents = true
|
|
35
|
+
} = input;
|
|
36
|
+
const meta = dynamic?.columnMeta;
|
|
37
|
+
if (!meta) return;
|
|
38
|
+
const colKey = `${table.getActiveCollectionName() ?? "default"}_${changedColumnId.value}`;
|
|
39
|
+
const changedMeta = meta.get(colKey) ?? meta.get(changedColumnId.value);
|
|
40
|
+
const resolveOn = changedMeta?.resolveOn;
|
|
41
|
+
if (!resolveOn) return;
|
|
42
|
+
if (resolveOn.fieldName !== changedColumnId.value) return;
|
|
43
|
+
const row = table.getRows().find((r) => r.id.value === rowId.value);
|
|
44
|
+
if (!row) return;
|
|
45
|
+
const rowValues = {};
|
|
46
|
+
for (const [colId, cell] of row.getCells().entries()) {
|
|
47
|
+
rowValues[colId] = cell.getValue();
|
|
48
|
+
}
|
|
49
|
+
if (newValue == null || newValue === "") return;
|
|
50
|
+
const params = typeof resolveOn.buildParams === "function" ? resolveOn.buildParams(rowValues) : { value: newValue };
|
|
51
|
+
const response = await dynamic.remoteApi.request({
|
|
52
|
+
endpoint: resolveOn.endpoint,
|
|
53
|
+
params,
|
|
54
|
+
method: "POST"
|
|
55
|
+
});
|
|
56
|
+
resolveOn.getResponse?.(response, row);
|
|
57
|
+
const flags = resolveOn.mapFlags?.(response) ?? {};
|
|
58
|
+
const toShow = [];
|
|
59
|
+
const visibilityCondition = {};
|
|
60
|
+
const activeCollection = table.getActiveCollectionName() ?? "default";
|
|
61
|
+
meta.forEach((colCfg) => {
|
|
62
|
+
if ((colCfg.fieldCollection ?? "default") !== activeCollection) return;
|
|
63
|
+
const v = colCfg.visibility;
|
|
64
|
+
if (v?.kind === "whenRemoteFlag" && v.sourceFieldName === changedColumnId.value) {
|
|
65
|
+
const colId = new chunkNTV2UUAJ_cjs.ColumnId(colCfg.fieldName);
|
|
66
|
+
const schema = table.getColumnSchema(colId);
|
|
67
|
+
const flagValue = flags[v.flag] ?? false;
|
|
68
|
+
visibilityCondition[colCfg.fieldName] = flagValue;
|
|
69
|
+
if (flagValue && schema) {
|
|
70
|
+
toShow.push({ ...schema, hidden: false });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const dependency = colCfg.dynamicSource?.dependsOn;
|
|
74
|
+
if (clearDependents && dependency && dependency.includes(changedColumnId.value) && !Object.hasOwn(visibilityCondition, colCfg.fieldName) && colCfg.visibility?.kind !== "whenTableType" && colCfg.visibility?.kind !== "whenCollection") {
|
|
75
|
+
const cell = row.getCell(colCfg.fieldName);
|
|
76
|
+
cell?.changeValue(null);
|
|
77
|
+
cell?.changeDisplay(null);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (toShow.length > 0) {
|
|
81
|
+
table.addColumns(toShow);
|
|
82
|
+
}
|
|
83
|
+
row.setVisibilityCondition(visibilityCondition);
|
|
84
|
+
}
|
|
85
|
+
var ChangeCellValueHandler = class {
|
|
86
|
+
constructor(repo, audit, permissionPolicy, dynamic) {
|
|
87
|
+
this.repo = repo;
|
|
88
|
+
this.audit = audit;
|
|
89
|
+
this.permissionPolicy = permissionPolicy;
|
|
90
|
+
this.dynamic = dynamic;
|
|
91
|
+
}
|
|
92
|
+
async execute(command, actor) {
|
|
93
|
+
const table = await this.repo.getById(command.store, command.tableKey);
|
|
94
|
+
try {
|
|
95
|
+
const rowId = new chunkNTV2UUAJ_cjs.RowId(command.rowId);
|
|
96
|
+
const columnId = new chunkNTV2UUAJ_cjs.ColumnId(command.columnId);
|
|
97
|
+
const schema = table.getColumnSchema(columnId);
|
|
98
|
+
if (!schema) {
|
|
99
|
+
throw new chunkKMRURD5J_cjs.DomainError("COLUMN_NOT_FOUND", "Column does not exist", {
|
|
100
|
+
columnId: columnId.value
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (schema.editable === false) {
|
|
104
|
+
throw new chunkKMRURD5J_cjs.DomainError("NOT_EDITABLE", "Cell is not editable", {
|
|
105
|
+
rowId: rowId.value,
|
|
106
|
+
columnId: columnId.value
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (!this.permissionPolicy.canChangeCell({
|
|
110
|
+
actor,
|
|
111
|
+
rowId: command.rowId,
|
|
112
|
+
columnId: command.columnId
|
|
113
|
+
})) {
|
|
114
|
+
throw new chunkKMRURD5J_cjs.DomainError(
|
|
115
|
+
"FORBIDDEN",
|
|
116
|
+
"Actor is not allowed to change this cell",
|
|
117
|
+
{ actor, rowId: rowId.value, columnId: columnId.value }
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
const validated = this.validateCellValue(schema.fieldType, command.newValue);
|
|
121
|
+
const domainEvent = table.changeCell(rowId, columnId, validated.value);
|
|
122
|
+
if (!domainEvent) {
|
|
123
|
+
throw new chunkKMRURD5J_cjs.DomainError(
|
|
124
|
+
"CELL_NOT_FOUND",
|
|
125
|
+
"Cell not found or value not changed",
|
|
126
|
+
{ rowId: rowId.value, columnId: columnId.value }
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
if (this.dynamic) {
|
|
130
|
+
await this.applyComputedColumns({
|
|
131
|
+
table,
|
|
132
|
+
rowId,
|
|
133
|
+
changedColumnId: columnId,
|
|
134
|
+
remoteApi: this.dynamic.remoteApi
|
|
135
|
+
});
|
|
136
|
+
await this.applyRemoteVisibilityRules({
|
|
137
|
+
table,
|
|
138
|
+
rowId,
|
|
139
|
+
changedColumnId: columnId,
|
|
140
|
+
newValue: command.newValue
|
|
141
|
+
});
|
|
142
|
+
this.applyDynamicProjection({
|
|
143
|
+
table,
|
|
144
|
+
rowId,
|
|
145
|
+
changedColumnId: columnId,
|
|
146
|
+
validatedValue: command.newValue
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
const state = table.getRows().find((r) => r.id.value === rowId.value)?.getCells().get("RowState")?.getValue();
|
|
150
|
+
if (state === "None" /* Unchanged */) {
|
|
151
|
+
table.changeCell(rowId, new chunkNTV2UUAJ_cjs.ColumnId("RowState"), "Update" /* Modified */);
|
|
152
|
+
table.changeDisplay(rowId, new chunkNTV2UUAJ_cjs.ColumnId("RowState"), "Update" /* Modified */);
|
|
153
|
+
}
|
|
154
|
+
await this.repo.save(command.store, table);
|
|
155
|
+
const out = {
|
|
156
|
+
type: "CELL_CHANGED",
|
|
157
|
+
tableId: command.tableKey,
|
|
158
|
+
rowId: domainEvent.rowId.value,
|
|
159
|
+
columnId: domainEvent.columnId.value,
|
|
160
|
+
newValue: domainEvent.newValue,
|
|
161
|
+
previousValue: domainEvent.previousValue
|
|
162
|
+
};
|
|
163
|
+
this.audit.log({ type: "CELL_CHANGED", message: out.type, payload: out });
|
|
164
|
+
return [out];
|
|
165
|
+
} catch (e) {
|
|
166
|
+
logError(this.audit, e, `ChangeCellValueHandler[${command.tableKey}:${command.rowId}:${command.columnId}]`);
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/* ── helpers ─────────────────────────────────────────────────────── */
|
|
171
|
+
applyRemoteVisibilityRules(input) {
|
|
172
|
+
return applyRemoteVisibilityRules(this.dynamic, input);
|
|
173
|
+
}
|
|
174
|
+
async applyComputedColumns(input) {
|
|
175
|
+
const { table, rowId, changedColumnId, remoteApi } = input;
|
|
176
|
+
const meta = this.dynamic.columnMeta;
|
|
177
|
+
const computedColumns = Array.from(meta.values()).filter(
|
|
178
|
+
(c) => c.computed != null
|
|
179
|
+
);
|
|
180
|
+
if (computedColumns.length === 0) return;
|
|
181
|
+
const row = table.getRows().find((r) => r.id.value === rowId.value);
|
|
182
|
+
if (!row) return;
|
|
183
|
+
const rowValues = {};
|
|
184
|
+
for (const [colId, cell] of row.getCells().entries()) {
|
|
185
|
+
rowValues[colId] = cell.getValue();
|
|
186
|
+
}
|
|
187
|
+
const dependents = /* @__PURE__ */ new Map();
|
|
188
|
+
for (const col of computedColumns) {
|
|
189
|
+
for (const dep of col.computed.dependsOn ?? []) {
|
|
190
|
+
if (!dependents.has(dep)) dependents.set(dep, []);
|
|
191
|
+
dependents.get(dep).push(col);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const queue = [changedColumnId.value];
|
|
195
|
+
const visited = /* @__PURE__ */ new Set();
|
|
196
|
+
let safetyCounter = 0;
|
|
197
|
+
const MAX = computedColumns.length + 1;
|
|
198
|
+
while (queue.length > 0) {
|
|
199
|
+
if (safetyCounter++ > MAX) {
|
|
200
|
+
throw new Error("Computed cycle detected");
|
|
201
|
+
}
|
|
202
|
+
const source = queue.shift();
|
|
203
|
+
const targets = dependents.get(source) ?? [];
|
|
204
|
+
for (const colCfg of targets) {
|
|
205
|
+
const targetField = colCfg.fieldName;
|
|
206
|
+
const targetColId = new chunkNTV2UUAJ_cjs.ColumnId(targetField);
|
|
207
|
+
const schema = table.getColumnSchema(targetColId);
|
|
208
|
+
if (!schema || !colCfg.computed) continue;
|
|
209
|
+
const rawValue = colCfg.computed.compute(rowValues, remoteApi);
|
|
210
|
+
const newValue = rawValue instanceof Promise ? await rawValue : rawValue;
|
|
211
|
+
const validated = this.validateCellValue(schema.fieldType, newValue);
|
|
212
|
+
if (validated.value instanceof Promise) {
|
|
213
|
+
throw new Error(
|
|
214
|
+
`Computed column "${targetField}" returned a Promise after validation`
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
const prev = rowValues[targetField];
|
|
218
|
+
if (Object.is(prev, validated.value)) continue;
|
|
219
|
+
table.changeCell(rowId, targetColId, validated.value);
|
|
220
|
+
if (schema.displayFormat) {
|
|
221
|
+
const validatedDisplay = this.validateCellValue(
|
|
222
|
+
schema.fieldType,
|
|
223
|
+
schema.displayFormat(newValue)
|
|
224
|
+
);
|
|
225
|
+
table.changeDisplay(rowId, targetColId, validatedDisplay.value);
|
|
226
|
+
} else {
|
|
227
|
+
table.changeDisplay(rowId, targetColId, validated.value);
|
|
228
|
+
}
|
|
229
|
+
rowValues[targetField] = validated.value;
|
|
230
|
+
queue.push(targetField);
|
|
231
|
+
visited.add(targetField);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
validateCellValue(type, value) {
|
|
236
|
+
switch (type) {
|
|
237
|
+
case "text":
|
|
238
|
+
case "textArea":
|
|
239
|
+
case "description":
|
|
240
|
+
case "date":
|
|
241
|
+
return typeof value === "string" ? { ok: true, value } : { ok: false, error: { message: "Expected string", details: { value } }, value };
|
|
242
|
+
case "static":
|
|
243
|
+
return { ok: true, value };
|
|
244
|
+
case "checkbox":
|
|
245
|
+
return typeof value === "boolean" ? { ok: true, value } : { ok: false, error: { message: "Expected boolean", details: { value } }, value };
|
|
246
|
+
case "number":
|
|
247
|
+
case "price":
|
|
248
|
+
case "select":
|
|
249
|
+
case "selectOption": {
|
|
250
|
+
if (value === "" || value === void 0) {
|
|
251
|
+
return { ok: true, value };
|
|
252
|
+
}
|
|
253
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
254
|
+
return Number.isFinite(n) ? { ok: true, value: n } : { ok: false, error: { message: "Expected number", details: { value } }, value };
|
|
255
|
+
}
|
|
256
|
+
default:
|
|
257
|
+
return { ok: false, error: { message: "Unsupported type", details: { type, value } }, value };
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
applyDynamicProjection(input) {
|
|
261
|
+
const { table, changedColumnId, validatedValue } = input;
|
|
262
|
+
const activeCollection = table.getActiveCollectionName() ?? "default";
|
|
263
|
+
this.dynamic.columnMeta.forEach((colMeta, key) => {
|
|
264
|
+
if ((colMeta.fieldCollection ?? "default") !== activeCollection) return;
|
|
265
|
+
const col = table.getColumnSchema(new chunkNTV2UUAJ_cjs.ColumnId(colMeta.fieldName));
|
|
266
|
+
const depends = colMeta.dynamicSource?.dependsOn;
|
|
267
|
+
if (depends?.includes(changedColumnId.value)) {
|
|
268
|
+
const { dynamicSource } = colMeta;
|
|
269
|
+
const { endpoint, dependsOn, ...restDynamic } = dynamicSource ?? {};
|
|
270
|
+
const base = col ?? colMeta;
|
|
271
|
+
table.setColumnSchema(new chunkNTV2UUAJ_cjs.ColumnId(base.fieldName), {
|
|
272
|
+
...base,
|
|
273
|
+
dynamicSelectFilterOption: base.dynamicSelectFilterOption ?? (() => true),
|
|
274
|
+
dynamicSource: {
|
|
275
|
+
endpoint: endpoint ?? "",
|
|
276
|
+
...restDynamic,
|
|
277
|
+
dependOn: {
|
|
278
|
+
fieldName: changedColumnId.value,
|
|
279
|
+
value: validatedValue
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (colMeta.visibility?.kind === "whenFieldTruthy" && colMeta.visibility.fieldName === changedColumnId.value && col) {
|
|
285
|
+
table.setColumnSchema(new chunkNTV2UUAJ_cjs.ColumnId(colMeta.fieldName), col);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var ChangeCellDisplayValueHandler = class {
|
|
291
|
+
constructor(repo, audit, permissionPolicy) {
|
|
292
|
+
this.repo = repo;
|
|
293
|
+
this.audit = audit;
|
|
294
|
+
this.permissionPolicy = permissionPolicy;
|
|
295
|
+
}
|
|
296
|
+
async execute(command, actor) {
|
|
297
|
+
const table = await this.repo.getById(command.store, command.tableKey);
|
|
298
|
+
try {
|
|
299
|
+
const rowId = new chunkNTV2UUAJ_cjs.RowId(command.rowId);
|
|
300
|
+
const columnId = new chunkNTV2UUAJ_cjs.ColumnId(command.columnId);
|
|
301
|
+
const schema = table.getColumnSchema(columnId);
|
|
302
|
+
if (!schema) {
|
|
303
|
+
throw new chunkKMRURD5J_cjs.DomainError("COLUMN_NOT_FOUND", "Column does not exist", {
|
|
304
|
+
columnId: columnId.value
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
if (schema.editable === false) {
|
|
308
|
+
throw new chunkKMRURD5J_cjs.DomainError("NOT_EDITABLE", "Cell is not editable", {
|
|
309
|
+
rowId: rowId.value,
|
|
310
|
+
columnId: columnId.value
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (!this.permissionPolicy.canChangeCell({
|
|
314
|
+
actor,
|
|
315
|
+
rowId: command.rowId,
|
|
316
|
+
columnId: command.columnId
|
|
317
|
+
})) {
|
|
318
|
+
throw new chunkKMRURD5J_cjs.DomainError(
|
|
319
|
+
"FORBIDDEN",
|
|
320
|
+
"Actor is not allowed to change this cell",
|
|
321
|
+
{ actor, rowId: rowId.value, columnId: columnId.value }
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
const domainEvent = table.changeDisplay(rowId, columnId, command.newValue);
|
|
325
|
+
if (!domainEvent) {
|
|
326
|
+
throw new chunkKMRURD5J_cjs.DomainError(
|
|
327
|
+
"CELL_NOT_FOUND",
|
|
328
|
+
"Cell not found or value not changed",
|
|
329
|
+
{ rowId: rowId.value, columnId: columnId.value }
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
await this.repo.save(command.store, table);
|
|
333
|
+
const out = {
|
|
334
|
+
type: "CELL_DISPLAY_CHANGED",
|
|
335
|
+
tableId: command.tableKey,
|
|
336
|
+
rowId: domainEvent.rowId.value,
|
|
337
|
+
columnId: domainEvent.columnId.value,
|
|
338
|
+
newValue: domainEvent.newValue
|
|
339
|
+
};
|
|
340
|
+
this.audit.log({ type: "CELL_DISPLAY_CHANGED", message: out.type, payload: out });
|
|
341
|
+
return [out];
|
|
342
|
+
} catch (e) {
|
|
343
|
+
logError(this.audit, e, `ChangeCellDisplayValueHandler[${command.tableKey}:${command.rowId}:${command.columnId}]`);
|
|
344
|
+
return [];
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
var SaveDescriptionHandler = class {
|
|
349
|
+
constructor(repo, audit, permissionPolicy) {
|
|
350
|
+
this.repo = repo;
|
|
351
|
+
this.audit = audit;
|
|
352
|
+
this.permissionPolicy = permissionPolicy;
|
|
353
|
+
}
|
|
354
|
+
async execute(command, actor) {
|
|
355
|
+
const table = await this.repo.getById(command.store, command.tableKey);
|
|
356
|
+
try {
|
|
357
|
+
const rowId = new chunkNTV2UUAJ_cjs.RowId(command.rowId);
|
|
358
|
+
const domainEvent = table.saveDescription(rowId, command.flag);
|
|
359
|
+
if (!domainEvent) {
|
|
360
|
+
throw new chunkKMRURD5J_cjs.DomainError(
|
|
361
|
+
"CELL_NOT_FOUND",
|
|
362
|
+
"Cell not found or value not changed",
|
|
363
|
+
{ rowId: rowId.value, flag: command.flag }
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
await this.repo.save(command.store, table);
|
|
367
|
+
const out = {
|
|
368
|
+
type: "ROW_DESCRIPTION_SAVED",
|
|
369
|
+
tableId: command.tableKey,
|
|
370
|
+
rowId: domainEvent.rowId.value,
|
|
371
|
+
description: command.flag
|
|
372
|
+
};
|
|
373
|
+
this.audit.log({ type: "INFORMATION", message: out.type, payload: out });
|
|
374
|
+
return [out];
|
|
375
|
+
} catch (e) {
|
|
376
|
+
logError(this.audit, e, `SaveDescriptionHandler[${command.tableKey}:${command.rowId}]`);
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
var ApplyDynamicProjectionHandler = class {
|
|
382
|
+
constructor(repo, audit, permissionPolicy, dynamic) {
|
|
383
|
+
this.repo = repo;
|
|
384
|
+
this.audit = audit;
|
|
385
|
+
this.permissionPolicy = permissionPolicy;
|
|
386
|
+
this.dynamic = dynamic;
|
|
387
|
+
}
|
|
388
|
+
async execute(command, actor) {
|
|
389
|
+
const { store, tableKey, rowId, columnId } = command;
|
|
390
|
+
const table = await this.repo.getById(store, tableKey);
|
|
391
|
+
try {
|
|
392
|
+
const row = table.getRow(rowId);
|
|
393
|
+
if (!row) {
|
|
394
|
+
throw new chunkKMRURD5J_cjs.DomainError("ROW_NOT_FOUND", `Row ${rowId} not found`, { rowId });
|
|
395
|
+
}
|
|
396
|
+
const cell = row.getCell(columnId);
|
|
397
|
+
if (!cell) {
|
|
398
|
+
throw new chunkKMRURD5J_cjs.DomainError("CELL_NOT_FOUND", `Cell ${columnId} not found`, { columnId });
|
|
399
|
+
}
|
|
400
|
+
const colValue = cell.getValue();
|
|
401
|
+
const previousValue = colValue;
|
|
402
|
+
const newRowId = new chunkNTV2UUAJ_cjs.RowId(rowId);
|
|
403
|
+
const newColumnId = new chunkNTV2UUAJ_cjs.ColumnId(columnId);
|
|
404
|
+
if (this.dynamic) {
|
|
405
|
+
await this.applyComputedColumns({
|
|
406
|
+
table,
|
|
407
|
+
rowId: newRowId,
|
|
408
|
+
changedColumnId: newColumnId,
|
|
409
|
+
remoteApi: this.dynamic.remoteApi
|
|
410
|
+
});
|
|
411
|
+
await this.applyRemoteVisibilityRules({
|
|
412
|
+
table,
|
|
413
|
+
rowId: newRowId,
|
|
414
|
+
changedColumnId: newColumnId,
|
|
415
|
+
newValue: colValue,
|
|
416
|
+
clearDependents: false
|
|
417
|
+
});
|
|
418
|
+
this.applyDynamicProjection({
|
|
419
|
+
table,
|
|
420
|
+
rowId: newRowId,
|
|
421
|
+
changedColumnId: newColumnId,
|
|
422
|
+
validatedValue: colValue
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
const state = table.getRows().find((r) => r.id.value === newRowId.value)?.getCells().get("RowState")?.getValue();
|
|
426
|
+
if (state === "None" /* Unchanged */) {
|
|
427
|
+
table.changeCell(newRowId, new chunkNTV2UUAJ_cjs.ColumnId("RowState"), "Update" /* Modified */);
|
|
428
|
+
table.changeDisplay(newRowId, new chunkNTV2UUAJ_cjs.ColumnId("RowState"), "Update" /* Modified */);
|
|
429
|
+
}
|
|
430
|
+
await this.repo.save(store, table);
|
|
431
|
+
const out = {
|
|
432
|
+
type: "CELL_CHANGED",
|
|
433
|
+
tableId: tableKey,
|
|
434
|
+
rowId: newRowId.value,
|
|
435
|
+
columnId: newColumnId.value,
|
|
436
|
+
newValue: colValue,
|
|
437
|
+
previousValue
|
|
438
|
+
};
|
|
439
|
+
this.audit.log({ type: "CELL_CHANGED", message: out.type, payload: out });
|
|
440
|
+
return [out];
|
|
441
|
+
} catch (e) {
|
|
442
|
+
logError(this.audit, e, `ApplyDynamicProjectionHandler[${tableKey}:${rowId}:${columnId}]`);
|
|
443
|
+
return [];
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/* ── helpers (identical to ChangeCellValueHandler) ───────────────── */
|
|
447
|
+
applyRemoteVisibilityRules(input) {
|
|
448
|
+
return applyRemoteVisibilityRules(this.dynamic, input);
|
|
449
|
+
}
|
|
450
|
+
async applyComputedColumns(input) {
|
|
451
|
+
const { table, rowId, changedColumnId, remoteApi } = input;
|
|
452
|
+
const meta = this.dynamic.columnMeta;
|
|
453
|
+
const computedColumns = Array.from(meta.values()).filter(
|
|
454
|
+
(c) => c.computed != null
|
|
455
|
+
);
|
|
456
|
+
if (computedColumns.length === 0) return;
|
|
457
|
+
const row = table.getRows().find((r) => r.id.value === rowId.value);
|
|
458
|
+
if (!row) return;
|
|
459
|
+
const rowValues = {};
|
|
460
|
+
for (const [colId, cell] of row.getCells().entries()) {
|
|
461
|
+
rowValues[colId] = cell.getValue();
|
|
462
|
+
}
|
|
463
|
+
const dependents = /* @__PURE__ */ new Map();
|
|
464
|
+
for (const col of computedColumns) {
|
|
465
|
+
for (const dep of col.computed.dependsOn ?? []) {
|
|
466
|
+
if (!dependents.has(dep)) dependents.set(dep, []);
|
|
467
|
+
dependents.get(dep).push(col);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
const queue = [changedColumnId.value];
|
|
471
|
+
const visited = /* @__PURE__ */ new Set();
|
|
472
|
+
let safetyCounter = 0;
|
|
473
|
+
const MAX = computedColumns.length + 1;
|
|
474
|
+
while (queue.length > 0) {
|
|
475
|
+
if (safetyCounter++ > MAX) throw new Error("Computed cycle detected");
|
|
476
|
+
const source = queue.shift();
|
|
477
|
+
const targets = dependents.get(source) ?? [];
|
|
478
|
+
for (const colCfg of targets) {
|
|
479
|
+
const targetField = colCfg.fieldName;
|
|
480
|
+
const targetColId = new chunkNTV2UUAJ_cjs.ColumnId(targetField);
|
|
481
|
+
const schema = table.getColumnSchema(targetColId);
|
|
482
|
+
if (!schema || !colCfg.computed) continue;
|
|
483
|
+
const rawValue = colCfg.computed.compute(rowValues, remoteApi);
|
|
484
|
+
const newValue = rawValue instanceof Promise ? await rawValue : rawValue;
|
|
485
|
+
const validated = this.validateCellValue(schema.fieldType, newValue);
|
|
486
|
+
if (validated.value instanceof Promise) {
|
|
487
|
+
throw new Error(`Computed column "${targetField}" returned a Promise after validation`);
|
|
488
|
+
}
|
|
489
|
+
const prev = rowValues[targetField];
|
|
490
|
+
if (Object.is(prev, validated.value)) continue;
|
|
491
|
+
table.changeCell(rowId, targetColId, validated.value);
|
|
492
|
+
if (schema.displayFormat) {
|
|
493
|
+
const validatedDisplay = this.validateCellValue(
|
|
494
|
+
schema.fieldType,
|
|
495
|
+
schema.displayFormat(newValue)
|
|
496
|
+
);
|
|
497
|
+
table.changeDisplay(rowId, targetColId, validatedDisplay.value);
|
|
498
|
+
} else {
|
|
499
|
+
table.changeDisplay(rowId, targetColId, validated.value);
|
|
500
|
+
}
|
|
501
|
+
rowValues[targetField] = validated.value;
|
|
502
|
+
queue.push(targetField);
|
|
503
|
+
visited.add(targetField);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
validateCellValue(type, value) {
|
|
508
|
+
switch (type) {
|
|
509
|
+
case "text":
|
|
510
|
+
case "textArea":
|
|
511
|
+
case "description":
|
|
512
|
+
case "date":
|
|
513
|
+
return typeof value === "string" ? { ok: true, value } : { ok: false, error: { message: "Expected string", details: { value } }, value };
|
|
514
|
+
case "static":
|
|
515
|
+
return { ok: true, value };
|
|
516
|
+
case "checkbox":
|
|
517
|
+
return typeof value === "boolean" ? { ok: true, value } : { ok: false, error: { message: "Expected boolean", details: { value } }, value };
|
|
518
|
+
case "number":
|
|
519
|
+
case "price":
|
|
520
|
+
case "select":
|
|
521
|
+
case "selectOption": {
|
|
522
|
+
if (value === "" || value === void 0) return { ok: true, value };
|
|
523
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
524
|
+
return Number.isFinite(n) ? { ok: true, value: n } : { ok: false, error: { message: "Expected number", details: { value } }, value };
|
|
525
|
+
}
|
|
526
|
+
default:
|
|
527
|
+
return { ok: false, error: { message: "Unsupported type", details: { type, value } }, value };
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
applyDynamicProjection(input) {
|
|
531
|
+
const { table, changedColumnId, validatedValue } = input;
|
|
532
|
+
const activeCollection = table.getActiveCollectionName() ?? "default";
|
|
533
|
+
this.dynamic.columnMeta.forEach((colMeta, key) => {
|
|
534
|
+
if ((colMeta.fieldCollection ?? "default") !== activeCollection) return;
|
|
535
|
+
const col = table.getColumnSchema(new chunkNTV2UUAJ_cjs.ColumnId(colMeta.fieldName));
|
|
536
|
+
const depends = colMeta.dynamicSource?.dependsOn;
|
|
537
|
+
if (depends?.includes(changedColumnId.value)) {
|
|
538
|
+
const { dynamicSource } = colMeta;
|
|
539
|
+
const { endpoint, dependsOn, ...restDynamic } = dynamicSource ?? {};
|
|
540
|
+
const base = col ?? colMeta;
|
|
541
|
+
table.setColumnSchema(new chunkNTV2UUAJ_cjs.ColumnId(base.fieldName), {
|
|
542
|
+
...base,
|
|
543
|
+
dynamicSelectFilterOption: base.dynamicSelectFilterOption ?? (() => true),
|
|
544
|
+
dynamicSource: {
|
|
545
|
+
endpoint: endpoint ?? "",
|
|
546
|
+
...restDynamic,
|
|
547
|
+
dependOn: {
|
|
548
|
+
fieldName: changedColumnId.value,
|
|
549
|
+
value: validatedValue
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
if (colMeta.visibility?.kind === "whenFieldTruthy" && colMeta.visibility.fieldName === changedColumnId.value && col) {
|
|
555
|
+
table.setColumnSchema(new chunkNTV2UUAJ_cjs.ColumnId(colMeta.fieldName), col);
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
exports.ApplyDynamicProjectionHandler = ApplyDynamicProjectionHandler;
|
|
562
|
+
exports.ChangeCellDisplayValueHandler = ChangeCellDisplayValueHandler;
|
|
563
|
+
exports.ChangeCellValueHandler = ChangeCellValueHandler;
|
|
564
|
+
exports.SaveDescriptionHandler = SaveDescriptionHandler;
|
|
565
|
+
exports.applyRemoteVisibilityRules = applyRemoteVisibilityRules;
|
|
566
|
+
exports.logError = logError;
|
|
567
|
+
//# sourceMappingURL=chunk-DXRCYW42.cjs.map
|
|
568
|
+
//# sourceMappingURL=chunk-DXRCYW42.cjs.map
|