@uipath/apollo-react 7.36.0 → 7.37.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/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/CitationButton.cjs +72 -0
- package/dist/decision-table/CitationButton.d.ts +33 -0
- package/dist/decision-table/CitationButton.d.ts.map +1 -0
- package/dist/decision-table/CitationButton.js +35 -0
- package/dist/decision-table/DecisionGraphCard.cjs +16 -2
- package/dist/decision-table/DecisionGraphCard.d.ts +5 -0
- package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphCard.js +17 -3
- package/dist/decision-table/DecisionGraphText.cjs +23 -4
- package/dist/decision-table/DecisionGraphText.d.ts +13 -5
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +23 -4
- package/dist/decision-table/DecisionText.cjs +27 -2
- package/dist/decision-table/DecisionText.d.ts +4 -3
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +27 -2
- package/dist/decision-table/DecisionTextHeader.cjs +17 -1
- package/dist/decision-table/DecisionTextHeader.d.ts +7 -1
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
- package/dist/decision-table/DecisionTextHeader.js +18 -2
- package/dist/decision-table/RuleCard.cjs +60 -26
- package/dist/decision-table/RuleCard.d.ts +2 -0
- package/dist/decision-table/RuleCard.d.ts.map +1 -1
- package/dist/decision-table/RuleCard.js +61 -27
- package/dist/decision-table/RuleList.cjs +2 -1
- package/dist/decision-table/RuleList.d.ts +1 -0
- package/dist/decision-table/RuleList.d.ts.map +1 -1
- package/dist/decision-table/RuleList.js +2 -1
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts +4 -2
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/textMode.d.ts +3 -0
- package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
- package/dist/decision-table/decisionGraphTypes.d.ts +8 -0
- package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +16 -8
- package/dist/decision-table/index.d.ts +4 -3
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -1
- package/dist/decision-table/locales/de.cjs +1 -1
- package/dist/decision-table/locales/de.d.ts.map +1 -1
- package/dist/decision-table/locales/de.js +1 -1
- package/dist/decision-table/locales/en.cjs +1 -1
- package/dist/decision-table/locales/en.d.ts.map +1 -1
- package/dist/decision-table/locales/en.js +1 -1
- package/dist/decision-table/locales/es-MX.cjs +1 -1
- package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
- package/dist/decision-table/locales/es-MX.js +1 -1
- package/dist/decision-table/locales/es.cjs +1 -1
- package/dist/decision-table/locales/es.d.ts.map +1 -1
- package/dist/decision-table/locales/es.js +1 -1
- package/dist/decision-table/locales/fr.cjs +1 -1
- package/dist/decision-table/locales/fr.d.ts.map +1 -1
- package/dist/decision-table/locales/fr.js +1 -1
- package/dist/decision-table/locales/ja.cjs +1 -1
- package/dist/decision-table/locales/ja.d.ts.map +1 -1
- package/dist/decision-table/locales/ja.js +1 -1
- package/dist/decision-table/locales/ko.cjs +1 -1
- package/dist/decision-table/locales/ko.d.ts.map +1 -1
- package/dist/decision-table/locales/ko.js +1 -1
- package/dist/decision-table/locales/pt-BR.cjs +1 -1
- package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
- package/dist/decision-table/locales/pt-BR.js +1 -1
- package/dist/decision-table/locales/pt.cjs +1 -1
- package/dist/decision-table/locales/pt.d.ts.map +1 -1
- package/dist/decision-table/locales/pt.js +1 -1
- package/dist/decision-table/locales/ro.cjs +1 -1
- package/dist/decision-table/locales/ro.d.ts.map +1 -1
- package/dist/decision-table/locales/ro.js +1 -1
- package/dist/decision-table/locales/ru.cjs +1 -1
- package/dist/decision-table/locales/ru.d.ts.map +1 -1
- package/dist/decision-table/locales/ru.js +1 -1
- package/dist/decision-table/locales/tr.cjs +1 -1
- package/dist/decision-table/locales/tr.d.ts.map +1 -1
- package/dist/decision-table/locales/tr.js +1 -1
- package/dist/decision-table/locales/zh-CN.cjs +1 -1
- package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
- package/dist/decision-table/locales/zh-CN.js +1 -1
- package/dist/decision-table/locales/zh-TW.cjs +1 -1
- package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
- package/dist/decision-table/locales/zh-TW.js +1 -1
- package/dist/decision-table/ruleCardModel.d.ts +2 -1
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -1
- package/dist/decision-table/sentenceSelection.cjs +15 -1
- package/dist/decision-table/sentenceSelection.d.ts +3 -1
- package/dist/decision-table/sentenceSelection.d.ts.map +1 -1
- package/dist/decision-table/sentenceSelection.js +9 -1
- package/dist/decision-table/sentenceStyles.cjs +33 -6
- package/dist/decision-table/sentenceStyles.d.ts +8 -1
- package/dist/decision-table/sentenceStyles.d.ts.map +1 -1
- package/dist/decision-table/sentenceStyles.js +9 -3
- package/dist/decision-table/sentenceTypes.d.ts +28 -0
- package/dist/decision-table/sentenceTypes.d.ts.map +1 -1
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useContainerHandlers.cjs +88 -3
- package/dist/decision-table/useContainerHandlers.d.ts +10 -1
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
- package/dist/decision-table/useContainerHandlers.js +88 -3
- package/dist/decision-table/useDecisionGraphStrings.cjs +6 -2
- package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
- package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionGraphStrings.js +6 -2
- package/dist/decision-table/useDecisionTextStrings.cjs +36 -0
- package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionTextStrings.js +36 -0
- package/dist/decision-table/useSentenceNavigation.cjs +5 -6
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -1
- package/dist/decision-table/useSentenceNavigation.js +1 -2
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
CitationButtons: ()=>CitationButtons,
|
|
28
|
+
CitationButton: ()=>CitationButton
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
33
|
+
const external_sentenceStyles_cjs_namespaceObject = require("./sentenceStyles.cjs");
|
|
34
|
+
const CitationButton = ({ citation, owner, index, onOpen, selected, tabIndex, className, labels, dataTestId })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Button, {
|
|
35
|
+
variant: "ghost",
|
|
36
|
+
size: "3xs",
|
|
37
|
+
tabIndex: tabIndex,
|
|
38
|
+
"aria-label": labels.openCitation(owner, citation.page, index),
|
|
39
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_sentenceStyles_cjs_namespaceObject.CITATION_BUTTON_CLASS, className),
|
|
40
|
+
"data-rule-action": "citation",
|
|
41
|
+
"data-testid": dataTestId,
|
|
42
|
+
onClick: ()=>onOpen(citation),
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.FileText, {
|
|
45
|
+
"aria-hidden": true
|
|
46
|
+
}),
|
|
47
|
+
selected && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
children: labels.citationPage(citation.page)
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
const indexOf = (citations, at)=>{
|
|
54
|
+
const page = citations[at]?.page;
|
|
55
|
+
const shared = citations.filter((citation)=>citation.page === page).length;
|
|
56
|
+
return shared > 1 ? citations.slice(0, at + 1).filter((citation)=>citation.page === page).length : null;
|
|
57
|
+
};
|
|
58
|
+
const CitationButtons = ({ citations, dataTestId, ...props })=>citations.map((citation, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CitationButton, {
|
|
59
|
+
citation: citation,
|
|
60
|
+
index: indexOf(citations, index),
|
|
61
|
+
dataTestId: 0 === index ? dataTestId : `${dataTestId}-${index}`,
|
|
62
|
+
...props
|
|
63
|
+
}, `${citation.kind}-${citation.page}-${index}`));
|
|
64
|
+
exports.CitationButton = __webpack_exports__.CitationButton;
|
|
65
|
+
exports.CitationButtons = __webpack_exports__.CitationButtons;
|
|
66
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
67
|
+
"CitationButton",
|
|
68
|
+
"CitationButtons"
|
|
69
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
70
|
+
Object.defineProperty(exports, '__esModule', {
|
|
71
|
+
value: true
|
|
72
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { OpenCitation, SentenceCitation } from './sentenceTypes';
|
|
3
|
+
export type CitationOwner = {
|
|
4
|
+
kind: 'rule';
|
|
5
|
+
position: number;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'decision';
|
|
8
|
+
name: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'table';
|
|
11
|
+
};
|
|
12
|
+
export interface CitationLabels {
|
|
13
|
+
openCitation: (owner: CitationOwner, page: number, index: number | null) => string;
|
|
14
|
+
citationPage: (page: number) => string;
|
|
15
|
+
}
|
|
16
|
+
export interface CitationButtonProps {
|
|
17
|
+
citation: SentenceCitation;
|
|
18
|
+
owner: CitationOwner;
|
|
19
|
+
index: number | null;
|
|
20
|
+
onOpen: OpenCitation;
|
|
21
|
+
selected: boolean;
|
|
22
|
+
tabIndex: 0 | -1;
|
|
23
|
+
className: string;
|
|
24
|
+
labels: CitationLabels;
|
|
25
|
+
dataTestId: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const CitationButton: React.FC<CitationButtonProps>;
|
|
28
|
+
export interface CitationButtonsProps extends Omit<CitationButtonProps, 'citation' | 'index' | 'dataTestId'> {
|
|
29
|
+
citations: readonly SentenceCitation[];
|
|
30
|
+
dataTestId: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const CitationButtons: React.FC<CitationButtonsProps>;
|
|
33
|
+
//# sourceMappingURL=CitationButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CitationButton.d.ts","sourceRoot":"","sources":["../../src/decision-table/CitationButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAA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x, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { FileText } from "lucide-react";
|
|
4
|
+
import { CITATION_BUTTON_CLASS } from "./sentenceStyles.js";
|
|
5
|
+
const CitationButton = ({ citation, owner, index, onOpen, selected, tabIndex, className, labels, dataTestId })=>/*#__PURE__*/ jsxs(Button, {
|
|
6
|
+
variant: "ghost",
|
|
7
|
+
size: "3xs",
|
|
8
|
+
tabIndex: tabIndex,
|
|
9
|
+
"aria-label": labels.openCitation(owner, citation.page, index),
|
|
10
|
+
className: cn(CITATION_BUTTON_CLASS, className),
|
|
11
|
+
"data-rule-action": "citation",
|
|
12
|
+
"data-testid": dataTestId,
|
|
13
|
+
onClick: ()=>onOpen(citation),
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ jsx(FileText, {
|
|
16
|
+
"aria-hidden": true
|
|
17
|
+
}),
|
|
18
|
+
selected && /*#__PURE__*/ jsx("span", {
|
|
19
|
+
"aria-hidden": true,
|
|
20
|
+
children: labels.citationPage(citation.page)
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
const indexOf = (citations, at)=>{
|
|
25
|
+
const page = citations[at]?.page;
|
|
26
|
+
const shared = citations.filter((citation)=>citation.page === page).length;
|
|
27
|
+
return shared > 1 ? citations.slice(0, at + 1).filter((citation)=>citation.page === page).length : null;
|
|
28
|
+
};
|
|
29
|
+
const CitationButtons = ({ citations, dataTestId, ...props })=>citations.map((citation, index)=>/*#__PURE__*/ jsx(CitationButton, {
|
|
30
|
+
citation: citation,
|
|
31
|
+
index: indexOf(citations, index),
|
|
32
|
+
dataTestId: 0 === index ? dataTestId : `${dataTestId}-${index}`,
|
|
33
|
+
...props
|
|
34
|
+
}, `${citation.kind}-${citation.page}-${index}`));
|
|
35
|
+
export { CitationButton, CitationButtons };
|
|
@@ -31,9 +31,10 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
31
31
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
32
|
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
33
33
|
const external_react_namespaceObject = require("react");
|
|
34
|
-
const
|
|
34
|
+
const external_CitationButton_cjs_namespaceObject = require("./CitationButton.cjs");
|
|
35
35
|
const external_decisionGraphStyles_cjs_namespaceObject = require("./decisionGraphStyles.cjs");
|
|
36
36
|
const external_GridMenu_cjs_namespaceObject = require("./GridMenu.cjs");
|
|
37
|
+
const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
|
|
37
38
|
const external_MarkGlyph_cjs_namespaceObject = require("./MarkGlyph.cjs");
|
|
38
39
|
const external_sentenceMarks_cjs_namespaceObject = require("./sentenceMarks.cjs");
|
|
39
40
|
const HEADINGS = [
|
|
@@ -126,7 +127,7 @@ const NameField = ({ field, label, dataTestId })=>{
|
|
|
126
127
|
]
|
|
127
128
|
});
|
|
128
129
|
};
|
|
129
|
-
const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, labels, onToggle, onShowProblem, onOpen, actions, cardRef, dataTestId })=>{
|
|
130
|
+
const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, labels, onToggle, onShowProblem, onOpen, actions, citations, cardRef, dataTestId })=>{
|
|
130
131
|
const { logic } = node;
|
|
131
132
|
const rename = actions?.rename ?? null;
|
|
132
133
|
const headingMark = node.mark?.mark;
|
|
@@ -203,6 +204,19 @@ const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, la
|
|
|
203
204
|
className: "size-3.5"
|
|
204
205
|
})
|
|
205
206
|
}),
|
|
207
|
+
citations && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CitationButton_cjs_namespaceObject.CitationButtons, {
|
|
208
|
+
citations: citations.citations,
|
|
209
|
+
owner: {
|
|
210
|
+
kind: 'decision',
|
|
211
|
+
name: node.label
|
|
212
|
+
},
|
|
213
|
+
onOpen: citations.onOpen,
|
|
214
|
+
selected: active,
|
|
215
|
+
tabIndex: 0,
|
|
216
|
+
className: (0, apollo_wind_namespaceObject.cn)('shrink-0', !active && external_decisionGraphStyles_cjs_namespaceObject.GRAPH_REVEAL_CLASS, '[@media(hover:none)]:opacity-100'),
|
|
217
|
+
labels: labels,
|
|
218
|
+
dataTestId: `${dataTestId}-citation-${node.id}`
|
|
219
|
+
}),
|
|
206
220
|
actions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NodeMenu, {
|
|
207
221
|
actions: actions,
|
|
208
222
|
dataTestId: `${dataTestId}-menu-${node.id}`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { DecisionGraphDecisionNode, DecisionGraphReferenceNode } from './decisionGraphTypes';
|
|
3
3
|
import { type GridMenuEntry } from './GridMenu';
|
|
4
|
+
import type { OpenCitation, SentenceCitation } from './sentenceTypes';
|
|
4
5
|
import type { DecisionGraphLabels } from './useDecisionGraphStrings';
|
|
5
6
|
export interface DecisionGraphRenameField {
|
|
6
7
|
from: string;
|
|
@@ -33,6 +34,10 @@ export interface DecisionGraphCardProps {
|
|
|
33
34
|
onShowProblem: (byKey: boolean) => void;
|
|
34
35
|
onOpen: (() => void) | undefined;
|
|
35
36
|
actions: DecisionGraphCardActions | null;
|
|
37
|
+
citations: {
|
|
38
|
+
citations: readonly SentenceCitation[];
|
|
39
|
+
onOpen: OpenCitation;
|
|
40
|
+
} | null;
|
|
36
41
|
cardRef: (element: HTMLElement | null) => void;
|
|
37
42
|
dataTestId: string;
|
|
38
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionGraphCard.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DecisionGraphCard.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphCard.tsx"],"names":[],"m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AE,KAAK,CAAC,SAAS,CAAC;IACtB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAEzC,SAAS,EAAE;QAAE,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,GAAG,IAAI,CAAC;IACnF,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AA+GD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA8H9D,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,0BAA0B,CAAC;IACjC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CA6CxE,CAAC"}
|
|
@@ -2,9 +2,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Input, cn } from "@uipath/apollo-wind";
|
|
3
3
|
import { ChevronDown, ChevronRight, CornerDownRight, Ellipsis, Network } from "lucide-react";
|
|
4
4
|
import { useId, useLayoutEffect, useRef } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import { GRAPH_BODY_CLASS, GRAPH_CARD_CLASS, GRAPH_CARD_COLLAPSED_CLASS, GRAPH_CARD_TONE_CLASS, GRAPH_HEADER_CLASS, GRAPH_HIT_POLICY_CLASS, GRAPH_MARK_BUTTON_CLASS, GRAPH_MENU_BUTTON_CLASS, GRAPH_NAME_CLASS, GRAPH_REFERENCE_CHIP_CLASS, GRAPH_REFERENCE_CLASS, GRAPH_RULE_COUNT_CLASS, GRAPH_TOGGLE_CLASS } from "./decisionGraphStyles.js";
|
|
5
|
+
import { CitationButtons } from "./CitationButton.js";
|
|
6
|
+
import { GRAPH_BODY_CLASS, GRAPH_CARD_CLASS, GRAPH_CARD_COLLAPSED_CLASS, GRAPH_CARD_TONE_CLASS, GRAPH_HEADER_CLASS, GRAPH_HIT_POLICY_CLASS, GRAPH_MARK_BUTTON_CLASS, GRAPH_MENU_BUTTON_CLASS, GRAPH_NAME_CLASS, GRAPH_REFERENCE_CHIP_CLASS, GRAPH_REFERENCE_CLASS, GRAPH_REVEAL_CLASS, GRAPH_RULE_COUNT_CLASS, GRAPH_TOGGLE_CLASS } from "./decisionGraphStyles.js";
|
|
7
7
|
import { GridMenuButton } from "./GridMenu.js";
|
|
8
|
+
import { isComposing } from "./gridEvents.js";
|
|
8
9
|
import { MarkGlyph } from "./MarkGlyph.js";
|
|
9
10
|
import { isLineMark } from "./sentenceMarks.js";
|
|
10
11
|
const HEADINGS = [
|
|
@@ -97,7 +98,7 @@ const NameField = ({ field, label, dataTestId })=>{
|
|
|
97
98
|
]
|
|
98
99
|
});
|
|
99
100
|
};
|
|
100
|
-
const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, labels, onToggle, onShowProblem, onOpen, actions, cardRef, dataTestId })=>{
|
|
101
|
+
const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, labels, onToggle, onShowProblem, onOpen, actions, citations, cardRef, dataTestId })=>{
|
|
101
102
|
const { logic } = node;
|
|
102
103
|
const rename = actions?.rename ?? null;
|
|
103
104
|
const headingMark = node.mark?.mark;
|
|
@@ -174,6 +175,19 @@ const DecisionGraphCard = ({ node, depth, open, active, usedBy, bodyId, body, la
|
|
|
174
175
|
className: "size-3.5"
|
|
175
176
|
})
|
|
176
177
|
}),
|
|
178
|
+
citations && /*#__PURE__*/ jsx(CitationButtons, {
|
|
179
|
+
citations: citations.citations,
|
|
180
|
+
owner: {
|
|
181
|
+
kind: 'decision',
|
|
182
|
+
name: node.label
|
|
183
|
+
},
|
|
184
|
+
onOpen: citations.onOpen,
|
|
185
|
+
selected: active,
|
|
186
|
+
tabIndex: 0,
|
|
187
|
+
className: cn('shrink-0', !active && GRAPH_REVEAL_CLASS, '[@media(hover:none)]:opacity-100'),
|
|
188
|
+
labels: labels,
|
|
189
|
+
dataTestId: `${dataTestId}-citation-${node.id}`
|
|
190
|
+
}),
|
|
177
191
|
actions && /*#__PURE__*/ jsx(NodeMenu, {
|
|
178
192
|
actions: actions,
|
|
179
193
|
dataTestId: `${dataTestId}-menu-${node.id}`
|
|
@@ -32,6 +32,7 @@ const external_lucide_react_namespaceObject = require("lucide-react");
|
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
33
|
const external_DecisionGraphCard_cjs_namespaceObject = require("./DecisionGraphCard.cjs");
|
|
34
34
|
const external_DecisionGraphMinimapSlot_cjs_namespaceObject = require("./DecisionGraphMinimapSlot.cjs");
|
|
35
|
+
const external_DecisionText_cjs_namespaceObject = require("./DecisionText.cjs");
|
|
35
36
|
const external_decisionGraphPositions_cjs_namespaceObject = require("./decisionGraphPositions.cjs");
|
|
36
37
|
const external_decisionGraphStyles_cjs_namespaceObject = require("./decisionGraphStyles.cjs");
|
|
37
38
|
const external_revealIn_cjs_namespaceObject = require("./revealIn.cjs");
|
|
@@ -40,6 +41,9 @@ const external_useDecisionGraphActions_cjs_namespaceObject = require("./useDecis
|
|
|
40
41
|
const external_useDecisionGraphStrings_cjs_namespaceObject = require("./useDecisionGraphStrings.cjs");
|
|
41
42
|
const external_useDecisionTextStrings_cjs_namespaceObject = require("./useDecisionTextStrings.cjs");
|
|
42
43
|
const external_useTextAnnouncements_cjs_namespaceObject = require("./useTextAnnouncements.cjs");
|
|
44
|
+
const NO_CITATIONS = {
|
|
45
|
+
kind: 'none'
|
|
46
|
+
};
|
|
43
47
|
const NO_EXPANDED = new Set();
|
|
44
48
|
const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
45
49
|
kind: 'rule',
|
|
@@ -49,6 +53,13 @@ const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
|
49
53
|
kind: 'decision',
|
|
50
54
|
decisionId: id
|
|
51
55
|
};
|
|
56
|
+
const citationOf = (citations, decisionId)=>{
|
|
57
|
+
const cited = 'cited' === citations.kind ? citations.decisions.get(decisionId) ?? [] : [];
|
|
58
|
+
return 'cited' === citations.kind && cited.length > 0 ? {
|
|
59
|
+
citations: cited,
|
|
60
|
+
onOpen: citations.onOpenCitation
|
|
61
|
+
} : null;
|
|
62
|
+
};
|
|
52
63
|
const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
|
|
53
64
|
const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
|
|
54
65
|
const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -106,7 +117,7 @@ const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
|
106
117
|
}
|
|
107
118
|
return 0 === rules ? external_sentenceRuleHeights_cjs_namespaceObject.SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
108
119
|
};
|
|
109
|
-
const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
|
|
120
|
+
const DecisionGraphText = ({ nodes, mode, renderBody, citations = NO_CITATIONS, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
|
|
110
121
|
const labels = (0, external_useDecisionGraphStrings_cjs_namespaceObject.useDecisionGraphLabels)();
|
|
111
122
|
const { selected } = mode;
|
|
112
123
|
const { announce, region } = (0, external_useTextAnnouncements_cjs_namespaceObject.useTextAnnouncements)((0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)(), dataTestId);
|
|
@@ -239,9 +250,16 @@ const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenD
|
|
|
239
250
|
const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
|
|
240
251
|
const bodyOf = (decisionId, scrollContainer)=>{
|
|
241
252
|
const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
|
|
242
|
-
if (mounted)
|
|
243
|
-
|
|
244
|
-
|
|
253
|
+
if (mounted) {
|
|
254
|
+
const body = renderBody(decisionId, bodyContext);
|
|
255
|
+
return 'table' === body.kind ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionText_cjs_namespaceObject.DecisionText, {
|
|
256
|
+
...body.text,
|
|
257
|
+
scroll: {
|
|
258
|
+
container: scrollContainer
|
|
259
|
+
},
|
|
260
|
+
onOpenDecision: bodyContext.revealDecision
|
|
261
|
+
}) : body.content;
|
|
262
|
+
}
|
|
245
263
|
const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
|
|
246
264
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
247
265
|
"aria-hidden": true,
|
|
@@ -340,6 +358,7 @@ const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenD
|
|
|
340
358
|
}),
|
|
341
359
|
onOpen: openOf(node.id),
|
|
342
360
|
actions: actions.cardOf(node, position),
|
|
361
|
+
citations: citationOf(citations, node.id),
|
|
343
362
|
cardRef: cardRef(node.id),
|
|
344
363
|
dataTestId: dataTestId
|
|
345
364
|
}),
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type DecisionGraphMinimapSlotProps } from './DecisionGraphMinimapSlot';
|
|
3
|
+
import { type DecisionTextProps } from './DecisionText';
|
|
3
4
|
import type { DecisionGraphMode } from './decisionGraphActionTypes';
|
|
4
|
-
import type { DecisionGraphBodyContext, DecisionGraphExpansion, DecisionGraphNode } from './decisionGraphTypes';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import type { DecisionGraphBodyContext, DecisionGraphCitations, DecisionGraphExpansion, DecisionGraphNode } from './decisionGraphTypes';
|
|
6
|
+
export type DecisionGraphBody<Op, Policy, Total, Type, TextRefusal> = {
|
|
7
|
+
kind: 'table';
|
|
8
|
+
text: Omit<DecisionTextProps<Op, Policy, Total, Type, TextRefusal>, 'scroll' | 'onOpenDecision'>;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'other';
|
|
11
|
+
content: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export interface DecisionGraphTextProps<Refusal, Logic, Op, Policy, Total, Type, TextRefusal> {
|
|
7
14
|
nodes: readonly DecisionGraphNode[];
|
|
8
15
|
mode: DecisionGraphMode<Refusal, Logic>;
|
|
9
|
-
renderBody: (decisionId: string,
|
|
16
|
+
renderBody: (decisionId: string, context: DecisionGraphBodyContext) => DecisionGraphBody<Op, Policy, Total, Type, TextRefusal>;
|
|
17
|
+
citations?: DecisionGraphCitations;
|
|
10
18
|
onFold?: (decisionId: string) => void;
|
|
11
19
|
expansion?: DecisionGraphExpansion;
|
|
12
20
|
onOpenDecision?: (decisionId: string) => void;
|
|
13
21
|
rules?: DecisionGraphMinimapSlotProps['rules'];
|
|
14
22
|
dataTestId: string;
|
|
15
23
|
}
|
|
16
|
-
export declare const DecisionGraphText: <Refusal, Logic>({ nodes, mode, renderBody, expansion, onFold, onOpenDecision, rules, dataTestId, }: DecisionGraphTextProps<Refusal, Logic>) => React.ReactElement;
|
|
24
|
+
export declare const DecisionGraphText: <Refusal, Logic, Op, Policy, Total, Type, TextRefusal>({ nodes, mode, renderBody, citations, expansion, onFold, onOpenDecision, rules, dataTestId, }: DecisionGraphTextProps<Refusal, Logic, Op, Policy, Total, Type, TextRefusal>) => React.ReactElement;
|
|
17
25
|
//# sourceMappingURL=DecisionGraphText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionGraphText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphText.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DecisionGraphText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphText.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAoBpE,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EAEtB,sBAAsB,EACtB,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAW9B,MAAM,MAAM,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,IAC9D;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,IAAI,CACR,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,EACvD,QAAQ,GAAG,gBAAgB,CAC5B,CAAC;CACH,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAEhD,MAAM,WAAW,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW;IAE1F,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAEpC,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAExC,UAAU,EAAE,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,wBAAwB,KAC9B,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAE7D,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAEnC,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAEnC,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C,KAAK,CAAC,EAAE,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAgGD,eAAO,MAAM,iBAAiB,GAAI,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,+FAUrF,sBAAsB,CACvB,OAAO,EACP,KAAK,EACL,EAAE,EACF,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,CACZ,KAAG,KAAK,CAAC,YAsUT,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { Plus } from "lucide-react";
|
|
|
4
4
|
import { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { DecisionGraphCard, DecisionGraphReference } from "./DecisionGraphCard.js";
|
|
6
6
|
import { DecisionGraphMinimapSlot } from "./DecisionGraphMinimapSlot.js";
|
|
7
|
+
import { DecisionText } from "./DecisionText.js";
|
|
7
8
|
import { childPositionsOf, decisionsOf, topPositionsOf, usersOf } from "./decisionGraphPositions.js";
|
|
8
9
|
import { GRAPH_ADD_DECISION_CLASS, GRAPH_BRANCH_CLASS, GRAPH_COLUMN_CLASS, GRAPH_EMPTY_CLASS, GRAPH_FRAME_CLASS, GRAPH_MINIMAP_GAP_PX, GRAPH_NEST_CLASS, GRAPH_OUTPUT_HUE_CLASS, GRAPH_SCROLLER_CLASS, graphColumnInsetOf } from "./decisionGraphStyles.js";
|
|
9
10
|
import { revealIn } from "./revealIn.js";
|
|
@@ -12,6 +13,9 @@ import { useDecisionGraphActions } from "./useDecisionGraphActions.js";
|
|
|
12
13
|
import { useDecisionGraphLabels } from "./useDecisionGraphStrings.js";
|
|
13
14
|
import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
|
|
14
15
|
import { useTextAnnouncements } from "./useTextAnnouncements.js";
|
|
16
|
+
const NO_CITATIONS = {
|
|
17
|
+
kind: 'none'
|
|
18
|
+
};
|
|
15
19
|
const NO_EXPANDED = new Set();
|
|
16
20
|
const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
17
21
|
kind: 'rule',
|
|
@@ -21,6 +25,13 @@ const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
|
21
25
|
kind: 'decision',
|
|
22
26
|
decisionId: id
|
|
23
27
|
};
|
|
28
|
+
const citationOf = (citations, decisionId)=>{
|
|
29
|
+
const cited = 'cited' === citations.kind ? citations.decisions.get(decisionId) ?? [] : [];
|
|
30
|
+
return 'cited' === citations.kind && cited.length > 0 ? {
|
|
31
|
+
citations: cited,
|
|
32
|
+
onOpen: citations.onOpenCitation
|
|
33
|
+
} : null;
|
|
34
|
+
};
|
|
24
35
|
const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
|
|
25
36
|
const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
|
|
26
37
|
const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -78,7 +89,7 @@ const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
|
78
89
|
}
|
|
79
90
|
return 0 === rules ? SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
80
91
|
};
|
|
81
|
-
const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
|
|
92
|
+
const DecisionGraphText = ({ nodes, mode, renderBody, citations = NO_CITATIONS, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
|
|
82
93
|
const labels = useDecisionGraphLabels();
|
|
83
94
|
const { selected } = mode;
|
|
84
95
|
const { announce, region } = useTextAnnouncements(useDecisionTextLabels(), dataTestId);
|
|
@@ -211,9 +222,16 @@ const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenD
|
|
|
211
222
|
const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
|
|
212
223
|
const bodyOf = (decisionId, scrollContainer)=>{
|
|
213
224
|
const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
|
|
214
|
-
if (mounted)
|
|
215
|
-
|
|
216
|
-
|
|
225
|
+
if (mounted) {
|
|
226
|
+
const body = renderBody(decisionId, bodyContext);
|
|
227
|
+
return 'table' === body.kind ? /*#__PURE__*/ jsx(DecisionText, {
|
|
228
|
+
...body.text,
|
|
229
|
+
scroll: {
|
|
230
|
+
container: scrollContainer
|
|
231
|
+
},
|
|
232
|
+
onOpenDecision: bodyContext.revealDecision
|
|
233
|
+
}) : body.content;
|
|
234
|
+
}
|
|
217
235
|
const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
|
|
218
236
|
return /*#__PURE__*/ jsx("div", {
|
|
219
237
|
"aria-hidden": true,
|
|
@@ -312,6 +330,7 @@ const DecisionGraphText = ({ nodes, mode, renderBody, expansion, onFold, onOpenD
|
|
|
312
330
|
}),
|
|
313
331
|
onOpen: openOf(node.id),
|
|
314
332
|
actions: actions.cardOf(node, position),
|
|
333
|
+
citations: citationOf(citations, node.id),
|
|
315
334
|
cardRef: cardRef(node.id),
|
|
316
335
|
dataTestId: dataTestId
|
|
317
336
|
}),
|
|
@@ -58,6 +58,9 @@ const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenc
|
|
|
58
58
|
const external_useTextAnnouncements_cjs_namespaceObject = require("./useTextAnnouncements.cjs");
|
|
59
59
|
const external_useValueEditing_cjs_namespaceObject = require("./useValueEditing.cjs");
|
|
60
60
|
const external_ValueEditorOverlay_cjs_namespaceObject = require("./ValueEditorOverlay.cjs");
|
|
61
|
+
const NO_CITATIONS = {
|
|
62
|
+
kind: 'none'
|
|
63
|
+
};
|
|
61
64
|
const NO_FOLDS = new Set();
|
|
62
65
|
const nameTokensOf = (bands)=>{
|
|
63
66
|
const names = new Map(bands.flatMap(({ id, columns })=>columns.map((column)=>[
|
|
@@ -74,7 +77,7 @@ const nameTokensOf = (bands)=>{
|
|
|
74
77
|
text: columnId
|
|
75
78
|
};
|
|
76
79
|
};
|
|
77
|
-
const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false, marks = external_marks_cjs_namespaceObject.EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
|
|
80
|
+
const DecisionText = ({ table, mode, hitPolicies, columnTypes, citations = NO_CITATIONS, numbered = false, marks = external_marks_cjs_namespaceObject.EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
|
|
78
81
|
const { rules, inputs, outputs } = table;
|
|
79
82
|
const selected = 'diff' === mode.kind ? null : mode.selected;
|
|
80
83
|
const onSelect = 'select' === mode.kind || 'edit' === mode.kind ? mode.onSelect : void 0;
|
|
@@ -143,6 +146,19 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
143
146
|
focusedRowId
|
|
144
147
|
]);
|
|
145
148
|
const ruleWindow = (0, external_useRuleWindow_cjs_namespaceObject.useRuleWindow)(listed, selected?.rowId, retainedRowIds, scroll);
|
|
149
|
+
const citedRows = (0, external_react_namespaceObject.useMemo)(()=>'cited' === citations.kind ? listed.flatMap((rule, index)=>{
|
|
150
|
+
const count = citations.rules.get(rule.rowId)?.length ?? 0;
|
|
151
|
+
return count > 0 ? [
|
|
152
|
+
{
|
|
153
|
+
rowId: rule.rowId,
|
|
154
|
+
index,
|
|
155
|
+
count
|
|
156
|
+
}
|
|
157
|
+
] : [];
|
|
158
|
+
}) : [], [
|
|
159
|
+
citations,
|
|
160
|
+
listed
|
|
161
|
+
]);
|
|
146
162
|
const selectable = void 0 !== onSelect;
|
|
147
163
|
const addRuleAction = (0, external_useAddRule_cjs_namespaceObject.useAddRule)({
|
|
148
164
|
...ruleWindow,
|
|
@@ -185,7 +201,11 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
185
201
|
history: 'edit' === mode.kind ? {
|
|
186
202
|
onUndo: mode.onUndo,
|
|
187
203
|
onRedo: mode.onRedo
|
|
188
|
-
} : null
|
|
204
|
+
} : null,
|
|
205
|
+
citationKeys: !selectable,
|
|
206
|
+
citedRows,
|
|
207
|
+
revealRow: ruleWindow.scrollRowIntoView,
|
|
208
|
+
revealStop: ruleWindow.scrollStopIntoView
|
|
189
209
|
});
|
|
190
210
|
const columnEditing = (0, external_useColumnEditing_cjs_namespaceObject.useColumnEditing)({
|
|
191
211
|
column: 'edit' === mode.kind ? mode.edit.column : void 0,
|
|
@@ -212,6 +232,10 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
212
232
|
title: title,
|
|
213
233
|
hint: policyHeader.hint,
|
|
214
234
|
mark: headerMark,
|
|
235
|
+
citations: 'cited' === citations.kind && citations.decision.length > 0 ? {
|
|
236
|
+
citations: citations.decision,
|
|
237
|
+
onOpen: citations.onOpenCitation
|
|
238
|
+
} : null,
|
|
215
239
|
labels: labels,
|
|
216
240
|
sticky: 'self' === scroll,
|
|
217
241
|
dataTestId: dataTestId
|
|
@@ -260,6 +284,7 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
260
284
|
selectedColumnId: navigation.selectedColumnId,
|
|
261
285
|
selectable: selectable,
|
|
262
286
|
decisionLinks: void 0 !== onOpenDecision,
|
|
287
|
+
citations: citations,
|
|
263
288
|
style: listStyle,
|
|
264
289
|
idPrefix: idPrefix,
|
|
265
290
|
dataTestId: dataTestId,
|
|
@@ -5,9 +5,9 @@ import { type DecisionTextDiff } from './decisionTextDiff';
|
|
|
5
5
|
import type { DecisionTextEdit } from './decisionTextTypes';
|
|
6
6
|
import { type HitPolicyCatalog, type HitPolicyPick } from './hitPolicyMenu';
|
|
7
7
|
import { type TableMarks } from './marks';
|
|
8
|
-
import type { DecisionTextTable, SentenceSelection } from './sentenceTypes';
|
|
8
|
+
import type { DecisionTextCitations, DecisionTextTable, SentenceSelection } from './sentenceTypes';
|
|
9
9
|
import { useCellHover } from './useCellHover';
|
|
10
|
-
import { type ContainerHandlersParams, type
|
|
10
|
+
import { type ContainerHandlersParams, type DecisionTextContainerProps, type TextHistory } from './useContainerHandlers';
|
|
11
11
|
import { type DecisionTextScroll } from './useRuleWindow';
|
|
12
12
|
import { type SentenceNavigationSource } from './useSentenceNavigation';
|
|
13
13
|
type SelectHandler = NonNullable<SentenceNavigationSource['onSelect']>;
|
|
@@ -34,6 +34,7 @@ export interface DecisionTextProps<Op, Policy, Total, Type, Refusal> {
|
|
|
34
34
|
mode: DecisionTextMode<Op, Policy, Total, Type, Refusal>;
|
|
35
35
|
hitPolicies: HitPolicyCatalog<Policy, Total>;
|
|
36
36
|
columnTypes: readonly ColumnTypeOption<Type>[];
|
|
37
|
+
citations?: DecisionTextCitations;
|
|
37
38
|
numbered?: boolean;
|
|
38
39
|
marks?: TableMarks;
|
|
39
40
|
onCellHover?: Parameters<typeof useCellHover>[0];
|
|
@@ -45,6 +46,6 @@ export interface DecisionTextProps<Op, Policy, Total, Type, Refusal> {
|
|
|
45
46
|
dataTestId: string;
|
|
46
47
|
children?: React.ReactNode;
|
|
47
48
|
}
|
|
48
|
-
export declare const DecisionText: <Op, Policy, Total, Type, Refusal>({ table, mode, hitPolicies, columnTypes, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Op, Policy, Total, Type, Refusal>) => React.JSX.Element;
|
|
49
|
+
export declare const DecisionText: <Op, Policy, Total, Type, Refusal>({ table, mode, hitPolicies, columnTypes, citations, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Op, Policy, Total, Type, Refusal>) => React.JSX.Element;
|
|
49
50
|
export {};
|
|
50
51
|
//# sourceMappingURL=DecisionText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAMvD,OAAO,KAAK,EACV,iBAAiB,EAGjB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,
|
|
1
|
+
{"version":3,"file":"DecisionText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAE,g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AAG,CAAC,OA2OlE,CAAC"}
|
|
@@ -30,6 +30,9 @@ import { useSentenceNavigation } from "./useSentenceNavigation.js";
|
|
|
30
30
|
import { useTextAnnouncements } from "./useTextAnnouncements.js";
|
|
31
31
|
import { useValueEditing } from "./useValueEditing.js";
|
|
32
32
|
import { ValueEditorOverlay } from "./ValueEditorOverlay.js";
|
|
33
|
+
const NO_CITATIONS = {
|
|
34
|
+
kind: 'none'
|
|
35
|
+
};
|
|
33
36
|
const NO_FOLDS = new Set();
|
|
34
37
|
const nameTokensOf = (bands)=>{
|
|
35
38
|
const names = new Map(bands.flatMap(({ id, columns })=>columns.map((column)=>[
|
|
@@ -46,7 +49,7 @@ const nameTokensOf = (bands)=>{
|
|
|
46
49
|
text: columnId
|
|
47
50
|
};
|
|
48
51
|
};
|
|
49
|
-
const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false, marks = EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
|
|
52
|
+
const DecisionText = ({ table, mode, hitPolicies, columnTypes, citations = NO_CITATIONS, numbered = false, marks = EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
|
|
50
53
|
const { rules, inputs, outputs } = table;
|
|
51
54
|
const selected = 'diff' === mode.kind ? null : mode.selected;
|
|
52
55
|
const onSelect = 'select' === mode.kind || 'edit' === mode.kind ? mode.onSelect : void 0;
|
|
@@ -115,6 +118,19 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
115
118
|
focusedRowId
|
|
116
119
|
]);
|
|
117
120
|
const ruleWindow = useRuleWindow(listed, selected?.rowId, retainedRowIds, scroll);
|
|
121
|
+
const citedRows = useMemo(()=>'cited' === citations.kind ? listed.flatMap((rule, index)=>{
|
|
122
|
+
const count = citations.rules.get(rule.rowId)?.length ?? 0;
|
|
123
|
+
return count > 0 ? [
|
|
124
|
+
{
|
|
125
|
+
rowId: rule.rowId,
|
|
126
|
+
index,
|
|
127
|
+
count
|
|
128
|
+
}
|
|
129
|
+
] : [];
|
|
130
|
+
}) : [], [
|
|
131
|
+
citations,
|
|
132
|
+
listed
|
|
133
|
+
]);
|
|
118
134
|
const selectable = void 0 !== onSelect;
|
|
119
135
|
const addRuleAction = useAddRule({
|
|
120
136
|
...ruleWindow,
|
|
@@ -157,7 +173,11 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
157
173
|
history: 'edit' === mode.kind ? {
|
|
158
174
|
onUndo: mode.onUndo,
|
|
159
175
|
onRedo: mode.onRedo
|
|
160
|
-
} : null
|
|
176
|
+
} : null,
|
|
177
|
+
citationKeys: !selectable,
|
|
178
|
+
citedRows,
|
|
179
|
+
revealRow: ruleWindow.scrollRowIntoView,
|
|
180
|
+
revealStop: ruleWindow.scrollStopIntoView
|
|
161
181
|
});
|
|
162
182
|
const columnEditing = useColumnEditing({
|
|
163
183
|
column: 'edit' === mode.kind ? mode.edit.column : void 0,
|
|
@@ -184,6 +204,10 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
184
204
|
title: title,
|
|
185
205
|
hint: policyHeader.hint,
|
|
186
206
|
mark: headerMark,
|
|
207
|
+
citations: 'cited' === citations.kind && citations.decision.length > 0 ? {
|
|
208
|
+
citations: citations.decision,
|
|
209
|
+
onOpen: citations.onOpenCitation
|
|
210
|
+
} : null,
|
|
187
211
|
labels: labels,
|
|
188
212
|
sticky: 'self' === scroll,
|
|
189
213
|
dataTestId: dataTestId
|
|
@@ -232,6 +256,7 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
|
|
|
232
256
|
selectedColumnId: navigation.selectedColumnId,
|
|
233
257
|
selectable: selectable,
|
|
234
258
|
decisionLinks: void 0 !== onOpenDecision,
|
|
259
|
+
citations: citations,
|
|
235
260
|
style: listStyle,
|
|
236
261
|
idPrefix: idPrefix,
|
|
237
262
|
dataTestId: dataTestId,
|