@uipath/apollo-react 7.17.4 → 7.19.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/BaseNode/BaseNode.cjs +2 -1
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +3 -2
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +3 -4
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +4 -5
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.cjs +3 -7
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.d.ts.map +1 -1
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.js +4 -8
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.cjs +59 -0
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.d.ts +2 -0
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.d.ts.map +1 -0
- package/dist/canvas/hooks/useBatchedUpdateNodeInternals.js +25 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/AddRuleButton.cjs +49 -0
- package/dist/decision-table/AddRuleButton.d.ts +7 -0
- package/dist/decision-table/AddRuleButton.d.ts.map +1 -0
- package/dist/decision-table/AddRuleButton.js +15 -0
- package/dist/decision-table/AddRuleFooter.cjs +46 -0
- package/dist/decision-table/AddRuleFooter.d.ts +9 -0
- package/dist/decision-table/AddRuleFooter.d.ts.map +1 -0
- package/dist/decision-table/AddRuleFooter.js +12 -0
- package/dist/decision-table/BandColumn.cjs +66 -0
- package/dist/decision-table/BandColumn.d.ts +12 -0
- package/dist/decision-table/BandColumn.d.ts.map +1 -0
- package/dist/decision-table/BandColumn.js +32 -0
- package/dist/decision-table/BandList.cjs +54 -0
- package/dist/decision-table/BandList.d.ts +12 -0
- package/dist/decision-table/BandList.d.ts.map +1 -0
- package/dist/decision-table/BandList.js +20 -0
- package/dist/decision-table/CellTextEditor.cjs +78 -0
- package/dist/decision-table/CellTextEditor.d.ts +8 -0
- package/dist/decision-table/CellTextEditor.d.ts.map +1 -0
- package/dist/decision-table/CellTextEditor.js +44 -0
- package/dist/decision-table/ConditionLine.cjs +66 -0
- package/dist/decision-table/ConditionLine.d.ts +12 -0
- package/dist/decision-table/ConditionLine.d.ts.map +1 -0
- package/dist/decision-table/ConditionLine.js +32 -0
- package/dist/decision-table/DecisionText.cjs +168 -0
- package/dist/decision-table/DecisionText.d.ts +44 -0
- package/dist/decision-table/DecisionText.d.ts.map +1 -0
- package/dist/decision-table/DecisionText.js +134 -0
- package/dist/decision-table/DecisionTextHeader.cjs +73 -0
- package/dist/decision-table/DecisionTextHeader.d.ts +13 -0
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -0
- package/dist/decision-table/DecisionTextHeader.js +39 -0
- package/dist/decision-table/EmptyRules.cjs +51 -0
- package/dist/decision-table/EmptyRules.d.ts +9 -0
- package/dist/decision-table/EmptyRules.d.ts.map +1 -0
- package/dist/decision-table/EmptyRules.js +17 -0
- package/dist/decision-table/GridCell.cjs +11 -31
- package/dist/decision-table/GridCell.d.ts +1 -9
- package/dist/decision-table/GridCell.d.ts.map +1 -1
- package/dist/decision-table/GridCell.js +12 -32
- package/dist/decision-table/LineLead.cjs +58 -0
- package/dist/decision-table/LineLead.d.ts +10 -0
- package/dist/decision-table/LineLead.d.ts.map +1 -0
- package/dist/decision-table/LineLead.js +24 -0
- package/dist/decision-table/LineText.cjs +109 -0
- package/dist/decision-table/LineText.d.ts +20 -0
- package/dist/decision-table/LineText.d.ts.map +1 -0
- package/dist/decision-table/LineText.js +75 -0
- package/dist/decision-table/MarkBadge.cjs +66 -0
- package/dist/decision-table/MarkBadge.d.ts +13 -0
- package/dist/decision-table/MarkBadge.d.ts.map +1 -0
- package/dist/decision-table/MarkBadge.js +29 -0
- package/dist/decision-table/PolicyOptionItem.cjs +121 -0
- package/dist/decision-table/PolicyOptionItem.d.ts +16 -0
- package/dist/decision-table/PolicyOptionItem.d.ts.map +1 -0
- package/dist/decision-table/PolicyOptionItem.js +84 -0
- package/dist/decision-table/PolicyPicker.cjs +110 -0
- package/dist/decision-table/PolicyPicker.d.ts +17 -0
- package/dist/decision-table/PolicyPicker.d.ts.map +1 -0
- package/dist/decision-table/PolicyPicker.js +76 -0
- package/dist/decision-table/RemoveConditionButton.cjs +52 -0
- package/dist/decision-table/RemoveConditionButton.d.ts +7 -0
- package/dist/decision-table/RemoveConditionButton.d.ts.map +1 -0
- package/dist/decision-table/RemoveConditionButton.js +18 -0
- package/dist/decision-table/RuleActions.cjs +76 -0
- package/dist/decision-table/RuleActions.d.ts +15 -0
- package/dist/decision-table/RuleActions.d.ts.map +1 -0
- package/dist/decision-table/RuleActions.js +42 -0
- package/dist/decision-table/RuleCard.cjs +123 -0
- package/dist/decision-table/RuleCard.d.ts +14 -0
- package/dist/decision-table/RuleCard.d.ts.map +1 -0
- package/dist/decision-table/RuleCard.js +89 -0
- package/dist/decision-table/RuleLine.cjs +56 -0
- package/dist/decision-table/RuleLine.d.ts +12 -0
- package/dist/decision-table/RuleLine.d.ts.map +1 -0
- package/dist/decision-table/RuleLine.js +22 -0
- package/dist/decision-table/RuleList.cjs +73 -0
- package/dist/decision-table/RuleList.d.ts +28 -0
- package/dist/decision-table/RuleList.d.ts.map +1 -0
- package/dist/decision-table/RuleList.js +39 -0
- package/dist/decision-table/SentenceBands.cjs +60 -0
- package/dist/decision-table/SentenceBands.d.ts +12 -0
- package/dist/decision-table/SentenceBands.d.ts.map +1 -0
- package/dist/decision-table/SentenceBands.js +26 -0
- package/dist/decision-table/StopLabels.cjs +43 -0
- package/dist/decision-table/StopLabels.d.ts +7 -0
- package/dist/decision-table/StopLabels.d.ts.map +1 -0
- package/dist/decision-table/StopLabels.js +9 -0
- package/dist/decision-table/TokenChip.cjs +87 -0
- package/dist/decision-table/TokenChip.d.ts +24 -0
- package/dist/decision-table/TokenChip.d.ts.map +1 -0
- package/dist/decision-table/TokenChip.js +53 -0
- package/dist/decision-table/ValueEditorOverlay.cjs +71 -0
- package/dist/decision-table/ValueEditorOverlay.d.ts +11 -0
- package/dist/decision-table/ValueEditorOverlay.d.ts.map +1 -0
- package/dist/decision-table/ValueEditorOverlay.js +37 -0
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts +37 -0
- package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts.map +1 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +30 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -0
- package/dist/decision-table/decisionTextTypes.cjs +18 -0
- package/dist/decision-table/decisionTextTypes.d.ts +21 -0
- package/dist/decision-table/decisionTextTypes.d.ts.map +1 -0
- package/dist/decision-table/decisionTextTypes.js +0 -0
- package/dist/decision-table/gridEvents.cjs +46 -2
- package/dist/decision-table/gridEvents.d.ts +4 -0
- package/dist/decision-table/gridEvents.d.ts.map +1 -1
- package/dist/decision-table/gridEvents.js +33 -1
- package/dist/decision-table/gridTypes.d.ts +8 -0
- package/dist/decision-table/gridTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +63 -55
- package/dist/decision-table/index.d.ts +11 -1
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -1
- package/dist/decision-table/ruleCardModel.cjs +171 -0
- package/dist/decision-table/ruleCardModel.d.ts +52 -0
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -0
- package/dist/decision-table/ruleCardModel.js +131 -0
- package/dist/decision-table/sentenceMarks.cjs +89 -0
- package/dist/decision-table/sentenceMarks.d.ts +27 -0
- package/dist/decision-table/sentenceMarks.d.ts.map +1 -0
- package/dist/decision-table/sentenceMarks.js +43 -0
- package/dist/decision-table/sentenceParts.cjs +133 -0
- package/dist/decision-table/sentenceParts.d.ts +24 -0
- package/dist/decision-table/sentenceParts.d.ts.map +1 -0
- package/dist/decision-table/sentenceParts.js +66 -0
- package/dist/decision-table/sentenceRuleHeights.cjs +70 -0
- package/dist/decision-table/sentenceRuleHeights.d.ts +7 -0
- package/dist/decision-table/sentenceRuleHeights.d.ts.map +1 -0
- package/dist/decision-table/sentenceRuleHeights.js +30 -0
- package/dist/decision-table/sentenceStyles.cjs +239 -0
- package/dist/decision-table/sentenceStyles.d.ts +56 -0
- package/dist/decision-table/sentenceStyles.d.ts.map +1 -0
- package/dist/decision-table/sentenceStyles.js +64 -0
- package/dist/decision-table/sentenceTargets.cjs +158 -0
- package/dist/decision-table/sentenceTargets.d.ts +33 -0
- package/dist/decision-table/sentenceTargets.d.ts.map +1 -0
- package/dist/decision-table/sentenceTargets.js +94 -0
- package/dist/decision-table/sentenceTypes.cjs +18 -0
- package/dist/decision-table/sentenceTypes.d.ts +49 -0
- package/dist/decision-table/sentenceTypes.d.ts.map +1 -0
- package/dist/decision-table/sentenceTypes.js +0 -0
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useAddRule.cjs +63 -0
- package/dist/decision-table/useAddRule.d.ts +8 -0
- package/dist/decision-table/useAddRule.d.ts.map +1 -0
- package/dist/decision-table/useAddRule.js +29 -0
- package/dist/decision-table/useCellHover.cjs +55 -0
- package/dist/decision-table/useCellHover.d.ts +4 -0
- package/dist/decision-table/useCellHover.d.ts.map +1 -0
- package/dist/decision-table/useCellHover.js +21 -0
- package/dist/decision-table/useContainerHandlers.cjs +140 -0
- package/dist/decision-table/useContainerHandlers.d.ts +299 -0
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -0
- package/dist/decision-table/useContainerHandlers.js +106 -0
- package/dist/decision-table/useEditorPlacement.cjs +104 -0
- package/dist/decision-table/useEditorPlacement.d.ts +17 -0
- package/dist/decision-table/useEditorPlacement.d.ts.map +1 -0
- package/dist/decision-table/useEditorPlacement.js +70 -0
- package/dist/decision-table/useGridLayout.d.ts +1 -8
- package/dist/decision-table/useGridLayout.d.ts.map +1 -1
- package/dist/decision-table/useGridNavigation.cjs +11 -2
- package/dist/decision-table/useGridNavigation.d.ts +3 -0
- package/dist/decision-table/useGridNavigation.d.ts.map +1 -1
- package/dist/decision-table/useGridNavigation.js +1 -1
- package/dist/decision-table/useHorizontalOverflow.cjs +65 -0
- package/dist/decision-table/useHorizontalOverflow.d.ts +5 -0
- package/dist/decision-table/useHorizontalOverflow.d.ts.map +1 -0
- package/dist/decision-table/useHorizontalOverflow.js +31 -0
- package/dist/decision-table/useRuleMenus.cjs +149 -0
- package/dist/decision-table/useRuleMenus.d.ts +24 -0
- package/dist/decision-table/useRuleMenus.d.ts.map +1 -0
- package/dist/decision-table/useRuleMenus.js +115 -0
- package/dist/decision-table/useRuleWindow.cjs +136 -0
- package/dist/decision-table/useRuleWindow.d.ts +17 -0
- package/dist/decision-table/useRuleWindow.d.ts.map +1 -0
- package/dist/decision-table/useRuleWindow.js +99 -0
- package/dist/decision-table/useSentenceNavigation.cjs +224 -0
- package/dist/decision-table/useSentenceNavigation.d.ts +21 -0
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -0
- package/dist/decision-table/useSentenceNavigation.js +187 -0
- package/dist/decision-table/useValueEditing.cjs +306 -0
- package/dist/decision-table/useValueEditing.d.ts +34 -0
- package/dist/decision-table/useValueEditing.d.ts.map +1 -0
- package/dist/decision-table/useValueEditing.js +272 -0
- package/dist/decision-table/useVirtualizedAxis.cjs +34 -11
- package/dist/decision-table/useVirtualizedAxis.d.ts +1 -1
- package/dist/decision-table/useVirtualizedAxis.d.ts.map +1 -1
- package/dist/decision-table/useVirtualizedAxis.js +34 -11
- package/dist/decision-table/valueTypes.cjs +18 -0
- package/dist/decision-table/valueTypes.d.ts +6 -0
- package/dist/decision-table/valueTypes.d.ts.map +1 -0
- package/dist/decision-table/valueTypes.js +0 -0
- package/package.json +4 -4
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
tableMarks: ()=>tableMarks,
|
|
28
|
+
lineMarksOf: ()=>lineMarksOf,
|
|
29
|
+
unplacedColumnIds: ()=>unplacedColumnIds,
|
|
30
|
+
worstTone: ()=>worstTone,
|
|
31
|
+
isLineMark: ()=>isLineMark
|
|
32
|
+
});
|
|
33
|
+
const external_sentenceParts_cjs_namespaceObject = require("./sentenceParts.cjs");
|
|
34
|
+
const tableMarks = ({ rows, columns })=>({
|
|
35
|
+
rows,
|
|
36
|
+
columns
|
|
37
|
+
});
|
|
38
|
+
const SHOWS_GLYPH = {
|
|
39
|
+
success: false,
|
|
40
|
+
error: true,
|
|
41
|
+
warning: true
|
|
42
|
+
};
|
|
43
|
+
const SEVERITY = {
|
|
44
|
+
warning: 1,
|
|
45
|
+
error: 2
|
|
46
|
+
};
|
|
47
|
+
const valueColumnIds = (parts)=>[
|
|
48
|
+
...new Set(parts.filter(external_sentenceParts_cjs_namespaceObject.isValue).map((part)=>part.columnId))
|
|
49
|
+
];
|
|
50
|
+
const isLineMark = (mark)=>mark?.glyph === true && void 0 !== mark.tone && SHOWS_GLYPH[mark.tone];
|
|
51
|
+
const unplacedColumnIds = (lines, cells)=>{
|
|
52
|
+
const placed = new Set(lines.flatMap(valueColumnIds));
|
|
53
|
+
return Object.keys(cells ?? {}).filter((columnId)=>!placed.has(columnId));
|
|
54
|
+
};
|
|
55
|
+
const lineMarksOf = (parts, cells, own, unplaced = [])=>{
|
|
56
|
+
const candidates = [
|
|
57
|
+
own,
|
|
58
|
+
...[
|
|
59
|
+
...valueColumnIds(parts),
|
|
60
|
+
...unplaced
|
|
61
|
+
].map((columnId)=>cells?.[columnId])
|
|
62
|
+
];
|
|
63
|
+
const marks = new Map();
|
|
64
|
+
for (const mark of candidates.filter(isLineMark))marks.set(`${mark.tone}\n${mark.title ?? ''}`, {
|
|
65
|
+
tone: mark.tone,
|
|
66
|
+
title: mark.title
|
|
67
|
+
});
|
|
68
|
+
const [first, ...rest] = marks.values();
|
|
69
|
+
return first ? [
|
|
70
|
+
first,
|
|
71
|
+
...rest
|
|
72
|
+
] : null;
|
|
73
|
+
};
|
|
74
|
+
const worstTone = ([first, ...rest])=>rest.reduce((worst, mark)=>SEVERITY[mark.tone] > SEVERITY[worst] ? mark.tone : worst, first.tone);
|
|
75
|
+
exports.isLineMark = __webpack_exports__.isLineMark;
|
|
76
|
+
exports.lineMarksOf = __webpack_exports__.lineMarksOf;
|
|
77
|
+
exports.tableMarks = __webpack_exports__.tableMarks;
|
|
78
|
+
exports.unplacedColumnIds = __webpack_exports__.unplacedColumnIds;
|
|
79
|
+
exports.worstTone = __webpack_exports__.worstTone;
|
|
80
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
81
|
+
"isLineMark",
|
|
82
|
+
"lineMarksOf",
|
|
83
|
+
"tableMarks",
|
|
84
|
+
"unplacedColumnIds",
|
|
85
|
+
"worstTone"
|
|
86
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
87
|
+
Object.defineProperty(exports, '__esModule', {
|
|
88
|
+
value: true
|
|
89
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Mark, MarkTone, RowMark, TableMarks } from './marks';
|
|
2
|
+
import type { SentencePart } from './sentenceTypes';
|
|
3
|
+
export type MarkFields<T> = {
|
|
4
|
+
[K in keyof T]-?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare const tableMarks: ({ rows, columns }: TableMarks) => {
|
|
7
|
+
rows: ReadonlyMap<string, RowMark>;
|
|
8
|
+
columns: ReadonlyMap<string, Mark>;
|
|
9
|
+
};
|
|
10
|
+
declare const SHOWS_GLYPH: {
|
|
11
|
+
success: false;
|
|
12
|
+
error: true;
|
|
13
|
+
warning: true;
|
|
14
|
+
};
|
|
15
|
+
export type GlyphTone = {
|
|
16
|
+
[T in MarkTone]: (typeof SHOWS_GLYPH)[T] extends true ? T : never;
|
|
17
|
+
}[MarkTone];
|
|
18
|
+
type LineMark = Pick<Mark, 'title'> & {
|
|
19
|
+
tone: GlyphTone;
|
|
20
|
+
};
|
|
21
|
+
export type LineMarks = readonly [LineMark, ...LineMark[]];
|
|
22
|
+
export declare const isLineMark: (mark: Mark | undefined) => mark is Mark & LineMark;
|
|
23
|
+
export declare const unplacedColumnIds: (lines: readonly (readonly SentencePart[])[], cells: RowMark["cells"]) => string[];
|
|
24
|
+
export declare const lineMarksOf: (parts: readonly SentencePart[], cells: RowMark["cells"], own?: Mark, unplaced?: readonly string[]) => LineMarks | null;
|
|
25
|
+
export declare const worstTone: ([first, ...rest]: LineMarks) => GlyphTone;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=sentenceMarks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentenceMarks.d.ts","sourceRoot":"","sources":["../../src/decision-table/sentenceMarks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO;CAAE,CAAC;AAG1D,eAAO,MAAM,UAAU,GAAI,mBAAmB,UAAU;;;CACF,CAAC;AAGvD,QAAA,MAAM,WAAW;;;;CAGhB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;KACrB,CAAC,IAAI,QAAQ,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK;CAClE,CAAC,QAAQ,CAAC,CAAC;AAKZ,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAG1D,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;AAM3D,eAAO,MAAM,UAAU,GAAI,MAAM,IAAI,GAAG,SAAS,KAAG,IAAI,IAAI,IAAI,GAAG,QACQ,CAAC;AAG5E,eAAO,MAAM,iBAAiB,GAC5B,OAAO,SAAS,CAAC,SAAS,YAAY,EAAE,CAAC,EAAE,EAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,KACtB,MAAM,EAGR,CAAC;AAGF,eAAO,MAAM,WAAW,GACtB,OAAO,SAAS,YAAY,EAAE,EAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,EACvB,MAAM,IAAI,EACV,WAAU,SAAS,MAAM,EAAO,KAC/B,SAAS,GAAG,IAWd,CAAC;AAGF,eAAO,MAAM,SAAS,GAAI,kBAAkB,SAAS,KAAG,SAIrD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isValue } from "./sentenceParts.js";
|
|
2
|
+
const tableMarks = ({ rows, columns })=>({
|
|
3
|
+
rows,
|
|
4
|
+
columns
|
|
5
|
+
});
|
|
6
|
+
const SHOWS_GLYPH = {
|
|
7
|
+
success: false,
|
|
8
|
+
error: true,
|
|
9
|
+
warning: true
|
|
10
|
+
};
|
|
11
|
+
const SEVERITY = {
|
|
12
|
+
warning: 1,
|
|
13
|
+
error: 2
|
|
14
|
+
};
|
|
15
|
+
const valueColumnIds = (parts)=>[
|
|
16
|
+
...new Set(parts.filter(isValue).map((part)=>part.columnId))
|
|
17
|
+
];
|
|
18
|
+
const isLineMark = (mark)=>mark?.glyph === true && void 0 !== mark.tone && SHOWS_GLYPH[mark.tone];
|
|
19
|
+
const unplacedColumnIds = (lines, cells)=>{
|
|
20
|
+
const placed = new Set(lines.flatMap(valueColumnIds));
|
|
21
|
+
return Object.keys(cells ?? {}).filter((columnId)=>!placed.has(columnId));
|
|
22
|
+
};
|
|
23
|
+
const lineMarksOf = (parts, cells, own, unplaced = [])=>{
|
|
24
|
+
const candidates = [
|
|
25
|
+
own,
|
|
26
|
+
...[
|
|
27
|
+
...valueColumnIds(parts),
|
|
28
|
+
...unplaced
|
|
29
|
+
].map((columnId)=>cells?.[columnId])
|
|
30
|
+
];
|
|
31
|
+
const marks = new Map();
|
|
32
|
+
for (const mark of candidates.filter(isLineMark))marks.set(`${mark.tone}\n${mark.title ?? ''}`, {
|
|
33
|
+
tone: mark.tone,
|
|
34
|
+
title: mark.title
|
|
35
|
+
});
|
|
36
|
+
const [first, ...rest] = marks.values();
|
|
37
|
+
return first ? [
|
|
38
|
+
first,
|
|
39
|
+
...rest
|
|
40
|
+
] : null;
|
|
41
|
+
};
|
|
42
|
+
const worstTone = ([first, ...rest])=>rest.reduce((worst, mark)=>SEVERITY[mark.tone] > SEVERITY[worst] ? mark.tone : worst, first.tone);
|
|
43
|
+
export { isLineMark, lineMarksOf, tableMarks, unplacedColumnIds, worstTone };
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
bandColumnNameOf: ()=>bandColumnNameOf,
|
|
28
|
+
partsText: ()=>partsText,
|
|
29
|
+
hasStop: ()=>hasStop,
|
|
30
|
+
boundedParts: ()=>boundedParts,
|
|
31
|
+
stopTokensOf: ()=>stopTokensOf,
|
|
32
|
+
isValue: ()=>isValue,
|
|
33
|
+
cellTextOf: ()=>cellTextOf,
|
|
34
|
+
tokenText: ()=>tokenText,
|
|
35
|
+
valueTokenOf: ()=>valueTokenOf,
|
|
36
|
+
columnNameOf: ()=>columnNameOf,
|
|
37
|
+
isOutcome: ()=>isOutcome,
|
|
38
|
+
SENTENCE_LINE_VALUE_LIMIT: ()=>SENTENCE_LINE_VALUE_LIMIT
|
|
39
|
+
});
|
|
40
|
+
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
41
|
+
const SENTENCE_LINE_VALUE_LIMIT = 20;
|
|
42
|
+
const isValue = (part)=>'string' != typeof part && 'value' === part.kind;
|
|
43
|
+
const tokenText = (token, empty = external_constants_cjs_namespaceObject.EMPTY_VALUE_DASH)=>'value' === token.kind && '' === token.text ? empty : token.text;
|
|
44
|
+
const isToken = (part)=>'string' != typeof part;
|
|
45
|
+
const ruleTokens = (rule)=>[
|
|
46
|
+
...rule.heading,
|
|
47
|
+
...rule.lead,
|
|
48
|
+
...rule.lines.flatMap((line)=>line.parts)
|
|
49
|
+
].filter(isToken);
|
|
50
|
+
const stopTokensOf = (rule)=>{
|
|
51
|
+
const tokens = ruleTokens(rule);
|
|
52
|
+
const valued = new Set(tokens.flatMap((token)=>'value' === token.kind ? [
|
|
53
|
+
token.columnId
|
|
54
|
+
] : []));
|
|
55
|
+
const stops = new Map();
|
|
56
|
+
for (const token of tokens){
|
|
57
|
+
const isStop = 'value' === token.kind || 'input' === token.kind && !valued.has(token.columnId);
|
|
58
|
+
if (isStop && !stops.has(token.columnId)) stops.set(token.columnId, token);
|
|
59
|
+
}
|
|
60
|
+
return [
|
|
61
|
+
...stops.values()
|
|
62
|
+
];
|
|
63
|
+
};
|
|
64
|
+
const hasStop = (rule, columnId)=>void 0 !== rule && stopTokensOf(rule).some((token)=>token.columnId === columnId);
|
|
65
|
+
const cellTextOf = (rule, columnId)=>ruleTokens(rule).filter((token)=>token.columnId === columnId).map((token)=>`${token.kind}:${token.text}`).join('\n');
|
|
66
|
+
const isOutcome = (rule, columnId)=>rule.heading.some((part)=>'string' != typeof part && part.columnId === columnId);
|
|
67
|
+
const columnNameOf = (rule, columnId)=>ruleTokens(rule).find((token)=>'value' !== token.kind && token.columnId === columnId)?.text ?? '';
|
|
68
|
+
const bandColumnNameOf = (bands, columnId)=>bands.flatMap((band)=>band.columns).find((column)=>column.id === columnId)?.name ?? '';
|
|
69
|
+
const valueTokenOf = (rule, value)=>ruleTokens(rule).find((token)=>'value' === token.kind && token.columnId === value.columnId && token.index === value.index);
|
|
70
|
+
const partsText = (parts, empty = external_constants_cjs_namespaceObject.EMPTY_VALUE_DASH)=>parts.map((part)=>'string' == typeof part ? part : tokenText(part, empty)).join('');
|
|
71
|
+
const boundedParts = (parts, limit)=>{
|
|
72
|
+
const shown = [];
|
|
73
|
+
const runs = [];
|
|
74
|
+
let pending = [];
|
|
75
|
+
let column;
|
|
76
|
+
let count = 0;
|
|
77
|
+
for (const part of parts){
|
|
78
|
+
if ('string' == typeof part) {
|
|
79
|
+
pending.push(part);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const value = 'value' === part.kind;
|
|
83
|
+
count = value && part.columnId === column ? count + 1 : 1;
|
|
84
|
+
column = value ? part.columnId : void 0;
|
|
85
|
+
if (!value || count <= limit) shown.push(...pending, part);
|
|
86
|
+
else if (count === limit + 1) runs.push({
|
|
87
|
+
hidden: [
|
|
88
|
+
part
|
|
89
|
+
],
|
|
90
|
+
end: shown.length
|
|
91
|
+
});
|
|
92
|
+
else runs.at(-1)?.hidden.push(...pending, part);
|
|
93
|
+
pending = [];
|
|
94
|
+
}
|
|
95
|
+
shown.push(...pending);
|
|
96
|
+
return {
|
|
97
|
+
shown,
|
|
98
|
+
clamped: runs.map(({ hidden, end })=>({
|
|
99
|
+
hidden,
|
|
100
|
+
after: shown.slice(end),
|
|
101
|
+
hiddenValues: hidden.filter(isValue).length
|
|
102
|
+
}))
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
exports.SENTENCE_LINE_VALUE_LIMIT = __webpack_exports__.SENTENCE_LINE_VALUE_LIMIT;
|
|
106
|
+
exports.bandColumnNameOf = __webpack_exports__.bandColumnNameOf;
|
|
107
|
+
exports.boundedParts = __webpack_exports__.boundedParts;
|
|
108
|
+
exports.cellTextOf = __webpack_exports__.cellTextOf;
|
|
109
|
+
exports.columnNameOf = __webpack_exports__.columnNameOf;
|
|
110
|
+
exports.hasStop = __webpack_exports__.hasStop;
|
|
111
|
+
exports.isOutcome = __webpack_exports__.isOutcome;
|
|
112
|
+
exports.isValue = __webpack_exports__.isValue;
|
|
113
|
+
exports.partsText = __webpack_exports__.partsText;
|
|
114
|
+
exports.stopTokensOf = __webpack_exports__.stopTokensOf;
|
|
115
|
+
exports.tokenText = __webpack_exports__.tokenText;
|
|
116
|
+
exports.valueTokenOf = __webpack_exports__.valueTokenOf;
|
|
117
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
118
|
+
"SENTENCE_LINE_VALUE_LIMIT",
|
|
119
|
+
"bandColumnNameOf",
|
|
120
|
+
"boundedParts",
|
|
121
|
+
"cellTextOf",
|
|
122
|
+
"columnNameOf",
|
|
123
|
+
"hasStop",
|
|
124
|
+
"isOutcome",
|
|
125
|
+
"isValue",
|
|
126
|
+
"partsText",
|
|
127
|
+
"stopTokensOf",
|
|
128
|
+
"tokenText",
|
|
129
|
+
"valueTokenOf"
|
|
130
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
131
|
+
Object.defineProperty(exports, '__esModule', {
|
|
132
|
+
value: true
|
|
133
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SentenceBand, SentencePart, SentenceRule, SentenceToken, SentenceValueId, SentenceValueToken } from './sentenceTypes';
|
|
2
|
+
export declare const SENTENCE_LINE_VALUE_LIMIT = 20;
|
|
3
|
+
export declare const isValue: (part: SentencePart) => part is SentenceToken;
|
|
4
|
+
export declare const tokenText: (token: SentenceToken, empty?: string) => string;
|
|
5
|
+
export declare const stopTokensOf: (rule: SentenceRule) => SentenceToken[];
|
|
6
|
+
export declare const hasStop: (rule: SentenceRule | undefined, columnId: string) => boolean;
|
|
7
|
+
export declare const cellTextOf: (rule: SentenceRule, columnId: string) => string;
|
|
8
|
+
export declare const isOutcome: (rule: SentenceRule, columnId: string) => boolean;
|
|
9
|
+
export declare const columnNameOf: (rule: SentenceRule, columnId: string) => string;
|
|
10
|
+
export declare const bandColumnNameOf: (bands: readonly SentenceBand[], columnId: string) => string;
|
|
11
|
+
export declare const valueTokenOf: (rule: SentenceRule, value: SentenceValueId) => SentenceValueToken | undefined;
|
|
12
|
+
export declare const partsText: (parts: readonly SentencePart[], empty?: string) => string;
|
|
13
|
+
interface ClampedRun {
|
|
14
|
+
hidden: readonly SentencePart[];
|
|
15
|
+
after: readonly SentencePart[];
|
|
16
|
+
hiddenValues: number;
|
|
17
|
+
}
|
|
18
|
+
interface BoundedParts {
|
|
19
|
+
shown: readonly SentencePart[];
|
|
20
|
+
clamped: readonly ClampedRun[];
|
|
21
|
+
}
|
|
22
|
+
export declare const boundedParts: (parts: readonly SentencePart[], limit: number) => BoundedParts;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=sentenceParts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentenceParts.d.ts","sourceRoot":"","sources":["../../src/decision-table/sentenceParts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAGzB,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,eAAO,MAAM,OAAO,GAAI,MAAM,YAAY,KAAG,IAAI,IAAI,aACF,CAAC;AAGpD,eAAO,MAAM,SAAS,GAAI,OAAO,aAAa,EAAE,cAAwB,KAAG,MACT,CAAC;AASnE,eAAO,MAAM,YAAY,GAAI,MAAM,YAAY,KAAG,aAAa,EAY9D,CAAC;AAGF,eAAO,MAAM,OAAO,GAAI,MAAM,YAAY,GAAG,SAAS,EAAE,UAAU,MAAM,KAAG,OACY,CAAC;AAGxF,eAAO,MAAM,UAAU,GAAI,MAAM,YAAY,EAAE,UAAU,MAAM,KAAG,MAInD,CAAC;AAGhB,eAAO,MAAM,SAAS,GAAI,MAAM,YAAY,EAAE,UAAU,MAAM,KAAG,OACoB,CAAC;AAGtF,eAAO,MAAM,YAAY,GAAI,MAAM,YAAY,EAAE,UAAU,MAAM,KAAG,MAEhE,CAAC;AAGL,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,YAAY,EAAE,EAAE,UAAU,MAAM,KAAG,MACQ,CAAC;AAG7F,eAAO,MAAM,YAAY,GACvB,MAAM,YAAY,EAClB,OAAO,eAAe,KACrB,kBAAkB,GAAG,SAIrB,CAAC;AAGJ,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,YAAY,EAAE,EAAE,cAAwB,KAAG,MACK,CAAC;AAG3F,UAAU,UAAU;IAClB,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB;AAGD,UAAU,YAAY;IACpB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CAChC;AASD,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,YAAY,EAAE,EAAE,OAAO,MAAM,KAAG,YA4B5E,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EMPTY_VALUE_DASH } from "./constants.js";
|
|
2
|
+
const SENTENCE_LINE_VALUE_LIMIT = 20;
|
|
3
|
+
const isValue = (part)=>'string' != typeof part && 'value' === part.kind;
|
|
4
|
+
const tokenText = (token, empty = EMPTY_VALUE_DASH)=>'value' === token.kind && '' === token.text ? empty : token.text;
|
|
5
|
+
const isToken = (part)=>'string' != typeof part;
|
|
6
|
+
const ruleTokens = (rule)=>[
|
|
7
|
+
...rule.heading,
|
|
8
|
+
...rule.lead,
|
|
9
|
+
...rule.lines.flatMap((line)=>line.parts)
|
|
10
|
+
].filter(isToken);
|
|
11
|
+
const stopTokensOf = (rule)=>{
|
|
12
|
+
const tokens = ruleTokens(rule);
|
|
13
|
+
const valued = new Set(tokens.flatMap((token)=>'value' === token.kind ? [
|
|
14
|
+
token.columnId
|
|
15
|
+
] : []));
|
|
16
|
+
const stops = new Map();
|
|
17
|
+
for (const token of tokens){
|
|
18
|
+
const isStop = 'value' === token.kind || 'input' === token.kind && !valued.has(token.columnId);
|
|
19
|
+
if (isStop && !stops.has(token.columnId)) stops.set(token.columnId, token);
|
|
20
|
+
}
|
|
21
|
+
return [
|
|
22
|
+
...stops.values()
|
|
23
|
+
];
|
|
24
|
+
};
|
|
25
|
+
const hasStop = (rule, columnId)=>void 0 !== rule && stopTokensOf(rule).some((token)=>token.columnId === columnId);
|
|
26
|
+
const cellTextOf = (rule, columnId)=>ruleTokens(rule).filter((token)=>token.columnId === columnId).map((token)=>`${token.kind}:${token.text}`).join('\n');
|
|
27
|
+
const isOutcome = (rule, columnId)=>rule.heading.some((part)=>'string' != typeof part && part.columnId === columnId);
|
|
28
|
+
const columnNameOf = (rule, columnId)=>ruleTokens(rule).find((token)=>'value' !== token.kind && token.columnId === columnId)?.text ?? '';
|
|
29
|
+
const bandColumnNameOf = (bands, columnId)=>bands.flatMap((band)=>band.columns).find((column)=>column.id === columnId)?.name ?? '';
|
|
30
|
+
const valueTokenOf = (rule, value)=>ruleTokens(rule).find((token)=>'value' === token.kind && token.columnId === value.columnId && token.index === value.index);
|
|
31
|
+
const partsText = (parts, empty = EMPTY_VALUE_DASH)=>parts.map((part)=>'string' == typeof part ? part : tokenText(part, empty)).join('');
|
|
32
|
+
const boundedParts = (parts, limit)=>{
|
|
33
|
+
const shown = [];
|
|
34
|
+
const runs = [];
|
|
35
|
+
let pending = [];
|
|
36
|
+
let column;
|
|
37
|
+
let count = 0;
|
|
38
|
+
for (const part of parts){
|
|
39
|
+
if ('string' == typeof part) {
|
|
40
|
+
pending.push(part);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const value = 'value' === part.kind;
|
|
44
|
+
count = value && part.columnId === column ? count + 1 : 1;
|
|
45
|
+
column = value ? part.columnId : void 0;
|
|
46
|
+
if (!value || count <= limit) shown.push(...pending, part);
|
|
47
|
+
else if (count === limit + 1) runs.push({
|
|
48
|
+
hidden: [
|
|
49
|
+
part
|
|
50
|
+
],
|
|
51
|
+
end: shown.length
|
|
52
|
+
});
|
|
53
|
+
else runs.at(-1)?.hidden.push(...pending, part);
|
|
54
|
+
pending = [];
|
|
55
|
+
}
|
|
56
|
+
shown.push(...pending);
|
|
57
|
+
return {
|
|
58
|
+
shown,
|
|
59
|
+
clamped: runs.map(({ hidden, end })=>({
|
|
60
|
+
hidden,
|
|
61
|
+
after: shown.slice(end),
|
|
62
|
+
hiddenValues: hidden.filter(isValue).length
|
|
63
|
+
}))
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export { SENTENCE_LINE_VALUE_LIMIT, bandColumnNameOf, boundedParts, cellTextOf, columnNameOf, hasStop, isOutcome, isValue, partsText, stopTokensOf, tokenText, valueTokenOf };
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
SENTENCE_MIN_RULE_HEIGHT_PX: ()=>SENTENCE_MIN_RULE_HEIGHT_PX,
|
|
28
|
+
sentenceListStyle: ()=>sentenceListStyle,
|
|
29
|
+
sentenceRuleOffsets: ()=>sentenceRuleOffsets
|
|
30
|
+
});
|
|
31
|
+
const SENTENCE_LINE_HEIGHT_PX = 24;
|
|
32
|
+
const SENTENCE_RULE_BORDER_PX = 1;
|
|
33
|
+
const SENTENCE_RULE_PADDING_PX = 10;
|
|
34
|
+
const SENTENCE_LINES_GAP_PX = 2;
|
|
35
|
+
const SENTENCE_RULE_GAP_PX = 8;
|
|
36
|
+
const SENTENCE_MIN_RULE_HEIGHT_PX = 2 * SENTENCE_RULE_BORDER_PX + 2 * SENTENCE_RULE_PADDING_PX + SENTENCE_RULE_GAP_PX + 2 * SENTENCE_LINE_HEIGHT_PX;
|
|
37
|
+
const sentenceRuleHeight = (rule)=>0 === rule.lines.length ? SENTENCE_MIN_RULE_HEIGHT_PX : SENTENCE_MIN_RULE_HEIGHT_PX + SENTENCE_LINES_GAP_PX + SENTENCE_LINE_HEIGHT_PX * rule.lines.length;
|
|
38
|
+
const sentenceRuleOffsets = (rules, measured)=>{
|
|
39
|
+
let total = 0;
|
|
40
|
+
const offsets = [
|
|
41
|
+
total
|
|
42
|
+
];
|
|
43
|
+
for (const rule of rules){
|
|
44
|
+
total += measured?.get(rule.rowId) ?? sentenceRuleHeight(rule);
|
|
45
|
+
offsets.push(total);
|
|
46
|
+
}
|
|
47
|
+
return offsets;
|
|
48
|
+
};
|
|
49
|
+
const LIST_GEOMETRY = {
|
|
50
|
+
'--sentence-line': `${SENTENCE_LINE_HEIGHT_PX}px`,
|
|
51
|
+
'--sentence-row-border': `${SENTENCE_RULE_BORDER_PX}px`,
|
|
52
|
+
'--sentence-row-padding': `${SENTENCE_RULE_PADDING_PX}px`,
|
|
53
|
+
'--sentence-lines-gap': `${SENTENCE_LINES_GAP_PX}px`,
|
|
54
|
+
'--sentence-row-gap': `${SENTENCE_RULE_GAP_PX}px`
|
|
55
|
+
};
|
|
56
|
+
const sentenceListStyle = (numbered, ruleCount)=>numbered ? {
|
|
57
|
+
...LIST_GEOMETRY,
|
|
58
|
+
'--sentence-number-digits': String(ruleCount).length
|
|
59
|
+
} : LIST_GEOMETRY;
|
|
60
|
+
exports.SENTENCE_MIN_RULE_HEIGHT_PX = __webpack_exports__.SENTENCE_MIN_RULE_HEIGHT_PX;
|
|
61
|
+
exports.sentenceListStyle = __webpack_exports__.sentenceListStyle;
|
|
62
|
+
exports.sentenceRuleOffsets = __webpack_exports__.sentenceRuleOffsets;
|
|
63
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
64
|
+
"SENTENCE_MIN_RULE_HEIGHT_PX",
|
|
65
|
+
"sentenceListStyle",
|
|
66
|
+
"sentenceRuleOffsets"
|
|
67
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
68
|
+
Object.defineProperty(exports, '__esModule', {
|
|
69
|
+
value: true
|
|
70
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SentenceRule } from './sentenceTypes';
|
|
3
|
+
export declare const SENTENCE_MIN_RULE_HEIGHT_PX: number;
|
|
4
|
+
export declare const sentenceRuleOffsets: (rules: readonly SentenceRule[], measured?: ReadonlyMap<string, number>) => number[];
|
|
5
|
+
export type SentenceListStyle = React.CSSProperties & Record<`--sentence-${string}`, string | number>;
|
|
6
|
+
export declare const sentenceListStyle: (numbered: boolean, ruleCount: number) => SentenceListStyle;
|
|
7
|
+
//# sourceMappingURL=sentenceRuleHeights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentenceRuleHeights.d.ts","sourceRoot":"","sources":["../../src/decision-table/sentenceRuleHeights.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD,eAAO,MAAM,2BAA2B,QAIX,CAAC;AAW9B,eAAO,MAAM,mBAAmB,GAC9B,OAAO,SAAS,YAAY,EAAE,EAC9B,WAAW,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KACrC,MAAM,EAQR,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,GACjD,MAAM,CAAC,cAAc,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAWlD,eAAO,MAAM,iBAAiB,GAAI,UAAU,OAAO,EAAE,WAAW,MAAM,KAAG,iBAGtD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const SENTENCE_LINE_HEIGHT_PX = 24;
|
|
2
|
+
const SENTENCE_RULE_BORDER_PX = 1;
|
|
3
|
+
const SENTENCE_RULE_PADDING_PX = 10;
|
|
4
|
+
const SENTENCE_LINES_GAP_PX = 2;
|
|
5
|
+
const SENTENCE_RULE_GAP_PX = 8;
|
|
6
|
+
const SENTENCE_MIN_RULE_HEIGHT_PX = 2 * SENTENCE_RULE_BORDER_PX + 2 * SENTENCE_RULE_PADDING_PX + SENTENCE_RULE_GAP_PX + 2 * SENTENCE_LINE_HEIGHT_PX;
|
|
7
|
+
const sentenceRuleHeight = (rule)=>0 === rule.lines.length ? SENTENCE_MIN_RULE_HEIGHT_PX : SENTENCE_MIN_RULE_HEIGHT_PX + SENTENCE_LINES_GAP_PX + SENTENCE_LINE_HEIGHT_PX * rule.lines.length;
|
|
8
|
+
const sentenceRuleOffsets = (rules, measured)=>{
|
|
9
|
+
let total = 0;
|
|
10
|
+
const offsets = [
|
|
11
|
+
total
|
|
12
|
+
];
|
|
13
|
+
for (const rule of rules){
|
|
14
|
+
total += measured?.get(rule.rowId) ?? sentenceRuleHeight(rule);
|
|
15
|
+
offsets.push(total);
|
|
16
|
+
}
|
|
17
|
+
return offsets;
|
|
18
|
+
};
|
|
19
|
+
const LIST_GEOMETRY = {
|
|
20
|
+
'--sentence-line': `${SENTENCE_LINE_HEIGHT_PX}px`,
|
|
21
|
+
'--sentence-row-border': `${SENTENCE_RULE_BORDER_PX}px`,
|
|
22
|
+
'--sentence-row-padding': `${SENTENCE_RULE_PADDING_PX}px`,
|
|
23
|
+
'--sentence-lines-gap': `${SENTENCE_LINES_GAP_PX}px`,
|
|
24
|
+
'--sentence-row-gap': `${SENTENCE_RULE_GAP_PX}px`
|
|
25
|
+
};
|
|
26
|
+
const sentenceListStyle = (numbered, ruleCount)=>numbered ? {
|
|
27
|
+
...LIST_GEOMETRY,
|
|
28
|
+
'--sentence-number-digits': String(ruleCount).length
|
|
29
|
+
} : LIST_GEOMETRY;
|
|
30
|
+
export { SENTENCE_MIN_RULE_HEIGHT_PX, sentenceListStyle, sentenceRuleOffsets };
|