@uipath/apollo-react 7.11.3 → 7.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.cjs +6 -6
- package/dist/canvas/components/CanvasDiffView/CanvasDiffView.js +6 -6
- package/dist/canvas/components/JsonTree/JsonTree.cjs +2 -2
- package/dist/canvas/components/JsonTree/JsonTree.js +2 -2
- package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.cjs +6 -6
- package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.js +6 -6
- package/dist/canvas/components/StageNode/tasks/TaskContent.cjs +1 -1
- package/dist/canvas/components/StageNode/tasks/TaskContent.js +1 -1
- package/dist/canvas/locales/de.cjs +1 -1
- package/dist/canvas/locales/de.d.ts.map +1 -1
- package/dist/canvas/locales/de.js +1 -1
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/locales/es-MX.cjs +1 -1
- package/dist/canvas/locales/es-MX.d.ts.map +1 -1
- package/dist/canvas/locales/es-MX.js +1 -1
- package/dist/canvas/locales/es.cjs +1 -1
- package/dist/canvas/locales/es.d.ts.map +1 -1
- package/dist/canvas/locales/es.js +1 -1
- package/dist/canvas/locales/fr.cjs +1 -1
- package/dist/canvas/locales/fr.d.ts.map +1 -1
- package/dist/canvas/locales/fr.js +1 -1
- package/dist/canvas/locales/ja.cjs +1 -1
- package/dist/canvas/locales/ja.d.ts.map +1 -1
- package/dist/canvas/locales/ja.js +1 -1
- package/dist/canvas/locales/ko.cjs +1 -1
- package/dist/canvas/locales/ko.d.ts.map +1 -1
- package/dist/canvas/locales/ko.js +1 -1
- package/dist/canvas/locales/pt-BR.cjs +1 -1
- package/dist/canvas/locales/pt-BR.d.ts.map +1 -1
- package/dist/canvas/locales/pt-BR.js +1 -1
- package/dist/canvas/locales/pt.cjs +1 -1
- package/dist/canvas/locales/pt.d.ts.map +1 -1
- package/dist/canvas/locales/pt.js +1 -1
- package/dist/canvas/locales/ro.cjs +1 -1
- package/dist/canvas/locales/ro.d.ts.map +1 -1
- package/dist/canvas/locales/ro.js +1 -1
- package/dist/canvas/locales/ru.cjs +1 -1
- package/dist/canvas/locales/ru.d.ts.map +1 -1
- package/dist/canvas/locales/ru.js +1 -1
- package/dist/canvas/locales/tr.cjs +1 -1
- package/dist/canvas/locales/tr.d.ts.map +1 -1
- package/dist/canvas/locales/tr.js +1 -1
- package/dist/canvas/locales/zh-CN.cjs +1 -1
- package/dist/canvas/locales/zh-CN.d.ts.map +1 -1
- package/dist/canvas/locales/zh-CN.js +1 -1
- package/dist/canvas/locales/zh-TW.cjs +1 -1
- package/dist/canvas/locales/zh-TW.d.ts.map +1 -1
- package/dist/canvas/locales/zh-TW.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/locales/de.cjs +1 -1
- package/dist/chat/locales/de.d.ts.map +1 -1
- package/dist/chat/locales/de.js +1 -1
- package/dist/chat/locales/en.cjs +1 -1
- package/dist/chat/locales/en.d.ts.map +1 -1
- package/dist/chat/locales/en.js +1 -1
- package/dist/chat/locales/es-MX.cjs +1 -1
- package/dist/chat/locales/es-MX.d.ts.map +1 -1
- package/dist/chat/locales/es-MX.js +1 -1
- package/dist/chat/locales/es.cjs +1 -1
- package/dist/chat/locales/es.d.ts.map +1 -1
- package/dist/chat/locales/es.js +1 -1
- package/dist/chat/locales/fr.cjs +1 -1
- package/dist/chat/locales/fr.d.ts.map +1 -1
- package/dist/chat/locales/fr.js +1 -1
- package/dist/chat/locales/ja.cjs +1 -1
- package/dist/chat/locales/ja.d.ts.map +1 -1
- package/dist/chat/locales/ja.js +1 -1
- package/dist/chat/locales/ko.cjs +1 -1
- package/dist/chat/locales/ko.d.ts.map +1 -1
- package/dist/chat/locales/ko.js +1 -1
- package/dist/chat/locales/pt-BR.cjs +1 -1
- package/dist/chat/locales/pt-BR.d.ts.map +1 -1
- package/dist/chat/locales/pt-BR.js +1 -1
- package/dist/chat/locales/pt.cjs +1 -1
- package/dist/chat/locales/pt.d.ts.map +1 -1
- package/dist/chat/locales/pt.js +1 -1
- package/dist/chat/locales/ro.cjs +1 -1
- package/dist/chat/locales/ro.d.ts.map +1 -1
- package/dist/chat/locales/ro.js +1 -1
- package/dist/chat/locales/ru.cjs +1 -1
- package/dist/chat/locales/ru.d.ts.map +1 -1
- package/dist/chat/locales/ru.js +1 -1
- package/dist/chat/locales/tr.cjs +1 -1
- package/dist/chat/locales/tr.d.ts.map +1 -1
- package/dist/chat/locales/tr.js +1 -1
- package/dist/chat/locales/zh-CN.cjs +1 -1
- package/dist/chat/locales/zh-CN.d.ts.map +1 -1
- package/dist/chat/locales/zh-CN.js +1 -1
- package/dist/chat/locales/zh-TW.cjs +1 -1
- package/dist/chat/locales/zh-TW.d.ts.map +1 -1
- package/dist/chat/locales/zh-TW.js +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/DecisionTable.cjs +454 -0
- package/dist/decision-table/DecisionTable.d.ts +36 -0
- package/dist/decision-table/DecisionTable.d.ts.map +1 -0
- package/dist/decision-table/DecisionTable.js +410 -0
- package/dist/decision-table/GridCell.cjs +153 -0
- package/dist/decision-table/GridCell.d.ts +43 -0
- package/dist/decision-table/GridCell.d.ts.map +1 -0
- package/dist/decision-table/GridCell.js +116 -0
- package/dist/decision-table/GridMenu.cjs +135 -0
- package/dist/decision-table/GridMenu.d.ts +30 -0
- package/dist/decision-table/GridMenu.d.ts.map +1 -0
- package/dist/decision-table/GridMenu.js +101 -0
- package/dist/decision-table/MarkGlyph.cjs +51 -0
- package/dist/decision-table/MarkGlyph.d.ts +7 -0
- package/dist/decision-table/MarkGlyph.d.ts.map +1 -0
- package/dist/decision-table/MarkGlyph.js +17 -0
- package/dist/decision-table/clipboardCodec.cjs +123 -0
- package/dist/decision-table/clipboardCodec.d.ts +8 -0
- package/dist/decision-table/clipboardCodec.d.ts.map +1 -0
- package/dist/decision-table/clipboardCodec.js +80 -0
- package/dist/decision-table/clippedTitle.cjs +39 -0
- package/dist/decision-table/clippedTitle.d.ts +3 -0
- package/dist/decision-table/clippedTitle.d.ts.map +1 -0
- package/dist/decision-table/clippedTitle.js +5 -0
- package/dist/decision-table/columnSizing.cjs +92 -0
- package/dist/decision-table/columnSizing.d.ts +13 -0
- package/dist/decision-table/columnSizing.d.ts.map +1 -0
- package/dist/decision-table/columnSizing.js +52 -0
- package/dist/decision-table/constants.cjs +84 -0
- package/dist/decision-table/constants.d.ts +14 -0
- package/dist/decision-table/constants.d.ts.map +1 -0
- package/dist/decision-table/constants.js +14 -0
- package/dist/decision-table/gridClipboard.cjs +129 -0
- package/dist/decision-table/gridClipboard.d.ts +19 -0
- package/dist/decision-table/gridClipboard.d.ts.map +1 -0
- package/dist/decision-table/gridClipboard.js +89 -0
- package/dist/decision-table/gridEvents.cjs +72 -0
- package/dist/decision-table/gridEvents.d.ts +14 -0
- package/dist/decision-table/gridEvents.d.ts.map +1 -0
- package/dist/decision-table/gridEvents.js +23 -0
- package/dist/decision-table/gridStyles.cjs +196 -0
- package/dist/decision-table/gridStyles.d.ts +47 -0
- package/dist/decision-table/gridStyles.d.ts.map +1 -0
- package/dist/decision-table/gridStyles.js +54 -0
- package/dist/decision-table/gridTypes.cjs +18 -0
- package/dist/decision-table/gridTypes.d.ts +93 -0
- package/dist/decision-table/gridTypes.d.ts.map +1 -0
- package/dist/decision-table/gridTypes.js +0 -0
- package/dist/decision-table/index.cjs +271 -0
- package/dist/decision-table/index.d.ts +13 -0
- package/dist/decision-table/index.d.ts.map +1 -0
- package/dist/decision-table/index.js +12 -0
- package/dist/decision-table/marks.cjs +39 -0
- package/dist/decision-table/marks.d.ts +20 -0
- package/dist/decision-table/marks.d.ts.map +1 -0
- package/dist/decision-table/marks.js +5 -0
- package/dist/decision-table/styles/tailwind.decision-table.css +2 -0
- package/dist/decision-table/useColumnWidths.cjs +313 -0
- package/dist/decision-table/useColumnWidths.d.ts +21 -0
- package/dist/decision-table/useColumnWidths.d.ts.map +1 -0
- package/dist/decision-table/useColumnWidths.js +279 -0
- package/dist/decision-table/useDragReorder.cjs +229 -0
- package/dist/decision-table/useDragReorder.d.ts +31 -0
- package/dist/decision-table/useDragReorder.d.ts.map +1 -0
- package/dist/decision-table/useDragReorder.js +186 -0
- package/dist/decision-table/useDragSelection.cjs +75 -0
- package/dist/decision-table/useDragSelection.d.ts +18 -0
- package/dist/decision-table/useDragSelection.d.ts.map +1 -0
- package/dist/decision-table/useDragSelection.js +41 -0
- package/dist/decision-table/useGridClipboard.cjs +195 -0
- package/dist/decision-table/useGridClipboard.d.ts +13 -0
- package/dist/decision-table/useGridClipboard.d.ts.map +1 -0
- package/dist/decision-table/useGridClipboard.js +161 -0
- package/dist/decision-table/useGridLayout.cjs +248 -0
- package/dist/decision-table/useGridLayout.d.ts +50 -0
- package/dist/decision-table/useGridLayout.d.ts.map +1 -0
- package/dist/decision-table/useGridLayout.js +211 -0
- package/dist/decision-table/useGridNavigation.cjs +441 -0
- package/dist/decision-table/useGridNavigation.d.ts +67 -0
- package/dist/decision-table/useGridNavigation.d.ts.map +1 -0
- package/dist/decision-table/useGridNavigation.js +404 -0
- package/dist/decision-table/useVirtualizedAxis.cjs +256 -0
- package/dist/decision-table/useVirtualizedAxis.d.ts +34 -0
- package/dist/decision-table/useVirtualizedAxis.d.ts.map +1 -0
- package/dist/decision-table/useVirtualizedAxis.js +219 -0
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +20 -10
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const CLIPBOARD_PAYLOAD_ATTRIBUTE = 'data-uipath-brv2-payload';
|
|
2
|
+
const needsQuoting = (cell)=>cell.includes('\t') || cell.includes('\n') || cell.includes('\r') || cell.includes('"');
|
|
3
|
+
const quoteCell = (cell)=>needsQuoting(cell) ? `"${cell.replace(/"/g, '""')}"` : cell;
|
|
4
|
+
const toTsv = (matrix)=>matrix.map((row)=>row.map(quoteCell).join('\t')).join('\n');
|
|
5
|
+
const parseTsv = (text)=>{
|
|
6
|
+
const normalized = text.replace(/\r\n?/g, '\n');
|
|
7
|
+
const rows = [];
|
|
8
|
+
let row = [];
|
|
9
|
+
let cell = '';
|
|
10
|
+
let quoted = false;
|
|
11
|
+
let cellOpened = false;
|
|
12
|
+
let index = 0;
|
|
13
|
+
while(index < normalized.length){
|
|
14
|
+
const char = normalized[index];
|
|
15
|
+
if (quoted) {
|
|
16
|
+
if ('"' === char) {
|
|
17
|
+
if ('"' === normalized[index + 1]) {
|
|
18
|
+
cell += '"';
|
|
19
|
+
index += 2;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
quoted = false;
|
|
23
|
+
index += 1;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
cell += char;
|
|
27
|
+
index += 1;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if ('"' === char && '' === cell) {
|
|
31
|
+
quoted = true;
|
|
32
|
+
cellOpened = true;
|
|
33
|
+
index += 1;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if ('\t' === char) {
|
|
37
|
+
row.push(cell);
|
|
38
|
+
cell = '';
|
|
39
|
+
cellOpened = false;
|
|
40
|
+
index += 1;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if ('\n' === char) {
|
|
44
|
+
row.push(cell);
|
|
45
|
+
rows.push(row);
|
|
46
|
+
row = [];
|
|
47
|
+
cell = '';
|
|
48
|
+
cellOpened = false;
|
|
49
|
+
index += 1;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
cell += char;
|
|
53
|
+
index += 1;
|
|
54
|
+
}
|
|
55
|
+
if ('' !== cell || row.length > 0 || cellOpened) {
|
|
56
|
+
row.push(cell);
|
|
57
|
+
rows.push(row);
|
|
58
|
+
}
|
|
59
|
+
return rows;
|
|
60
|
+
};
|
|
61
|
+
const escapeHtml = (text)=>text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
62
|
+
const toClipboardHtml = (payload)=>{
|
|
63
|
+
const body = payload.matrix.map((row)=>`<tr>${row.map((cell)=>`<td>${escapeHtml(cell)}</td>`).join('')}</tr>`).join('');
|
|
64
|
+
return `<table ${CLIPBOARD_PAYLOAD_ATTRIBUTE}="${escapeHtml(JSON.stringify(payload))}"><tbody>${body}</tbody></table>`;
|
|
65
|
+
};
|
|
66
|
+
const fromClipboardHtml = (html)=>{
|
|
67
|
+
if (!html.includes(CLIPBOARD_PAYLOAD_ATTRIBUTE)) return null;
|
|
68
|
+
const parsed = new DOMParser().parseFromString(html, 'text/html');
|
|
69
|
+
const carrier = parsed.querySelector(`[${CLIPBOARD_PAYLOAD_ATTRIBUTE}]`);
|
|
70
|
+
const raw = carrier?.getAttribute(CLIPBOARD_PAYLOAD_ATTRIBUTE);
|
|
71
|
+
if (!raw) return null;
|
|
72
|
+
try {
|
|
73
|
+
const payload = JSON.parse(raw);
|
|
74
|
+
if (!Array.isArray(payload.matrix) || !payload.matrix.every((row)=>Array.isArray(row) && row.every((cell)=>'string' == typeof cell))) return null;
|
|
75
|
+
return payload;
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export { fromClipboardHtml, parseTsv, toClipboardHtml, toTsv };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
showTitleIfClipped: ()=>showTitleIfClipped
|
|
28
|
+
});
|
|
29
|
+
const showTitleIfClipped = (event)=>{
|
|
30
|
+
const element = event.currentTarget;
|
|
31
|
+
element.title = element.scrollWidth > element.clientWidth ? element.textContent ?? '' : '';
|
|
32
|
+
};
|
|
33
|
+
exports.showTitleIfClipped = __webpack_exports__.showTitleIfClipped;
|
|
34
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
|
+
"showTitleIfClipped"
|
|
36
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
37
|
+
Object.defineProperty(exports, '__esModule', {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clippedTitle.d.ts","sourceRoot":"","sources":["../../src/decision-table/clippedTitle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAGnE,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
resizeColumnWidths: ()=>resizeColumnWidths,
|
|
28
|
+
resolveColumnWidths: ()=>resolveColumnWidths,
|
|
29
|
+
widthFor: ()=>widthFor
|
|
30
|
+
});
|
|
31
|
+
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
32
|
+
const widthFor = (map, id)=>Object.hasOwn(map, id) ? map[id] : void 0;
|
|
33
|
+
function resolveColumnWidths({ containerWidth, columns, overrides, reservedPx }) {
|
|
34
|
+
const base = columns.map((column)=>Math.max(external_constants_cjs_namespaceObject.MIN_COLUMN_WIDTH, widthFor(overrides, column.id) ?? column.defaultWidth));
|
|
35
|
+
const total = reservedPx + base.reduce((sum, width)=>sum + width, 0);
|
|
36
|
+
if (total >= containerWidth) return base;
|
|
37
|
+
const growIndices = columns.reduce((acc, column, index)=>{
|
|
38
|
+
if (void 0 === widthFor(overrides, column.id)) acc.push(index);
|
|
39
|
+
return acc;
|
|
40
|
+
}, []);
|
|
41
|
+
if (0 === growIndices.length) return base;
|
|
42
|
+
const surplus = containerWidth - total;
|
|
43
|
+
const share = Math.floor(surplus / growIndices.length);
|
|
44
|
+
const remainder = surplus - share * growIndices.length;
|
|
45
|
+
const widths = [
|
|
46
|
+
...base
|
|
47
|
+
];
|
|
48
|
+
growIndices.forEach((columnIndex, position)=>{
|
|
49
|
+
widths[columnIndex] += share + (position === growIndices.length - 1 ? remainder : 0);
|
|
50
|
+
});
|
|
51
|
+
return widths;
|
|
52
|
+
}
|
|
53
|
+
function fitColumns(columns, available) {
|
|
54
|
+
const floors = columns.map((column)=>Math.max(external_constants_cjs_namespaceObject.MIN_COLUMN_WIDTH, column.defaultWidth));
|
|
55
|
+
const defaultsTotal = floors.reduce((sum, width)=>sum + width, 0);
|
|
56
|
+
const surplus = available - defaultsTotal;
|
|
57
|
+
if (surplus <= 0) return floors;
|
|
58
|
+
const share = surplus / columns.length;
|
|
59
|
+
return floors.map((width)=>width + share);
|
|
60
|
+
}
|
|
61
|
+
function resizeColumnWidths(sizes, columns, key, newWidth, overrides, containerWidth, reservedPx) {
|
|
62
|
+
const index = columns.findIndex((column)=>column.id === key);
|
|
63
|
+
const next = {
|
|
64
|
+
...sizes
|
|
65
|
+
};
|
|
66
|
+
if (index < 0) return next;
|
|
67
|
+
const width = Math.max(external_constants_cjs_namespaceObject.MIN_COLUMN_WIDTH, newWidth);
|
|
68
|
+
next[key] = width;
|
|
69
|
+
const rightColumns = columns.slice(index + 1);
|
|
70
|
+
const rightFlexible = rightColumns.filter((column)=>void 0 === widthFor(overrides, column.id));
|
|
71
|
+
if (0 === rightFlexible.length) return next;
|
|
72
|
+
const widthOf = (column)=>widthFor(next, column.id) ?? column.defaultWidth;
|
|
73
|
+
const heldBefore = columns.slice(0, index).reduce((sum, column)=>sum + widthOf(column), 0);
|
|
74
|
+
const heldRightPinned = rightColumns.filter((column)=>void 0 !== widthFor(overrides, column.id)).reduce((sum, column)=>sum + widthOf(column), 0);
|
|
75
|
+
const available = containerWidth - reservedPx - heldBefore - width - heldRightPinned;
|
|
76
|
+
const fitted = fitColumns(rightFlexible, available);
|
|
77
|
+
rightFlexible.forEach((column, position)=>{
|
|
78
|
+
next[column.id] = fitted[position];
|
|
79
|
+
});
|
|
80
|
+
return next;
|
|
81
|
+
}
|
|
82
|
+
exports.resizeColumnWidths = __webpack_exports__.resizeColumnWidths;
|
|
83
|
+
exports.resolveColumnWidths = __webpack_exports__.resolveColumnWidths;
|
|
84
|
+
exports.widthFor = __webpack_exports__.widthFor;
|
|
85
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
86
|
+
"resizeColumnWidths",
|
|
87
|
+
"resolveColumnWidths",
|
|
88
|
+
"widthFor"
|
|
89
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
90
|
+
Object.defineProperty(exports, '__esModule', {
|
|
91
|
+
value: true
|
|
92
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SizedColumn {
|
|
2
|
+
id: string;
|
|
3
|
+
defaultWidth: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const widthFor: (map: Record<string, number>, id: string) => number | undefined;
|
|
6
|
+
export declare function resolveColumnWidths({ containerWidth, columns, overrides, reservedPx, }: {
|
|
7
|
+
containerWidth: number;
|
|
8
|
+
columns: SizedColumn[];
|
|
9
|
+
overrides: Record<string, number>;
|
|
10
|
+
reservedPx: number;
|
|
11
|
+
}): number[];
|
|
12
|
+
export declare function resizeColumnWidths(sizes: Record<string, number>, columns: SizedColumn[], key: string, newWidth: number, overrides: Record<string, number>, containerWidth: number, reservedPx: number): Record<string, number>;
|
|
13
|
+
//# sourceMappingURL=columnSizing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnSizing.d.ts","sourceRoot":"","sources":["../../src/decision-table/columnSizing.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;CACtB;AAaD,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,KAAG,MAAM,GAAG,SAC9B,CAAC;AAE/C,wBAAgB,mBAAmB,CAAC,EAClC,cAAc,EACd,OAAO,EACP,SAAS,EACT,UAAU,GACX,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,EAAE,CA2BX;AAwBD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,OAAO,EAAE,WAAW,EAAE,EACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6BxB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { MIN_COLUMN_WIDTH } from "./constants.js";
|
|
2
|
+
const widthFor = (map, id)=>Object.hasOwn(map, id) ? map[id] : void 0;
|
|
3
|
+
function resolveColumnWidths({ containerWidth, columns, overrides, reservedPx }) {
|
|
4
|
+
const base = columns.map((column)=>Math.max(MIN_COLUMN_WIDTH, widthFor(overrides, column.id) ?? column.defaultWidth));
|
|
5
|
+
const total = reservedPx + base.reduce((sum, width)=>sum + width, 0);
|
|
6
|
+
if (total >= containerWidth) return base;
|
|
7
|
+
const growIndices = columns.reduce((acc, column, index)=>{
|
|
8
|
+
if (void 0 === widthFor(overrides, column.id)) acc.push(index);
|
|
9
|
+
return acc;
|
|
10
|
+
}, []);
|
|
11
|
+
if (0 === growIndices.length) return base;
|
|
12
|
+
const surplus = containerWidth - total;
|
|
13
|
+
const share = Math.floor(surplus / growIndices.length);
|
|
14
|
+
const remainder = surplus - share * growIndices.length;
|
|
15
|
+
const widths = [
|
|
16
|
+
...base
|
|
17
|
+
];
|
|
18
|
+
growIndices.forEach((columnIndex, position)=>{
|
|
19
|
+
widths[columnIndex] += share + (position === growIndices.length - 1 ? remainder : 0);
|
|
20
|
+
});
|
|
21
|
+
return widths;
|
|
22
|
+
}
|
|
23
|
+
function fitColumns(columns, available) {
|
|
24
|
+
const floors = columns.map((column)=>Math.max(MIN_COLUMN_WIDTH, column.defaultWidth));
|
|
25
|
+
const defaultsTotal = floors.reduce((sum, width)=>sum + width, 0);
|
|
26
|
+
const surplus = available - defaultsTotal;
|
|
27
|
+
if (surplus <= 0) return floors;
|
|
28
|
+
const share = surplus / columns.length;
|
|
29
|
+
return floors.map((width)=>width + share);
|
|
30
|
+
}
|
|
31
|
+
function resizeColumnWidths(sizes, columns, key, newWidth, overrides, containerWidth, reservedPx) {
|
|
32
|
+
const index = columns.findIndex((column)=>column.id === key);
|
|
33
|
+
const next = {
|
|
34
|
+
...sizes
|
|
35
|
+
};
|
|
36
|
+
if (index < 0) return next;
|
|
37
|
+
const width = Math.max(MIN_COLUMN_WIDTH, newWidth);
|
|
38
|
+
next[key] = width;
|
|
39
|
+
const rightColumns = columns.slice(index + 1);
|
|
40
|
+
const rightFlexible = rightColumns.filter((column)=>void 0 === widthFor(overrides, column.id));
|
|
41
|
+
if (0 === rightFlexible.length) return next;
|
|
42
|
+
const widthOf = (column)=>widthFor(next, column.id) ?? column.defaultWidth;
|
|
43
|
+
const heldBefore = columns.slice(0, index).reduce((sum, column)=>sum + widthOf(column), 0);
|
|
44
|
+
const heldRightPinned = rightColumns.filter((column)=>void 0 !== widthFor(overrides, column.id)).reduce((sum, column)=>sum + widthOf(column), 0);
|
|
45
|
+
const available = containerWidth - reservedPx - heldBefore - width - heldRightPinned;
|
|
46
|
+
const fitted = fitColumns(rightFlexible, available);
|
|
47
|
+
rightFlexible.forEach((column, position)=>{
|
|
48
|
+
next[column.id] = fitted[position];
|
|
49
|
+
});
|
|
50
|
+
return next;
|
|
51
|
+
}
|
|
52
|
+
export { resizeColumnWidths, resolveColumnWidths, widthFor };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
AUTOSCROLL_EDGE_PX: ()=>AUTOSCROLL_EDGE_PX,
|
|
28
|
+
AUTOSCROLL_STEP_PX: ()=>AUTOSCROLL_STEP_PX,
|
|
29
|
+
BODY_ROW_HEIGHT_PX: ()=>BODY_ROW_HEIGHT_PX,
|
|
30
|
+
COLUMN_ESTIMATE_PX: ()=>COLUMN_ESTIMATE_PX,
|
|
31
|
+
COLUMN_RESIZE_KEYBOARD_STEP: ()=>COLUMN_RESIZE_KEYBOARD_STEP,
|
|
32
|
+
DEFAULT_COLUMN_OVERSCAN: ()=>DEFAULT_COLUMN_OVERSCAN,
|
|
33
|
+
DEFAULT_ROW_OVERSCAN: ()=>DEFAULT_ROW_OVERSCAN,
|
|
34
|
+
EMPTY_VALUE_DASH: ()=>EMPTY_VALUE_DASH,
|
|
35
|
+
FALLBACK_COLUMN_VIEWPORT_PX: ()=>FALLBACK_COLUMN_VIEWPORT_PX,
|
|
36
|
+
FALLBACK_ROW_VIEWPORT_PX: ()=>FALLBACK_ROW_VIEWPORT_PX,
|
|
37
|
+
GROUP_SEPARATOR_WIDTH_PX: ()=>GROUP_SEPARATOR_WIDTH_PX,
|
|
38
|
+
MIN_COLUMN_WIDTH: ()=>MIN_COLUMN_WIDTH,
|
|
39
|
+
ROW_NUMBER_WIDTH: ()=>ROW_NUMBER_WIDTH
|
|
40
|
+
});
|
|
41
|
+
const EMPTY_VALUE_DASH = '—';
|
|
42
|
+
const ROW_NUMBER_WIDTH = 48;
|
|
43
|
+
const MIN_COLUMN_WIDTH = 80;
|
|
44
|
+
const BODY_ROW_HEIGHT_PX = 40;
|
|
45
|
+
const GROUP_SEPARATOR_WIDTH_PX = 30;
|
|
46
|
+
const COLUMN_ESTIMATE_PX = 220;
|
|
47
|
+
const COLUMN_RESIZE_KEYBOARD_STEP = 16;
|
|
48
|
+
const DEFAULT_ROW_OVERSCAN = 30;
|
|
49
|
+
const DEFAULT_COLUMN_OVERSCAN = 8;
|
|
50
|
+
const FALLBACK_ROW_VIEWPORT_PX = 800;
|
|
51
|
+
const FALLBACK_COLUMN_VIEWPORT_PX = 1600;
|
|
52
|
+
const AUTOSCROLL_EDGE_PX = 32;
|
|
53
|
+
const AUTOSCROLL_STEP_PX = 14;
|
|
54
|
+
exports.AUTOSCROLL_EDGE_PX = __webpack_exports__.AUTOSCROLL_EDGE_PX;
|
|
55
|
+
exports.AUTOSCROLL_STEP_PX = __webpack_exports__.AUTOSCROLL_STEP_PX;
|
|
56
|
+
exports.BODY_ROW_HEIGHT_PX = __webpack_exports__.BODY_ROW_HEIGHT_PX;
|
|
57
|
+
exports.COLUMN_ESTIMATE_PX = __webpack_exports__.COLUMN_ESTIMATE_PX;
|
|
58
|
+
exports.COLUMN_RESIZE_KEYBOARD_STEP = __webpack_exports__.COLUMN_RESIZE_KEYBOARD_STEP;
|
|
59
|
+
exports.DEFAULT_COLUMN_OVERSCAN = __webpack_exports__.DEFAULT_COLUMN_OVERSCAN;
|
|
60
|
+
exports.DEFAULT_ROW_OVERSCAN = __webpack_exports__.DEFAULT_ROW_OVERSCAN;
|
|
61
|
+
exports.EMPTY_VALUE_DASH = __webpack_exports__.EMPTY_VALUE_DASH;
|
|
62
|
+
exports.FALLBACK_COLUMN_VIEWPORT_PX = __webpack_exports__.FALLBACK_COLUMN_VIEWPORT_PX;
|
|
63
|
+
exports.FALLBACK_ROW_VIEWPORT_PX = __webpack_exports__.FALLBACK_ROW_VIEWPORT_PX;
|
|
64
|
+
exports.GROUP_SEPARATOR_WIDTH_PX = __webpack_exports__.GROUP_SEPARATOR_WIDTH_PX;
|
|
65
|
+
exports.MIN_COLUMN_WIDTH = __webpack_exports__.MIN_COLUMN_WIDTH;
|
|
66
|
+
exports.ROW_NUMBER_WIDTH = __webpack_exports__.ROW_NUMBER_WIDTH;
|
|
67
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
68
|
+
"AUTOSCROLL_EDGE_PX",
|
|
69
|
+
"AUTOSCROLL_STEP_PX",
|
|
70
|
+
"BODY_ROW_HEIGHT_PX",
|
|
71
|
+
"COLUMN_ESTIMATE_PX",
|
|
72
|
+
"COLUMN_RESIZE_KEYBOARD_STEP",
|
|
73
|
+
"DEFAULT_COLUMN_OVERSCAN",
|
|
74
|
+
"DEFAULT_ROW_OVERSCAN",
|
|
75
|
+
"EMPTY_VALUE_DASH",
|
|
76
|
+
"FALLBACK_COLUMN_VIEWPORT_PX",
|
|
77
|
+
"FALLBACK_ROW_VIEWPORT_PX",
|
|
78
|
+
"GROUP_SEPARATOR_WIDTH_PX",
|
|
79
|
+
"MIN_COLUMN_WIDTH",
|
|
80
|
+
"ROW_NUMBER_WIDTH"
|
|
81
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
82
|
+
Object.defineProperty(exports, '__esModule', {
|
|
83
|
+
value: true
|
|
84
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const EMPTY_VALUE_DASH = "\u2014";
|
|
2
|
+
export declare const ROW_NUMBER_WIDTH = 48;
|
|
3
|
+
export declare const MIN_COLUMN_WIDTH = 80;
|
|
4
|
+
export declare const BODY_ROW_HEIGHT_PX = 40;
|
|
5
|
+
export declare const GROUP_SEPARATOR_WIDTH_PX = 30;
|
|
6
|
+
export declare const COLUMN_ESTIMATE_PX = 220;
|
|
7
|
+
export declare const COLUMN_RESIZE_KEYBOARD_STEP = 16;
|
|
8
|
+
export declare const DEFAULT_ROW_OVERSCAN = 30;
|
|
9
|
+
export declare const DEFAULT_COLUMN_OVERSCAN = 8;
|
|
10
|
+
export declare const FALLBACK_ROW_VIEWPORT_PX = 800;
|
|
11
|
+
export declare const FALLBACK_COLUMN_VIEWPORT_PX = 1600;
|
|
12
|
+
export declare const AUTOSCROLL_EDGE_PX = 32;
|
|
13
|
+
export declare const AUTOSCROLL_STEP_PX = 14;
|
|
14
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/decision-table/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,WAAM,CAAC;AAEpC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAKnC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const EMPTY_VALUE_DASH = '—';
|
|
2
|
+
const ROW_NUMBER_WIDTH = 48;
|
|
3
|
+
const MIN_COLUMN_WIDTH = 80;
|
|
4
|
+
const BODY_ROW_HEIGHT_PX = 40;
|
|
5
|
+
const GROUP_SEPARATOR_WIDTH_PX = 30;
|
|
6
|
+
const COLUMN_ESTIMATE_PX = 220;
|
|
7
|
+
const COLUMN_RESIZE_KEYBOARD_STEP = 16;
|
|
8
|
+
const DEFAULT_ROW_OVERSCAN = 30;
|
|
9
|
+
const DEFAULT_COLUMN_OVERSCAN = 8;
|
|
10
|
+
const FALLBACK_ROW_VIEWPORT_PX = 800;
|
|
11
|
+
const FALLBACK_COLUMN_VIEWPORT_PX = 1600;
|
|
12
|
+
const AUTOSCROLL_EDGE_PX = 32;
|
|
13
|
+
const AUTOSCROLL_STEP_PX = 14;
|
|
14
|
+
export { AUTOSCROLL_EDGE_PX, AUTOSCROLL_STEP_PX, BODY_ROW_HEIGHT_PX, COLUMN_ESTIMATE_PX, COLUMN_RESIZE_KEYBOARD_STEP, DEFAULT_COLUMN_OVERSCAN, DEFAULT_ROW_OVERSCAN, EMPTY_VALUE_DASH, FALLBACK_COLUMN_VIEWPORT_PX, FALLBACK_ROW_VIEWPORT_PX, GROUP_SEPARATOR_WIDTH_PX, MIN_COLUMN_WIDTH, ROW_NUMBER_WIDTH };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
copyRangeMatrix: ()=>copyRangeMatrix,
|
|
28
|
+
planRangeClear: ()=>planRangeClear,
|
|
29
|
+
planRangePaste: ()=>planRangePaste
|
|
30
|
+
});
|
|
31
|
+
const rectOf = (range)=>({
|
|
32
|
+
top: Math.min(range.anchor.row, range.focus.row),
|
|
33
|
+
bottom: Math.max(range.anchor.row, range.focus.row),
|
|
34
|
+
left: Math.min(range.anchor.col, range.focus.col),
|
|
35
|
+
right: Math.max(range.anchor.col, range.focus.col)
|
|
36
|
+
});
|
|
37
|
+
const copyRangeMatrix = (source, range)=>{
|
|
38
|
+
const rect = rectOf(range);
|
|
39
|
+
const matrix = [];
|
|
40
|
+
for(let row = rect.top; row <= Math.min(rect.bottom, source.rowCount - 1); row++){
|
|
41
|
+
const cells = [];
|
|
42
|
+
for(let col = rect.left; col <= Math.min(rect.right, source.columnCount - 1); col++)cells.push(source.textAt(row, col));
|
|
43
|
+
matrix.push(cells);
|
|
44
|
+
}
|
|
45
|
+
return matrix;
|
|
46
|
+
};
|
|
47
|
+
const expandSingleCell = (matrix, rect)=>{
|
|
48
|
+
if (1 !== matrix.length || 1 !== matrix[0].length) return matrix;
|
|
49
|
+
const rows = rect.bottom - rect.top + 1;
|
|
50
|
+
const cols = rect.right - rect.left + 1;
|
|
51
|
+
if (1 === rows && 1 === cols) return matrix;
|
|
52
|
+
return Array.from({
|
|
53
|
+
length: rows
|
|
54
|
+
}, ()=>Array.from({
|
|
55
|
+
length: cols
|
|
56
|
+
}, ()=>matrix[0][0]));
|
|
57
|
+
};
|
|
58
|
+
const planRangePaste = (source, range, matrix, options = {})=>{
|
|
59
|
+
const writes = [];
|
|
60
|
+
const widest = matrix.reduce((max, row)=>Math.max(max, row.length), 0);
|
|
61
|
+
if (0 === matrix.length || 0 === widest) return {
|
|
62
|
+
writes,
|
|
63
|
+
appendRows: 0,
|
|
64
|
+
clampedRows: 0,
|
|
65
|
+
clampedColumns: 0,
|
|
66
|
+
skippedCells: 0
|
|
67
|
+
};
|
|
68
|
+
const rect = rectOf(range);
|
|
69
|
+
const block = expandSingleCell(matrix, rect);
|
|
70
|
+
const blockWidest = block.reduce((max, row)=>Math.max(max, row.length), 0);
|
|
71
|
+
const rowsWanted = block.length;
|
|
72
|
+
const rowsAvailable = source.rowCount - rect.top;
|
|
73
|
+
const appendRows = options.grow ? Math.min(Math.max(0, rowsWanted - rowsAvailable), source.maxAppendRows ?? 0) : 0;
|
|
74
|
+
const rowsWritable = Math.min(rowsWanted, Math.max(0, rowsAvailable + appendRows));
|
|
75
|
+
const colsWritable = Math.min(blockWidest, Math.max(0, source.columnCount - rect.left));
|
|
76
|
+
let skippedCells = 0;
|
|
77
|
+
for(let rowOffset = 0; rowOffset < rowsWritable; rowOffset++){
|
|
78
|
+
const sourceRow = block[rowOffset];
|
|
79
|
+
for(let colOffset = 0; colOffset < colsWritable; colOffset++){
|
|
80
|
+
const text = sourceRow[colOffset];
|
|
81
|
+
if (void 0 === text) {
|
|
82
|
+
skippedCells += 1;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const row = rect.top + rowOffset;
|
|
86
|
+
const col = rect.left + colOffset;
|
|
87
|
+
if (source.canWriteAt?.(row, col, text) === false) {
|
|
88
|
+
skippedCells += 1;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
writes.push({
|
|
92
|
+
row,
|
|
93
|
+
col,
|
|
94
|
+
text
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
writes,
|
|
100
|
+
appendRows,
|
|
101
|
+
clampedRows: Math.max(0, rowsWanted - rowsWritable),
|
|
102
|
+
clampedColumns: Math.max(0, blockWidest - colsWritable),
|
|
103
|
+
skippedCells
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const planRangeClear = (source, range)=>{
|
|
107
|
+
const rect = rectOf(range);
|
|
108
|
+
const writes = [];
|
|
109
|
+
for(let row = rect.top; row <= Math.min(rect.bottom, source.rowCount - 1); row++)for(let col = rect.left; col <= Math.min(rect.right, source.columnCount - 1); col++){
|
|
110
|
+
const text = source.blankTextAt?.(col) ?? '';
|
|
111
|
+
if (source.canWriteAt?.(row, col, text) !== false) writes.push({
|
|
112
|
+
row,
|
|
113
|
+
col,
|
|
114
|
+
text
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return writes;
|
|
118
|
+
};
|
|
119
|
+
exports.copyRangeMatrix = __webpack_exports__.copyRangeMatrix;
|
|
120
|
+
exports.planRangeClear = __webpack_exports__.planRangeClear;
|
|
121
|
+
exports.planRangePaste = __webpack_exports__.planRangePaste;
|
|
122
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
123
|
+
"copyRangeMatrix",
|
|
124
|
+
"planRangeClear",
|
|
125
|
+
"planRangePaste"
|
|
126
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
127
|
+
Object.defineProperty(exports, '__esModule', {
|
|
128
|
+
value: true
|
|
129
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GridCellWrite, GridClipboardProps, GridRange } from './gridTypes';
|
|
2
|
+
type CellSource = Pick<GridClipboardProps, 'textAt' | 'canWriteAt' | 'blankTextAt' | 'maxAppendRows'> & {
|
|
3
|
+
rowCount: number;
|
|
4
|
+
columnCount: number;
|
|
5
|
+
};
|
|
6
|
+
interface GridPastePlan {
|
|
7
|
+
writes: GridCellWrite[];
|
|
8
|
+
appendRows: number;
|
|
9
|
+
clampedRows: number;
|
|
10
|
+
clampedColumns: number;
|
|
11
|
+
skippedCells: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const copyRangeMatrix: (source: CellSource, range: GridRange) => string[][];
|
|
14
|
+
export declare const planRangePaste: (source: CellSource, range: GridRange, matrix: string[][], options?: {
|
|
15
|
+
grow?: boolean;
|
|
16
|
+
}) => GridPastePlan;
|
|
17
|
+
export declare const planRangeClear: (source: CellSource, range: GridRange) => GridCellWrite[];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=gridClipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridClipboard.d.ts","sourceRoot":"","sources":["../../src/decision-table/gridClipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAehF,KAAK,UAAU,GAAG,IAAI,CACpB,kBAAkB,EAClB,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,eAAe,CAC1D,GAAG;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,UAAU,aAAa;IACrB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAGD,eAAO,MAAM,eAAe,GAAI,QAAQ,UAAU,EAAE,OAAO,SAAS,KAAG,MAAM,EAAE,EAa9E,CAAC;AAgBF,eAAO,MAAM,cAAc,GACzB,QAAQ,UAAU,EAClB,OAAO,SAAS,EAChB,QAAQ,MAAM,EAAE,EAAE,EAClB,UAAS;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,KAC/B,aAmDF,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,EAAE,OAAO,SAAS,KAAG,aAAa,EAYlF,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const rectOf = (range)=>({
|
|
2
|
+
top: Math.min(range.anchor.row, range.focus.row),
|
|
3
|
+
bottom: Math.max(range.anchor.row, range.focus.row),
|
|
4
|
+
left: Math.min(range.anchor.col, range.focus.col),
|
|
5
|
+
right: Math.max(range.anchor.col, range.focus.col)
|
|
6
|
+
});
|
|
7
|
+
const copyRangeMatrix = (source, range)=>{
|
|
8
|
+
const rect = rectOf(range);
|
|
9
|
+
const matrix = [];
|
|
10
|
+
for(let row = rect.top; row <= Math.min(rect.bottom, source.rowCount - 1); row++){
|
|
11
|
+
const cells = [];
|
|
12
|
+
for(let col = rect.left; col <= Math.min(rect.right, source.columnCount - 1); col++)cells.push(source.textAt(row, col));
|
|
13
|
+
matrix.push(cells);
|
|
14
|
+
}
|
|
15
|
+
return matrix;
|
|
16
|
+
};
|
|
17
|
+
const expandSingleCell = (matrix, rect)=>{
|
|
18
|
+
if (1 !== matrix.length || 1 !== matrix[0].length) return matrix;
|
|
19
|
+
const rows = rect.bottom - rect.top + 1;
|
|
20
|
+
const cols = rect.right - rect.left + 1;
|
|
21
|
+
if (1 === rows && 1 === cols) return matrix;
|
|
22
|
+
return Array.from({
|
|
23
|
+
length: rows
|
|
24
|
+
}, ()=>Array.from({
|
|
25
|
+
length: cols
|
|
26
|
+
}, ()=>matrix[0][0]));
|
|
27
|
+
};
|
|
28
|
+
const planRangePaste = (source, range, matrix, options = {})=>{
|
|
29
|
+
const writes = [];
|
|
30
|
+
const widest = matrix.reduce((max, row)=>Math.max(max, row.length), 0);
|
|
31
|
+
if (0 === matrix.length || 0 === widest) return {
|
|
32
|
+
writes,
|
|
33
|
+
appendRows: 0,
|
|
34
|
+
clampedRows: 0,
|
|
35
|
+
clampedColumns: 0,
|
|
36
|
+
skippedCells: 0
|
|
37
|
+
};
|
|
38
|
+
const rect = rectOf(range);
|
|
39
|
+
const block = expandSingleCell(matrix, rect);
|
|
40
|
+
const blockWidest = block.reduce((max, row)=>Math.max(max, row.length), 0);
|
|
41
|
+
const rowsWanted = block.length;
|
|
42
|
+
const rowsAvailable = source.rowCount - rect.top;
|
|
43
|
+
const appendRows = options.grow ? Math.min(Math.max(0, rowsWanted - rowsAvailable), source.maxAppendRows ?? 0) : 0;
|
|
44
|
+
const rowsWritable = Math.min(rowsWanted, Math.max(0, rowsAvailable + appendRows));
|
|
45
|
+
const colsWritable = Math.min(blockWidest, Math.max(0, source.columnCount - rect.left));
|
|
46
|
+
let skippedCells = 0;
|
|
47
|
+
for(let rowOffset = 0; rowOffset < rowsWritable; rowOffset++){
|
|
48
|
+
const sourceRow = block[rowOffset];
|
|
49
|
+
for(let colOffset = 0; colOffset < colsWritable; colOffset++){
|
|
50
|
+
const text = sourceRow[colOffset];
|
|
51
|
+
if (void 0 === text) {
|
|
52
|
+
skippedCells += 1;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const row = rect.top + rowOffset;
|
|
56
|
+
const col = rect.left + colOffset;
|
|
57
|
+
if (source.canWriteAt?.(row, col, text) === false) {
|
|
58
|
+
skippedCells += 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
writes.push({
|
|
62
|
+
row,
|
|
63
|
+
col,
|
|
64
|
+
text
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
writes,
|
|
70
|
+
appendRows,
|
|
71
|
+
clampedRows: Math.max(0, rowsWanted - rowsWritable),
|
|
72
|
+
clampedColumns: Math.max(0, blockWidest - colsWritable),
|
|
73
|
+
skippedCells
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const planRangeClear = (source, range)=>{
|
|
77
|
+
const rect = rectOf(range);
|
|
78
|
+
const writes = [];
|
|
79
|
+
for(let row = rect.top; row <= Math.min(rect.bottom, source.rowCount - 1); row++)for(let col = rect.left; col <= Math.min(rect.right, source.columnCount - 1); col++){
|
|
80
|
+
const text = source.blankTextAt?.(col) ?? '';
|
|
81
|
+
if (source.canWriteAt?.(row, col, text) !== false) writes.push({
|
|
82
|
+
row,
|
|
83
|
+
col,
|
|
84
|
+
text
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return writes;
|
|
88
|
+
};
|
|
89
|
+
export { copyRangeMatrix, planRangeClear, planRangePaste };
|