@uipath/apollo-react 7.17.4 → 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/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/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 +4 -4
|
@@ -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 };
|
|
@@ -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 };
|