@servicetitan/dte-pdf-editor 1.41.0 → 1.43.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 (120) hide show
  1. package/README.md +89 -45
  2. package/dist/components/display-conditions/condition-group.d.ts +8 -3
  3. package/dist/components/display-conditions/condition-group.d.ts.map +1 -1
  4. package/dist/components/display-conditions/condition-group.js +7 -2
  5. package/dist/components/display-conditions/condition-group.js.map +1 -1
  6. package/dist/components/display-conditions/condition-groups-section.d.ts +8 -3
  7. package/dist/components/display-conditions/condition-groups-section.d.ts.map +1 -1
  8. package/dist/components/display-conditions/condition-groups-section.js +2 -2
  9. package/dist/components/display-conditions/condition-groups-section.js.map +1 -1
  10. package/dist/components/display-conditions/condition-row.d.ts +8 -3
  11. package/dist/components/display-conditions/condition-row.d.ts.map +1 -1
  12. package/dist/components/display-conditions/condition-row.js +154 -22
  13. package/dist/components/display-conditions/condition-row.js.map +1 -1
  14. package/dist/components/display-conditions/display-condition-modal.d.ts +6 -2
  15. package/dist/components/display-conditions/display-condition-modal.d.ts.map +1 -1
  16. package/dist/components/display-conditions/display-condition-modal.js +7 -7
  17. package/dist/components/display-conditions/display-condition-modal.js.map +1 -1
  18. package/dist/components/display-conditions/display-condition.d.ts +1 -1
  19. package/dist/components/display-conditions/display-condition.d.ts.map +1 -1
  20. package/dist/components/display-conditions/display-condition.js +2 -2
  21. package/dist/components/display-conditions/display-condition.js.map +1 -1
  22. package/dist/components/field-config-panel/field-config-panel-overlay.d.ts +6 -2
  23. package/dist/components/field-config-panel/field-config-panel-overlay.d.ts.map +1 -1
  24. package/dist/components/field-config-panel/field-config-panel-overlay.js +2 -2
  25. package/dist/components/field-config-panel/field-config-panel-overlay.js.map +1 -1
  26. package/dist/components/field-config-panel/field-config-panel.d.ts +6 -2
  27. package/dist/components/field-config-panel/field-config-panel.d.ts.map +1 -1
  28. package/dist/components/field-config-panel/field-config-panel.js +9 -4
  29. package/dist/components/field-config-panel/field-config-panel.js.map +1 -1
  30. package/dist/components/field-config-panel/field-sidebar.d.ts +5 -1
  31. package/dist/components/field-config-panel/field-sidebar.d.ts.map +1 -1
  32. package/dist/components/field-config-panel/field-sidebar.js +42 -8
  33. package/dist/components/field-config-panel/field-sidebar.js.map +1 -1
  34. package/dist/components/field-config-panel/formula-generator.d.ts +5 -1
  35. package/dist/components/field-config-panel/formula-generator.d.ts.map +1 -1
  36. package/dist/components/field-config-panel/formula-generator.js +2 -2
  37. package/dist/components/field-config-panel/formula-generator.js.map +1 -1
  38. package/dist/components/field-config-panel/formula-modal.d.ts +5 -1
  39. package/dist/components/field-config-panel/formula-modal.d.ts.map +1 -1
  40. package/dist/components/field-config-panel/formula-modal.js +38 -8
  41. package/dist/components/field-config-panel/formula-modal.js.map +1 -1
  42. package/dist/components/field-sidebar/field-sidebar.d.ts +6 -1
  43. package/dist/components/field-sidebar/field-sidebar.d.ts.map +1 -1
  44. package/dist/components/field-sidebar/field-sidebar.js +11 -6
  45. package/dist/components/field-sidebar/field-sidebar.js.map +1 -1
  46. package/dist/components/field-sidebar/form-fields-type-list.d.ts +13 -0
  47. package/dist/components/field-sidebar/form-fields-type-list.d.ts.map +1 -0
  48. package/dist/components/field-sidebar/form-fields-type-list.js +14 -0
  49. package/dist/components/field-sidebar/form-fields-type-list.js.map +1 -0
  50. package/dist/components/pdf-editor/pdf-editor.d.ts +4 -1
  51. package/dist/components/pdf-editor/pdf-editor.d.ts.map +1 -1
  52. package/dist/components/pdf-editor/pdf-editor.js +6 -5
  53. package/dist/components/pdf-editor/pdf-editor.js.map +1 -1
  54. package/dist/components/pdf-fields-overlay/pdf-overlay-field.d.ts.map +1 -1
  55. package/dist/components/pdf-fields-overlay/pdf-overlay-field.js +1 -1
  56. package/dist/components/pdf-fields-overlay/pdf-overlay-field.js.map +1 -1
  57. package/dist/components/pdf-view/pdf-view.d.ts.map +1 -1
  58. package/dist/components/pdf-view/pdf-view.js +2 -1
  59. package/dist/components/pdf-view/pdf-view.js.map +1 -1
  60. package/dist/constants/menu-group.d.ts.map +1 -1
  61. package/dist/constants/menu-group.js +2 -0
  62. package/dist/constants/menu-group.js.map +1 -1
  63. package/dist/hooks/index.d.ts +1 -0
  64. package/dist/hooks/index.d.ts.map +1 -1
  65. package/dist/hooks/index.js +1 -0
  66. package/dist/hooks/index.js.map +1 -1
  67. package/dist/hooks/useFormFields.d.ts +13 -0
  68. package/dist/hooks/useFormFields.d.ts.map +1 -0
  69. package/dist/hooks/useFormFields.js +121 -0
  70. package/dist/hooks/useFormFields.js.map +1 -0
  71. package/dist/hooks/useFormulaEditor.d.ts.map +1 -1
  72. package/dist/hooks/useFormulaEditor.js +7 -1
  73. package/dist/hooks/useFormulaEditor.js.map +1 -1
  74. package/dist/hooks/usePdfFieldDnD.d.ts.map +1 -1
  75. package/dist/hooks/usePdfFieldDnD.js +4 -0
  76. package/dist/hooks/usePdfFieldDnD.js.map +1 -1
  77. package/dist/interface/types.d.ts +35 -3
  78. package/dist/interface/types.d.ts.map +1 -1
  79. package/dist/interface/types.js +1 -0
  80. package/dist/interface/types.js.map +1 -1
  81. package/dist/utils/formula/expression.utils.d.ts +5 -2
  82. package/dist/utils/formula/expression.utils.d.ts.map +1 -1
  83. package/dist/utils/formula/expression.utils.js +8 -6
  84. package/dist/utils/formula/expression.utils.js.map +1 -1
  85. package/dist/utils/formula/form-fields.utils.d.ts +21 -0
  86. package/dist/utils/formula/form-fields.utils.d.ts.map +1 -0
  87. package/dist/utils/formula/form-fields.utils.js +101 -0
  88. package/dist/utils/formula/form-fields.utils.js.map +1 -0
  89. package/dist/utils/formula/index.d.ts +1 -0
  90. package/dist/utils/formula/index.d.ts.map +1 -1
  91. package/dist/utils/formula/index.js +1 -0
  92. package/dist/utils/formula/index.js.map +1 -1
  93. package/package.json +1 -1
  94. package/src/components/display-conditions/condition-group.tsx +32 -5
  95. package/src/components/display-conditions/condition-groups-section.tsx +24 -4
  96. package/src/components/display-conditions/condition-row.tsx +359 -80
  97. package/src/components/display-conditions/display-condition-modal.tsx +39 -10
  98. package/src/components/display-conditions/display-condition.tsx +19 -2
  99. package/src/components/field-config-panel/field-config-panel-overlay.tsx +22 -2
  100. package/src/components/field-config-panel/field-config-panel.tsx +34 -10
  101. package/src/components/field-config-panel/field-sidebar.tsx +187 -41
  102. package/src/components/field-config-panel/formula-generator.tsx +14 -0
  103. package/src/components/field-config-panel/formula-modal.tsx +62 -5
  104. package/src/components/field-sidebar/field-sidebar.tsx +35 -4
  105. package/src/components/field-sidebar/form-fields-type-list.tsx +113 -0
  106. package/src/components/pdf-editor/pdf-editor.tsx +42 -25
  107. package/src/components/pdf-fields-overlay/pdf-overlay-field.tsx +3 -1
  108. package/src/components/pdf-view/pdf-view.tsx +2 -1
  109. package/src/constants/menu-group.ts +2 -0
  110. package/src/hooks/index.ts +1 -0
  111. package/src/hooks/useFormFields.ts +157 -0
  112. package/src/hooks/useFormulaEditor.ts +7 -1
  113. package/src/hooks/usePdfFieldDnD.ts +4 -0
  114. package/src/interface/types.ts +43 -4
  115. package/src/styles/field-type-list.css +1 -0
  116. package/src/styles/formula-modal.css +66 -8
  117. package/src/styles/variables.css +4 -0
  118. package/src/utils/formula/expression.utils.ts +24 -6
  119. package/src/utils/formula/form-fields.utils.ts +165 -0
  120. package/src/utils/formula/index.ts +1 -0
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # @servicetitan/dte-pdf-editor
2
2
 
3
3
  A React component library for creating interactive PDF editors with drag-and-drop field placement, data model
4
- integration, e-signature support, fillable form fields, and calculated fields with formulas.
4
+ integration, e-signature support, fillable form fields, **job form (submission) fields**, and calculated fields with
5
+ formulas.
5
6
 
6
7
  ## Features
7
8
 
@@ -12,6 +13,8 @@ integration, e-signature support, fillable form fields, and calculated fields wi
12
13
  - 📝 **Fillable Fields**: Support for text, number, date, checkbox, and radio button inputs
13
14
  - 🧮 **Calculated Fields**: Formula-based fields with validation, autosuggest, and advanced formatting (number, currency,
14
15
  percent, date, rounding, separators)
16
+ - 🗂️ **Forms Fields**: Bind PDF placements to job form submission values (`__submission_fields.*` paths), with async
17
+ field definitions from the host and the same paths usable inside calculated-field formulas
15
18
  - 📋 **Generic Fields**: Custom table and text blocks with configurable rows/cells and inline editing in view mode
16
19
  - 👥 **Multi-Recipient Support**: Assign fields to different recipients with color-coded visualization
17
20
  - ⚙️ **Field Configuration**: Configure field properties including position, size, label, recipient assignment,
@@ -19,29 +22,29 @@ integration, e-signature support, fillable form fields, and calculated fields wi
19
22
  - 👁️ **View Mode**: Display PDFs with filled data in a read-only or interactive view mode (including generic fields via
20
23
  `PdfViewGeneric`)
21
24
 
22
- ### Recent changes (vs master) — feature/DTE-3900
23
-
24
- - **Date fields in formulas**: Calculated fields now support date-typed fields from the data model and fillable date
25
- fields. Date arithmetic uses day-based semantics (date + number = add days, date - date = day difference). The `*` and
26
- `/` operators are disabled when date fields are present, enforced in both the UI and validation.
27
- - **Date result type**: New `date` option in the result type selector. When the formula contains date fields, the result
28
- type is automatically set to `date`. Advanced settings show a customizable date format (tokens: `YYYY`, `YY`, `MMMM`,
29
- `MMM`, `MM`, `M`, `DD`, `D`) instead of numeric rounding/separator controls.
30
- - **CalculatedFieldFormat**: Extended with `dateFormat?: string` (custom format pattern).
31
- - **FormulaToken**: Field tokens now carry `fieldType?: 'date' | 'number'` to indicate whether a field is date- or
32
- number-typed, replacing the previously separate `dateFieldPaths` array on `CalculatedFieldFormat`.
33
- - **SchemaFieldType**: New `fieldType` on `FieldTypeOption` tracks whether a schema field is `'number'` or `'date'`.
34
- - **Validation**: Date formulas are restricted to `+`, `-`, and parentheses only. Numeric literals are capped at
35
- 365 days.
36
- - **Generic fields** (DTE-3811): Field type `generic` with subTypes `table` and `text`. Tables support configurable
37
- header and body rows with editable cells; text blocks support inline editing. Both are rendered in the overlay and in
38
- view mode.
39
- - **PdfField**: Added optional `data?: FieldDataType` for generic fields (`GenericFieldTableDataType` for tables,
40
- `GenericFieldTextDataType` for text).
41
- - **Field config panel**: **Table configs** (TableConfigs) for generic table fields—manage header visibility,
42
- header/body row heights, and cell values. Inline editable components for text and table content in the overlay.
43
- - **Sidebar**: Generic field type list (Text, Table) in the field menu for drag-and-drop placement.
44
- - **PdfView**: Generic fields are rendered in view mode via `PdfViewGeneric` with the same inline editing support.
25
+ ### Recent changes (vs `master`) — feature/DTE-3867 (forms & submission fields)
26
+
27
+ - **`FieldTypeEnum.forms`**: New canvas field type bound to a job form field. Paths use the same convention as Unlayer
28
+ tools: `__submission_fields.{formId}.{normalizedFieldId}` (hyphens stripped from the field UUID in the path segment).
29
+ - **`PdfEditor`**: Optional `forms` (`FormInfo[]`) and optional **`onFormSelect`**. When both are provided, the host
30
+ loads field metadata for one or more form IDs and calls `sendFormFields` with a `FormFieldsByFormIdI` map
31
+ (`Record<number, FormFieldInfo[]>`). The editor preloads forms referenced in existing calculated formulas and hydrates
32
+ the formula builder as definitions arrive. Omit `onFormSelect` when not using job forms (no TypeScript requirement on
33
+ existing consumers).
34
+ - **`FormulaFieldFormSnapshot`**: Shared snapshot (`formId`, `fieldId`, `formName`, `fieldName`, `fieldType`) attached
35
+ to **`PdfField.formSnapshot`** (forms fields), **`FieldTypeOption.formSnapshot`** (drag payloads), and optional
36
+ **`formSnapshot`** on structured-formula **`field`** tokens when `parseExpression` can resolve the path against
37
+ `forms` + `formFieldsByFormId`.
38
+ - **Formula builder UI**: Slide-out “Forms” list in the sidebar; pick a form, load fields on demand, insert only
39
+ **number**/**date** form fields into formulas (aligned with calculated-field operand types). `formulaLoadingFormId`
40
+ surfaces loading state for async field fetches.
41
+ - **Exports / utilities**: `buildFormFieldKey`, `parseFormFieldKey`, `normalizeFormFieldIdForPath`,
42
+ `buildFormFieldSnapshot`, `tryBuildFormFieldFormulaSnapshot`, `SUBMISSION_FIELDS_PATH_PREFIX`, and
43
+ **`ParseExpressionFormContext`** for integrators reusing path logic outside the editor.
44
+
45
+ Earlier milestones still reflected elsewhere in this README: **date-aware formulas** (day-based `+` / `-`, disabled
46
+ `*` / `/` with dates, `fieldType` on field tokens), **generic table/text fields**, and **Table configs** in the field
47
+ panel.
45
48
 
46
49
  ## Installation
47
50
 
@@ -54,7 +57,7 @@ npm install @servicetitan/dte-pdf-editor
54
57
  This package requires the following peer dependencies:
55
58
 
56
59
  ```bash
57
- npm install @servicetitan/anvil2@^1.46.9 react@~18.3.1 react-dom@~18.3.1
60
+ npm install @servicetitan/anvil2@^2.0.2 react@~18.3.1 react-dom@~18.3.1
58
61
  ```
59
62
 
60
63
  ## Quick Start
@@ -69,6 +72,10 @@ function App() {
69
72
  const [fields, setFields] = useState<PdfField[]>([]);
70
73
  const [data, setData] = useState<Record<string, any>>({});
71
74
 
75
+ const forms = [
76
+ { id: 1, name: 'Job checklist' },
77
+ ];
78
+
72
79
  const recipients = [
73
80
  { id: 1, name: 'technician', displayName: 'Technician' },
74
81
  { id: 2, name: 'customer', displayName: 'Customer' },
@@ -92,6 +99,13 @@ function App() {
92
99
  onFieldsChange={setFields}
93
100
  dataModel={dataModel}
94
101
  recipients={recipients}
102
+ forms={forms}
103
+ onFormSelect={(formIds, sendFormFields) => {
104
+ // Load FormFieldInfo[] for each formId, then:
105
+ sendFormFields({
106
+ /* [formId]: [{ id, header, itemType: 'number' | 'text' | 'date' }, ...] */
107
+ });
108
+ }}
95
109
  />
96
110
  );
97
111
  }
@@ -105,16 +119,22 @@ The main component for editing PDF documents and placing fields.
105
119
 
106
120
  #### Props
107
121
 
108
- | Prop | Type | Required | Description |
109
- |----------------------|--------------------------------|----------|---------------------------------------------------------|
110
- | `pdfUrl` | `string` | Yes | URL or path to the PDF file |
111
- | `fields` | `PdfField[]` | No | Array of fields placed on the PDF |
112
- | `onFieldsChange` | `(fields: PdfField[]) => void` | Yes | Callback when fields are added, modified, or deleted |
113
- | `dataModel` | `SchemaObject` | No | JSON Schema object defining available data model fields |
114
- | `recipients` | `RecipientInfo[]` | No | Array of recipients that can be assigned to fields |
115
- | `loading` | `boolean` | No | Whether the PDF is currently loading |
116
- | `loadingPlaceholder` | `ReactNode` | No | Custom component to display while PDF is loading |
117
- | `errorPlaceholder` | `ReactNode` | No | Custom component to display if PDF fails to load |
122
+ | Prop | Type | Required | Description |
123
+ |------------------------|--------------------------------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------|
124
+ | `pdfUrl` | `string` | Yes | URL or path to the PDF file |
125
+ | `fields` | `PdfField[]` | No | Array of fields placed on the PDF |
126
+ | `onFieldsChange` | `(fields: PdfField[]) => void` | Yes | Callback when fields are added, modified, or deleted |
127
+ | `onFormSelect` | `(formIds: number[], sendFormFields: (formFieldsByFormId: FormFieldsByFormIdI) => void) => void` | No | With `forms`, host supplies `FormFieldInfo[]` per form id for sidebar, formulas, and preload; omit when not using forms |
128
+ | `dataModel` | `SchemaObject` | No | JSON Schema object defining available data model fields |
129
+ | `recipients` | `RecipientInfo[]` | No | Array of recipients that can be assigned to fields |
130
+ | `forms` | `FormInfo[]` | No | Job forms shown in the sidebar and formula builder; omit to hide the Forms field group |
131
+ | `hideFields` | `FieldTypeEnum[]` | No | Field menu groups to hide (e.g. omit `forms` when not supported) |
132
+ | `hideConditionalLogic` | `boolean` | No | When true, hides display-condition UI in the field config panel |
133
+ | `loading` | `boolean` | No | Whether the PDF is currently loading |
134
+ | `loadingPlaceholder` | `ReactNode` | No | Custom component to display while PDF is loading |
135
+ | `errorPlaceholder` | `ReactNode` | No | Custom component to display if PDF fails to load |
136
+ | `onLoadSuccess` | `(numPages: number) => void` | No | Called when the PDF document loads successfully |
137
+ | `errors` | `Record<string, string>` | No | Map of field id → validation message rendered on the canvas |
118
138
 
119
139
  #### Example
120
140
 
@@ -183,19 +203,24 @@ interface PdfField {
183
203
  height: number;
184
204
  required?: boolean;
185
205
  path?: string;
206
+ formSnapshot?: FormulaFieldFormSnapshot; // for `type: forms` — mirrors bound submission path metadata
186
207
  recipient?: string;
187
208
  description?: string;
188
- data?: FieldDataType; // for generic fields (table/text)
189
- formula?: StructuredFormula; // for calculated fields
190
- formulaFormat?: CalculatedFieldFormat; // for calculated fields (includes dateFormat)
209
+ data?: FieldDataType; // for generic fields (table/text)
210
+ formula?: StructuredFormula; // for calculated fields
211
+ formulaFormat?: CalculatedFieldFormat; // for calculated fields (includes dateFormat)
212
+ displayCondition?: DisplayConditionState | null;
191
213
  }
192
214
  ```
193
215
 
216
+ `DisplayConditionState` and related types model optional show/hide rule groups for a field (exported from this package).
217
+
194
218
  ### FieldTypeEnum
195
219
 
196
220
  Enumeration of field types:
197
221
 
198
222
  - `dataModel`: Field connected to a data model schema
223
+ - `forms`: Bound to a job form submission field (`path` under `__submission_fields.*`)
199
224
  - `eSign`: E-signature field
200
225
  - `fillable`: User-fillable form field
201
226
  - `calculated`: Formula-based calculated field
@@ -212,8 +237,9 @@ Types of e-signature fields:
212
237
 
213
238
  ### PdfFieldSubType
214
239
 
215
- Union of fillable, e-sign, and generic sub-types: `FillableFieldType | ESignFieldType | GenericFieldType`. Used for
216
- `PdfField.subType` and `FieldTypeOption.subType`.
240
+ Union of fillable, e-sign, generic, and form field sub-types:
241
+ `FillableFieldType | ESignFieldType | GenericFieldType | FormFieldType`. Used for `PdfField.subType` and
242
+ `FieldTypeOption.subType` (form fields use `FormFieldType`: `number` | `text` | `date`).
217
243
 
218
244
  ### FillableFieldType
219
245
 
@@ -248,8 +274,10 @@ Calculated fields use a structured formula and optional display format:
248
274
  - **CalculatedFieldFormat**: Controls result display: `resultType` (`number` | `currency` | `percent` | `date`),
249
275
  rounding mode, decimal places, thousands/decimal separators, prefix/postfix text, `dateFormat` (custom pattern using
250
276
  `YYYY`, `MM`, `DD`, etc.).
251
- - **FormulaToken (field)**: Field tokens carry `fieldType?: 'date' | 'number'` to support date-aware evaluation
252
- directly from the formula structure.
277
+ - **FormulaToken (field)**: Field tokens carry `fieldType: 'date' | 'number'` (schema / fillable / form operands) for
278
+ date-aware evaluation. Optional **`formSnapshot`** is filled when the token path is a submission field
279
+ (`__submission_fields.*`) and `parseExpression` is given `ParseExpressionFormContext` (`forms` +
280
+ `formFieldsByFormId`).
253
281
 
254
282
  Date fields in formulas use day-based arithmetic: `date + number` adds days, `date - date` yields a day count. Only `+`,
255
283
  `-`, and parentheses are allowed when date fields are present.
@@ -257,6 +285,17 @@ Date fields in formulas use day-based arithmetic: `date + number` adds days, `da
257
285
  Schema fields can opt in via `options.useInCalculatedFields` and `options.useInConditionals` for data model extraction
258
286
  in formula builder and conditionals.
259
287
 
288
+ ### Job forms (`FormInfo`, `FormFieldInfo`, submission data)
289
+
290
+ - **`FormInfo`**: `{ id: number; name: string }` — entries passed as **`PdfEditor`** `forms`.
291
+ - **`FormFieldInfo`**: `{ id: string; header: string; itemType: 'number' | 'text' | 'date' }` — returned from the host
292
+ for each requested form id.
293
+ - **`FormFieldsByFormIdI`**: `Record<number, FormFieldInfo[]>` — argument to **`sendFormFields`** in the optional
294
+ **`onFormSelect`** callback.
295
+ - **Preview / `PdfView` data**: Provide values under **`__submission_fields`** mirroring the path layout, e.g.
296
+ `{ __submission_fields: { [formId]: { [normalizedFieldId]: value } } }` (field id keys without hyphens match
297
+ `buildFormFieldKey`).
298
+
260
299
  ### SchemaObject
261
300
 
262
301
  JSON Schema object defining the data model structure. Supports nested objects, arrays, and various string subtypes (
@@ -410,6 +449,8 @@ Fields are added by dragging from the sidebar onto the PDF canvas. The sidebar d
410
449
  - **Data Model Fields (Merge Tags)**: Grouped by schema structure
411
450
  - **E-Sign Fields**: Signature, initials, date signed, full name
412
451
  - **Fillable Fields**: Text, number, date, checkbox, radio
452
+ - **Forms** (when `forms` + `onFormSelect` are provided): Choose a job form, then drag a field onto the canvas; the new
453
+ `PdfField` stores `path` and **`formSnapshot`** for the bound submission key
413
454
  - **Calculated Fields**: Formula-based fields (configure formula and format in the config panel)
414
455
  - **Generic Fields**: Text and Table (configure table rows/cells in the config panel; inline editing in view mode)
415
456
 
@@ -420,10 +461,13 @@ Click on a field to open the configuration panel where you can:
420
461
  - Change the label
421
462
  - Adjust position and size
422
463
  - Assign a recipient
423
- - Set required status (fillable fields, except checkbox)
464
+ - Set the required status (fillable fields, except checkbox)
424
465
  - Update the data model path
425
- - For **calculated fields**: edit formula (with validation and autosuggest from data model + fillable fields), set
426
- result type (number/currency/percent/date), rounding, decimals, separators, and date format
466
+ - For **calculated fields**: edit formula (with validation and autosuggest from data model, fillable fields, and
467
+ **number/date job form fields** via the Forms slide-out), set result type (number/currency/percent/date), rounding,
468
+ decimals, separators, and date format
469
+ - For **forms fields**: edit label like other display labels; binding is defined by `path` / `formSnapshot` from
470
+ placement
427
471
  - For **generic table fields**: configure header visibility, header/body row heights, and cell values via Table configs;
428
472
  generic text fields support inline editing in the overlay
429
473
 
@@ -1,8 +1,13 @@
1
- import type { DataPointOption, DisplayConditionGroup } from '../../interface/types';
1
+ import type { DataPointOption, DisplayConditionGroup, FormFieldsByFormIdI, FormInfo } from '../../interface/types';
2
2
  export interface ConditionGroupProps {
3
3
  canDelete: boolean;
4
4
  conditionJoinOperator: 'and' | 'or';
5
- dataPointOptions: DataPointOption[];
5
+ fillableOptions: DataPointOption[];
6
+ mergeTagOptions: DataPointOption[];
7
+ forms?: FormInfo[];
8
+ formFieldsByFormId?: FormFieldsByFormIdI;
9
+ onRequestFormFields?: (formId: number) => void;
10
+ formFieldsLoadingFormId?: number | null;
6
11
  group: DisplayConditionGroup;
7
12
  onDelete: () => void;
8
13
  onUpdate: (g: DisplayConditionGroup) => void;
@@ -10,5 +15,5 @@ export interface ConditionGroupProps {
10
15
  /** When 1, the UI hides the per-rule title (single-rule layout). */
11
16
  totalRuleCount: number;
12
17
  }
13
- export declare function ConditionGroup({ canDelete, conditionJoinOperator, dataPointOptions, group, onDelete, onUpdate, ruleIndex, totalRuleCount, }: Readonly<ConditionGroupProps>): import("react/jsx-runtime").JSX.Element;
18
+ export declare function ConditionGroup({ canDelete, conditionJoinOperator, fillableOptions, formFieldsByFormId, formFieldsLoadingFormId, forms, group, mergeTagOptions, onDelete, onRequestFormFields, onUpdate, ruleIndex, totalRuleCount, }: Readonly<ConditionGroupProps>): import("react/jsx-runtime").JSX.Element;
14
19
  //# sourceMappingURL=condition-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-group.d.ts","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-group.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,eAAe,EACf,qBAAqB,EAExB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,KAAK,GAAG,IAAI,CAAC;IACpC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,EAC3B,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,cAAc,GACjB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CAgF/B"}
1
+ {"version":3,"file":"condition-group.d.ts","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-group.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,eAAe,EACf,qBAAqB,EAErB,mBAAmB,EACnB,QAAQ,EACX,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,KAAK,GAAG,IAAI,CAAC;IACpC,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,cAAc,CAAC,EAC3B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,EACL,KAAK,EACL,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,cAAc,GACjB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,2CA+F/B"}
@@ -5,7 +5,7 @@ import TrashIcon from '@servicetitan/anvil2/assets/icons/material/round/delete.s
5
5
  import { useCallback } from 'react';
6
6
  import { defaultCondition } from '../../constants';
7
7
  import { ConditionRow } from './condition-row';
8
- export function ConditionGroup({ canDelete, conditionJoinOperator, dataPointOptions, group, onDelete, onUpdate, ruleIndex, totalRuleCount, }) {
8
+ export function ConditionGroup({ canDelete, conditionJoinOperator, fillableOptions, formFieldsByFormId, formFieldsLoadingFormId, forms, group, mergeTagOptions, onDelete, onRequestFormFields, onUpdate, ruleIndex, totalRuleCount, }) {
9
9
  const addCondition = useCallback(() => {
10
10
  const newCondition = {
11
11
  ...defaultCondition(),
@@ -33,6 +33,11 @@ export function ConditionGroup({ canDelete, conditionJoinOperator, dataPointOpti
33
33
  });
34
34
  }, [group, onUpdate]);
35
35
  const showRuleHeading = totalRuleCount > 1;
36
- return (_jsxs(Flex, { direction: "column", gap: "2", flex: 1, children: [showRuleHeading && (_jsxs(Flex, { direction: "row", alignItems: "center", justifyContent: "space-between", flex: 1, children: [_jsxs(Text, { size: "medium", variant: "body", style: { fontWeight: 'bold' }, children: ["Rule ", ruleIndex + 1] }), canDelete && (_jsx(Button, { appearance: "ghost", "aria-label": "Delete rule", icon: { before: TrashIcon }, size: "large", onClick: onDelete }))] })), _jsxs(Flex, { direction: "column", gap: "3", flex: 1, children: [group.conditions.map((c, i) => (_jsx(Flex, { direction: "column", gap: "3", style: { padding: '8px 0' }, children: _jsx(ConditionRow, { canRemove: true, condition: c, dataPointOptions: dataPointOptions, onRemove: () => removeCondition(i), onChange: next => updateCondition(i, next) }) }, c.id))), _jsx(Flex, { justifyContent: "center", flex: 1, style: { paddingTop: 8 }, children: _jsx(Button, { appearance: "secondary", icon: { before: PlusIcon }, onClick: addCondition, children: "Add Condition" }) })] })] }));
36
+ return (_jsxs(Flex, { direction: "column", gap: "2", flex: 1, style: { padding: '0 8px' }, children: [showRuleHeading && (_jsxs(Flex, { direction: "row", alignItems: "center", justifyContent: "space-between", flex: 1, children: [_jsxs(Text, { size: "medium", variant: "body", style: { fontWeight: 'bold' }, children: ["Rule ", ruleIndex + 1] }), canDelete && (_jsx(Button, { appearance: "ghost", "aria-label": "Delete rule", icon: { before: TrashIcon }, size: "large", onClick: onDelete }))] })), _jsxs(Flex, { direction: "column", gap: "3", flex: 1, children: [group.conditions.map((c, i) => (_jsx(Flex, { direction: "column", gap: "3", style: {
37
+ padding: '8px',
38
+ background: '#f7f7f7',
39
+ boxShadow: '0px 0px 4px 1px #e0e0e0',
40
+ borderRadius: '8px',
41
+ }, children: _jsx(ConditionRow, { canRemove: true, condition: c, fillableOptions: fillableOptions, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formFieldsLoadingFormId, forms: forms, mergeTagOptions: mergeTagOptions, onRemove: () => removeCondition(i), onChange: next => updateCondition(i, next), onRequestFormFields: onRequestFormFields }) }, c.id))), _jsx(Flex, { justifyContent: "center", flex: 1, style: { paddingTop: 8 }, children: _jsx(Button, { appearance: "secondary", icon: { before: PlusIcon }, onClick: addCondition, children: "Add Condition" }) })] })] }));
37
42
  }
38
43
  //# sourceMappingURL=condition-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-group.js","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,SAAS,MAAM,6DAA6D,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAc/C,MAAM,UAAU,cAAc,CAAC,EAC3B,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,cAAc,GACc;IAC5B,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,MAAM,YAAY,GAA2B;YACzC,GAAG,gBAAgB,EAAE;YACrB,eAAe,EAAE,qBAAqB;SACzC,CAAC;QACF,QAAQ,CAAC;YACL,GAAG,KAAK;YACR,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC;SAClD,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,qBAAqB,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE7C,MAAM,eAAe,GAAG,WAAW,CAC/B,CAAC,KAAa,EAAE,CAAyB,EAAE,EAAE;QACzC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChB,QAAQ,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC,EACD,CAAC,KAAK,EAAE,QAAQ,CAAC,CACpB,CAAC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,EAAE,EAC3B,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,QAAQ,GACnB,CACL,IACE,CACV,EACD,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,EAAC,IAAI,EAAE,CAAC,aACnC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5B,KAAC,IAAI,IAAY,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,YACnE,KAAC,YAAY,IACT,SAAS,QACT,SAAS,EAAE,CAAC,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,EAClC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,GAC5C,IAPK,CAAC,CAAC,EAAE,CAQR,CACV,CAAC,EACF,KAAC,IAAI,IAAC,cAAc,EAAC,QAAQ,EAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,YAC3D,KAAC,MAAM,IACH,UAAU,EAAC,WAAW,EACtB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAC1B,OAAO,EAAE,YAAY,8BAGhB,GACN,IACJ,IACJ,CACV,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"condition-group.js","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,SAAS,MAAM,6DAA6D,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,gBAAgB,EA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AC,CAC5B,KAAC,IAAI,IAED,SAAS,EAAC,QAAQ,EAClB,GAAG,EAAC,GAAG,EACP,KAAK,EAAE;4BACH,OAAO,EAAE,KAAK;4BACd,UAAU,EAAE,SAAS;4BACrB,SAAS,EAAE,yBAAyB;4BACpC,YAAY,EAAE,KAAK;yBACtB,YAED,KAAC,YAAY,IACT,SAAS,QACT,SAAS,EAAE,CAAC,EACZ,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,kBAAkB,EACtC,uBAAuB,EAAE,uBAAuB,EAChD,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,EAClC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,EAC1C,mBAAmB,EAAE,mBAAmB,GAC1C,IArBG,CAAC,CAAC,EAAE,CAsBN,CACV,CAAC,EACF,KAAC,IAAI,IAAC,cAAc,EAAC,QAAQ,EAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,YAC3D,KAAC,MAAM,IACH,UAAU,EAAC,WAAW,EACtB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAC1B,OAAO,EAAE,YAAY,8BAGhB,GACN,IACJ,IACJ,CACV,CAAC;AACN,CAAC"}
@@ -1,11 +1,16 @@
1
- import type { DataPointOption, DisplayConditionGroup } from '../../interface/types';
1
+ import type { DataPointOption, DisplayConditionGroup, FormFieldsByFormIdI, FormInfo } from '../../interface/types';
2
2
  export interface ConditionGroupsSectionProps {
3
3
  conditionJoinOperator: 'and' | 'or';
4
- dataPointOptions: DataPointOption[];
4
+ fillableOptions: DataPointOption[];
5
+ mergeTagOptions: DataPointOption[];
6
+ forms?: FormInfo[];
7
+ formFieldsByFormId?: FormFieldsByFormIdI;
8
+ onRequestFormFields?: (formId: number) => void;
9
+ formFieldsLoadingFormId?: number | null;
5
10
  groups: DisplayConditionGroup[];
6
11
  onAddGroup: () => void;
7
12
  onRemoveGroup: (index: number) => void;
8
13
  onUpdateGroup: (index: number, group: DisplayConditionGroup) => void;
9
14
  }
10
- export declare function ConditionGroupsSection({ conditionJoinOperator, dataPointOptions, groups, onAddGroup, onRemoveGroup, onUpdateGroup, }: Readonly<ConditionGroupsSectionProps>): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ConditionGroupsSection({ conditionJoinOperator, fillableOptions, formFieldsByFormId, formFieldsLoadingFormId, forms, groups, mergeTagOptions, onAddGroup, onRemoveGroup, onRequestFormFields, onUpdateGroup, }: Readonly<ConditionGroupsSectionProps>): import("react/jsx-runtime").JSX.Element;
11
16
  //# sourceMappingURL=condition-groups-section.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-groups-section.d.ts","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-groups-section.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGpF,MAAM,WAAW,2BAA2B;IACxC,qBAAqB,EAAE,KAAK,GAAG,IAAI,CAAC;IACpC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,sBAAsB,CAAC,EACnC,qBAAqB,EACrB,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,aAAa,EACb,aAAa,GAChB,EAAE,QAAQ,CAAC,2BAA2B,CAAC,2CA0BvC"}
1
+ {"version":3,"file":"condition-groups-section.d.ts","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-groups-section.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,QAAQ,EACX,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,2BAA2B;IACxC,qBAAqB,EAAE,KAAK,GAAG,IAAI,CAAC;IACpC,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,sBAAsB,CAAC,EACnC,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,EACL,MAAM,EACN,eAAe,EACf,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,GAChB,EAAE,QAAQ,CAAC,2BAA2B,CAAC,2CA+BvC"}
@@ -3,7 +3,7 @@ import { Button, Flex } from '@servicetitan/anvil2';
3
3
  import PlusIcon from '@servicetitan/anvil2/assets/icons/material/round/add.svg';
4
4
  import { MAX_DISPLAY_CONDITION_RULES_UI } from '../../constants';
5
5
  import { ConditionGroup } from './condition-group';
6
- export function ConditionGroupsSection({ conditionJoinOperator, dataPointOptions, groups, onAddGroup, onRemoveGroup, onUpdateGroup, }) {
7
- return (_jsxs(Flex, { direction: "column", gap: "4", children: [groups.map((group, index) => (_jsx(Flex, { direction: "column", gap: "3", children: _jsx(ConditionGroup, { canDelete: groups.length > 1, conditionJoinOperator: conditionJoinOperator, dataPointOptions: dataPointOptions, group: group, onDelete: () => onRemoveGroup(index), onUpdate: g => onUpdateGroup(index, g), ruleIndex: index, totalRuleCount: groups.length }) }, group.id))), groups.length < MAX_DISPLAY_CONDITION_RULES_UI && (_jsx(Flex, { justifyContent: "center", flex: 1, style: { paddingTop: 8 }, children: _jsx(Button, { appearance: "secondary", icon: { before: PlusIcon }, onClick: onAddGroup, children: "Add Rule" }) }))] }));
6
+ export function ConditionGroupsSection({ conditionJoinOperator, fillableOptions, formFieldsByFormId, formFieldsLoadingFormId, forms, groups, mergeTagOptions, onAddGroup, onRemoveGroup, onRequestFormFields, onUpdateGroup, }) {
7
+ return (_jsxs(Flex, { direction: "column", gap: "4", children: [groups.map((group, index) => (_jsx(Flex, { direction: "column", gap: "3", children: _jsx(ConditionGroup, { canDelete: groups.length > 1, conditionJoinOperator: conditionJoinOperator, fillableOptions: fillableOptions, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formFieldsLoadingFormId, forms: forms, group: group, mergeTagOptions: mergeTagOptions, onDelete: () => onRemoveGroup(index), onUpdate: g => onUpdateGroup(index, g), onRequestFormFields: onRequestFormFields, ruleIndex: index, totalRuleCount: groups.length }) }, group.id))), groups.length < MAX_DISPLAY_CONDITION_RULES_UI && (_jsx(Flex, { justifyContent: "center", flex: 1, style: { paddingTop: 8 }, children: _jsx(Button, { appearance: "secondary", icon: { before: PlusIcon }, onClick: onAddGroup, children: "Add Rule" }) }))] }));
8
8
  }
9
9
  //# sourceMappingURL=condition-groups-section.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-groups-section.js","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-groups-section.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAWnD,MAAM,UAAU,sBAAsB,CAAC,EACnC,qBAAqB,EACrB,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,aAAa,EACb,aAAa,GACuB;IACpC,OAAO,CACH,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,aAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,KAAC,IAAI,IAAgB,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,YAC3C,KAAC,cAAc,IACX,SAAS,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,EAC5B,qBAAqB,EAAE,qBAAqB,EAC5C,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EACpC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,EACtC,SAAS,EAAE,KAAK,EAChB,cAAc,EAAE,MAAM,CAAC,MAAM,GAC/B,IAVK,KAAK,CAAC,EAAE,CAWZ,CACV,CAAC,EACD,MAAM,CAAC,MAAM,GAAG,8BAA8B,IAAI,CAC/C,KAAC,IAAI,IAAC,cAAc,EAAC,QAAQ,EAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,YAC3D,KAAC,MAAM,IAAC,UAAU,EAAC,WAAW,EAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,yBAErE,GACN,CACV,IACE,CACV,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"condition-groups-section.js","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-groups-section.tsx"],"names":[],"mappings":";AAAA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AAE,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,YAC3D,KAAC,MAAM,IAAC,UAAU,EAAC,WAAW,EAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,yBAErE,GACN,CACV,IACE,CACV,CAAC;AACN,CAAC"}
@@ -1,10 +1,15 @@
1
- import { DataPointOption, DisplayConditionSingle } from '../../interface/types';
1
+ import { DataPointOption, DisplayConditionSingle, FormFieldsByFormIdI, FormInfo } from '../../interface/types';
2
2
  export interface ConditionRowProps {
3
3
  canRemove: boolean;
4
4
  condition: DisplayConditionSingle;
5
- dataPointOptions: DataPointOption[];
5
+ fillableOptions: DataPointOption[];
6
+ mergeTagOptions: DataPointOption[];
7
+ forms?: FormInfo[];
8
+ formFieldsByFormId?: FormFieldsByFormIdI;
9
+ onRequestFormFields?: (formId: number) => void;
10
+ formFieldsLoadingFormId?: number | null;
6
11
  onChange: (c: DisplayConditionSingle) => void;
7
12
  onRemove: () => void;
8
13
  }
9
- export declare function ConditionRow({ canRemove, condition, dataPointOptions, onChange, onRemove, }: Readonly<ConditionRowProps>): import("react/jsx-runtime").JSX.Element;
14
+ export declare function ConditionRow({ canRemove, condition, fillableOptions, formFieldsByFormId, formFieldsLoadingFormId, forms, mergeTagOptions, onChange, onRemove, onRequestFormFields, }: Readonly<ConditionRowProps>): import("react/jsx-runtime").JSX.Element;
10
15
  //# sourceMappingURL=condition-row.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition-row.d.ts","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,eAAe,EACf,sBAAsB,EAIzB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAqBD,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,GACX,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAwI7B"}
1
+ {"version":3,"file":"condition-row.d.ts","sourceRoot":"","sources":["../../../src/components/display-conditions/condition-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,eAAe,EACf,sBAAsB,EAEtB,mBAAmB,EACnB,QAAQ,EAIX,MAAM,uBAAuB,CAAC;AAS/B,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,sBAAsB,CAAC;IAClC,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,CAAC,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AA0CD,wBAAgB,YAAY,CAAC,EACzB,SAAS,EACT,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,EACL,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,mBAAmB,GACtB,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAsX7B"}