@uipath/apollo-react 7.17.3 → 7.18.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/headless/hooks/use-chat-history.cjs +2 -0
- package/dist/chat/headless/hooks/use-chat-history.d.ts.map +1 -1
- package/dist/chat/headless/hooks/use-chat-history.js +2 -0
- package/dist/chat/headless/hooks/use-chat-messages.cjs +1 -0
- package/dist/chat/headless/hooks/use-chat-messages.d.ts.map +1 -1
- package/dist/chat/headless/hooks/use-chat-messages.js +1 -0
- package/dist/chat/headless/hooks/use-message-actions.cjs +3 -3
- package/dist/chat/headless/hooks/use-message-actions.d.ts +2 -2
- package/dist/chat/headless/hooks/use-message-actions.d.ts.map +1 -1
- package/dist/chat/headless/hooks/use-message-actions.js +3 -3
- package/dist/chat/headless/providers/chat-state-provider.cjs +7 -0
- package/dist/chat/headless/providers/chat-state-provider.d.ts +1 -0
- package/dist/chat/headless/providers/chat-state-provider.d.ts.map +1 -1
- package/dist/chat/headless/providers/chat-state-provider.js +7 -0
- package/dist/chat/service/ChatModel.cjs +1 -0
- package/dist/chat/service/ChatModel.d.ts +2 -0
- package/dist/chat/service/ChatModel.d.ts.map +1 -1
- package/dist/chat/service/ChatModel.js +1 -0
- package/dist/chat/service/ChatService.cjs +1 -0
- package/dist/chat/service/ChatService.d.ts.map +1 -1
- package/dist/chat/service/ChatService.js +1 -0
- package/dist/chat/stories/chat-playground.d.ts +1 -0
- package/dist/chat/stories/chat-playground.d.ts.map +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/chat/wind/messages/message-action-bar.cjs +21 -3
- package/dist/chat/wind/messages/message-action-bar.d.ts.map +1 -1
- package/dist/chat/wind/messages/message-action-bar.js +11 -3
- package/dist/chat/wind/messages/message-list.cjs +5 -3
- package/dist/chat/wind/messages/message-list.d.ts.map +1 -1
- package/dist/chat/wind/messages/message-list.js +5 -3
- 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/ConditionLine.cjs +62 -0
- package/dist/decision-table/ConditionLine.d.ts +10 -0
- package/dist/decision-table/ConditionLine.d.ts.map +1 -0
- package/dist/decision-table/ConditionLine.js +28 -0
- package/dist/decision-table/DecisionText.cjs +122 -0
- package/dist/decision-table/DecisionText.d.ts +28 -0
- package/dist/decision-table/DecisionText.d.ts.map +1 -0
- package/dist/decision-table/DecisionText.js +88 -0
- package/dist/decision-table/DecisionTextHeader.cjs +53 -0
- package/dist/decision-table/DecisionTextHeader.d.ts +7 -0
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -0
- package/dist/decision-table/DecisionTextHeader.js +19 -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/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 +108 -0
- package/dist/decision-table/LineText.d.ts +19 -0
- package/dist/decision-table/LineText.d.ts.map +1 -0
- package/dist/decision-table/LineText.js +74 -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/RuleCard.cjs +109 -0
- package/dist/decision-table/RuleCard.d.ts +8 -0
- package/dist/decision-table/RuleCard.d.ts.map +1 -0
- package/dist/decision-table/RuleCard.js +75 -0
- package/dist/decision-table/RuleLine.cjs +51 -0
- package/dist/decision-table/RuleLine.d.ts +9 -0
- package/dist/decision-table/RuleLine.d.ts.map +1 -0
- package/dist/decision-table/RuleLine.js +17 -0
- package/dist/decision-table/RuleList.cjs +70 -0
- package/dist/decision-table/RuleList.d.ts +20 -0
- package/dist/decision-table/RuleList.d.ts.map +1 -0
- package/dist/decision-table/RuleList.js +36 -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 +67 -0
- package/dist/decision-table/TokenChip.d.ts +17 -0
- package/dist/decision-table/TokenChip.d.ts.map +1 -0
- package/dist/decision-table/TokenChip.js +33 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +17 -0
- package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -0
- package/dist/decision-table/gridEvents.cjs +24 -0
- package/dist/decision-table/gridEvents.d.ts +3 -0
- package/dist/decision-table/gridEvents.d.ts.map +1 -1
- package/dist/decision-table/gridEvents.js +16 -1
- package/dist/decision-table/index.cjs +63 -55
- package/dist/decision-table/index.d.ts +5 -0
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -1
- package/dist/decision-table/ruleCardModel.cjs +138 -0
- package/dist/decision-table/ruleCardModel.d.ts +38 -0
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -0
- package/dist/decision-table/ruleCardModel.js +101 -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 +100 -0
- package/dist/decision-table/sentenceParts.d.ts +19 -0
- package/dist/decision-table/sentenceParts.d.ts.map +1 -0
- package/dist/decision-table/sentenceParts.js +48 -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 +166 -0
- package/dist/decision-table/sentenceStyles.d.ts +38 -0
- package/dist/decision-table/sentenceStyles.d.ts.map +1 -0
- package/dist/decision-table/sentenceStyles.js +45 -0
- package/dist/decision-table/sentenceTargets.cjs +74 -0
- package/dist/decision-table/sentenceTargets.d.ts +10 -0
- package/dist/decision-table/sentenceTargets.d.ts.map +1 -0
- package/dist/decision-table/sentenceTargets.js +31 -0
- package/dist/decision-table/sentenceTypes.cjs +18 -0
- package/dist/decision-table/sentenceTypes.d.ts +38 -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 +106 -0
- package/dist/decision-table/useContainerHandlers.d.ts +294 -0
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -0
- package/dist/decision-table/useContainerHandlers.js +72 -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/useRuleWindow.cjs +132 -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 +95 -0
- package/dist/decision-table/useSentenceNavigation.cjs +192 -0
- package/dist/decision-table/useSentenceNavigation.d.ts +16 -0
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -0
- package/dist/decision-table/useSentenceNavigation.js +158 -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/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BODY_ROW_HEIGHT_PX, EMPTY_VALUE_DASH, ROW_NUMBER_WIDTH } from "./constants.js";
|
|
2
2
|
import { DecisionTable } from "./DecisionTable.js";
|
|
3
|
+
import { DecisionText } from "./DecisionText.js";
|
|
3
4
|
import { DragIndicator } from "./DragIndicator.js";
|
|
4
5
|
import { EdgeInsertButton } from "./EdgeInsertButton.js";
|
|
5
6
|
import { GridCell, renderRestingCellContent } from "./GridCell.js";
|
|
@@ -12,4 +13,4 @@ import { usePressDrag } from "./useDragReorder.js";
|
|
|
12
13
|
import { useDragSelection } from "./useDragSelection.js";
|
|
13
14
|
import { normalizedRect, useGridNavigation } from "./useGridNavigation.js";
|
|
14
15
|
export * from "./gridTypes.js";
|
|
15
|
-
export { BAND_BOUNDARY_CLASS, BAND_LABEL_ROW_CLASS, BODY_CELL_CLASS, BODY_ROW_HEIGHT_PX, BREADCRUMB_POINT_STYLE, CELL_SURFACE_CLASS, DELETE_ROW_BUTTON_CLASS, DELETE_ROW_CLASS, DecisionTable, DragIndicator, EMPTY_MARKS, EMPTY_VALUE_DASH, EdgeInsertButton, FOOTER_ACTION_CLASS, FROZEN_RIGHT_CELL_CLASS, FROZEN_RIGHT_GROUP_CELL_CLASS, FROZEN_RIGHT_HEADER_CELL_CLASS, GROUP_TONE_CLASS, GridCell, GridContextMenu, HEADER_CELL_CLASS, HEADER_LABEL_ROW_CLASS, IN_RANGE_CLASS, LIVE_NOTE_CLASS, LOCKABLE_ROW_ACTION_BUTTON_CLASS, MONO_CELL_TEXT_CLASS, MarkGlyph, OUTPUT_BAND_DOT_CLASS, OUTPUT_CELL_TINT_CLASS, OUTPUT_HUE_CLASS, ROW_GUTTER_MARK_CLASS, ROW_MARK_OVERLAY_CLASS, ROW_NUMBER_CELL_CLASS, ROW_NUMBER_WIDTH, SEPARATOR_BODY_CELL_CLASS, commitMoveFor, emptyAreaPressHandler, isFromTextField, isRedoKey, isUndoKey, normalizedRect, renderRestingCellContent, useDragSelection, useGridNavigation, usePressDrag };
|
|
16
|
+
export { BAND_BOUNDARY_CLASS, BAND_LABEL_ROW_CLASS, BODY_CELL_CLASS, BODY_ROW_HEIGHT_PX, BREADCRUMB_POINT_STYLE, CELL_SURFACE_CLASS, DELETE_ROW_BUTTON_CLASS, DELETE_ROW_CLASS, DecisionTable, DecisionText, DragIndicator, EMPTY_MARKS, EMPTY_VALUE_DASH, EdgeInsertButton, FOOTER_ACTION_CLASS, FROZEN_RIGHT_CELL_CLASS, FROZEN_RIGHT_GROUP_CELL_CLASS, FROZEN_RIGHT_HEADER_CELL_CLASS, GROUP_TONE_CLASS, GridCell, GridContextMenu, HEADER_CELL_CLASS, HEADER_LABEL_ROW_CLASS, IN_RANGE_CLASS, LIVE_NOTE_CLASS, LOCKABLE_ROW_ACTION_BUTTON_CLASS, MONO_CELL_TEXT_CLASS, MarkGlyph, OUTPUT_BAND_DOT_CLASS, OUTPUT_CELL_TINT_CLASS, OUTPUT_HUE_CLASS, ROW_GUTTER_MARK_CLASS, ROW_MARK_OVERLAY_CLASS, ROW_NUMBER_CELL_CLASS, ROW_NUMBER_WIDTH, SEPARATOR_BODY_CELL_CLASS, commitMoveFor, emptyAreaPressHandler, isFromTextField, isRedoKey, isUndoKey, normalizedRect, renderRestingCellContent, useDragSelection, useGridNavigation, usePressDrag };
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
firstValuesOf: ()=>firstValuesOf,
|
|
28
|
+
ruleCardModel: ()=>ruleCardModel
|
|
29
|
+
});
|
|
30
|
+
const external_MarkBadge_cjs_namespaceObject = require("./MarkBadge.cjs");
|
|
31
|
+
const external_sentenceMarks_cjs_namespaceObject = require("./sentenceMarks.cjs");
|
|
32
|
+
const external_sentenceParts_cjs_namespaceObject = require("./sentenceParts.cjs");
|
|
33
|
+
const cardMark = (mark)=>({
|
|
34
|
+
tone: mark?.tone,
|
|
35
|
+
dim: mark?.dim,
|
|
36
|
+
title: mark?.title,
|
|
37
|
+
glyph: mark?.glyph,
|
|
38
|
+
cells: mark?.cells
|
|
39
|
+
});
|
|
40
|
+
const firstValuesOf = (rule)=>{
|
|
41
|
+
const first = new Map();
|
|
42
|
+
for (const parts of [
|
|
43
|
+
rule.heading,
|
|
44
|
+
rule.lead,
|
|
45
|
+
...rule.lines.map((line)=>line.parts)
|
|
46
|
+
])for (const part of parts)if ('string' != typeof part && 'value' === part.kind && !first.has(part.columnId)) first.set(part.columnId, {
|
|
47
|
+
token: part,
|
|
48
|
+
parts
|
|
49
|
+
});
|
|
50
|
+
return first;
|
|
51
|
+
};
|
|
52
|
+
const cellName = ({ cell }, column, values, position)=>cell?.(column, values, position) ?? [
|
|
53
|
+
column,
|
|
54
|
+
values
|
|
55
|
+
].filter(Boolean).join(' ');
|
|
56
|
+
const verdictOf = (rule, columnId, cells, labels)=>{
|
|
57
|
+
const matched = (0, external_sentenceParts_cjs_namespaceObject.isOutcome)(rule, columnId) ? void 0 : cells?.[columnId]?.matched;
|
|
58
|
+
return void 0 === matched ? '' : labels.conditionVerdict(matched);
|
|
59
|
+
};
|
|
60
|
+
const shownValuesOf = (parts, columnId, labels)=>{
|
|
61
|
+
const { shown, clamped } = (0, external_sentenceParts_cjs_namespaceObject.boundedParts)(parts, external_sentenceParts_cjs_namespaceObject.SENTENCE_LINE_VALUE_LIMIT);
|
|
62
|
+
const isCell = (part)=>'string' != typeof part && 'value' === part.kind && part.columnId === columnId;
|
|
63
|
+
const indexes = shown.flatMap((part, index)=>isCell(part) ? [
|
|
64
|
+
index
|
|
65
|
+
] : []);
|
|
66
|
+
const text = (0, external_sentenceParts_cjs_namespaceObject.partsText)(shown.slice(indexes[0], (indexes.at(-1) ?? 0) + 1), labels.emptyValue);
|
|
67
|
+
const hidden = clamped.reduce((count, run)=>run.hidden.some(isCell) ? count + run.hiddenValues : count, 0);
|
|
68
|
+
return hidden > 0 ? `${text} ${labels.moreValues(hidden)}` : text;
|
|
69
|
+
};
|
|
70
|
+
const shownLineText = (parts, labels)=>{
|
|
71
|
+
const { shown, clamped } = (0, external_sentenceParts_cjs_namespaceObject.boundedParts)(parts, external_sentenceParts_cjs_namespaceObject.SENTENCE_LINE_VALUE_LIMIT);
|
|
72
|
+
const cuts = clamped.map(({ after })=>shown.length - after.length);
|
|
73
|
+
return [
|
|
74
|
+
...clamped.map(({ hiddenValues }, index)=>`${(0, external_sentenceParts_cjs_namespaceObject.partsText)(shown.slice(cuts[index - 1] ?? 0, cuts[index]))} ${labels.moreValues(hiddenValues)}`),
|
|
75
|
+
(0, external_sentenceParts_cjs_namespaceObject.partsText)(shown.slice(cuts.at(-1) ?? 0))
|
|
76
|
+
].join('');
|
|
77
|
+
};
|
|
78
|
+
const ruleCardModel = ({ rule, position, numbered, mark, selectable, idPrefix, labels })=>{
|
|
79
|
+
const id = `${idPrefix}-${position}`;
|
|
80
|
+
const { tone, dim, title, cells } = cardMark(mark);
|
|
81
|
+
const stops = selectable ? [
|
|
82
|
+
...firstValuesOf(rule)
|
|
83
|
+
].map(([columnId, { token, parts }], index)=>({
|
|
84
|
+
token,
|
|
85
|
+
labelId: `${id}-cell-${index}`,
|
|
86
|
+
label: [
|
|
87
|
+
cellName(labels, (0, external_sentenceParts_cjs_namespaceObject.columnNameOf)(rule, columnId), shownValuesOf(parts, columnId, labels), position),
|
|
88
|
+
verdictOf(rule, columnId, cells, labels)
|
|
89
|
+
].filter(Boolean).join(' ')
|
|
90
|
+
})) : [];
|
|
91
|
+
const stopByToken = new Map(stops.map((stop)=>[
|
|
92
|
+
stop.token,
|
|
93
|
+
stop
|
|
94
|
+
]));
|
|
95
|
+
const badgeFor = (key, marks)=>marks ? {
|
|
96
|
+
id: `${id}-mark-${key}`,
|
|
97
|
+
marks,
|
|
98
|
+
labels
|
|
99
|
+
} : null;
|
|
100
|
+
const unplaced = (0, external_sentenceMarks_cjs_namespaceObject.unplacedColumnIds)([
|
|
101
|
+
rule.heading,
|
|
102
|
+
rule.lead,
|
|
103
|
+
...rule.lines.map((line)=>line.parts)
|
|
104
|
+
], cells);
|
|
105
|
+
const badges = {
|
|
106
|
+
heading: badgeFor('heading', (0, external_sentenceMarks_cjs_namespaceObject.lineMarksOf)(rule.heading, cells, mark, unplaced)),
|
|
107
|
+
lead: badgeFor('lead', (0, external_sentenceMarks_cjs_namespaceObject.lineMarksOf)(rule.lead, cells)),
|
|
108
|
+
lines: rule.lines.map((line, index)=>badgeFor(`line-${index}`, (0, external_sentenceMarks_cjs_namespaceObject.lineMarksOf)(line.parts, cells)))
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
tone,
|
|
112
|
+
dim,
|
|
113
|
+
title,
|
|
114
|
+
cells,
|
|
115
|
+
ariaLabel: [
|
|
116
|
+
numbered ? String(position) : '',
|
|
117
|
+
shownLineText(rule.heading, labels),
|
|
118
|
+
shownLineText(rule.lead, labels)
|
|
119
|
+
].filter(Boolean).join(' '),
|
|
120
|
+
describedBy: [
|
|
121
|
+
badges.heading,
|
|
122
|
+
badges.lead,
|
|
123
|
+
...badges.lines
|
|
124
|
+
].flatMap((badge)=>badge ? (0, external_MarkBadge_cjs_namespaceObject.markIds)(badge.id, badge.marks) : []).join(' ') || void 0,
|
|
125
|
+
stops,
|
|
126
|
+
stopOf: (token)=>stopByToken.get(token),
|
|
127
|
+
badges
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
exports.firstValuesOf = __webpack_exports__.firstValuesOf;
|
|
131
|
+
exports.ruleCardModel = __webpack_exports__.ruleCardModel;
|
|
132
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
133
|
+
"firstValuesOf",
|
|
134
|
+
"ruleCardModel"
|
|
135
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
136
|
+
Object.defineProperty(exports, '__esModule', {
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { LineTextLabels } from './LineText';
|
|
2
|
+
import type { MarkBadgeLabels, MarkBadgeProps } from './MarkBadge';
|
|
3
|
+
import type { RowMark } from './marks';
|
|
4
|
+
import type { SentencePart, SentenceRule, SentenceToken } from './sentenceTypes';
|
|
5
|
+
import type { CellStop } from './TokenChip';
|
|
6
|
+
export interface RuleCardLabels extends MarkBadgeLabels, LineTextLabels {
|
|
7
|
+
cell?: (column: string, values: string, position: number) => string;
|
|
8
|
+
emptyValue?: string;
|
|
9
|
+
}
|
|
10
|
+
interface FirstValue {
|
|
11
|
+
token: SentenceToken;
|
|
12
|
+
parts: readonly SentencePart[];
|
|
13
|
+
}
|
|
14
|
+
export declare const firstValuesOf: (rule: SentenceRule) => Map<string, FirstValue>;
|
|
15
|
+
interface RuleBadges {
|
|
16
|
+
heading: MarkBadgeProps | null;
|
|
17
|
+
lead: MarkBadgeProps | null;
|
|
18
|
+
lines: (MarkBadgeProps | null)[];
|
|
19
|
+
}
|
|
20
|
+
export interface RuleCardModelParams {
|
|
21
|
+
rule: SentenceRule;
|
|
22
|
+
position: number;
|
|
23
|
+
numbered: boolean;
|
|
24
|
+
mark: RowMark | undefined;
|
|
25
|
+
selectable: boolean;
|
|
26
|
+
idPrefix: string;
|
|
27
|
+
labels: RuleCardLabels;
|
|
28
|
+
}
|
|
29
|
+
interface RuleCardModel extends Pick<RowMark, 'tone' | 'dim' | 'title' | 'cells'> {
|
|
30
|
+
ariaLabel: string;
|
|
31
|
+
describedBy: string | undefined;
|
|
32
|
+
stops: CellStop[];
|
|
33
|
+
stopOf: (token: SentenceToken) => CellStop | undefined;
|
|
34
|
+
badges: RuleBadges;
|
|
35
|
+
}
|
|
36
|
+
export declare const ruleCardModel: ({ rule, position, numbered, mark, selectable, idPrefix, labels, }: RuleCardModelParams) => RuleCardModel;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=ruleCardModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruleCardModel.d.ts","sourceRoot":"","sources":["../../src/decision-table/ruleCardModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASvC,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,cAAe,SAAQ,eAAe,EAAE,cAAc;IAErE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAEpE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAaD,UAAU,UAAU;IAClB,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CAChC;AAGD,eAAO,MAAM,aAAa,GAAI,MAAM,YAAY,4BAU/C,CAAC;AAqDF,UAAU,UAAU;IAClB,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,YAAY,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;CACxB;AAGD,UAAU,aAAc,SAAQ,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;IAC/E,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,QAAQ,GAAG,SAAS,CAAC;IACvD,MAAM,EAAE,UAAU,CAAC;CACpB;AAGD,eAAO,MAAM,aAAa,GAAI,mEAQ3B,mBAAmB,KAAG,aAsDxB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { markIds } from "./MarkBadge.js";
|
|
2
|
+
import { lineMarksOf, unplacedColumnIds } from "./sentenceMarks.js";
|
|
3
|
+
import { SENTENCE_LINE_VALUE_LIMIT, boundedParts, columnNameOf, isOutcome, partsText } from "./sentenceParts.js";
|
|
4
|
+
const cardMark = (mark)=>({
|
|
5
|
+
tone: mark?.tone,
|
|
6
|
+
dim: mark?.dim,
|
|
7
|
+
title: mark?.title,
|
|
8
|
+
glyph: mark?.glyph,
|
|
9
|
+
cells: mark?.cells
|
|
10
|
+
});
|
|
11
|
+
const firstValuesOf = (rule)=>{
|
|
12
|
+
const first = new Map();
|
|
13
|
+
for (const parts of [
|
|
14
|
+
rule.heading,
|
|
15
|
+
rule.lead,
|
|
16
|
+
...rule.lines.map((line)=>line.parts)
|
|
17
|
+
])for (const part of parts)if ('string' != typeof part && 'value' === part.kind && !first.has(part.columnId)) first.set(part.columnId, {
|
|
18
|
+
token: part,
|
|
19
|
+
parts
|
|
20
|
+
});
|
|
21
|
+
return first;
|
|
22
|
+
};
|
|
23
|
+
const cellName = ({ cell }, column, values, position)=>cell?.(column, values, position) ?? [
|
|
24
|
+
column,
|
|
25
|
+
values
|
|
26
|
+
].filter(Boolean).join(' ');
|
|
27
|
+
const verdictOf = (rule, columnId, cells, labels)=>{
|
|
28
|
+
const matched = isOutcome(rule, columnId) ? void 0 : cells?.[columnId]?.matched;
|
|
29
|
+
return void 0 === matched ? '' : labels.conditionVerdict(matched);
|
|
30
|
+
};
|
|
31
|
+
const shownValuesOf = (parts, columnId, labels)=>{
|
|
32
|
+
const { shown, clamped } = boundedParts(parts, SENTENCE_LINE_VALUE_LIMIT);
|
|
33
|
+
const isCell = (part)=>'string' != typeof part && 'value' === part.kind && part.columnId === columnId;
|
|
34
|
+
const indexes = shown.flatMap((part, index)=>isCell(part) ? [
|
|
35
|
+
index
|
|
36
|
+
] : []);
|
|
37
|
+
const text = partsText(shown.slice(indexes[0], (indexes.at(-1) ?? 0) + 1), labels.emptyValue);
|
|
38
|
+
const hidden = clamped.reduce((count, run)=>run.hidden.some(isCell) ? count + run.hiddenValues : count, 0);
|
|
39
|
+
return hidden > 0 ? `${text} ${labels.moreValues(hidden)}` : text;
|
|
40
|
+
};
|
|
41
|
+
const shownLineText = (parts, labels)=>{
|
|
42
|
+
const { shown, clamped } = boundedParts(parts, SENTENCE_LINE_VALUE_LIMIT);
|
|
43
|
+
const cuts = clamped.map(({ after })=>shown.length - after.length);
|
|
44
|
+
return [
|
|
45
|
+
...clamped.map(({ hiddenValues }, index)=>`${partsText(shown.slice(cuts[index - 1] ?? 0, cuts[index]))} ${labels.moreValues(hiddenValues)}`),
|
|
46
|
+
partsText(shown.slice(cuts.at(-1) ?? 0))
|
|
47
|
+
].join('');
|
|
48
|
+
};
|
|
49
|
+
const ruleCardModel = ({ rule, position, numbered, mark, selectable, idPrefix, labels })=>{
|
|
50
|
+
const id = `${idPrefix}-${position}`;
|
|
51
|
+
const { tone, dim, title, cells } = cardMark(mark);
|
|
52
|
+
const stops = selectable ? [
|
|
53
|
+
...firstValuesOf(rule)
|
|
54
|
+
].map(([columnId, { token, parts }], index)=>({
|
|
55
|
+
token,
|
|
56
|
+
labelId: `${id}-cell-${index}`,
|
|
57
|
+
label: [
|
|
58
|
+
cellName(labels, columnNameOf(rule, columnId), shownValuesOf(parts, columnId, labels), position),
|
|
59
|
+
verdictOf(rule, columnId, cells, labels)
|
|
60
|
+
].filter(Boolean).join(' ')
|
|
61
|
+
})) : [];
|
|
62
|
+
const stopByToken = new Map(stops.map((stop)=>[
|
|
63
|
+
stop.token,
|
|
64
|
+
stop
|
|
65
|
+
]));
|
|
66
|
+
const badgeFor = (key, marks)=>marks ? {
|
|
67
|
+
id: `${id}-mark-${key}`,
|
|
68
|
+
marks,
|
|
69
|
+
labels
|
|
70
|
+
} : null;
|
|
71
|
+
const unplaced = unplacedColumnIds([
|
|
72
|
+
rule.heading,
|
|
73
|
+
rule.lead,
|
|
74
|
+
...rule.lines.map((line)=>line.parts)
|
|
75
|
+
], cells);
|
|
76
|
+
const badges = {
|
|
77
|
+
heading: badgeFor('heading', lineMarksOf(rule.heading, cells, mark, unplaced)),
|
|
78
|
+
lead: badgeFor('lead', lineMarksOf(rule.lead, cells)),
|
|
79
|
+
lines: rule.lines.map((line, index)=>badgeFor(`line-${index}`, lineMarksOf(line.parts, cells)))
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
tone,
|
|
83
|
+
dim,
|
|
84
|
+
title,
|
|
85
|
+
cells,
|
|
86
|
+
ariaLabel: [
|
|
87
|
+
numbered ? String(position) : '',
|
|
88
|
+
shownLineText(rule.heading, labels),
|
|
89
|
+
shownLineText(rule.lead, labels)
|
|
90
|
+
].filter(Boolean).join(' '),
|
|
91
|
+
describedBy: [
|
|
92
|
+
badges.heading,
|
|
93
|
+
badges.lead,
|
|
94
|
+
...badges.lines
|
|
95
|
+
].flatMap((badge)=>badge ? markIds(badge.id, badge.marks) : []).join(' ') || void 0,
|
|
96
|
+
stops,
|
|
97
|
+
stopOf: (token)=>stopByToken.get(token),
|
|
98
|
+
badges
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export { firstValuesOf, ruleCardModel };
|
|
@@ -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,100 @@
|
|
|
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
|
+
isValue: ()=>isValue,
|
|
28
|
+
partsText: ()=>partsText,
|
|
29
|
+
tokenText: ()=>tokenText,
|
|
30
|
+
boundedParts: ()=>boundedParts,
|
|
31
|
+
SENTENCE_LINE_VALUE_LIMIT: ()=>SENTENCE_LINE_VALUE_LIMIT,
|
|
32
|
+
columnNameOf: ()=>columnNameOf,
|
|
33
|
+
isOutcome: ()=>isOutcome
|
|
34
|
+
});
|
|
35
|
+
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
36
|
+
const SENTENCE_LINE_VALUE_LIMIT = 20;
|
|
37
|
+
const isValue = (part)=>'string' != typeof part && 'value' === part.kind;
|
|
38
|
+
const tokenText = (token, empty = external_constants_cjs_namespaceObject.EMPTY_VALUE_DASH)=>'value' === token.kind && '' === token.text ? empty : token.text;
|
|
39
|
+
const isToken = (part)=>'string' != typeof part;
|
|
40
|
+
const ruleTokens = (rule)=>[
|
|
41
|
+
...rule.heading,
|
|
42
|
+
...rule.lead,
|
|
43
|
+
...rule.lines.flatMap((line)=>line.parts)
|
|
44
|
+
].filter(isToken);
|
|
45
|
+
const isOutcome = (rule, columnId)=>rule.heading.some((part)=>'string' != typeof part && part.columnId === columnId);
|
|
46
|
+
const columnNameOf = (rule, columnId)=>ruleTokens(rule).find((token)=>'value' !== token.kind && token.columnId === columnId)?.text ?? '';
|
|
47
|
+
const partsText = (parts, empty = external_constants_cjs_namespaceObject.EMPTY_VALUE_DASH)=>parts.map((part)=>'string' == typeof part ? part : tokenText(part, empty)).join('');
|
|
48
|
+
const boundedParts = (parts, limit)=>{
|
|
49
|
+
const shown = [];
|
|
50
|
+
const runs = [];
|
|
51
|
+
let pending = [];
|
|
52
|
+
let column;
|
|
53
|
+
let count = 0;
|
|
54
|
+
for (const part of parts){
|
|
55
|
+
if ('string' == typeof part) {
|
|
56
|
+
pending.push(part);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const value = 'value' === part.kind;
|
|
60
|
+
count = value && part.columnId === column ? count + 1 : 1;
|
|
61
|
+
column = value ? part.columnId : void 0;
|
|
62
|
+
if (!value || count <= limit) shown.push(...pending, part);
|
|
63
|
+
else if (count === limit + 1) runs.push({
|
|
64
|
+
hidden: [
|
|
65
|
+
part
|
|
66
|
+
],
|
|
67
|
+
end: shown.length
|
|
68
|
+
});
|
|
69
|
+
else runs.at(-1)?.hidden.push(...pending, part);
|
|
70
|
+
pending = [];
|
|
71
|
+
}
|
|
72
|
+
shown.push(...pending);
|
|
73
|
+
return {
|
|
74
|
+
shown,
|
|
75
|
+
clamped: runs.map(({ hidden, end })=>({
|
|
76
|
+
hidden,
|
|
77
|
+
after: shown.slice(end),
|
|
78
|
+
hiddenValues: hidden.filter(isValue).length
|
|
79
|
+
}))
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
exports.SENTENCE_LINE_VALUE_LIMIT = __webpack_exports__.SENTENCE_LINE_VALUE_LIMIT;
|
|
83
|
+
exports.boundedParts = __webpack_exports__.boundedParts;
|
|
84
|
+
exports.columnNameOf = __webpack_exports__.columnNameOf;
|
|
85
|
+
exports.isOutcome = __webpack_exports__.isOutcome;
|
|
86
|
+
exports.isValue = __webpack_exports__.isValue;
|
|
87
|
+
exports.partsText = __webpack_exports__.partsText;
|
|
88
|
+
exports.tokenText = __webpack_exports__.tokenText;
|
|
89
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
90
|
+
"SENTENCE_LINE_VALUE_LIMIT",
|
|
91
|
+
"boundedParts",
|
|
92
|
+
"columnNameOf",
|
|
93
|
+
"isOutcome",
|
|
94
|
+
"isValue",
|
|
95
|
+
"partsText",
|
|
96
|
+
"tokenText"
|
|
97
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
98
|
+
Object.defineProperty(exports, '__esModule', {
|
|
99
|
+
value: true
|
|
100
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SentencePart, SentenceRule, SentenceToken } 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 isOutcome: (rule: SentenceRule, columnId: string) => boolean;
|
|
6
|
+
export declare const columnNameOf: (rule: SentenceRule, columnId: string) => string;
|
|
7
|
+
export declare const partsText: (parts: readonly SentencePart[], empty?: string) => string;
|
|
8
|
+
interface ClampedRun {
|
|
9
|
+
hidden: readonly SentencePart[];
|
|
10
|
+
after: readonly SentencePart[];
|
|
11
|
+
hiddenValues: number;
|
|
12
|
+
}
|
|
13
|
+
interface BoundedParts {
|
|
14
|
+
shown: readonly SentencePart[];
|
|
15
|
+
clamped: readonly ClampedRun[];
|
|
16
|
+
}
|
|
17
|
+
export declare const boundedParts: (parts: readonly SentencePart[], limit: number) => BoundedParts;
|
|
18
|
+
export {};
|
|
19
|
+
//# 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,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGjF,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,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,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,48 @@
|
|
|
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 isOutcome = (rule, columnId)=>rule.heading.some((part)=>'string' != typeof part && part.columnId === columnId);
|
|
12
|
+
const columnNameOf = (rule, columnId)=>ruleTokens(rule).find((token)=>'value' !== token.kind && token.columnId === columnId)?.text ?? '';
|
|
13
|
+
const partsText = (parts, empty = EMPTY_VALUE_DASH)=>parts.map((part)=>'string' == typeof part ? part : tokenText(part, empty)).join('');
|
|
14
|
+
const boundedParts = (parts, limit)=>{
|
|
15
|
+
const shown = [];
|
|
16
|
+
const runs = [];
|
|
17
|
+
let pending = [];
|
|
18
|
+
let column;
|
|
19
|
+
let count = 0;
|
|
20
|
+
for (const part of parts){
|
|
21
|
+
if ('string' == typeof part) {
|
|
22
|
+
pending.push(part);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const value = 'value' === part.kind;
|
|
26
|
+
count = value && part.columnId === column ? count + 1 : 1;
|
|
27
|
+
column = value ? part.columnId : void 0;
|
|
28
|
+
if (!value || count <= limit) shown.push(...pending, part);
|
|
29
|
+
else if (count === limit + 1) runs.push({
|
|
30
|
+
hidden: [
|
|
31
|
+
part
|
|
32
|
+
],
|
|
33
|
+
end: shown.length
|
|
34
|
+
});
|
|
35
|
+
else runs.at(-1)?.hidden.push(...pending, part);
|
|
36
|
+
pending = [];
|
|
37
|
+
}
|
|
38
|
+
shown.push(...pending);
|
|
39
|
+
return {
|
|
40
|
+
shown,
|
|
41
|
+
clamped: runs.map(({ hidden, end })=>({
|
|
42
|
+
hidden,
|
|
43
|
+
after: shown.slice(end),
|
|
44
|
+
hiddenValues: hidden.filter(isValue).length
|
|
45
|
+
}))
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export { SENTENCE_LINE_VALUE_LIMIT, boundedParts, columnNameOf, isOutcome, isValue, partsText, tokenText };
|