@uipath/apollo-react 7.26.0 → 7.27.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.
Files changed (95) hide show
  1. package/dist/decision-table/BandColumn.d.ts +2 -2
  2. package/dist/decision-table/BandColumn.d.ts.map +1 -1
  3. package/dist/decision-table/ColumnEditorOverlay.cjs +3 -3
  4. package/dist/decision-table/ColumnEditorOverlay.d.ts +6 -5
  5. package/dist/decision-table/ColumnEditorOverlay.d.ts.map +1 -1
  6. package/dist/decision-table/ColumnEditorOverlay.js +3 -3
  7. package/dist/decision-table/ColumnPopover.cjs +52 -31
  8. package/dist/decision-table/ColumnPopover.d.ts +36 -23
  9. package/dist/decision-table/ColumnPopover.d.ts.map +1 -1
  10. package/dist/decision-table/ColumnPopover.js +52 -31
  11. package/dist/decision-table/DecisionText.cjs +25 -8
  12. package/dist/decision-table/DecisionText.d.ts +23 -24
  13. package/dist/decision-table/DecisionText.d.ts.map +1 -1
  14. package/dist/decision-table/DecisionText.js +25 -8
  15. package/dist/decision-table/DecisionTextHeader.cjs +10 -8
  16. package/dist/decision-table/DecisionTextHeader.d.ts +13 -5
  17. package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
  18. package/dist/decision-table/DecisionTextHeader.js +10 -8
  19. package/dist/decision-table/__fixtures__/diffSentences.fixtures.d.ts +9 -8
  20. package/dist/decision-table/__fixtures__/diffSentences.fixtures.d.ts.map +1 -1
  21. package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts +1 -1
  22. package/dist/decision-table/__fixtures__/editableSentences.fixtures.d.ts.map +1 -1
  23. package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts +12 -7
  24. package/dist/decision-table/__fixtures__/sentences.fixtures.d.ts.map +1 -1
  25. package/dist/decision-table/__fixtures__/storyTableHost.d.ts +13 -14
  26. package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
  27. package/dist/decision-table/__fixtures__/textMode.d.ts +9 -5
  28. package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
  29. package/dist/decision-table/bandColumns.cjs +22 -35
  30. package/dist/decision-table/bandColumns.d.ts +2 -4
  31. package/dist/decision-table/bandColumns.d.ts.map +1 -1
  32. package/dist/decision-table/bandColumns.js +21 -31
  33. package/dist/decision-table/decisionTextDiff.d.ts +13 -12
  34. package/dist/decision-table/decisionTextDiff.d.ts.map +1 -1
  35. package/dist/decision-table/decisionTextTypes.d.ts +4 -3
  36. package/dist/decision-table/decisionTextTypes.d.ts.map +1 -1
  37. package/dist/decision-table/index.cjs +4 -4
  38. package/dist/decision-table/index.d.ts +7 -6
  39. package/dist/decision-table/index.d.ts.map +1 -1
  40. package/dist/decision-table/index.js +1 -1
  41. package/dist/decision-table/locales/de.cjs +1 -1
  42. package/dist/decision-table/locales/de.d.ts.map +1 -1
  43. package/dist/decision-table/locales/de.js +1 -1
  44. package/dist/decision-table/locales/en.cjs +1 -1
  45. package/dist/decision-table/locales/en.d.ts.map +1 -1
  46. package/dist/decision-table/locales/en.js +1 -1
  47. package/dist/decision-table/locales/es-MX.cjs +1 -1
  48. package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
  49. package/dist/decision-table/locales/es-MX.js +1 -1
  50. package/dist/decision-table/locales/es.cjs +1 -1
  51. package/dist/decision-table/locales/es.d.ts.map +1 -1
  52. package/dist/decision-table/locales/es.js +1 -1
  53. package/dist/decision-table/locales/fr.cjs +1 -1
  54. package/dist/decision-table/locales/fr.d.ts.map +1 -1
  55. package/dist/decision-table/locales/fr.js +1 -1
  56. package/dist/decision-table/locales/ja.cjs +1 -1
  57. package/dist/decision-table/locales/ja.d.ts.map +1 -1
  58. package/dist/decision-table/locales/ja.js +1 -1
  59. package/dist/decision-table/locales/ko.cjs +1 -1
  60. package/dist/decision-table/locales/ko.d.ts.map +1 -1
  61. package/dist/decision-table/locales/ko.js +1 -1
  62. package/dist/decision-table/locales/pt-BR.cjs +1 -1
  63. package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
  64. package/dist/decision-table/locales/pt-BR.js +1 -1
  65. package/dist/decision-table/locales/pt.cjs +1 -1
  66. package/dist/decision-table/locales/pt.d.ts.map +1 -1
  67. package/dist/decision-table/locales/pt.js +1 -1
  68. package/dist/decision-table/locales/ro.cjs +1 -1
  69. package/dist/decision-table/locales/ro.d.ts.map +1 -1
  70. package/dist/decision-table/locales/ro.js +1 -1
  71. package/dist/decision-table/locales/ru.cjs +1 -1
  72. package/dist/decision-table/locales/ru.d.ts.map +1 -1
  73. package/dist/decision-table/locales/ru.js +1 -1
  74. package/dist/decision-table/locales/tr.cjs +1 -1
  75. package/dist/decision-table/locales/tr.d.ts.map +1 -1
  76. package/dist/decision-table/locales/tr.js +1 -1
  77. package/dist/decision-table/locales/zh-CN.cjs +1 -1
  78. package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
  79. package/dist/decision-table/locales/zh-CN.js +1 -1
  80. package/dist/decision-table/locales/zh-TW.cjs +1 -1
  81. package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
  82. package/dist/decision-table/locales/zh-TW.js +1 -1
  83. package/dist/decision-table/sentenceTypes.d.ts +12 -8
  84. package/dist/decision-table/sentenceTypes.d.ts.map +1 -1
  85. package/dist/decision-table/useColumnEditing.cjs +7 -5
  86. package/dist/decision-table/useColumnEditing.d.ts +6 -6
  87. package/dist/decision-table/useColumnEditing.d.ts.map +1 -1
  88. package/dist/decision-table/useColumnEditing.js +7 -5
  89. package/dist/decision-table/useDecisionTextStrings.cjs +1 -1
  90. package/dist/decision-table/useDecisionTextStrings.js +1 -1
  91. package/dist/decision-table/useEditState.d.ts +2 -2
  92. package/dist/decision-table/useEditState.d.ts.map +1 -1
  93. package/dist/decision-table/valueTypes.d.ts +2 -2
  94. package/dist/decision-table/valueTypes.d.ts.map +1 -1
  95. package/package.json +3 -3
@@ -2,9 +2,9 @@ import type React from 'react';
2
2
  import type { DiffChange, DiffLabels } from './decisionTextDiff';
3
3
  import { type MarkBadgeProps } from './MarkBadge';
4
4
  import type { Mark } from './marks';
5
- import type { SentenceBandColumn } from './sentenceTypes';
5
+ import type { BandColumnView } from './sentenceTypes';
6
6
  export interface BandColumnProps {
7
- column: SentenceBandColumn;
7
+ column: BandColumnView;
8
8
  mark: Mark | undefined;
9
9
  badgeId: string;
10
10
  change: DiffChange | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BandColumn.d.ts","sourceRoot":"","sources":["../../src/decision-table/BandColumn.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAa,KAAK,cAAc,EAAW,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AASpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAW1D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAEpE,IAAI,EACA;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GACjB;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC3F;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqDhD,CAAC"}
1
+ {"version":3,"file":"BandColumn.d.ts","sourceRoot":"","sources":["../../src/decision-table/BandColumn.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAa,KAAK,cAAc,EAAW,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AASpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAWtD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAEpE,IAAI,EACA;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GACjB;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC3F;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqDhD,CAAC"}
@@ -30,8 +30,8 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const external_ColumnPopover_cjs_namespaceObject = require("./ColumnPopover.cjs");
31
31
  const external_EditorOverlay_cjs_namespaceObject = require("./EditorOverlay.cjs");
32
32
  const external_sentenceStyles_cjs_namespaceObject = require("./sentenceStyles.cjs");
33
- const ColumnEditorOverlay = ({ editor, edit, labels, container, id, dataTestId })=>{
34
- const field = edit.field(editor.column.id);
33
+ const ColumnEditorOverlay = ({ editor, types, labels, container, id, dataTestId })=>{
34
+ const { field } = editor;
35
35
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_EditorOverlay_cjs_namespaceObject.EditorOverlay, {
36
36
  anchor: editor.anchor,
37
37
  container: container,
@@ -44,7 +44,7 @@ const ColumnEditorOverlay = ({ editor, edit, labels, container, id, dataTestId }
44
44
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ColumnPopover_cjs_namespaceObject.ColumnPopover, {
45
45
  column: editor.column,
46
46
  field: field,
47
- types: edit.types,
47
+ types: types,
48
48
  onApply: editor.onApply,
49
49
  onCancel: editor.onCancel,
50
50
  onMoreProperties: editor.onMoreProperties,
@@ -1,14 +1,15 @@
1
1
  import type React from 'react';
2
- import { type ColumnEdit, type ColumnPopoverLabels } from './ColumnPopover';
2
+ import { type ColumnPopoverLabels } from './ColumnPopover';
3
+ import type { ColumnTypeOption } from './columnTypes';
3
4
  import type { OpenColumnEditor } from './useColumnEditing';
4
5
  import type { RuleWindow } from './useRuleWindow';
5
- export interface ColumnEditorOverlayProps {
6
- editor: OpenColumnEditor;
7
- edit: ColumnEdit;
6
+ export interface ColumnEditorOverlayProps<Type> {
7
+ editor: OpenColumnEditor<Type>;
8
+ types: readonly ColumnTypeOption<Type>[];
8
9
  labels: ColumnPopoverLabels;
9
10
  container: RuleWindow['container'];
10
11
  id: string;
11
12
  dataTestId: string;
12
13
  }
13
- export declare const ColumnEditorOverlay: React.FC<ColumnEditorOverlayProps>;
14
+ export declare const ColumnEditorOverlay: <Type>({ editor, types, labels, container, id, dataTestId, }: ColumnEditorOverlayProps<Type>) => React.JSX.Element;
14
15
  //# sourceMappingURL=ColumnEditorOverlay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnEditorOverlay.d.ts","sourceRoot":"","sources":["../../src/decision-table/ColumnEditorOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,mBAAmB,EAEzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAA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 import { jsx } from "react/jsx-runtime";
2
2
  import { ColumnPopover, columnTitle } from "./ColumnPopover.js";
3
3
  import { EditorOverlay } from "./EditorOverlay.js";
4
4
  import { COLUMN_EDITOR_CLASS } from "./sentenceStyles.js";
5
- const ColumnEditorOverlay = ({ editor, edit, labels, container, id, dataTestId })=>{
6
- const field = edit.field(editor.column.id);
5
+ const ColumnEditorOverlay = ({ editor, types, labels, container, id, dataTestId })=>{
6
+ const { field } = editor;
7
7
  return /*#__PURE__*/ jsx(EditorOverlay, {
8
8
  anchor: editor.anchor,
9
9
  container: container,
@@ -16,7 +16,7 @@ const ColumnEditorOverlay = ({ editor, edit, labels, container, id, dataTestId }
16
16
  children: /*#__PURE__*/ jsx(ColumnPopover, {
17
17
  column: editor.column,
18
18
  field: field,
19
- types: edit.types,
19
+ types: types,
20
20
  onApply: editor.onApply,
21
21
  onCancel: editor.onCancel,
22
22
  onMoreProperties: editor.onMoreProperties,
@@ -30,44 +30,62 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
31
  const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
32
32
  const external_react_namespaceObject = require("react");
33
- const external_bandColumns_cjs_namespaceObject = require("./bandColumns.cjs");
33
+ const useSafeLingui_cjs_namespaceObject = require("../i18n/useSafeLingui.cjs");
34
+ const external_columnTypes_cjs_namespaceObject = require("./columnTypes.cjs");
34
35
  const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
35
36
  const external_PopoverFooter_cjs_namespaceObject = require("./PopoverFooter.cjs");
36
37
  const external_PopoverHeader_cjs_namespaceObject = require("./PopoverHeader.cjs");
37
38
  const external_PopoverSelect_cjs_namespaceObject = require("./PopoverSelect.cjs");
38
39
  const external_sentenceStyles_cjs_namespaceObject = require("./sentenceStyles.cjs");
39
40
  const columnTitle = (kind, name, labels)=>'input' === kind ? labels.inputColumn(name) : labels.outputColumn(name);
41
+ const bindingOf = (field)=>'input' === field.kind ? field.expression : field.name;
42
+ const changed = (draft, held)=>draft.trim() === held.trim() ? void 0 : draft.trim();
40
43
  const changeOf = (field, draft)=>{
41
- const change = {};
42
- if (draft.label.trim() !== field.label.trim()) change.label = draft.label.trim();
43
- if (draft.binding.trim() !== field.binding.trim()) change.binding = draft.binding.trim();
44
- if (draft.typeRef !== field.typeRef) change.typeRef = draft.typeRef;
45
- if (void 0 !== field.allowedValues && draft.allowedValues.trim() !== field.allowedValues.trim()) change.allowedValues = draft.allowedValues.trim();
46
- return change;
44
+ const label = changed(draft.label, field.label);
45
+ const allowedValues = changed(draft.allowedValues, field.allowedValues);
46
+ const common = {
47
+ ...void 0 === label ? {} : {
48
+ label
49
+ },
50
+ ...draft.type === field.type ? {} : {
51
+ type: draft.type
52
+ },
53
+ ...void 0 === allowedValues ? {} : {
54
+ allowedValues
55
+ }
56
+ };
57
+ const binding = changed(draft.binding, bindingOf(field));
58
+ if ('input' === field.kind) return {
59
+ kind: 'input',
60
+ ...common,
61
+ ...void 0 === binding ? {} : {
62
+ expression: binding
63
+ }
64
+ };
65
+ return {
66
+ kind: 'output',
67
+ ...common,
68
+ ...void 0 === binding ? {} : {
69
+ name: binding
70
+ }
71
+ };
47
72
  };
48
73
  const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperties, labels, dataTestId })=>{
49
74
  const id = (0, external_react_namespaceObject.useId)();
75
+ const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
50
76
  const [root, setRoot] = (0, external_react_namespaceObject.useState)(null);
51
77
  const [draft, setDraft] = (0, external_react_namespaceObject.useState)({
52
78
  label: field.label,
53
- binding: field.binding,
54
- typeRef: field.typeRef,
55
- allowedValues: field.allowedValues ?? ''
79
+ binding: bindingOf(field),
80
+ type: field.type,
81
+ allowedValues: field.allowedValues
56
82
  });
57
- const missing = field.required && '' === draft.binding.trim();
83
+ const required = 'input' === field.kind || field.nameRequired;
84
+ const missing = required && '' === draft.binding.trim();
58
85
  const missingLabel = '' === draft.label.trim();
59
- const typed = types.map((type)=>({
60
- ...type,
61
- icon: type.icon ?? (0, external_bandColumns_cjs_namespaceObject.valueTypeIcon)(type.type)
62
- }));
63
- const options = types.some((type)=>type.id === field.typeRef) ? typed : [
64
- {
65
- id: field.typeRef,
66
- label: field.typeRef
67
- },
68
- ...typed
69
- ];
70
- const placeholder = types.find((type)=>type.id === draft.typeRef)?.allowedValuesPlaceholder;
86
+ const choices = (0, external_columnTypes_cjs_namespaceObject.columnTypeChoicesOf)(types, _);
87
+ const place = types.findIndex((option)=>option.type === draft.type);
88
+ const placeholder = choices.find((_choice, index)=>index === place)?.allowedValuesPlaceholder;
71
89
  const set = (key)=>(event)=>{
72
90
  const value = event.currentTarget.value;
73
91
  setDraft((current)=>({
@@ -136,7 +154,7 @@ const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperti
136
154
  className: external_sentenceStyles_cjs_namespaceObject.COLUMN_FIELD_LABEL_CLASS,
137
155
  children: [
138
156
  bindingLabel,
139
- field.required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
157
+ required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
140
158
  "aria-hidden": true,
141
159
  className: external_sentenceStyles_cjs_namespaceObject.COLUMN_REQUIRED_CLASS,
142
160
  children: ' *'
@@ -146,7 +164,7 @@ const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperti
146
164
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Input, {
147
165
  id: `${id}-binding`,
148
166
  className: external_sentenceStyles_cjs_namespaceObject.COLUMN_CODE_FIELD_CLASS,
149
- "aria-required": field.required,
167
+ "aria-required": required,
150
168
  "aria-invalid": missing,
151
169
  "aria-describedby": missing ? `${id}-missing` : void 0,
152
170
  value: draft.binding,
@@ -170,19 +188,22 @@ const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperti
170
188
  }),
171
189
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PopoverSelect_cjs_namespaceObject.PopoverSelect, {
172
190
  id: `${id}-type`,
173
- value: draft.typeRef,
174
- options: options,
175
- onChange: (typeRef)=>setDraft((current)=>({
191
+ value: String(place),
192
+ options: choices,
193
+ onChange: (picked)=>{
194
+ const option = types.find((_option, index)=>String(index) === picked);
195
+ if (option) setDraft((current)=>({
176
196
  ...current,
177
- typeRef
178
- })),
197
+ type: option.type
198
+ }));
199
+ },
179
200
  container: root,
180
201
  label: labels.dataType,
181
202
  dataTestId: `${dataTestId}-type`
182
203
  })
183
204
  ]
184
205
  }),
185
- void 0 !== field.allowedValues && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
206
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
186
207
  className: external_sentenceStyles_cjs_namespaceObject.COLUMN_FIELD_CLASS,
187
208
  children: [
188
209
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Label, {
@@ -1,24 +1,37 @@
1
1
  import type React from 'react';
2
+ import { type ColumnTypeOption } from './columnTypes';
2
3
  import { type PopoverFooterLabels } from './PopoverFooter';
3
- import { type PopoverSelectOption } from './PopoverSelect';
4
- import type { SentenceBand, SentenceNameToken, SentenceValueType } from './sentenceTypes';
5
- export interface ColumnField {
6
- kind: SentenceNameToken['kind'];
4
+ import type { SentenceBand } from './sentenceTypes';
5
+ export type ColumnFieldData<Type> = {
6
+ kind: 'input';
7
7
  label: string;
8
- binding: string;
9
- required: boolean;
10
- typeRef: string;
8
+ expression: string;
9
+ type: Type;
10
+ allowedValues: string;
11
+ } | {
12
+ kind: 'output';
13
+ label: string;
14
+ name: string;
15
+ nameRequired: boolean;
16
+ type: Type;
17
+ allowedValues: string;
18
+ };
19
+ export type ColumnChange<Type> = {
20
+ kind: 'input';
21
+ label?: string;
22
+ expression?: string;
23
+ type?: Type;
11
24
  allowedValues?: string;
12
- }
13
- export type ColumnChange = Partial<Pick<ColumnField, 'label' | 'binding' | 'typeRef' | 'allowedValues'>>;
14
- export interface ColumnTypeOption extends PopoverSelectOption {
15
- type?: SentenceValueType;
16
- allowedValuesPlaceholder?: string;
17
- }
18
- export interface ColumnEdit {
19
- field: (columnId: string) => ColumnField;
20
- types: readonly ColumnTypeOption[];
21
- onCommit: (columnId: string, change: ColumnChange) => void;
25
+ } | {
26
+ kind: 'output';
27
+ label?: string;
28
+ name?: string;
29
+ type?: Type;
30
+ allowedValues?: string;
31
+ };
32
+ export interface ColumnEdit<Type> {
33
+ field: (columnId: string) => ColumnFieldData<Type> | undefined;
34
+ onCommit: (columnId: string, change: ColumnChange<Type>) => void;
22
35
  onMoreProperties?: (columnId: string) => void;
23
36
  }
24
37
  export interface ColumnPopoverLabels extends PopoverFooterLabels {
@@ -35,16 +48,16 @@ export interface ColumnPopoverLabels extends PopoverFooterLabels {
35
48
  allowedValuesHint: string;
36
49
  moreProperties: string;
37
50
  }
38
- export interface ColumnPopoverProps {
51
+ export interface ColumnPopoverProps<Type> {
39
52
  column: SentenceBand['columns'][number];
40
- field: ColumnField;
41
- types: ColumnEdit['types'];
42
- onApply: (change: ColumnChange) => void;
53
+ field: ColumnFieldData<Type>;
54
+ types: readonly ColumnTypeOption<Type>[];
55
+ onApply: (change: ColumnChange<Type>) => void;
43
56
  onCancel: () => void;
44
57
  onMoreProperties: (() => void) | undefined;
45
58
  labels: ColumnPopoverLabels;
46
59
  dataTestId: string;
47
60
  }
48
- export declare const columnTitle: (kind: ColumnField["kind"], name: string, labels: ColumnPopoverLabels) => string;
49
- export declare const ColumnPopover: React.FC<ColumnPopoverProps>;
61
+ export declare const columnTitle: (kind: ColumnFieldData<unknown>["kind"], name: string, labels: ColumnPopoverLabels) => string;
62
+ export declare const ColumnPopover: <Type>({ column, field, types, onApply, onCancel, onMoreProperties, labels, dataTestId, }: ColumnPopoverProps<Type>) => React.JSX.Element;
50
63
  //# sourceMappingURL=ColumnPopover.d.ts.map
@@ -1 +1 @@
1
- {"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from "@uipath/apollo-wind";
3
3
  import { useId, useState } from "react";
4
- import { valueTypeIcon } from "./bandColumns.js";
4
+ import { useSafeLingui } from "../i18n/useSafeLingui.js";
5
+ import { columnTypeChoicesOf } from "./columnTypes.js";
5
6
  import { isComposing } from "./gridEvents.js";
6
7
  import { PopoverFooter } from "./PopoverFooter.js";
7
8
  import { PopoverHeader } from "./PopoverHeader.js";
8
9
  import { PopoverSelect } from "./PopoverSelect.js";
9
10
  import { COLUMN_CODE_FIELD_CLASS, COLUMN_FIELD_CLASS, COLUMN_FIELD_LABEL_CLASS, COLUMN_HINT_CLASS, COLUMN_REQUIRED_CLASS, POPOVER_CLASS, POPOVER_ERROR_CLASS, POPOVER_FIELD_CLASS } from "./sentenceStyles.js";
10
11
  const columnTitle = (kind, name, labels)=>'input' === kind ? labels.inputColumn(name) : labels.outputColumn(name);
12
+ const bindingOf = (field)=>'input' === field.kind ? field.expression : field.name;
13
+ const changed = (draft, held)=>draft.trim() === held.trim() ? void 0 : draft.trim();
11
14
  const changeOf = (field, draft)=>{
12
- const change = {};
13
- if (draft.label.trim() !== field.label.trim()) change.label = draft.label.trim();
14
- if (draft.binding.trim() !== field.binding.trim()) change.binding = draft.binding.trim();
15
- if (draft.typeRef !== field.typeRef) change.typeRef = draft.typeRef;
16
- if (void 0 !== field.allowedValues && draft.allowedValues.trim() !== field.allowedValues.trim()) change.allowedValues = draft.allowedValues.trim();
17
- return change;
15
+ const label = changed(draft.label, field.label);
16
+ const allowedValues = changed(draft.allowedValues, field.allowedValues);
17
+ const common = {
18
+ ...void 0 === label ? {} : {
19
+ label
20
+ },
21
+ ...draft.type === field.type ? {} : {
22
+ type: draft.type
23
+ },
24
+ ...void 0 === allowedValues ? {} : {
25
+ allowedValues
26
+ }
27
+ };
28
+ const binding = changed(draft.binding, bindingOf(field));
29
+ if ('input' === field.kind) return {
30
+ kind: 'input',
31
+ ...common,
32
+ ...void 0 === binding ? {} : {
33
+ expression: binding
34
+ }
35
+ };
36
+ return {
37
+ kind: 'output',
38
+ ...common,
39
+ ...void 0 === binding ? {} : {
40
+ name: binding
41
+ }
42
+ };
18
43
  };
19
44
  const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperties, labels, dataTestId })=>{
20
45
  const id = useId();
46
+ const { _ } = useSafeLingui();
21
47
  const [root, setRoot] = useState(null);
22
48
  const [draft, setDraft] = useState({
23
49
  label: field.label,
24
- binding: field.binding,
25
- typeRef: field.typeRef,
26
- allowedValues: field.allowedValues ?? ''
50
+ binding: bindingOf(field),
51
+ type: field.type,
52
+ allowedValues: field.allowedValues
27
53
  });
28
- const missing = field.required && '' === draft.binding.trim();
54
+ const required = 'input' === field.kind || field.nameRequired;
55
+ const missing = required && '' === draft.binding.trim();
29
56
  const missingLabel = '' === draft.label.trim();
30
- const typed = types.map((type)=>({
31
- ...type,
32
- icon: type.icon ?? valueTypeIcon(type.type)
33
- }));
34
- const options = types.some((type)=>type.id === field.typeRef) ? typed : [
35
- {
36
- id: field.typeRef,
37
- label: field.typeRef
38
- },
39
- ...typed
40
- ];
41
- const placeholder = types.find((type)=>type.id === draft.typeRef)?.allowedValuesPlaceholder;
57
+ const choices = columnTypeChoicesOf(types, _);
58
+ const place = types.findIndex((option)=>option.type === draft.type);
59
+ const placeholder = choices.find((_choice, index)=>index === place)?.allowedValuesPlaceholder;
42
60
  const set = (key)=>(event)=>{
43
61
  const value = event.currentTarget.value;
44
62
  setDraft((current)=>({
@@ -107,7 +125,7 @@ const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperti
107
125
  className: COLUMN_FIELD_LABEL_CLASS,
108
126
  children: [
109
127
  bindingLabel,
110
- field.required && /*#__PURE__*/ jsx("span", {
128
+ required && /*#__PURE__*/ jsx("span", {
111
129
  "aria-hidden": true,
112
130
  className: COLUMN_REQUIRED_CLASS,
113
131
  children: ' *'
@@ -117,7 +135,7 @@ const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperti
117
135
  /*#__PURE__*/ jsx(Input, {
118
136
  id: `${id}-binding`,
119
137
  className: COLUMN_CODE_FIELD_CLASS,
120
- "aria-required": field.required,
138
+ "aria-required": required,
121
139
  "aria-invalid": missing,
122
140
  "aria-describedby": missing ? `${id}-missing` : void 0,
123
141
  value: draft.binding,
@@ -141,19 +159,22 @@ const ColumnPopover = ({ column, field, types, onApply, onCancel, onMoreProperti
141
159
  }),
142
160
  /*#__PURE__*/ jsx(PopoverSelect, {
143
161
  id: `${id}-type`,
144
- value: draft.typeRef,
145
- options: options,
146
- onChange: (typeRef)=>setDraft((current)=>({
162
+ value: String(place),
163
+ options: choices,
164
+ onChange: (picked)=>{
165
+ const option = types.find((_option, index)=>String(index) === picked);
166
+ if (option) setDraft((current)=>({
147
167
  ...current,
148
- typeRef
149
- })),
168
+ type: option.type
169
+ }));
170
+ },
150
171
  container: root,
151
172
  label: labels.dataType,
152
173
  dataTestId: `${dataTestId}-type`
153
174
  })
154
175
  ]
155
176
  }),
156
- void 0 !== field.allowedValues && /*#__PURE__*/ jsxs("div", {
177
+ /*#__PURE__*/ jsxs("div", {
157
178
  className: COLUMN_FIELD_CLASS,
158
179
  children: [
159
180
  /*#__PURE__*/ jsx(Label, {
@@ -29,13 +29,16 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
31
  const external_react_namespaceObject = require("react");
32
+ const useSafeLingui_cjs_namespaceObject = require("../i18n/useSafeLingui.cjs");
32
33
  const external_AddRuleFooter_cjs_namespaceObject = require("./AddRuleFooter.cjs");
33
34
  const external_bandColumns_cjs_namespaceObject = require("./bandColumns.cjs");
34
35
  const external_ColumnEditorOverlay_cjs_namespaceObject = require("./ColumnEditorOverlay.cjs");
36
+ const external_columnTypes_cjs_namespaceObject = require("./columnTypes.cjs");
35
37
  const external_DecisionTextHeader_cjs_namespaceObject = require("./DecisionTextHeader.cjs");
36
38
  const external_decisionTextDiff_cjs_namespaceObject = require("./decisionTextDiff.cjs");
37
39
  const external_EmptyRules_cjs_namespaceObject = require("./EmptyRules.cjs");
38
40
  const external_GridMenu_cjs_namespaceObject = require("./GridMenu.cjs");
41
+ const external_hitPolicyMenu_cjs_namespaceObject = require("./hitPolicyMenu.cjs");
39
42
  const external_MarkTooltip_cjs_namespaceObject = require("./MarkTooltip.cjs");
40
43
  const external_marks_cjs_namespaceObject = require("./marks.cjs");
41
44
  const external_RuleList_cjs_namespaceObject = require("./RuleList.cjs");
@@ -71,11 +74,13 @@ const nameTokensOf = (bands)=>{
71
74
  text: columnId
72
75
  };
73
76
  };
74
- const DecisionText = ({ rules, inputs, outputs, header, numbered = false, marks = external_marks_cjs_namespaceObject.EMPTY_MARKS, onCellHover, mode, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
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 })=>{
78
+ const { rules, inputs, outputs } = table;
75
79
  const selected = 'diff' === mode.kind ? null : mode.selected;
76
80
  const onSelect = 'select' === mode.kind || 'edit' === mode.kind ? mode.onSelect : void 0;
77
81
  const diff = 'diff' === mode.kind ? mode.diff : void 0;
78
82
  const idPrefix = (0, external_react_namespaceObject.useId)();
83
+ const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
79
84
  const labels = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
80
85
  const hostEdit = 'edit' === mode.kind ? mode.edit : void 0;
81
86
  const { edit, refusal } = (0, external_useEditState_cjs_namespaceObject.useEditState)(hostEdit, (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextEditLabels)());
@@ -83,15 +88,28 @@ const DecisionText = ({ rules, inputs, outputs, header, numbered = false, marks
83
88
  label: labels.addRule,
84
89
  onAdd: mode.onAddRule
85
90
  } : void 0;
91
+ const policyHeader = (0, external_hitPolicyMenu_cjs_namespaceObject.policyHeaderOf)(hitPolicies, table.hitPolicy);
92
+ const title = 'edit' === mode.kind ? {
93
+ kind: 'picker',
94
+ policy: (0, external_hitPolicyMenu_cjs_namespaceObject.policyMenuOf)(hitPolicies, table.hitPolicy, mode.onPolicyChange, _)
95
+ } : diff?.hitPolicy ? {
96
+ kind: 'change',
97
+ before: (0, external_hitPolicyMenu_cjs_namespaceObject.policyHeaderOf)(hitPolicies, diff.hitPolicy.before).label,
98
+ after: (0, external_hitPolicyMenu_cjs_namespaceObject.policyHeaderOf)(hitPolicies, diff.hitPolicy.after).label
99
+ } : {
100
+ kind: 'label',
101
+ label: policyHeader.label
102
+ };
86
103
  const columns = (0, external_react_namespaceObject.useMemo)(()=>diff && (0, external_decisionTextDiff_cjs_namespaceObject.diffColumnsOf)(inputs, outputs, diff), [
87
104
  inputs,
88
105
  outputs,
89
106
  diff
90
107
  ]);
91
- const bands = (0, external_react_namespaceObject.useMemo)(()=>(0, external_bandColumns_cjs_namespaceObject.bandsOf)(columns?.inputs ?? inputs, columns?.outputs ?? outputs, labels), [
108
+ const bands = (0, external_react_namespaceObject.useMemo)(()=>(0, external_bandColumns_cjs_namespaceObject.bandsOf)(columns?.inputs ?? inputs, columns?.outputs ?? outputs, (type)=>(0, external_columnTypes_cjs_namespaceObject.glyphOf)(columnTypes, type), labels), [
92
109
  columns,
93
110
  inputs,
94
111
  outputs,
112
+ columnTypes,
95
113
  labels
96
114
  ]);
97
115
  const [folds, setFolds] = (0, external_react_namespaceObject.useState)({
@@ -154,7 +172,7 @@ const DecisionText = ({ rules, inputs, outputs, header, numbered = false, marks
154
172
  stopTabbable: selectable && null !== ruleWindow.selectedRow
155
173
  });
156
174
  const columnEditing = (0, external_useColumnEditing_cjs_namespaceObject.useColumnEditing)({
157
- column: edit?.column,
175
+ column: 'edit' === mode.kind ? mode.edit.column : void 0,
158
176
  bands,
159
177
  container: ruleWindow.container
160
178
  });
@@ -175,10 +193,9 @@ const DecisionText = ({ rules, inputs, outputs, header, numbered = false, marks
175
193
  children: [
176
194
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionTextHeader_cjs_namespaceObject.DecisionTextHeader, {
177
195
  ref: ruleWindow.headerRef,
178
- header: header,
179
- policy: 'edit' === mode.kind ? mode.policy : void 0,
196
+ title: title,
197
+ hint: policyHeader.hint,
180
198
  mark: headerMark,
181
- hitPolicy: diff?.hitPolicy,
182
199
  labels: labels,
183
200
  sticky: 'self' === scroll,
184
201
  dataTestId: dataTestId
@@ -245,9 +262,9 @@ const DecisionText = ({ rules, inputs, outputs, header, numbered = false, marks
245
262
  container: ruleWindow.container,
246
263
  dataTestId: dataTestId
247
264
  }, valueEditing.editorKey),
248
- 'edit' === columnEditing.kind && columnEditing.editor && edit?.column && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ColumnEditorOverlay_cjs_namespaceObject.ColumnEditorOverlay, {
265
+ 'edit' === columnEditing.kind && columnEditing.editor && edit && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ColumnEditorOverlay_cjs_namespaceObject.ColumnEditorOverlay, {
249
266
  editor: columnEditing.editor,
250
- edit: edit.column,
267
+ types: columnTypes,
251
268
  labels: edit.labels,
252
269
  container: ruleWindow.container,
253
270
  id: columnEditorId,
@@ -1,31 +1,17 @@
1
1
  import type React from 'react';
2
+ import { type ColumnTypeOption } from './columnTypes';
2
3
  import { type DecisionTextHeaderProps } from './DecisionTextHeader';
3
4
  import { type DecisionTextDiff } from './decisionTextDiff';
4
5
  import type { DecisionTextEdit } from './decisionTextTypes';
6
+ import { type HitPolicyCatalog, type HitPolicyPick } from './hitPolicyMenu';
5
7
  import { type TableMarks } from './marks';
6
- import type { SentenceBandColumn, SentenceHeader, SentenceRule, SentenceSelection } from './sentenceTypes';
8
+ import type { DecisionTextTable, SentenceSelection } from './sentenceTypes';
7
9
  import { useCellHover } from './useCellHover';
8
10
  import { type ContainerHandlersParams, type DecisionTextContainerProps } from './useContainerHandlers';
9
11
  import { type DecisionTextScroll } from './useRuleWindow';
10
12
  import { type SentenceNavigationSource } from './useSentenceNavigation';
11
- interface DecisionTextBaseProps {
12
- rules: readonly SentenceRule[];
13
- inputs: readonly SentenceBandColumn[];
14
- outputs: readonly SentenceBandColumn[];
15
- header: SentenceHeader;
16
- numbered?: boolean;
17
- marks?: TableMarks;
18
- onCellHover?: Parameters<typeof useCellHover>[0];
19
- headerMark?: DecisionTextHeaderProps['mark'];
20
- onOpenDecision?: ContainerHandlersParams['onOpenDecision'];
21
- scroll?: DecisionTextScroll;
22
- ariaLabel: string;
23
- containerProps?: DecisionTextContainerProps;
24
- dataTestId: string;
25
- children?: React.ReactNode;
26
- }
27
13
  type SelectHandler = NonNullable<SentenceNavigationSource['onSelect']>;
28
- export type DecisionTextMode = {
14
+ export type DecisionTextMode<Policy, Total, Type> = {
29
15
  kind: 'read';
30
16
  selected: SentenceSelection | null;
31
17
  } | {
@@ -36,16 +22,29 @@ export type DecisionTextMode = {
36
22
  kind: 'edit';
37
23
  selected: SentenceSelection | null;
38
24
  onSelect: SelectHandler;
39
- edit: DecisionTextEdit;
25
+ edit: DecisionTextEdit<Type>;
26
+ onPolicyChange: (picked: HitPolicyPick<Policy, Total>) => void;
40
27
  onAddRule: () => void;
41
- policy?: NonNullable<DecisionTextHeaderProps['policy']>;
42
28
  } | {
43
29
  kind: 'diff';
44
- diff: DecisionTextDiff;
30
+ diff: DecisionTextDiff<Policy, Total, Type>;
45
31
  };
46
- export interface DecisionTextProps extends DecisionTextBaseProps {
47
- mode: DecisionTextMode;
32
+ export interface DecisionTextProps<Policy, Total, Type> {
33
+ table: DecisionTextTable<Policy, Total, Type>;
34
+ mode: DecisionTextMode<Policy, Total, Type>;
35
+ hitPolicies: HitPolicyCatalog<Policy, Total>;
36
+ columnTypes: readonly ColumnTypeOption<Type>[];
37
+ numbered?: boolean;
38
+ marks?: TableMarks;
39
+ onCellHover?: Parameters<typeof useCellHover>[0];
40
+ headerMark?: DecisionTextHeaderProps['mark'];
41
+ onOpenDecision?: ContainerHandlersParams['onOpenDecision'];
42
+ scroll?: DecisionTextScroll;
43
+ ariaLabel: string;
44
+ containerProps?: DecisionTextContainerProps;
45
+ dataTestId: string;
46
+ children?: React.ReactNode;
48
47
  }
49
- export declare const DecisionText: React.FC<DecisionTextProps>;
48
+ export declare const DecisionText: <Policy, Total, Type>({ table, mode, hitPolicies, columnTypes, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Policy, Total, Type>) => React.JSX.Element;
50
49
  export {};
51
50
  //# sourceMappingURL=DecisionText.d.ts.map