@servicetitan/dte-pdf-editor 1.95.0 → 1.96.1
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/README.md +87 -2
- package/dist/components/field-config-panel/advanced-settings.d.ts +2 -0
- package/dist/components/field-config-panel/advanced-settings.d.ts.map +1 -1
- package/dist/components/field-config-panel/advanced-settings.js +5 -4
- package/dist/components/field-config-panel/advanced-settings.js.map +1 -1
- package/dist/components/field-config-panel/e-sign-options-modal.d.ts +3 -0
- package/dist/components/field-config-panel/e-sign-options-modal.d.ts.map +1 -1
- package/dist/components/field-config-panel/e-sign-options-modal.js +6 -4
- package/dist/components/field-config-panel/e-sign-options-modal.js.map +1 -1
- package/dist/components/field-config-panel/field-config-panel-overlay.d.ts +14 -1
- package/dist/components/field-config-panel/field-config-panel-overlay.d.ts.map +1 -1
- package/dist/components/field-config-panel/field-config-panel-overlay.js +41 -2
- package/dist/components/field-config-panel/field-config-panel-overlay.js.map +1 -1
- package/dist/components/field-config-panel/field-config-panel.d.ts +6 -0
- package/dist/components/field-config-panel/field-config-panel.d.ts.map +1 -1
- package/dist/components/field-config-panel/field-config-panel.js +17 -3
- package/dist/components/field-config-panel/field-config-panel.js.map +1 -1
- package/dist/components/field-config-panel/formula-generator.d.ts +4 -0
- package/dist/components/field-config-panel/formula-generator.d.ts.map +1 -1
- package/dist/components/field-config-panel/formula-generator.js +2 -2
- package/dist/components/field-config-panel/formula-generator.js.map +1 -1
- package/dist/components/field-config-panel/formula-modal.d.ts +5 -0
- package/dist/components/field-config-panel/formula-modal.d.ts.map +1 -1
- package/dist/components/field-config-panel/formula-modal.js +13 -6
- package/dist/components/field-config-panel/formula-modal.js.map +1 -1
- package/dist/components/field-config-panel/formula-workspace.d.ts +2 -0
- package/dist/components/field-config-panel/formula-workspace.d.ts.map +1 -1
- package/dist/components/field-config-panel/formula-workspace.js +6 -4
- package/dist/components/field-config-panel/formula-workspace.js.map +1 -1
- package/dist/components/pdf-editor/pdf-editor.d.ts +52 -1
- package/dist/components/pdf-editor/pdf-editor.d.ts.map +1 -1
- package/dist/components/pdf-editor/pdf-editor.js +2 -2
- package/dist/components/pdf-editor/pdf-editor.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-calculated.d.ts +3 -1
- package/dist/components/pdf-view/pdf-view-calculated.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-calculated.js +14 -4
- package/dist/components/pdf-view/pdf-view-calculated.js.map +1 -1
- package/dist/components/pdf-view/pdf-view.d.ts +18 -4
- package/dist/components/pdf-view/pdf-view.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view.js +2 -2
- package/dist/components/pdf-view/pdf-view.js.map +1 -1
- package/dist/constants/calculated.constants.d.ts +6 -0
- package/dist/constants/calculated.constants.d.ts.map +1 -1
- package/dist/constants/calculated.constants.js +6 -0
- package/dist/constants/calculated.constants.js.map +1 -1
- package/dist/hooks/usePinchZoom.d.ts.map +1 -1
- package/dist/hooks/usePinchZoom.js +1 -1
- package/dist/hooks/usePinchZoom.js.map +1 -1
- package/dist/interface/types.d.ts +37 -1
- package/dist/interface/types.d.ts.map +1 -1
- package/dist/interface/types.js.map +1 -1
- package/dist/utils/formula/business-days.utils.d.ts +32 -0
- package/dist/utils/formula/business-days.utils.d.ts.map +1 -0
- package/dist/utils/formula/business-days.utils.js +148 -0
- package/dist/utils/formula/business-days.utils.js.map +1 -0
- package/dist/utils/formula/caret.utils.js +1 -1
- package/dist/utils/formula/caret.utils.js.map +1 -1
- package/dist/utils/formula/evaluate-formula.utils.d.ts +25 -6
- package/dist/utils/formula/evaluate-formula.utils.d.ts.map +1 -1
- package/dist/utils/formula/evaluate-formula.utils.js +61 -101
- package/dist/utils/formula/evaluate-formula.utils.js.map +1 -1
- package/dist/utils/formula/index.d.ts +1 -0
- package/dist/utils/formula/index.d.ts.map +1 -1
- package/dist/utils/formula/index.js +1 -0
- package/dist/utils/formula/index.js.map +1 -1
- package/dist/utils/formula/schedule-bindings.utils.d.ts +12 -0
- package/dist/utils/formula/schedule-bindings.utils.d.ts.map +1 -0
- package/dist/utils/formula/schedule-bindings.utils.js +17 -0
- package/dist/utils/formula/schedule-bindings.utils.js.map +1 -0
- package/dist/vendor/dte-shared/business-calendar-validation.utils.d.ts +22 -0
- package/dist/vendor/dte-shared/business-calendar-validation.utils.js +76 -0
- package/dist/vendor/dte-shared/components/business-calendar-section.d.ts +15 -0
- package/dist/vendor/dte-shared/components/business-calendar-section.js +13 -0
- package/dist/vendor/dte-shared/components/schedule-drawer.d.ts +16 -0
- package/dist/vendor/dte-shared/components/schedule-drawer.js +112 -0
- package/dist/vendor/dte-shared/components/schedule-picker.d.ts +8 -0
- package/dist/vendor/dte-shared/components/schedule-picker.js +88 -0
- package/dist/vendor/dte-shared/constants.d.ts +10 -0
- package/dist/vendor/dte-shared/constants.js +10 -0
- package/dist/vendor/dte-shared/index.d.ts +6 -0
- package/dist/vendor/dte-shared/index.js +5 -0
- package/dist/vendor/dte-shared/styles/schedule.css +19 -0
- package/dist/vendor/dte-shared/types.d.ts +67 -0
- package/dist/vendor/dte-shared/types.js +1 -0
- package/package.json +5 -2
- package/src/__tests__/field-types/date-fields.test.ts +29 -3
- package/src/__tests__/field-types/e-sign-fields.test.ts +2 -2
- package/src/__tests__/field-types/fillable-fields.test.ts +2 -2
- package/src/components/field-config-panel/advanced-settings.tsx +16 -3
- package/src/components/field-config-panel/e-sign-options-modal.tsx +13 -2
- package/src/components/field-config-panel/field-config-panel-overlay.tsx +97 -1
- package/src/components/field-config-panel/field-config-panel.tsx +28 -0
- package/src/components/field-config-panel/formula-generator.tsx +8 -1
- package/src/components/field-config-panel/formula-modal.tsx +19 -4
- package/src/components/field-config-panel/formula-workspace.tsx +31 -6
- package/src/components/pdf-editor/pdf-editor.tsx +82 -0
- package/src/components/pdf-view/pdf-view-calculated.tsx +28 -3
- package/src/components/pdf-view/pdf-view.tsx +23 -3
- package/src/constants/calculated.constants.ts +7 -0
- package/src/hooks/usePinchZoom.ts +1 -6
- package/src/interface/types.ts +47 -0
- package/src/utils/field/__tests__/field-background-color.utils.test.ts +8 -8
- package/src/utils/field/__tests__/get-field-bounds-style.utils.test.ts +16 -0
- package/src/utils/formula/__tests__/evaluate-formula.utils.test.ts +198 -16
- package/src/utils/formula/__tests__/schedule-bindings.utils.test.ts +73 -0
- package/src/utils/formula/business-days.utils.ts +188 -0
- package/src/utils/formula/caret.utils.ts +1 -1
- package/src/utils/formula/evaluate-formula.utils.ts +94 -114
- package/src/utils/formula/index.ts +1 -0
- package/src/utils/formula/schedule-bindings.utils.ts +27 -0
package/README.md
CHANGED
|
@@ -14,6 +14,9 @@ formulas.
|
|
|
14
14
|
show a live character counter and only accept as much as fits the field
|
|
15
15
|
- 🧮 **Calculated Fields**: Formula-based fields with validation, autosuggest, and advanced formatting (number, currency,
|
|
16
16
|
percent, date, rounding, separators)
|
|
17
|
+
- 📅 **Business-Day Schedules**: Per-field toggle to exclude weekends and holidays from a date calculated field's
|
|
18
|
+
arithmetic, with a picker for the tenant's schedules and a drawer to create one (weekend days, catalog holidays,
|
|
19
|
+
recurring custom dates)
|
|
17
20
|
- 🗂️ **Forms Fields**: Bind PDF placements to job form submission values (`__submission_fields.*` paths), with async
|
|
18
21
|
field definitions from the host and the same paths usable inside calculated-field formulas
|
|
19
22
|
- 📋 **Generic Fields**: Custom table and text blocks with configurable rows/cells and inline editing in view mode
|
|
@@ -28,6 +31,14 @@ formulas.
|
|
|
28
31
|
|
|
29
32
|
### Recent changes
|
|
30
33
|
|
|
34
|
+
- **fix/shared-incloud-on-BYOD-build** (installable package) — the package no longer depends on the unpublished
|
|
35
|
+
`@servicetitan/dte-shared`; its code is bundled in, so `npm install` works. See
|
|
36
|
+
[RELEASE_NOTES.md](./RELEASE_NOTES.md).
|
|
37
|
+
- **feat/DTE-4695/custom-weekend-holiday-exclusion** (business-day calendars) — a per-field "Exclude weekends &
|
|
38
|
+
holidays" toggle, schedule picker and "Create New Schedule" drawer in the Formula Builder (`scheduleBindings`,
|
|
39
|
+
`holidayCatalog`, `schedules`, `onScheduleBindingsChange`, `onCreateSchedule`); date calculated fields take a
|
|
40
|
+
per-field business-day calendar (`fieldCalendars`) only while their toggle is on, match the backend's results and
|
|
41
|
+
sign. See [RELEASE_NOTES.md](./RELEASE_NOTES.md) and [Business-day calendars](#business-day-calendars).
|
|
31
42
|
- **feature/DTE-4671** (fillable text & number character limit) — text, multiline and number fields count characters
|
|
32
43
|
and accept only what fits the rendered field; text controls now use the field's font family and weight. See
|
|
33
44
|
[RELEASE_NOTES.md](./RELEASE_NOTES.md) and [Text and number field limits](#text-and-number-field-limits).
|
|
@@ -124,6 +135,19 @@ The main component for editing PDF documents and placing fields.
|
|
|
124
135
|
| `errorPlaceholder` | `ReactNode` | No | Custom component to display if PDF fails to load |
|
|
125
136
|
| `onLoadSuccess` | `(numPages: number) => void` | No | Called when the PDF document loads successfully |
|
|
126
137
|
| `errors` | `Record<string, string>` | No | Map of field id → validation message rendered on the canvas |
|
|
138
|
+
| `holidays` | `string[]` | No | Holidays of the default business-day calendar, for the formula builder preview; as on `PdfView` |
|
|
139
|
+
| `fieldCalendars` | `Record<string, BusinessCalendar>` | No | Calendars of date calculated fields bound to a schedule, by field id; as on `PdfView` |
|
|
140
|
+
| `scheduleBindings` | `FieldScheduleBinding[]` | No | Date fields whose exclusion toggle is on, and the schedule each uses; as on `PdfView` — see [Business-day calendars](#business-day-calendars) |
|
|
141
|
+
| `onScheduleBindingsChange` | `(bindings: FieldScheduleBinding[]) => void` | No | Called with the complete desired `scheduleBindings` when the toggle or picker changes the selected field's binding |
|
|
142
|
+
| `holidayCatalog` | `HolidayCatalog` | No | The tenant's known holidays, for the schedule editor's checklist |
|
|
143
|
+
| `holidayCatalogLoading`| `boolean` | No | Whether `holidayCatalog` is still loading |
|
|
144
|
+
| `holidayCatalogError` | `string` | No | Error message shown in the schedule editor if the catalog failed to load |
|
|
145
|
+
| `schedules` | `BusinessDaySchedule[]` | No | The schedules the tenant can pick from the Formula Builder's schedule picker, default schedule first |
|
|
146
|
+
| `schedulesLoading` | `boolean` | No | Whether `schedules` is still loading |
|
|
147
|
+
| `schedulesError` | `string` | No | Error message shown in the picker if the schedule list failed to load |
|
|
148
|
+
| `onCreateSchedule` | `(request: SaveScheduleRequest) => Promise<BusinessDaySchedule>` | No | Creates a tenant schedule from the "Create New Schedule" drawer; a rejected promise's `message` is shown as its error |
|
|
149
|
+
| `onUpdateSchedule` | `(id: number, request: SaveScheduleRequest) => Promise<BusinessDaySchedule>` | No | Replaces a tenant schedule in place from the picker's "Edit" action; same error handling as `onCreateSchedule` |
|
|
150
|
+
| `onDeleteSchedule` | `(id: number) => Promise<void>` | No | Permanently deletes a tenant schedule from the picker's delete action |
|
|
127
151
|
|
|
128
152
|
#### Example
|
|
129
153
|
|
|
@@ -159,6 +183,9 @@ Component for displaying PDFs with filled data in view mode.
|
|
|
159
183
|
| `loading` | `boolean` | No | Whether the PDF is currently loading |
|
|
160
184
|
| `loadingPlaceholder` | `ReactNode` | No | Custom component to display while PDF is loading |
|
|
161
185
|
| `errorPlaceholder` | `ReactNode` | No | Custom component to display if PDF fails to load |
|
|
186
|
+
| `holidays` | `string[]` | No | Holidays of the default business-day calendar — see [Business-day calendars](#business-day-calendars) |
|
|
187
|
+
| `fieldCalendars` | `Record<string, BusinessCalendar>` | No | Calendars of date calculated fields bound to a schedule, by field id — see [Business-day calendars](#business-day-calendars) |
|
|
188
|
+
| `scheduleBindings` | `FieldScheduleBinding[]` | No | Date fields whose exclusion toggle is on, and the schedule each uses — see [Business-day calendars](#business-day-calendars) |
|
|
162
189
|
|
|
163
190
|
#### View modes
|
|
164
191
|
|
|
@@ -300,8 +327,25 @@ Types of e-signature fields:
|
|
|
300
327
|
- `signature`: Signature field
|
|
301
328
|
- `initials`: Initials field
|
|
302
329
|
- `dateSigned`: Date signed field
|
|
330
|
+
- `dateSignedOffset`: Calculated date a fixed number of days after signing (see
|
|
331
|
+
**ESignDateSignedOffsetSettings** below)
|
|
303
332
|
- `fullName`: Full name field
|
|
304
333
|
|
|
334
|
+
#### ESignDateSignedOffsetSettings (`PdfField.data` for a `dateSignedOffset` field)
|
|
335
|
+
|
|
336
|
+
- **`rules`**: an ordered if/else-if/…/else chain — `ESignDateSignedOffsetSettingsRule[]` (each `{ days,
|
|
337
|
+
condition: DisplayConditionState }`) followed by exactly one trailing `ESignDateSignedOffsetSettingsFinalRule`
|
|
338
|
+
(`{ days }`, no condition, always matches). The first rule whose condition matches applies its `days`; this
|
|
339
|
+
package only authors the rule chain; evaluating it against submission data into an actual date happens on the
|
|
340
|
+
backend, at signing time.
|
|
341
|
+
- **`businessCalendarEnabled`** / **`scheduleId`**: the same business-day exclusion toggle and schedule choice as a
|
|
342
|
+
calculated field's (see **Business-day calendars** below), stored here instead of in `scheduleBindings` because,
|
|
343
|
+
like `rules`, it applies to every `dateSignedOffset` field in the document at once, not one field at a time.
|
|
344
|
+
|
|
345
|
+
All `dateSignedOffset` fields in a document share one `data` object — editing any one of them (days, rules, or the
|
|
346
|
+
business-calendar toggle) updates every sibling via `onMatchingFieldsConfigChange`, and a newly dropped
|
|
347
|
+
`dateSignedOffset` field seeds its `data` from an existing one if the document already has one.
|
|
348
|
+
|
|
305
349
|
### PdfFieldSubType
|
|
306
350
|
|
|
307
351
|
Union of fillable, e-sign, generic, and form field sub-types:
|
|
@@ -350,8 +394,49 @@ Calculated fields use a structured formula and optional display format:
|
|
|
350
394
|
(`__submission_fields.*`) and `parseExpression` is given `ParseExpressionFormContext` (`forms` +
|
|
351
395
|
`formFieldsByFormId`).
|
|
352
396
|
|
|
353
|
-
Date fields in formulas use day
|
|
354
|
-
|
|
397
|
+
Date fields in formulas use business-day arithmetic: `date + number` adds business days, `date - date` yields a
|
|
398
|
+
business-day count (`D1 - D2` counts from D2 to D1, positive when D1 is later). Only `+`, `-`, and parentheses are
|
|
399
|
+
allowed when date fields are present. Each `± N` step is applied in turn, left to right, as the backend does.
|
|
400
|
+
|
|
401
|
+
#### Business-day calendars
|
|
402
|
+
|
|
403
|
+
Business-day skipping is **opt-in per field**, via the Formula Builder's "Exclude weekends & holidays from the
|
|
404
|
+
calculation" toggle (Advanced Settings, date result type). A field with its toggle off uses plain calendar-day
|
|
405
|
+
arithmetic — no weekends or holidays are skipped. An e-sign `dateSignedOffset` field gets the same toggle and picker
|
|
406
|
+
shown inline in its own config panel (see **ESignDateSignedOffsetSettings** above), reusing the same tenant
|
|
407
|
+
schedules (`holidayCatalog`, `schedules`, `onCreateSchedule`/`onUpdateSchedule`/`onDeleteSchedule`) but storing the
|
|
408
|
+
choice on the field's `data` instead of in `scheduleBindings`.
|
|
409
|
+
|
|
410
|
+
- **`scheduleBindings`** (`FieldScheduleBinding[]`, `{ fieldKey, scheduleId? }`, `fieldKey` = `PdfField.id`) is the
|
|
411
|
+
source of truth for which fields have the toggle on, and which schedule each uses (`scheduleId` undefined = the
|
|
412
|
+
default schedule). A field with no entry here is unaffected by `holidays` / `fieldCalendars`.
|
|
413
|
+
- For an enabled field, the days skipped come from a **`BusinessCalendar`** — `{ weekendDays, holidays, firstYear,
|
|
414
|
+
lastYear }`, the shape DTE's `POST api/holidays/calendar` returns (weekend days `0` = Sunday, `6` = Saturday;
|
|
415
|
+
holidays as `YYYY-MM-DD`, already moved to their observed days).
|
|
416
|
+
- A field listed in `fieldCalendars` (by `PdfField.id`) uses only its calendar.
|
|
417
|
+
- An enabled field with no `fieldCalendars` entry uses the **default calendar**: Saturday, Sunday and `holidays`,
|
|
418
|
+
for the current year ± 1.
|
|
419
|
+
- As in the backend, the result is blank for a fractional offset, a start or result outside the calendar's years, a
|
|
420
|
+
difference spanning more than 365 days, or a missing or invalid date.
|
|
421
|
+
|
|
422
|
+
**Picking, creating, editing and deleting a schedule** (`PdfEditor` only): with the toggle on, a "Select Schedule or
|
|
423
|
+
create new" picker lists the default schedule and the tenant's own (`schedules`, default first, as DTE's
|
|
424
|
+
`GET api/holidays/schedules` returns them), with a collapsible preview of the selected schedule's excluded weekends,
|
|
425
|
+
holidays and custom dates. For a selected tenant schedule (not the read-only default), the preview also shows **Edit**
|
|
426
|
+
and delete actions. Choosing "create new" or **Edit** opens a drawer — "Create New Schedule" or "Edit Schedule" — to
|
|
427
|
+
name a schedule and set its weekend days, holidays (from `holidayCatalog`, as DTE's `GET api/holidays/catalog` returns
|
|
428
|
+
them) and recurring `MM-DD` custom dates (`02-29` included); creating always calls `onCreateSchedule` (a new schedule,
|
|
429
|
+
starting from the default's rules), while editing always calls `onUpdateSchedule` (replacing the selected schedule's
|
|
430
|
+
rules in place, starting from its own rules) — either way the result is auto-selected. The delete action calls
|
|
431
|
+
`onDeleteSchedule`, after which the picker falls back to the default schedule for the current field. Toggling, picking,
|
|
432
|
+
creating, editing and deleting all call `onScheduleBindingsChange` with the complete desired `scheduleBindings` as
|
|
433
|
+
needed; this package does not persist anything itself beyond that callback and the schedule CRUD callbacks.
|
|
434
|
+
|
|
435
|
+
**Types**: `WeekendDay` (`0 | 6`); `KnownHoliday` (`{ code, displayName, rule }`); `HolidayCatalog` (`{ jurisdiction,
|
|
436
|
+
holidays: KnownHoliday[] }`); `BusinessCalendarRules` (`{ weekendDays, knownHolidays, customDates }`, the unresolved
|
|
437
|
+
rules of a schedule — `knownHolidays` are catalog codes, `customDates` are `MM-DD` strings); `BusinessDaySchedule`
|
|
438
|
+
(`{ id?, name, isDefault, calendar: BusinessCalendarRules }`); `SaveScheduleRequest` (`BusinessCalendarRules & { name
|
|
439
|
+
}`, the `onCreateSchedule` argument); `FieldScheduleBinding` (`{ fieldKey, scheduleId? }`).
|
|
355
440
|
|
|
356
441
|
Schema fields can opt in via `options.useInCalculatedFields` and `options.useInConditionals` for data model extraction
|
|
357
442
|
in formula builder and conditionals.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { type ScheduleEditorContext } from '../../vendor/dte-shared/index';
|
|
1
2
|
import { Dispatch, FC, SetStateAction } from 'react';
|
|
2
3
|
import { type CalculatedFieldFormat } from '../../interface/types';
|
|
3
4
|
interface AdvancedSettingsProps {
|
|
4
5
|
format: CalculatedFieldFormat;
|
|
5
6
|
setFormat: Dispatch<SetStateAction<CalculatedFieldFormat>>;
|
|
7
|
+
businessCalendar?: ScheduleEditorContext;
|
|
6
8
|
}
|
|
7
9
|
export declare const AdvancedSettings: FC<AdvancedSettingsProps>;
|
|
8
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-settings.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/advanced-settings.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,qBAAqB,EAAkC,MAAM,uBAAuB,CAAC;AAEnG,UAAU,qBAAqB;IAC3B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"advanced-settings.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/advanced-settings.tsx"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,qBAAqB,EAAkC,MAAM,uBAAuB,CAAC;AAEnG,UAAU,qBAAqB;IAC3B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC3D,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC5C;AAsBD,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAoGtD,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Flex, SegmentedControl, Switch, Text } from '@servicetitan/anvil2';
|
|
3
|
+
import { BusinessCalendarSection } from '../../vendor/dte-shared/index';
|
|
3
4
|
import { DEFAULT_DATE_FORMAT, ROUNDING_OPTIONS } from '../../constants';
|
|
4
|
-
const DateFormatSettings = ({ format, setFormat }) => {
|
|
5
|
+
const DateFormatSettings = ({ businessCalendar, format, setFormat }) => {
|
|
5
6
|
var _a;
|
|
6
|
-
return (_jsxs("div", { className: "dte-formula-advanced", children: [_jsx(Text, { variant: "body", size: "small", children: "Date format" }), _jsx("input", { type: "text", className: "dte-formula-advanced-input", style: { width: '100%' }, value: (_a = format.dateFormat) !== null && _a !== void 0 ? _a : DEFAULT_DATE_FORMAT, placeholder: DEFAULT_DATE_FORMAT, onChange: e => setFormat(prev => ({ ...prev, dateFormat: e.target.value })) }), _jsx(Text, { variant: "body", size: "small", color: "tertiary", children: "Tokens: YYYY, YY, MMMM, MMM, MM, M, DD, D" })] }));
|
|
7
|
+
return (_jsxs("div", { className: "dte-formula-advanced", children: [_jsx(Text, { variant: "body", size: "small", children: "Date format" }), _jsx("input", { type: "text", className: "dte-formula-advanced-input", style: { width: '100%' }, value: (_a = format.dateFormat) !== null && _a !== void 0 ? _a : DEFAULT_DATE_FORMAT, placeholder: DEFAULT_DATE_FORMAT, onChange: e => setFormat(prev => ({ ...prev, dateFormat: e.target.value })) }), _jsx(Text, { variant: "body", size: "small", color: "tertiary", children: "Tokens: YYYY, YY, MMMM, MMM, MM, M, DD, D" }), businessCalendar && _jsx(BusinessCalendarSection, { businessCalendar: businessCalendar })] }));
|
|
7
8
|
};
|
|
8
|
-
export const AdvancedSettings = ({ format, setFormat }) => {
|
|
9
|
+
export const AdvancedSettings = ({ businessCalendar, format, setFormat, }) => {
|
|
9
10
|
if (format.resultType === 'date') {
|
|
10
|
-
return _jsx(DateFormatSettings, { format: format, setFormat: setFormat });
|
|
11
|
+
return (_jsx(DateFormatSettings, { format: format, setFormat: setFormat, businessCalendar: businessCalendar }));
|
|
11
12
|
}
|
|
12
13
|
return (_jsxs("div", { className: "dte-formula-advanced", children: [_jsxs(Flex, { direction: "column", children: [_jsx(Text, { variant: "body", size: "small", children: "Rounding mode" }), _jsx(SegmentedControl, { selected: format.roundingMode, onChange: (roundingMode) => setFormat(prev => ({ ...prev, roundingMode })), fill: true, children: ROUNDING_OPTIONS.map(opt => (_jsx(SegmentedControl.Segment, { value: opt.value, children: opt.label }, opt.value))) })] }), _jsxs(Flex, { direction: "column", flex: 1, children: [_jsxs(Flex, { alignItems: "center", justifyContent: "space-between", children: [_jsx(Text, { variant: "body", size: "small", children: "Decimal places" }), _jsx(Text, { variant: "body", size: "small", className: "dte-formula-advanced-value", children: format.decimals })] }), _jsx("input", { type: "range", min: 0, max: 10, value: format.decimals, onChange: e => setFormat(prev => ({
|
|
13
14
|
...prev,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-settings.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/advanced-settings.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"advanced-settings.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/advanced-settings.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAA8B,MAAM,0BAA0B,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASxE,MAAM,kBAAkB,GAA8B,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE;;IAAC,OAAA,CAC/F,eAAK,SAAS,EAAC,sBAAsB,aACjC,KAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,IA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IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,+BAE1B,EACP,MAAC,IAAI,IAAC,GAAG,EAAC,GAAG,EAAC,UAAU,EAAC,QAAQ,aAC7B,KAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,uBAE1B,EACP,gBACI,QAAQ,EAAE,MAAM,CAAC,UAAU,KAAK,UAAU,EAC1C,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,MAAM,CAAC,UAAU,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,GAC7E,EACF,KAAC,IAAI,IAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,wBAE1B,EACP,gBACI,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,MAAM,CAAC,UAAU,KAAK,SAAS,EACzC,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,CACV,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,GAEnE,IACC,IACJ,IACL,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ScheduleEditorContext } from '../../vendor/dte-shared/index';
|
|
1
2
|
import { FC } from 'react';
|
|
2
3
|
import { ESignDateSignedOffsetSettings, FormFieldsByFormIdI, FormInfo, PdfField, SchemaObject } from '../../interface/types';
|
|
3
4
|
interface ESignOptionsModalProps {
|
|
@@ -9,6 +10,8 @@ interface ESignOptionsModalProps {
|
|
|
9
10
|
formFieldsByFormId?: FormFieldsByFormIdI;
|
|
10
11
|
onRequestFormFields?: (formId: number) => void;
|
|
11
12
|
formFieldsLoadingFormId?: number | null;
|
|
13
|
+
/** The business-day exclusion toggle/picker/drawer state and callbacks for this field. */
|
|
14
|
+
businessCalendar?: ScheduleEditorContext;
|
|
12
15
|
}
|
|
13
16
|
export declare const ESignOptionsModal: FC<ESignOptionsModalProps>;
|
|
14
17
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-sign-options-modal.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/e-sign-options-modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAsB,MAAM,OAAO,CAAC;AAC/C,OAAO,EACH,6BAA6B,EAG7B,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,YAAY,EACf,MAAM,uBAAuB,CAAC;AAK/B,UAAU,sBAAsB;IAC5B,YAAY,EAAE,6BAA6B,CAAC;IAC5C,MAAM,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IACvD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,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;
|
|
1
|
+
{"version":3,"file":"e-sign-options-modal.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/e-sign-options-modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,EAAE,EAAsB,MAAM,OAAO,CAAC;AAC/C,OAAO,EACH,6BAA6B,EAG7B,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,YAAY,EACf,MAAM,uBAAuB,CAAC;AAK/B,UAAU,sBAAsB;IAC5B,YAAY,EAAE,6BAA6B,CAAC;IAC5C,MAAM,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;IACvD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,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,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC5C;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAkGxD,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Flex, NumberField } from '@servicetitan/anvil2';
|
|
3
3
|
import AddIcon from '@servicetitan/anvil2/assets/icons/material/round/add_circle.svg';
|
|
4
|
+
import { BusinessCalendarSection } from '../../vendor/dte-shared/index';
|
|
4
5
|
import { Fragment, useState } from 'react';
|
|
5
6
|
import { createClearedESignOffsetSettings } from '../../utils';
|
|
6
7
|
import { ESignDateRulesSummary } from './e-sign-date-rules-summary';
|
|
7
8
|
import { ESignDateSignedOffsetModal } from './e-sign-date-signed-offset-modal';
|
|
8
|
-
export const ESignOptionsModal = ({ documentFields, formFieldsByFormId, formFieldsLoadingFormId, forms, initialState, onRequestFormFields, onSave, schema, }) => {
|
|
9
|
+
export const ESignOptionsModal = ({ businessCalendar, documentFields, formFieldsByFormId, formFieldsLoadingFormId, forms, initialState, onRequestFormFields, onSave, schema, }) => {
|
|
9
10
|
const [open, setOpen] = useState(false);
|
|
10
11
|
/*
|
|
11
12
|
* `rules` is a tuple: zero or more conditioned rules followed by exactly one condition-less
|
|
@@ -16,15 +17,16 @@ export const ESignOptionsModal = ({ documentFields, formFieldsByFormId, formFiel
|
|
|
16
17
|
const rulesWithConditions = initialState.rules.slice(0, -1);
|
|
17
18
|
const handleDaysChange = (days) => {
|
|
18
19
|
onSave({
|
|
20
|
+
...initialState,
|
|
19
21
|
rules: [...rulesWithConditions, { days: Math.max(Math.min(365, days !== null && days !== void 0 ? days : 0), 0) }],
|
|
20
22
|
});
|
|
21
23
|
};
|
|
22
24
|
const handleSaveRules = (rules, finalRule) => {
|
|
23
|
-
onSave({ rules: [...rules, finalRule] });
|
|
25
|
+
onSave({ ...initialState, rules: [...rules, finalRule] });
|
|
24
26
|
};
|
|
25
27
|
const handleClearRules = () => {
|
|
26
|
-
onSave(createClearedESignOffsetSettings());
|
|
28
|
+
onSave({ ...initialState, ...createClearedESignOffsetSettings() });
|
|
27
29
|
};
|
|
28
|
-
return (_jsxs(Fragment, { children: [rulesWithConditions.length === 0 ? (_jsxs(Flex, { gap: 1, direction: "column", justifyContent: "space-between", children: [_jsx(NumberField, { size: "small", label: "Number of days", value: ruleWithOutCondition.days, onChange: handleDaysChange, suffix: "days", width: "100%" }), _jsx(Button, { appearance: "ghost", size: "small", icon: AddIcon, onClick: () => setOpen(true), style: { color: '#0265DC' }, children: "Set Date Rule" })] })) : (_jsx(ESignDateRulesSummary, { documentFields: documentFields, onClear: handleClearRules, onEdit: () => setOpen(true), rulesWithConditions: rulesWithConditions, schema: schema, elseDays: ruleWithOutCondition.days })), open && (_jsx(ESignDateSignedOffsetModal, { onClose: () => setOpen(false), onSave: handleSaveRules, documentFields: documentFields, finalRule: ruleWithOutCondition, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formFieldsLoadingFormId, forms: forms, initialState: rulesWithConditions, onRequestFormFields: onRequestFormFields, schema: schema }))] }));
|
|
30
|
+
return (_jsxs(Fragment, { children: [rulesWithConditions.length === 0 ? (_jsxs(Flex, { gap: 1, direction: "column", justifyContent: "space-between", children: [_jsx(NumberField, { size: "small", label: "Number of days", value: ruleWithOutCondition.days, onChange: handleDaysChange, suffix: "days", width: "100%" }), _jsx(Button, { appearance: "ghost", size: "small", icon: AddIcon, onClick: () => setOpen(true), style: { color: '#0265DC' }, children: "Set Date Rule" })] })) : (_jsx(ESignDateRulesSummary, { documentFields: documentFields, onClear: handleClearRules, onEdit: () => setOpen(true), rulesWithConditions: rulesWithConditions, schema: schema, elseDays: ruleWithOutCondition.days })), open && (_jsx(ESignDateSignedOffsetModal, { onClose: () => setOpen(false), onSave: handleSaveRules, documentFields: documentFields, finalRule: ruleWithOutCondition, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formFieldsLoadingFormId, forms: forms, initialState: rulesWithConditions, onRequestFormFields: onRequestFormFields, schema: schema })), businessCalendar && (_jsx(BusinessCalendarSection, { businessCalendar: businessCalendar, label: "Exclude weekends & holidays from the calculation" }))] }));
|
|
29
31
|
};
|
|
30
32
|
//# sourceMappingURL=e-sign-options-modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-sign-options-modal.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/e-sign-options-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,OAAO,MAAM,iEAAiE,CAAC;AACtF,OAAO,EAAM,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAU/C,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"e-sign-options-modal.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/e-sign-options-modal.tsx"],"names":[],"mappings":";AAAA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eAAe,EACvB,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,oBAAoB,EAC/B,kBAAkB,EAAE,kBAAkB,EACtC,uBAAuB,EAAE,uBAAuB,EAChD,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,mBAAmB,EACjC,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,MAAM,GAChB,CACL,EACA,gBAAgB,IAAI,CACjB,KAAC,uBAAuB,IACpB,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAC,kDAAkD,GAC1D,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { type FormFieldsByFormIdI, type FormInfo, type PdfField, type RecipientInfo, type SchemaObject } from '../../interface/types';
|
|
2
|
+
import { type BusinessCalendar, type BusinessDaySchedule, type FieldScheduleBinding, type FormFieldsByFormIdI, type FormInfo, type HolidayCatalog, type PdfField, type RecipientInfo, type SaveScheduleRequest, type SchemaObject } from '../../interface/types';
|
|
3
3
|
interface FieldConfigPanelOverlayProps {
|
|
4
4
|
dataModel?: SchemaObject;
|
|
5
5
|
documentFields?: PdfField[];
|
|
@@ -9,6 +9,19 @@ interface FieldConfigPanelOverlayProps {
|
|
|
9
9
|
selectedField: PdfField;
|
|
10
10
|
recipients: RecipientInfo[];
|
|
11
11
|
hideConditionalLogic?: boolean;
|
|
12
|
+
holidays?: string[];
|
|
13
|
+
fieldCalendars?: Record<string, BusinessCalendar>;
|
|
14
|
+
scheduleBindings?: FieldScheduleBinding[];
|
|
15
|
+
holidayCatalog?: HolidayCatalog;
|
|
16
|
+
holidayCatalogLoading?: boolean;
|
|
17
|
+
holidayCatalogError?: string;
|
|
18
|
+
schedules?: BusinessDaySchedule[];
|
|
19
|
+
schedulesLoading?: boolean;
|
|
20
|
+
schedulesError?: string;
|
|
21
|
+
onScheduleBindingsChange?(bindings: FieldScheduleBinding[]): void;
|
|
22
|
+
onCreateSchedule?(request: SaveScheduleRequest): Promise<BusinessDaySchedule>;
|
|
23
|
+
onUpdateSchedule?(id: number, request: SaveScheduleRequest): Promise<BusinessDaySchedule>;
|
|
24
|
+
onDeleteSchedule?(id: number): Promise<void>;
|
|
12
25
|
onFieldConfigChange(updates: Partial<PdfField>): void;
|
|
13
26
|
onMatchingFieldsConfigChange?(predicate: (field: PdfField) => boolean, updates: Partial<PdfField> | ((field: PdfField) => Partial<PdfField>)): void;
|
|
14
27
|
onDeleteField(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-config-panel-overlay.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel-overlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"field-config-panel-overlay.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel-overlay.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAwB,MAAM,OAAO,CAAC;AACjD,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACpB,MAAM,uBAAuB,CAAC;AAI/B,UAAU,4BAA4B;IAClC,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,kBAAkB,EAAE,mBAAmB,CAAC;IACxC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,aAAa,EAAE,QAAQ,CAAC;IACxB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,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/jsx-runtime";
|
|
2
2
|
import { Button, Flex, Text } from '@servicetitan/anvil2';
|
|
3
3
|
import IconClose from '@servicetitan/anvil2/assets/icons/material/round/close.svg';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { getFieldDateCalcOptions, setFieldSchedule, setFieldScheduleEnabled } from '../../utils';
|
|
4
6
|
import { FieldConfigPanel } from './field-config-panel';
|
|
5
|
-
export const FieldConfigPanelOverlay = ({ dataModel, documentFields = [], formFieldsByFormId, forms, formulaLoadingFormId, hideConditionalLogic, onDeleteField, onDeselectField, onFieldConfigChange, onMatchingFieldsConfigChange, onRequestFormFields, recipients, selectedField, }) => {
|
|
6
|
-
|
|
7
|
+
export const FieldConfigPanelOverlay = ({ dataModel, documentFields = [], fieldCalendars, formFieldsByFormId, forms, formulaLoadingFormId, hideConditionalLogic, holidayCatalog, holidayCatalogError, holidayCatalogLoading, holidays, onCreateSchedule, onDeleteField, onDeleteSchedule, onDeselectField, onFieldConfigChange, onMatchingFieldsConfigChange, onRequestFormFields, onScheduleBindingsChange, onUpdateSchedule, recipients, scheduleBindings, schedules, schedulesError, schedulesLoading, selectedField, }) => {
|
|
8
|
+
const dateCalcOptions = useMemo(() => getFieldDateCalcOptions(selectedField.id, scheduleBindings, holidays, fieldCalendars), [selectedField.id, scheduleBindings, holidays, fieldCalendars]);
|
|
9
|
+
const selectedFieldId = selectedField.id;
|
|
10
|
+
const selectedBinding = useMemo(() => scheduleBindings === null || scheduleBindings === void 0 ? void 0 : scheduleBindings.find(b => b.fieldKey === selectedFieldId), [scheduleBindings, selectedFieldId]);
|
|
11
|
+
const handleToggle = useCallback((enabled) => {
|
|
12
|
+
onScheduleBindingsChange === null || onScheduleBindingsChange === void 0 ? void 0 : onScheduleBindingsChange(setFieldScheduleEnabled(scheduleBindings !== null && scheduleBindings !== void 0 ? scheduleBindings : [], selectedFieldId, enabled));
|
|
13
|
+
}, [scheduleBindings, selectedFieldId, onScheduleBindingsChange]);
|
|
14
|
+
const handleSelectSchedule = useCallback((scheduleId) => {
|
|
15
|
+
onScheduleBindingsChange === null || onScheduleBindingsChange === void 0 ? void 0 : onScheduleBindingsChange(setFieldSchedule(scheduleBindings !== null && scheduleBindings !== void 0 ? scheduleBindings : [], selectedFieldId, scheduleId));
|
|
16
|
+
}, [scheduleBindings, selectedFieldId, onScheduleBindingsChange]);
|
|
17
|
+
const businessCalendar = useMemo(() => ({
|
|
18
|
+
enabled: !!selectedBinding,
|
|
19
|
+
selectedScheduleId: selectedBinding === null || selectedBinding === void 0 ? void 0 : selectedBinding.scheduleId,
|
|
20
|
+
onToggle: handleToggle,
|
|
21
|
+
onSelectSchedule: handleSelectSchedule,
|
|
22
|
+
holidayCatalog,
|
|
23
|
+
holidayCatalogLoading,
|
|
24
|
+
holidayCatalogError,
|
|
25
|
+
schedules,
|
|
26
|
+
schedulesLoading,
|
|
27
|
+
schedulesError,
|
|
28
|
+
onCreateSchedule,
|
|
29
|
+
onUpdateSchedule,
|
|
30
|
+
onDeleteSchedule,
|
|
31
|
+
}), [
|
|
32
|
+
selectedBinding,
|
|
33
|
+
handleToggle,
|
|
34
|
+
handleSelectSchedule,
|
|
35
|
+
holidayCatalog,
|
|
36
|
+
holidayCatalogLoading,
|
|
37
|
+
holidayCatalogError,
|
|
38
|
+
schedules,
|
|
39
|
+
schedulesLoading,
|
|
40
|
+
schedulesError,
|
|
41
|
+
onCreateSchedule,
|
|
42
|
+
onUpdateSchedule,
|
|
43
|
+
onDeleteSchedule,
|
|
44
|
+
]);
|
|
45
|
+
return (_jsxs(Flex, { className: "dte-field-config-panel-overlay", onClick: e => e.stopPropagation(), children: [_jsxs(Flex, { className: "dte-field-config-panel-header", alignItems: "center", justifyContent: "space-between", children: [_jsx(Text, { variant: "headline", el: "h6", size: "small", children: "Field Configuration" }), _jsx(Button, { appearance: "ghost", size: "small", onClick: onDeselectField, "aria-label": "Close", icon: IconClose })] }), _jsx("div", { className: "dte-field-config-panel-content", children: _jsx(FieldConfigPanel, { dataModel: dataModel, documentFields: documentFields, field: selectedField, formFieldsByFormId: formFieldsByFormId, forms: forms, formulaLoadingFormId: formulaLoadingFormId, recipients: recipients, onFieldConfigChange: onFieldConfigChange, onMatchingFieldsConfigChange: onMatchingFieldsConfigChange, onDeleteField: onDeleteField, hideConditionalLogic: hideConditionalLogic, dateCalcOptions: dateCalcOptions, businessCalendar: businessCalendar, onRequestFormFields: onRequestFormFields }) })] }));
|
|
7
46
|
};
|
|
8
47
|
//# sourceMappingURL=field-config-panel-overlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-config-panel-overlay.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel-overlay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,SAAS,MAAM,4DAA4D,CAAC;
|
|
1
|
+
{"version":3,"file":"field-config-panel-overlay.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel-overlay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,SAAS,MAAM,4DAA4D,CAAC;AAEnF,OAAO,EAAM,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAajD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAkCxD,MAAM,CAAC,MAAM,uBAAuB,GAAqC,CAAC,EACtE,SAAS,EACT,cAAc,GAAG,EAAE,EACnB,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAA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E,UAAU,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,4BAA4B,EAAE,4BAA4B,EAC1D,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,GAC1C,GACA,IACH,CACV,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type ScheduleEditorContext } from '../../vendor/dte-shared/index';
|
|
1
2
|
import { FC } from 'react';
|
|
2
3
|
import { type FormFieldsByFormIdI, type FormInfo, type PdfField, type RecipientInfo, type SchemaObject } from '../../interface/types';
|
|
4
|
+
import { type DateCalcOptions } from '../../utils';
|
|
3
5
|
interface FieldConfigPanelProps {
|
|
4
6
|
field: PdfField;
|
|
5
7
|
dataModel?: SchemaObject;
|
|
@@ -9,6 +11,10 @@ interface FieldConfigPanelProps {
|
|
|
9
11
|
formulaLoadingFormId?: number | null;
|
|
10
12
|
recipients: RecipientInfo[];
|
|
11
13
|
hideConditionalLogic?: boolean;
|
|
14
|
+
/** The calendar of this field's formula preview. */
|
|
15
|
+
dateCalcOptions?: DateCalcOptions;
|
|
16
|
+
/** The business-calendar toggle/picker/drawer state and callbacks for this field. */
|
|
17
|
+
businessCalendar?: ScheduleEditorContext;
|
|
12
18
|
onDeleteField(): void;
|
|
13
19
|
onFieldConfigChange(updates: Partial<PdfField>): void;
|
|
14
20
|
onMatchingFieldsConfigChange?(predicate: (field: PdfField) => boolean, updates: Partial<PdfField> | ((field: PdfField) => Partial<PdfField>)): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-config-panel.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAEpC,OAAO,EAIH,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,YAAY,EACpB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"field-config-panel.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAEpC,OAAO,EAIH,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,YAAY,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,KAAK,eAAe,EAOvB,MAAM,aAAa,CAAC;AAQrB,UAAU,qBAAqB;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oDAAoD;IACpD,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC,aAAa,IAAI,IAAI,CAAC;IACtB,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACtD,4BAA4B,CAAC,CACzB,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,EACvC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,GACtE,IAAI,CAAC;IACR,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAwStD,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { ESignOptionsModal } from './e-sign-options-modal';
|
|
|
10
10
|
import { FillableDefaultConfig } from './fillable-default-config';
|
|
11
11
|
import { FormulaGenerator } from './formula-generator';
|
|
12
12
|
import { TableConfigs } from './table-configs';
|
|
13
|
-
export const FieldConfigPanel = ({ dataModel, documentFields = [], field, formFieldsByFormId, forms, formulaLoadingFormId, hideConditionalLogic = false, onDeleteField, onFieldConfigChange, onMatchingFieldsConfigChange, onRequestFormFields, recipients, }) => {
|
|
13
|
+
export const FieldConfigPanel = ({ businessCalendar, dataModel, dateCalcOptions, documentFields = [], field, formFieldsByFormId, forms, formulaLoadingFormId, hideConditionalLogic = false, onDeleteField, onFieldConfigChange, onMatchingFieldsConfigChange, onRequestFormFields, recipients, }) => {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
const recipientOptions = useMemo(() => (field.type === FieldTypeEnum.fillable
|
|
16
16
|
? getFillableFieldsRecipients(recipients)
|
|
@@ -26,6 +26,20 @@ export const FieldConfigPanel = ({ dataModel, documentFields = [], field, formFi
|
|
|
26
26
|
}
|
|
27
27
|
onFieldConfigChange({ data });
|
|
28
28
|
};
|
|
29
|
+
/*
|
|
30
|
+
* Reuses the catalog/CRUD half of `businessCalendar` (shared tenant schedules, same as a
|
|
31
|
+
* calculated field's), but overrides the enabled/selected-schedule half to read and write
|
|
32
|
+
* `ESignDateSignedOffsetSettings` instead of a `scheduleBindings` entry, since the toggle here
|
|
33
|
+
* applies to every `dateSignedOffset` field in the document, same as `rules` does.
|
|
34
|
+
*/
|
|
35
|
+
const dateSignedOffsetData = field.data;
|
|
36
|
+
const eSignBusinessCalendar = businessCalendar && {
|
|
37
|
+
...businessCalendar,
|
|
38
|
+
enabled: !!(dateSignedOffsetData === null || dateSignedOffsetData === void 0 ? void 0 : dateSignedOffsetData.businessCalendarEnabled),
|
|
39
|
+
selectedScheduleId: dateSignedOffsetData === null || dateSignedOffsetData === void 0 ? void 0 : dateSignedOffsetData.scheduleId,
|
|
40
|
+
onToggle: businessCalendarEnabled => handleDateSignedOffsetSave({ ...dateSignedOffsetData, businessCalendarEnabled }),
|
|
41
|
+
onSelectSchedule: scheduleId => handleDateSignedOffsetSave({ ...dateSignedOffsetData, scheduleId }),
|
|
42
|
+
};
|
|
29
43
|
const handleRecipientChange = (item) => {
|
|
30
44
|
if (!item) {
|
|
31
45
|
return;
|
|
@@ -89,11 +103,11 @@ export const FieldConfigPanel = ({ dataModel, documentFields = [], field, formFi
|
|
|
89
103
|
multiline: !field.multiline,
|
|
90
104
|
}) })), field.type === FieldTypeEnum.fillable && field.subType === 'dropdown' && (_jsx(DropdownFieldItems, { field: field, onFieldConfigChange: onFieldConfigChange })), field.type === FieldTypeEnum.fillable &&
|
|
91
105
|
field.subType &&
|
|
92
|
-
['text', 'number', 'checkbox', 'date', 'radio'].includes(field.subType) && (_jsx(FillableDefaultConfig, { field: field, documentFields: documentFields, onFieldConfigChange: onFieldConfigChange, onMatchingFieldsConfigChange: onMatchingFieldsConfigChange })), field.type === FieldTypeEnum.calculated && (_jsx(FormulaGenerator, { dataModel: dataModel, documentFields: documentFields, formFieldsByFormId: formFieldsByFormId, forms: forms, formula: field.formula, formulaFormat: field.formulaFormat, formulaLoadingFormId: formulaLoadingFormId, onFormulaChange: (formula, formulaFormat) => onFieldConfigChange({
|
|
106
|
+
['text', 'number', 'checkbox', 'date', 'radio'].includes(field.subType) && (_jsx(FillableDefaultConfig, { field: field, documentFields: documentFields, onFieldConfigChange: onFieldConfigChange, onMatchingFieldsConfigChange: onMatchingFieldsConfigChange })), field.type === FieldTypeEnum.calculated && (_jsx(FormulaGenerator, { businessCalendar: businessCalendar, dataModel: dataModel, dateCalcOptions: dateCalcOptions, documentFields: documentFields, formFieldsByFormId: formFieldsByFormId, forms: forms, formula: field.formula, formulaFormat: field.formulaFormat, formulaLoadingFormId: formulaLoadingFormId, onFormulaChange: (formula, formulaFormat) => onFieldConfigChange({
|
|
93
107
|
formula,
|
|
94
108
|
formulaFormat,
|
|
95
109
|
}), onRequestFormFields: onRequestFormFields })), showFontSizeControl && (_jsx(SelectFieldSync, { label: "Font Size", disableClearButton: true, options: fontSizeOptions, value: selectedFontSize, onSelectedOptionChange: handleFontSizeChange })), field.type === FieldTypeEnum.generic && field.subType === 'table' && (_jsx(TableConfigs, { field: field, onFieldConfigChange: onFieldConfigChange })), field.type === FieldTypeEnum.eSign &&
|
|
96
|
-
field.subType === ESignFieldType.dateSignedOffset && (_jsx(ESignOptionsModal, { initialState: field.data, onSave: handleDateSignedOffsetSave, documentFields: documentFields, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formulaLoadingFormId, forms: forms, onRequestFormFields: onRequestFormFields, schema: dataModel })), !hideConditionalLogic && (_jsx(DisplayCondition, { onSave: onFieldConfigChange, documentFields: documentFields, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formulaLoadingFormId, forms: forms, initialState: (_b = field.displayCondition) !== null && _b !== void 0 ? _b : undefined, onRequestFormFields: onRequestFormFields, schema: dataModel })), _jsx(Textarea, { label: "Description", value: field.description, onChange: e => {
|
|
110
|
+
field.subType === ESignFieldType.dateSignedOffset && (_jsx(ESignOptionsModal, { initialState: field.data, onSave: handleDateSignedOffsetSave, businessCalendar: eSignBusinessCalendar, documentFields: documentFields, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formulaLoadingFormId, forms: forms, onRequestFormFields: onRequestFormFields, schema: dataModel })), !hideConditionalLogic && (_jsx(DisplayCondition, { onSave: onFieldConfigChange, documentFields: documentFields, formFieldsByFormId: formFieldsByFormId, formFieldsLoadingFormId: formulaLoadingFormId, forms: forms, initialState: (_b = field.displayCondition) !== null && _b !== void 0 ? _b : undefined, onRequestFormFields: onRequestFormFields, schema: dataModel })), _jsx(Textarea, { label: "Description", value: field.description, onChange: e => {
|
|
97
111
|
var _a;
|
|
98
112
|
return onFieldConfigChange({
|
|
99
113
|
description: (_a = e === null || e === void 0 ? void 0 : e.target.value) !== null && _a !== void 0 ? _a : '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-config-panel.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"field-config-panel.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/field-config-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpG,OAAO,EAAM,OAAO,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAEH,cAAc,EACd,aAAa,GAMhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEH,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAwB/C,MAAM,CAAC,MAAM,gBAAgB,GAA8B,C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
import { type CalculatedFieldFormat, type FormFieldsByFormIdI, type FormInfo, type PdfField, type SchemaObject, type StructuredFormula } from '../../interface/types';
|
|
4
|
+
import { type DateCalcOptions } from '../../utils';
|
|
3
5
|
export interface FormulaGeneratorProps {
|
|
6
|
+
businessCalendar?: ScheduleEditorContext;
|
|
4
7
|
dataModel?: SchemaObject;
|
|
8
|
+
dateCalcOptions?: DateCalcOptions;
|
|
5
9
|
documentFields?: PdfField[];
|
|
6
10
|
formFieldsByFormId?: FormFieldsByFormIdI;
|
|
7
11
|
forms: FormInfo[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-generator.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/formula-generator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AACxD,OAAO,EACH,KAAK,qBAAqB,EAG1B,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"formula-generator.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/formula-generator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AACxD,OAAO,EACH,KAAK,qBAAqB,EAG1B,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,eAAe,EAAqC,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,qBAAqB;IAClC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAClF,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAiBD,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA6DtD,CAAC"}
|
|
@@ -19,7 +19,7 @@ function getFillableFilteredBuySubTypeFields(fields, subTypes) {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
export const FormulaGenerator = ({ dataModel, documentFields = [], formFieldsByFormId, forms, formula, formulaFormat, formulaLoadingFormId, onFormulaChange, onRequestFormFields, }) => {
|
|
22
|
+
export const FormulaGenerator = ({ businessCalendar, dataModel, dateCalcOptions, documentFields = [], formFieldsByFormId, forms, formula, formulaFormat, formulaLoadingFormId, onFormulaChange, onRequestFormFields, }) => {
|
|
23
23
|
const [modalOpen, setModalOpen] = useState(false);
|
|
24
24
|
const dataModelGroups = useMemo(() => dataModel
|
|
25
25
|
? extractGroupedFieldsFromDataModel(dataModel, {
|
|
@@ -30,6 +30,6 @@ export const FormulaGenerator = ({ dataModel, documentFields = [], formFieldsByF
|
|
|
30
30
|
const handleSave = (newFormula, format) => {
|
|
31
31
|
onFormulaChange === null || onFormulaChange === void 0 ? void 0 : onFormulaChange(newFormula, format);
|
|
32
32
|
};
|
|
33
|
-
return (_jsxs(Fragment, { children: [_jsx(Button, { appearance: "secondary", className: "full-width", icon: EditIcon, onClick: () => setModalOpen(true), children: "Configure formula" }), modalOpen && (_jsx(FormulaModal, { initialFormula: formula, initialFormat: formulaFormat, dataModelGroups: dataModelGroups, fillableFieldsFromDocument: fillableFieldsFromDocument, formFieldsByFormId: formFieldsByFormId, forms: forms, formulaLoadingFormId: formulaLoadingFormId, onClose: () => setModalOpen(false), onRequestFormFields: onRequestFormFields, onSave: handleSave }))] }));
|
|
33
|
+
return (_jsxs(Fragment, { children: [_jsx(Button, { appearance: "secondary", className: "full-width", icon: EditIcon, onClick: () => setModalOpen(true), children: "Configure formula" }), modalOpen && (_jsx(FormulaModal, { initialFormula: formula, initialFormat: formulaFormat, businessCalendar: businessCalendar, dataModelGroups: dataModelGroups, dateCalcOptions: dateCalcOptions, fillableFieldsFromDocument: fillableFieldsFromDocument, formFieldsByFormId: formFieldsByFormId, forms: forms, formulaLoadingFormId: formulaLoadingFormId, onClose: () => setModalOpen(false), onRequestFormFields: onRequestFormFields, onSave: handleSave }))] }));
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=formula-generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-generator.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/formula-generator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,QAAQ,MAAM,2DAA2D,CAAC;
|
|
1
|
+
{"version":3,"file":"formula-generator.js","sourceRoot":"","sources":["../../../src/components/field-config-panel/formula-generator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,QAAQ,MAAM,2DAA2D,CAAC;AAEjF,OAAO,EAAM,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAEH,aAAa,GAQhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAwB,iCAAiC,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CA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AC7E,CAAC,cAAc,CAAC,CACnB,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,UAA6B,EAAE,MAA6B,EAAE,EAAE;QAChF,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAG,UAAU,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC,CAAC;IAEF,OAAO,CACH,MAAC,QAAQ,eACL,KAAC,MAAM,IACH,UAAU,EAAC,WAAW,EACtB,SAAS,EAAC,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,kCAG5B,EAER,SAAS,IAAI,CACV,KAAC,YAAY,IACT,cAAc,EAAE,OAAO,EACvB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,0BAA0B,EAAE,0BAA0B,EACtD,kBAAkB,EAAE,kBAAkB,EACtC,KAAK,EAAE,KAAK,EACZ,oBAAoB,EAAE,oBAAoB,EAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,UAAU,GACpB,CACL,IACM,CACd,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { type ScheduleEditorContext } from '../../vendor/dte-shared/index';
|
|
1
2
|
import { FC } from 'react';
|
|
2
3
|
import { type CalculatedFieldFormat, type DataModelFieldGroup, type FieldTypeOption, type FormFieldsByFormIdI, type FormInfo, type StructuredFormula } from '../../interface/types';
|
|
4
|
+
import { type DateCalcOptions } from '../../utils';
|
|
3
5
|
export interface FormulaModalProps {
|
|
4
6
|
initialFormula: StructuredFormula | undefined;
|
|
5
7
|
initialFormat?: CalculatedFieldFormat;
|
|
8
|
+
businessCalendar?: ScheduleEditorContext;
|
|
6
9
|
dataModelGroups: DataModelFieldGroup[];
|
|
10
|
+
/** The calendar the preview uses: the field's own, or the default one. */
|
|
11
|
+
dateCalcOptions?: DateCalcOptions;
|
|
7
12
|
fillableFieldsFromDocument?: FieldTypeOption[];
|
|
8
13
|
formFieldsByFormId?: FormFieldsByFormIdI;
|
|
9
14
|
forms: FormInfo[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-modal.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/formula-modal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AAOtE,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"formula-modal.d.ts","sourceRoot":"","sources":["../../../src/components/field-config-panel/formula-modal.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AAOtE,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,KAAK,eAAe,EAUvB,MAAM,aAAa,CAAC;AAsCrB,MAAM,WAAW,iBAAiB;IAC9B,cAAc,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9C,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC,eAAe,EAAE,mBAAmB,EAAE,CAAC;IACvC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,0BAA0B,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/C,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;IACzC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC;IAChB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC3E;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAqT9C,CAAC"}
|