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,135 @@
|
|
|
1
|
+
import { G as GridPlugin, a as GridPluginContext, E as ExportSource, b as ExportColumnDef } from './GridPlugin-oxhq8AsM.cjs';
|
|
2
|
+
import { U as UITableController } from './UITableController-Cuwq481K.cjs';
|
|
3
|
+
import { b as GridSession } from './GridSession-B-9lLcoB.cjs';
|
|
4
|
+
|
|
5
|
+
type ExcelExportPluginOptions = {
|
|
6
|
+
/** Skip browser download (useful in tests / Node). */
|
|
7
|
+
download?: boolean;
|
|
8
|
+
onBlob?: (blob: Blob, meta: {
|
|
9
|
+
fileName: string;
|
|
10
|
+
rowCount: number;
|
|
11
|
+
columnCount: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Subscribes to EXPORT_REQUESTED (format=xlsx); never mutates Domain.
|
|
16
|
+
*/
|
|
17
|
+
declare class ExcelExportPlugin implements GridPlugin {
|
|
18
|
+
private readonly options;
|
|
19
|
+
readonly name = "excel-export";
|
|
20
|
+
private unsub;
|
|
21
|
+
constructor(options?: ExcelExportPluginOptions);
|
|
22
|
+
register(ctx: GridPluginContext): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
private onEvent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type ExcelImportPluginOptions = {
|
|
28
|
+
onImported?: (meta: {
|
|
29
|
+
rowCount: number;
|
|
30
|
+
columnCount: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Subscribes to IMPORT_REQUESTED (format=xlsx); mutates domain only via
|
|
35
|
+
* session/engine commands (never touches Entity directly).
|
|
36
|
+
*/
|
|
37
|
+
declare class ExcelImportPlugin implements GridPlugin {
|
|
38
|
+
private readonly options;
|
|
39
|
+
readonly name = "excel-import";
|
|
40
|
+
private unsub;
|
|
41
|
+
constructor(options?: ExcelImportPluginOptions);
|
|
42
|
+
register(ctx: GridPluginContext): void;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
private onEvent;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type ExportActiveCollectionResult = {
|
|
48
|
+
rowCount: number;
|
|
49
|
+
columnCount: number;
|
|
50
|
+
};
|
|
51
|
+
type ExportActiveCollectionOptions = {
|
|
52
|
+
fileName?: string;
|
|
53
|
+
sheetName?: string;
|
|
54
|
+
direction?: 'rtl' | 'ltr';
|
|
55
|
+
rowHeaderLabel?: string;
|
|
56
|
+
/** When false, skip browser download (tests). */
|
|
57
|
+
download?: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Imperative facade used by ERP toolbar buttons.
|
|
61
|
+
* Prefer PluginHost.requestExport + ExcelExportPlugin for event-driven hosts.
|
|
62
|
+
*/
|
|
63
|
+
declare function exportActiveCollectionToExcel(controller: UITableController, options?: ExportActiveCollectionOptions): Promise<ExportActiveCollectionResult>;
|
|
64
|
+
|
|
65
|
+
type ExportTable = {
|
|
66
|
+
columns: Array<{
|
|
67
|
+
fieldName: string;
|
|
68
|
+
caption: string;
|
|
69
|
+
}>;
|
|
70
|
+
/** Parallel to columns; already stringified cell text */
|
|
71
|
+
rows: string[][];
|
|
72
|
+
/** Parallel to rows (PR-122). Absent ⇒ all leaf. */
|
|
73
|
+
rowKinds?: Array<'group' | 'leaf' | 'total'>;
|
|
74
|
+
/** Excel outlineLevel per data row (PR-122). */
|
|
75
|
+
outlineLevels?: number[];
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Builds a dense string matrix from ExportSource (plugin query port).
|
|
79
|
+
*/
|
|
80
|
+
declare function buildExportTable(source: ExportSource): ExportTable;
|
|
81
|
+
|
|
82
|
+
type BuildXlsxOptions = {
|
|
83
|
+
sheetName?: string;
|
|
84
|
+
direction?: 'rtl' | 'ltr';
|
|
85
|
+
rowHeaderLabel?: string;
|
|
86
|
+
};
|
|
87
|
+
declare function buildXlsxBlob(table: ExportTable, options?: BuildXlsxOptions): Blob;
|
|
88
|
+
declare function downloadBlob(blob: Blob, fileName: string): void;
|
|
89
|
+
|
|
90
|
+
type ParsedXlsxSheet = {
|
|
91
|
+
/** First row cells (header captions / field names). */
|
|
92
|
+
headers: string[];
|
|
93
|
+
/** Body rows; each row length matches headers (padded with ''). */
|
|
94
|
+
rows: string[][];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Parses a minimal OOXML .xlsx (store or deflate) into a string matrix.
|
|
98
|
+
* Supports shared strings and inlineStr (as produced by buildXlsxBlob).
|
|
99
|
+
*/
|
|
100
|
+
declare function parseXlsxBlob(data: Blob | ArrayBuffer | Uint8Array, options?: {
|
|
101
|
+
sheetName?: string;
|
|
102
|
+
}): Promise<ParsedXlsxSheet>;
|
|
103
|
+
|
|
104
|
+
type ImportCellKv = {
|
|
105
|
+
key: string;
|
|
106
|
+
value: unknown;
|
|
107
|
+
display: unknown;
|
|
108
|
+
};
|
|
109
|
+
type MappedImportRows = {
|
|
110
|
+
columns: Array<{
|
|
111
|
+
fieldName: string;
|
|
112
|
+
fieldType?: string;
|
|
113
|
+
}>;
|
|
114
|
+
/** One KeyValue[] per data row (no index column). */
|
|
115
|
+
rows: ImportCellKv[][];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Maps sheet headers to export/query columns by caption or fieldName.
|
|
119
|
+
* Skips index/static columns.
|
|
120
|
+
*/
|
|
121
|
+
declare function mapImportedSheet(sheet: ParsedXlsxSheet, columns: readonly ExportColumnDef[]): MappedImportRows;
|
|
122
|
+
|
|
123
|
+
type ApplyImportedRowsResult = {
|
|
124
|
+
rowCount: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Applies imported cell matrices through the engine (ADD_NEW_ROWS) so
|
|
128
|
+
* CachedTableRepository / IndexedDB persistence stays on the normal path.
|
|
129
|
+
*
|
|
130
|
+
* Uses a synthetic unique `index` token only for dedupe in Table.addNewRows;
|
|
131
|
+
* addNewRow still auto-assigns the real index cell.
|
|
132
|
+
*/
|
|
133
|
+
declare function applyImportedRows(session: GridSession, rows: ImportCellKv[][]): Promise<ApplyImportedRowsResult>;
|
|
134
|
+
|
|
135
|
+
export { ExcelExportPlugin as E, type ParsedXlsxSheet as P, type ExcelExportPluginOptions as a, ExcelImportPlugin as b, type ExcelImportPluginOptions as c, type ExportActiveCollectionOptions as d, type ExportActiveCollectionResult as e, type ExportTable as f, applyImportedRows as g, buildExportTable as h, buildXlsxBlob as i, downloadBlob as j, exportActiveCollectionToExcel as k, mapImportedSheet as m, parseXlsxBlob as p };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { G as GridPlugin, a as GridPluginContext, E as ExportSource, b as ExportColumnDef } from './GridPlugin-CJCaYnlw.js';
|
|
2
|
+
import { U as UITableController } from './UITableController-DU8RopUM.js';
|
|
3
|
+
import { b as GridSession } from './GridSession-Bc7UIawO.js';
|
|
4
|
+
|
|
5
|
+
type ExcelExportPluginOptions = {
|
|
6
|
+
/** Skip browser download (useful in tests / Node). */
|
|
7
|
+
download?: boolean;
|
|
8
|
+
onBlob?: (blob: Blob, meta: {
|
|
9
|
+
fileName: string;
|
|
10
|
+
rowCount: number;
|
|
11
|
+
columnCount: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Subscribes to EXPORT_REQUESTED (format=xlsx); never mutates Domain.
|
|
16
|
+
*/
|
|
17
|
+
declare class ExcelExportPlugin implements GridPlugin {
|
|
18
|
+
private readonly options;
|
|
19
|
+
readonly name = "excel-export";
|
|
20
|
+
private unsub;
|
|
21
|
+
constructor(options?: ExcelExportPluginOptions);
|
|
22
|
+
register(ctx: GridPluginContext): void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
private onEvent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type ExcelImportPluginOptions = {
|
|
28
|
+
onImported?: (meta: {
|
|
29
|
+
rowCount: number;
|
|
30
|
+
columnCount: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Subscribes to IMPORT_REQUESTED (format=xlsx); mutates domain only via
|
|
35
|
+
* session/engine commands (never touches Entity directly).
|
|
36
|
+
*/
|
|
37
|
+
declare class ExcelImportPlugin implements GridPlugin {
|
|
38
|
+
private readonly options;
|
|
39
|
+
readonly name = "excel-import";
|
|
40
|
+
private unsub;
|
|
41
|
+
constructor(options?: ExcelImportPluginOptions);
|
|
42
|
+
register(ctx: GridPluginContext): void;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
private onEvent;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type ExportActiveCollectionResult = {
|
|
48
|
+
rowCount: number;
|
|
49
|
+
columnCount: number;
|
|
50
|
+
};
|
|
51
|
+
type ExportActiveCollectionOptions = {
|
|
52
|
+
fileName?: string;
|
|
53
|
+
sheetName?: string;
|
|
54
|
+
direction?: 'rtl' | 'ltr';
|
|
55
|
+
rowHeaderLabel?: string;
|
|
56
|
+
/** When false, skip browser download (tests). */
|
|
57
|
+
download?: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Imperative facade used by ERP toolbar buttons.
|
|
61
|
+
* Prefer PluginHost.requestExport + ExcelExportPlugin for event-driven hosts.
|
|
62
|
+
*/
|
|
63
|
+
declare function exportActiveCollectionToExcel(controller: UITableController, options?: ExportActiveCollectionOptions): Promise<ExportActiveCollectionResult>;
|
|
64
|
+
|
|
65
|
+
type ExportTable = {
|
|
66
|
+
columns: Array<{
|
|
67
|
+
fieldName: string;
|
|
68
|
+
caption: string;
|
|
69
|
+
}>;
|
|
70
|
+
/** Parallel to columns; already stringified cell text */
|
|
71
|
+
rows: string[][];
|
|
72
|
+
/** Parallel to rows (PR-122). Absent ⇒ all leaf. */
|
|
73
|
+
rowKinds?: Array<'group' | 'leaf' | 'total'>;
|
|
74
|
+
/** Excel outlineLevel per data row (PR-122). */
|
|
75
|
+
outlineLevels?: number[];
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Builds a dense string matrix from ExportSource (plugin query port).
|
|
79
|
+
*/
|
|
80
|
+
declare function buildExportTable(source: ExportSource): ExportTable;
|
|
81
|
+
|
|
82
|
+
type BuildXlsxOptions = {
|
|
83
|
+
sheetName?: string;
|
|
84
|
+
direction?: 'rtl' | 'ltr';
|
|
85
|
+
rowHeaderLabel?: string;
|
|
86
|
+
};
|
|
87
|
+
declare function buildXlsxBlob(table: ExportTable, options?: BuildXlsxOptions): Blob;
|
|
88
|
+
declare function downloadBlob(blob: Blob, fileName: string): void;
|
|
89
|
+
|
|
90
|
+
type ParsedXlsxSheet = {
|
|
91
|
+
/** First row cells (header captions / field names). */
|
|
92
|
+
headers: string[];
|
|
93
|
+
/** Body rows; each row length matches headers (padded with ''). */
|
|
94
|
+
rows: string[][];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Parses a minimal OOXML .xlsx (store or deflate) into a string matrix.
|
|
98
|
+
* Supports shared strings and inlineStr (as produced by buildXlsxBlob).
|
|
99
|
+
*/
|
|
100
|
+
declare function parseXlsxBlob(data: Blob | ArrayBuffer | Uint8Array, options?: {
|
|
101
|
+
sheetName?: string;
|
|
102
|
+
}): Promise<ParsedXlsxSheet>;
|
|
103
|
+
|
|
104
|
+
type ImportCellKv = {
|
|
105
|
+
key: string;
|
|
106
|
+
value: unknown;
|
|
107
|
+
display: unknown;
|
|
108
|
+
};
|
|
109
|
+
type MappedImportRows = {
|
|
110
|
+
columns: Array<{
|
|
111
|
+
fieldName: string;
|
|
112
|
+
fieldType?: string;
|
|
113
|
+
}>;
|
|
114
|
+
/** One KeyValue[] per data row (no index column). */
|
|
115
|
+
rows: ImportCellKv[][];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Maps sheet headers to export/query columns by caption or fieldName.
|
|
119
|
+
* Skips index/static columns.
|
|
120
|
+
*/
|
|
121
|
+
declare function mapImportedSheet(sheet: ParsedXlsxSheet, columns: readonly ExportColumnDef[]): MappedImportRows;
|
|
122
|
+
|
|
123
|
+
type ApplyImportedRowsResult = {
|
|
124
|
+
rowCount: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Applies imported cell matrices through the engine (ADD_NEW_ROWS) so
|
|
128
|
+
* CachedTableRepository / IndexedDB persistence stays on the normal path.
|
|
129
|
+
*
|
|
130
|
+
* Uses a synthetic unique `index` token only for dedupe in Table.addNewRows;
|
|
131
|
+
* addNewRow still auto-assigns the real index cell.
|
|
132
|
+
*/
|
|
133
|
+
declare function applyImportedRows(session: GridSession, rows: ImportCellKv[][]): Promise<ApplyImportedRowsResult>;
|
|
134
|
+
|
|
135
|
+
export { ExcelExportPlugin as E, type ParsedXlsxSheet as P, type ExcelExportPluginOptions as a, ExcelImportPlugin as b, type ExcelImportPluginOptions as c, type ExportActiveCollectionOptions as d, type ExportActiveCollectionResult as e, type ExportTable as f, applyImportedRows as g, buildExportTable as h, buildXlsxBlob as i, downloadBlob as j, exportActiveCollectionToExcel as k, mapImportedSheet as m, parseXlsxBlob as p };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { logError, applyRemoteVisibilityRules } from './chunk-RM6ZWNT3.js';
|
|
2
|
+
import { DomainError } from './chunk-KHMG6EI2.js';
|
|
3
|
+
import { ColumnId, RowId } from './chunk-XLRE2J25.js';
|
|
4
|
+
|
|
5
|
+
// application/handlers/applyRowVisibilityHandler.ts
|
|
6
|
+
var ApplyRowVisibilityHandler = class {
|
|
7
|
+
constructor(repo, audit, permissionPolicy, dynamic) {
|
|
8
|
+
this.repo = repo;
|
|
9
|
+
this.audit = audit;
|
|
10
|
+
this.permissionPolicy = permissionPolicy;
|
|
11
|
+
this.dynamic = dynamic;
|
|
12
|
+
/**
|
|
13
|
+
* Dedupe guard: آخرین امضای (row + کالکشن + مقادیر ستونهای resolveOn) که
|
|
14
|
+
* برایش سر ریموت صدا زده شد. بدون این، دو مسیر مستقل (کلیک سطر →
|
|
15
|
+
* setActiveRow و کلیک سلول → setActiveCell) و رفرشهای متوالی، همان API را
|
|
16
|
+
* چند بار صدا میزدند. وقتی مقادیر عوض شود امضای جدید است و API دوباره
|
|
17
|
+
* صدا زده میشود.
|
|
18
|
+
*/
|
|
19
|
+
this.lastSignature = null;
|
|
20
|
+
}
|
|
21
|
+
async execute(command, actor) {
|
|
22
|
+
const { store, tableKey, rowId } = command;
|
|
23
|
+
const table = await this.repo.getById(store, tableKey);
|
|
24
|
+
try {
|
|
25
|
+
if (!this.dynamic) return [];
|
|
26
|
+
const row = table.getRow(rowId);
|
|
27
|
+
if (!row) {
|
|
28
|
+
throw new DomainError("ROW_NOT_FOUND", `Row ${rowId} not found`, { rowId });
|
|
29
|
+
}
|
|
30
|
+
const previousVisibility = { ...row.getVisibilityCondition() ?? {} };
|
|
31
|
+
const activeCollection = table.getActiveCollectionName() ?? "default";
|
|
32
|
+
const resolveOnColumns = Array.from(this.dynamic.columnMeta.values()).filter(
|
|
33
|
+
(colCfg) => colCfg.resolveOn != null
|
|
34
|
+
).filter(
|
|
35
|
+
(colCfg) => (colCfg.fieldCollection ?? "default") === activeCollection
|
|
36
|
+
);
|
|
37
|
+
if (resolveOnColumns.length === 0) return [];
|
|
38
|
+
const signatureParts = resolveOnColumns.map(
|
|
39
|
+
(colCfg) => String(row.getCell(colCfg.resolveOn.fieldName)?.getValue() ?? "")
|
|
40
|
+
);
|
|
41
|
+
const signature = `${store}:${tableKey}:${rowId}:${activeCollection}:${signatureParts.join("|")}`;
|
|
42
|
+
if (signature === this.lastSignature) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
this.lastSignature = signature;
|
|
46
|
+
for (const colCfg of resolveOnColumns) {
|
|
47
|
+
const cell = row.getCell(colCfg.resolveOn.fieldName);
|
|
48
|
+
if (!cell) continue;
|
|
49
|
+
const value = cell.getValue();
|
|
50
|
+
if (value == null || value === "") continue;
|
|
51
|
+
await this.applyRemoteVisibilityRules({
|
|
52
|
+
table,
|
|
53
|
+
rowId: new RowId(rowId),
|
|
54
|
+
changedColumnId: new ColumnId(colCfg.resolveOn.fieldName),
|
|
55
|
+
newValue: value,
|
|
56
|
+
clearDependents: false
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
await this.repo.save(store, table);
|
|
60
|
+
const out = {
|
|
61
|
+
type: "CELL_CHANGED",
|
|
62
|
+
tableId: tableKey,
|
|
63
|
+
rowId,
|
|
64
|
+
columnId: "visibilityCondition",
|
|
65
|
+
previousValue: previousVisibility,
|
|
66
|
+
newValue: row.getVisibilityCondition()
|
|
67
|
+
};
|
|
68
|
+
this.audit.log({ type: "INFORMATION", message: "ROW_VISIBILITY_APPLIED", payload: out });
|
|
69
|
+
return [out];
|
|
70
|
+
} catch (e) {
|
|
71
|
+
logError(this.audit, e, `ApplyRowVisibilityHandler[${tableKey}:${rowId}]`);
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/* ── identical to ChangeCellValueHandler helper ───────────────────── */
|
|
76
|
+
applyRemoteVisibilityRules(input) {
|
|
77
|
+
return applyRemoteVisibilityRules(this.dynamic, input);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { ApplyRowVisibilityHandler };
|
|
82
|
+
//# sourceMappingURL=applyRowVisibilityHandler-KS6TMCBN.js.map
|
|
83
|
+
//# sourceMappingURL=applyRowVisibilityHandler-KS6TMCBN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../application/handlers/applyRowVisibilityHandler.ts"],"names":[],"mappings":"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","file":"applyRowVisibilityHandler-KS6TMCBN.js","sourcesContent":["// application/handlers/applyRowVisibilityHandler.ts — lazy module (loaded the\r\n// first time a row with `resolveOn` columns becomes active).\r\nimport { ColumnSchema } from '../../bootstrap/type';\r\nimport { DomainError } from '../../domain/errors/DomainError';\r\nimport { Actor, PermissionPolicy } from '../../domain/policies';\r\nimport { ColumnId, RowId } from '../../domain/value-objects';\r\nimport { ApplyRowVisibilityCommand } from '../commands';\r\nimport { TableEvent } from '../events';\r\nimport { AuditLogger } from '../ports/AuditLogger';\r\nimport { TableRepository } from '../ports/TableRepository';\r\nimport {\r\n applyRemoteVisibilityRules,\r\n DynamicConfig,\r\n logError,\r\n} from './cellCommandsHandler';\r\n\r\n/* ======================================================\r\n ApplyRowVisibilityHandler\r\n ====================================================== */\r\n\r\n/**\r\n * هنگام فعالشدن (active) شدن یک سطر اجرا میشود:\r\n * برای هر ستون دارای resolveOn که سلولش مقدار دارد، applyRemoteVisibilityRules\r\n * را (بدون پاککردن سلولهای وابسته) صدا میزند تا visibilityCondition سطر فعال\r\n * از سرویس ریموت بهروز شود. مقدار RowState سطر را تغییر نمیدهد.\r\n */\r\nexport class ApplyRowVisibilityHandler {\r\n /**\r\n * Dedupe guard: آخرین امضای (row + کالکشن + مقادیر ستونهای resolveOn) که\r\n * برایش سر ریموت صدا زده شد. بدون این، دو مسیر مستقل (کلیک سطر →\r\n * setActiveRow و کلیک سلول → setActiveCell) و رفرشهای متوالی، همان API را\r\n * چند بار صدا میزدند. وقتی مقادیر عوض شود امضای جدید است و API دوباره\r\n * صدا زده میشود.\r\n */\r\n private lastSignature: string | null = null;\r\n\r\n constructor(\r\n private readonly repo: TableRepository,\r\n private readonly audit: AuditLogger,\r\n private readonly permissionPolicy: PermissionPolicy,\r\n private readonly dynamic?: DynamicConfig,\r\n ) { }\r\n\r\n async execute(\r\n command: ApplyRowVisibilityCommand,\r\n actor: Actor,\r\n ): Promise<TableEvent[]> {\r\n const { store, tableKey, rowId } = command;\r\n const table = await this.repo.getById(store, tableKey);\r\n\r\n try {\r\n if (!this.dynamic) return [];\r\n\r\n const row = table.getRow(rowId);\r\n if (!row) {\r\n throw new DomainError('ROW_NOT_FOUND', `Row ${rowId} not found`, { rowId });\r\n }\r\n\r\n const previousVisibility = { ...(row.getVisibilityCondition() ?? {}) };\r\n const activeCollection = table.getActiveCollectionName() ?? 'default';\r\n\r\n // گارد کالکشن: هر کالکشن فقط resolveOnِ خودش را اجرا کند. بدون این،\r\n // دوقلوهای RpWayId سایر کالکشنها هم حلقه را طی میکردند و API به ازای\r\n // هر کالکشن (۴ بار) صدا زده میشد.\r\n const resolveOnColumns = Array.from(this.dynamic.columnMeta.values())\r\n .filter(\r\n (colCfg): colCfg is ColumnSchema & { resolveOn: NonNullable<ColumnSchema['resolveOn']> } =>\r\n colCfg.resolveOn != null,\r\n )\r\n .filter(\r\n colCfg => (colCfg.fieldCollection ?? 'default') === activeCollection,\r\n );\r\n\r\n if (resolveOnColumns.length === 0) return [];\r\n\r\n // امضای dedupe: مقادیر فعلی سلولهای resolveOn این سطر.\r\n const signatureParts = resolveOnColumns.map(colCfg =>\r\n String(row.getCell(colCfg.resolveOn.fieldName)?.getValue() ?? ''),\r\n );\r\n const signature =\r\n `${store}:${tableKey}:${rowId}:${activeCollection}:${signatureParts.join('|')}`;\r\n if (signature === this.lastSignature) {\r\n // همان سطر با همان مقادیر — فلگها عوض نشدهاند؛ API و save لازم نیست.\r\n return [];\r\n }\r\n\r\n // ثبت امضا «قبل» از فراخوانی ریموت: دو مسیر dispatch (کلیک سطر و\r\n // کلیک سلول) تقریباً همزمان اجرا میشوند و اگر امضا بعد از await ثبت\r\n // میشد، هر دو از فیلتر رد میشدند و API دوبار صدا زده میشد.\r\n this.lastSignature = signature;\r\n\r\n for (const colCfg of resolveOnColumns) {\r\n const cell = row.getCell(colCfg.resolveOn.fieldName);\r\n if (!cell) continue;\r\n const value = cell.getValue();\r\n if (value == null || value === '') continue;\r\n\r\n await this.applyRemoteVisibilityRules({\r\n table,\r\n rowId: new RowId(rowId),\r\n changedColumnId: new ColumnId(colCfg.resolveOn.fieldName),\r\n newValue: value,\r\n clearDependents: false,\r\n });\r\n }\r\n\r\n await this.repo.save(store, table);\r\n\r\n const out: TableEvent = {\r\n type: 'CELL_CHANGED',\r\n tableId: tableKey,\r\n rowId,\r\n columnId: 'visibilityCondition',\r\n previousValue: previousVisibility,\r\n newValue: row.getVisibilityCondition(),\r\n };\r\n this.audit.log({ type: 'INFORMATION', message: 'ROW_VISIBILITY_APPLIED', payload: out });\r\n return [out];\r\n\r\n } catch (e) {\r\n logError(this.audit, e, `ApplyRowVisibilityHandler[${tableKey}:${rowId}]`);\r\n return [];\r\n }\r\n }\r\n\r\n /* ── identical to ChangeCellValueHandler helper ───────────────────── */\r\n\r\n private applyRemoteVisibilityRules(input: Parameters<typeof applyRemoteVisibilityRules>[1]): Promise<void> {\r\n return applyRemoteVisibilityRules(this.dynamic, input);\r\n }\r\n}"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkDXRCYW42_cjs = require('./chunk-DXRCYW42.cjs');
|
|
4
|
+
var chunkKMRURD5J_cjs = require('./chunk-KMRURD5J.cjs');
|
|
5
|
+
var chunkNTV2UUAJ_cjs = require('./chunk-NTV2UUAJ.cjs');
|
|
6
|
+
|
|
7
|
+
// application/handlers/applyRowVisibilityHandler.ts
|
|
8
|
+
var ApplyRowVisibilityHandler = class {
|
|
9
|
+
constructor(repo, audit, permissionPolicy, dynamic) {
|
|
10
|
+
this.repo = repo;
|
|
11
|
+
this.audit = audit;
|
|
12
|
+
this.permissionPolicy = permissionPolicy;
|
|
13
|
+
this.dynamic = dynamic;
|
|
14
|
+
/**
|
|
15
|
+
* Dedupe guard: آخرین امضای (row + کالکشن + مقادیر ستونهای resolveOn) که
|
|
16
|
+
* برایش سر ریموت صدا زده شد. بدون این، دو مسیر مستقل (کلیک سطر →
|
|
17
|
+
* setActiveRow و کلیک سلول → setActiveCell) و رفرشهای متوالی، همان API را
|
|
18
|
+
* چند بار صدا میزدند. وقتی مقادیر عوض شود امضای جدید است و API دوباره
|
|
19
|
+
* صدا زده میشود.
|
|
20
|
+
*/
|
|
21
|
+
this.lastSignature = null;
|
|
22
|
+
}
|
|
23
|
+
async execute(command, actor) {
|
|
24
|
+
const { store, tableKey, rowId } = command;
|
|
25
|
+
const table = await this.repo.getById(store, tableKey);
|
|
26
|
+
try {
|
|
27
|
+
if (!this.dynamic) return [];
|
|
28
|
+
const row = table.getRow(rowId);
|
|
29
|
+
if (!row) {
|
|
30
|
+
throw new chunkKMRURD5J_cjs.DomainError("ROW_NOT_FOUND", `Row ${rowId} not found`, { rowId });
|
|
31
|
+
}
|
|
32
|
+
const previousVisibility = { ...row.getVisibilityCondition() ?? {} };
|
|
33
|
+
const activeCollection = table.getActiveCollectionName() ?? "default";
|
|
34
|
+
const resolveOnColumns = Array.from(this.dynamic.columnMeta.values()).filter(
|
|
35
|
+
(colCfg) => colCfg.resolveOn != null
|
|
36
|
+
).filter(
|
|
37
|
+
(colCfg) => (colCfg.fieldCollection ?? "default") === activeCollection
|
|
38
|
+
);
|
|
39
|
+
if (resolveOnColumns.length === 0) return [];
|
|
40
|
+
const signatureParts = resolveOnColumns.map(
|
|
41
|
+
(colCfg) => String(row.getCell(colCfg.resolveOn.fieldName)?.getValue() ?? "")
|
|
42
|
+
);
|
|
43
|
+
const signature = `${store}:${tableKey}:${rowId}:${activeCollection}:${signatureParts.join("|")}`;
|
|
44
|
+
if (signature === this.lastSignature) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
this.lastSignature = signature;
|
|
48
|
+
for (const colCfg of resolveOnColumns) {
|
|
49
|
+
const cell = row.getCell(colCfg.resolveOn.fieldName);
|
|
50
|
+
if (!cell) continue;
|
|
51
|
+
const value = cell.getValue();
|
|
52
|
+
if (value == null || value === "") continue;
|
|
53
|
+
await this.applyRemoteVisibilityRules({
|
|
54
|
+
table,
|
|
55
|
+
rowId: new chunkNTV2UUAJ_cjs.RowId(rowId),
|
|
56
|
+
changedColumnId: new chunkNTV2UUAJ_cjs.ColumnId(colCfg.resolveOn.fieldName),
|
|
57
|
+
newValue: value,
|
|
58
|
+
clearDependents: false
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
await this.repo.save(store, table);
|
|
62
|
+
const out = {
|
|
63
|
+
type: "CELL_CHANGED",
|
|
64
|
+
tableId: tableKey,
|
|
65
|
+
rowId,
|
|
66
|
+
columnId: "visibilityCondition",
|
|
67
|
+
previousValue: previousVisibility,
|
|
68
|
+
newValue: row.getVisibilityCondition()
|
|
69
|
+
};
|
|
70
|
+
this.audit.log({ type: "INFORMATION", message: "ROW_VISIBILITY_APPLIED", payload: out });
|
|
71
|
+
return [out];
|
|
72
|
+
} catch (e) {
|
|
73
|
+
chunkDXRCYW42_cjs.logError(this.audit, e, `ApplyRowVisibilityHandler[${tableKey}:${rowId}]`);
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/* ── identical to ChangeCellValueHandler helper ───────────────────── */
|
|
78
|
+
applyRemoteVisibilityRules(input) {
|
|
79
|
+
return chunkDXRCYW42_cjs.applyRemoteVisibilityRules(this.dynamic, input);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.ApplyRowVisibilityHandler = ApplyRowVisibilityHandler;
|
|
84
|
+
//# sourceMappingURL=applyRowVisibilityHandler-LXCOGESZ.cjs.map
|
|
85
|
+
//# sourceMappingURL=applyRowVisibilityHandler-LXCOGESZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../application/handlers/applyRowVisibilityHandler.ts"],"names":["DomainError","RowId","ColumnId","logError","applyRemoteVisibilityRules"],"mappings":"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","file":"applyRowVisibilityHandler-LXCOGESZ.cjs","sourcesContent":["// application/handlers/applyRowVisibilityHandler.ts — lazy module (loaded the\r\n// first time a row with `resolveOn` columns becomes active).\r\nimport { ColumnSchema } from '../../bootstrap/type';\r\nimport { DomainError } from '../../domain/errors/DomainError';\r\nimport { Actor, PermissionPolicy } from '../../domain/policies';\r\nimport { ColumnId, RowId } from '../../domain/value-objects';\r\nimport { ApplyRowVisibilityCommand } from '../commands';\r\nimport { TableEvent } from '../events';\r\nimport { AuditLogger } from '../ports/AuditLogger';\r\nimport { TableRepository } from '../ports/TableRepository';\r\nimport {\r\n applyRemoteVisibilityRules,\r\n DynamicConfig,\r\n logError,\r\n} from './cellCommandsHandler';\r\n\r\n/* ======================================================\r\n ApplyRowVisibilityHandler\r\n ====================================================== */\r\n\r\n/**\r\n * هنگام فعالشدن (active) شدن یک سطر اجرا میشود:\r\n * برای هر ستون دارای resolveOn که سلولش مقدار دارد، applyRemoteVisibilityRules\r\n * را (بدون پاککردن سلولهای وابسته) صدا میزند تا visibilityCondition سطر فعال\r\n * از سرویس ریموت بهروز شود. مقدار RowState سطر را تغییر نمیدهد.\r\n */\r\nexport class ApplyRowVisibilityHandler {\r\n /**\r\n * Dedupe guard: آخرین امضای (row + کالکشن + مقادیر ستونهای resolveOn) که\r\n * برایش سر ریموت صدا زده شد. بدون این، دو مسیر مستقل (کلیک سطر →\r\n * setActiveRow و کلیک سلول → setActiveCell) و رفرشهای متوالی، همان API را\r\n * چند بار صدا میزدند. وقتی مقادیر عوض شود امضای جدید است و API دوباره\r\n * صدا زده میشود.\r\n */\r\n private lastSignature: string | null = null;\r\n\r\n constructor(\r\n private readonly repo: TableRepository,\r\n private readonly audit: AuditLogger,\r\n private readonly permissionPolicy: PermissionPolicy,\r\n private readonly dynamic?: DynamicConfig,\r\n ) { }\r\n\r\n async execute(\r\n command: ApplyRowVisibilityCommand,\r\n actor: Actor,\r\n ): Promise<TableEvent[]> {\r\n const { store, tableKey, rowId } = command;\r\n const table = await this.repo.getById(store, tableKey);\r\n\r\n try {\r\n if (!this.dynamic) return [];\r\n\r\n const row = table.getRow(rowId);\r\n if (!row) {\r\n throw new DomainError('ROW_NOT_FOUND', `Row ${rowId} not found`, { rowId });\r\n }\r\n\r\n const previousVisibility = { ...(row.getVisibilityCondition() ?? {}) };\r\n const activeCollection = table.getActiveCollectionName() ?? 'default';\r\n\r\n // گارد کالکشن: هر کالکشن فقط resolveOnِ خودش را اجرا کند. بدون این،\r\n // دوقلوهای RpWayId سایر کالکشنها هم حلقه را طی میکردند و API به ازای\r\n // هر کالکشن (۴ بار) صدا زده میشد.\r\n const resolveOnColumns = Array.from(this.dynamic.columnMeta.values())\r\n .filter(\r\n (colCfg): colCfg is ColumnSchema & { resolveOn: NonNullable<ColumnSchema['resolveOn']> } =>\r\n colCfg.resolveOn != null,\r\n )\r\n .filter(\r\n colCfg => (colCfg.fieldCollection ?? 'default') === activeCollection,\r\n );\r\n\r\n if (resolveOnColumns.length === 0) return [];\r\n\r\n // امضای dedupe: مقادیر فعلی سلولهای resolveOn این سطر.\r\n const signatureParts = resolveOnColumns.map(colCfg =>\r\n String(row.getCell(colCfg.resolveOn.fieldName)?.getValue() ?? ''),\r\n );\r\n const signature =\r\n `${store}:${tableKey}:${rowId}:${activeCollection}:${signatureParts.join('|')}`;\r\n if (signature === this.lastSignature) {\r\n // همان سطر با همان مقادیر — فلگها عوض نشدهاند؛ API و save لازم نیست.\r\n return [];\r\n }\r\n\r\n // ثبت امضا «قبل» از فراخوانی ریموت: دو مسیر dispatch (کلیک سطر و\r\n // کلیک سلول) تقریباً همزمان اجرا میشوند و اگر امضا بعد از await ثبت\r\n // میشد، هر دو از فیلتر رد میشدند و API دوبار صدا زده میشد.\r\n this.lastSignature = signature;\r\n\r\n for (const colCfg of resolveOnColumns) {\r\n const cell = row.getCell(colCfg.resolveOn.fieldName);\r\n if (!cell) continue;\r\n const value = cell.getValue();\r\n if (value == null || value === '') continue;\r\n\r\n await this.applyRemoteVisibilityRules({\r\n table,\r\n rowId: new RowId(rowId),\r\n changedColumnId: new ColumnId(colCfg.resolveOn.fieldName),\r\n newValue: value,\r\n clearDependents: false,\r\n });\r\n }\r\n\r\n await this.repo.save(store, table);\r\n\r\n const out: TableEvent = {\r\n type: 'CELL_CHANGED',\r\n tableId: tableKey,\r\n rowId,\r\n columnId: 'visibilityCondition',\r\n previousValue: previousVisibility,\r\n newValue: row.getVisibilityCondition(),\r\n };\r\n this.audit.log({ type: 'INFORMATION', message: 'ROW_VISIBILITY_APPLIED', payload: out });\r\n return [out];\r\n\r\n } catch (e) {\r\n logError(this.audit, e, `ApplyRowVisibilityHandler[${tableKey}:${rowId}]`);\r\n return [];\r\n }\r\n }\r\n\r\n /* ── identical to ChangeCellValueHandler helper ───────────────────── */\r\n\r\n private applyRemoteVisibilityRules(input: Parameters<typeof applyRemoteVisibilityRules>[1]): Promise<void> {\r\n return applyRemoteVisibilityRules(this.dynamic, input);\r\n }\r\n}"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkEBV6HGZB_cjs = require('./chunk-EBV6HGZB.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "createBroadcastChannelPresenceTransport", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkEBV6HGZB_cjs.createBroadcastChannelPresenceTransport; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=broadcastChannelTransport-FHUMV76O.cjs.map
|
|
12
|
+
//# sourceMappingURL=broadcastChannelTransport-FHUMV76O.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"broadcastChannelTransport-FHUMV76O.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"broadcastChannelTransport-MIH53VNZ.js"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { R as RemoteApi } from './RemoteApi-CCQxiSf1.js';
|
|
2
|
+
|
|
3
|
+
type RemoteApiRequest = {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
params?: Record<string, unknown>;
|
|
6
|
+
method?: 'GET' | 'POST';
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Wraps ANY host transport as a `RemoteApi` port — the grid never learns how
|
|
10
|
+
* requests are authenticated or where defaults come from.
|
|
11
|
+
*
|
|
12
|
+
* arianERP example (RTK Query base query with token refresh + Redux defaults):
|
|
13
|
+
*
|
|
14
|
+
* const remoteApi = new CallbackRemoteApi(async ({ endpoint, params, method }) => {
|
|
15
|
+
* const res = await baseQueryByToken(
|
|
16
|
+
* { url: endpoint, method: method ?? 'POST', body: params ?? {} },
|
|
17
|
+
* { getState: () => store.getState(), dispatch: store.dispatch } as never,
|
|
18
|
+
* {},
|
|
19
|
+
* );
|
|
20
|
+
* return res.data;
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
declare class CallbackRemoteApi implements RemoteApi {
|
|
24
|
+
private readonly send;
|
|
25
|
+
private readonly onError?;
|
|
26
|
+
constructor(send: (request: RemoteApiRequest) => Promise<unknown>, onError?: ((error: unknown) => void) | undefined);
|
|
27
|
+
request<TResponse = unknown>(input: RemoteApiRequest): Promise<TResponse>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { CallbackRemoteApi as C, type RemoteApiRequest as R };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { R as RemoteApi } from './RemoteApi-CCQxiSf1.cjs';
|
|
2
|
+
|
|
3
|
+
type RemoteApiRequest = {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
params?: Record<string, unknown>;
|
|
6
|
+
method?: 'GET' | 'POST';
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Wraps ANY host transport as a `RemoteApi` port — the grid never learns how
|
|
10
|
+
* requests are authenticated or where defaults come from.
|
|
11
|
+
*
|
|
12
|
+
* arianERP example (RTK Query base query with token refresh + Redux defaults):
|
|
13
|
+
*
|
|
14
|
+
* const remoteApi = new CallbackRemoteApi(async ({ endpoint, params, method }) => {
|
|
15
|
+
* const res = await baseQueryByToken(
|
|
16
|
+
* { url: endpoint, method: method ?? 'POST', body: params ?? {} },
|
|
17
|
+
* { getState: () => store.getState(), dispatch: store.dispatch } as never,
|
|
18
|
+
* {},
|
|
19
|
+
* );
|
|
20
|
+
* return res.data;
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
declare class CallbackRemoteApi implements RemoteApi {
|
|
24
|
+
private readonly send;
|
|
25
|
+
private readonly onError?;
|
|
26
|
+
constructor(send: (request: RemoteApiRequest) => Promise<unknown>, onError?: ((error: unknown) => void) | undefined);
|
|
27
|
+
request<TResponse = unknown>(input: RemoteApiRequest): Promise<TResponse>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { CallbackRemoteApi as C, type RemoteApiRequest as R };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { U as UIRow, C as ColumnSchema, V as ValidCell, D as DefaultOptionType } from './GridSession-Bc7UIawO.js';
|
|
3
|
+
import { U as UITableController } from './UITableController-DU8RopUM.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Argument passed to `ColumnSchema.render` / `ColumnViewBinding.render`.
|
|
7
|
+
* Built-in FieldType editors are skipped when `render` is set.
|
|
8
|
+
*/
|
|
9
|
+
interface CellRenderContext {
|
|
10
|
+
tableKey: string;
|
|
11
|
+
row: UIRow;
|
|
12
|
+
columnId: string;
|
|
13
|
+
meta: ColumnSchema;
|
|
14
|
+
controller: UITableController;
|
|
15
|
+
value: unknown;
|
|
16
|
+
display: unknown;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
isDeleted: boolean;
|
|
19
|
+
isEditable: boolean;
|
|
20
|
+
mode: 'view' | 'cell' | 'form';
|
|
21
|
+
tabIndex: number;
|
|
22
|
+
validation: ValidCell;
|
|
23
|
+
dispatchChangeValue: (newValue: unknown, option?: DefaultOptionType) => void;
|
|
24
|
+
dispatchChangeDisplay: (label: string | null) => void;
|
|
25
|
+
activeCell: () => void;
|
|
26
|
+
/** Current grid-search query when this cell is the active hit (PR-71). */
|
|
27
|
+
searchQuery?: string;
|
|
28
|
+
isCurrentSearchMatch?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type CustomCellResolveResult = {
|
|
31
|
+
hit: false;
|
|
32
|
+
} | {
|
|
33
|
+
hit: true;
|
|
34
|
+
node: ReactNode;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* PR-54: custom `render` wins over the FieldType switch.
|
|
38
|
+
* `returnDisplayValue` is not a renderer — it stays the engine display formatter.
|
|
39
|
+
*/
|
|
40
|
+
declare function resolveCustomCellNode(meta: Pick<ColumnSchema, 'render'> | undefined, ctx: CellRenderContext): CustomCellResolveResult;
|
|
41
|
+
|
|
42
|
+
export { type CellRenderContext as C, type CustomCellResolveResult as a, resolveCustomCellNode as r };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { U as UIRow, C as ColumnSchema, V as ValidCell, D as DefaultOptionType } from './GridSession-B-9lLcoB.cjs';
|
|
3
|
+
import { U as UITableController } from './UITableController-Cuwq481K.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Argument passed to `ColumnSchema.render` / `ColumnViewBinding.render`.
|
|
7
|
+
* Built-in FieldType editors are skipped when `render` is set.
|
|
8
|
+
*/
|
|
9
|
+
interface CellRenderContext {
|
|
10
|
+
tableKey: string;
|
|
11
|
+
row: UIRow;
|
|
12
|
+
columnId: string;
|
|
13
|
+
meta: ColumnSchema;
|
|
14
|
+
controller: UITableController;
|
|
15
|
+
value: unknown;
|
|
16
|
+
display: unknown;
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
isDeleted: boolean;
|
|
19
|
+
isEditable: boolean;
|
|
20
|
+
mode: 'view' | 'cell' | 'form';
|
|
21
|
+
tabIndex: number;
|
|
22
|
+
validation: ValidCell;
|
|
23
|
+
dispatchChangeValue: (newValue: unknown, option?: DefaultOptionType) => void;
|
|
24
|
+
dispatchChangeDisplay: (label: string | null) => void;
|
|
25
|
+
activeCell: () => void;
|
|
26
|
+
/** Current grid-search query when this cell is the active hit (PR-71). */
|
|
27
|
+
searchQuery?: string;
|
|
28
|
+
isCurrentSearchMatch?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type CustomCellResolveResult = {
|
|
31
|
+
hit: false;
|
|
32
|
+
} | {
|
|
33
|
+
hit: true;
|
|
34
|
+
node: ReactNode;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* PR-54: custom `render` wins over the FieldType switch.
|
|
38
|
+
* `returnDisplayValue` is not a renderer — it stays the engine display formatter.
|
|
39
|
+
*/
|
|
40
|
+
declare function resolveCustomCellNode(meta: Pick<ColumnSchema, 'render'> | undefined, ctx: CellRenderContext): CustomCellResolveResult;
|
|
41
|
+
|
|
42
|
+
export { type CellRenderContext as C, type CustomCellResolveResult as a, resolveCustomCellNode as r };
|