@servicetitan/dte-pdf-editor 1.55.0 → 1.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/dist/components/display-conditions/condition-row.d.ts.map +1 -1
- package/dist/components/display-conditions/condition-row.js +5 -1
- package/dist/components/display-conditions/condition-row.js.map +1 -1
- package/dist/components/display-conditions/condition-value-control.d.ts +14 -2
- package/dist/components/display-conditions/condition-value-control.d.ts.map +1 -1
- package/dist/components/display-conditions/condition-value-control.js +84 -13
- package/dist/components/display-conditions/condition-value-control.js.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-calculated.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-calculated.js +2 -2
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-calculated.js.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-data-model.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-data-model.js +2 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-data-model.js.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-e-sign.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-e-sign.js +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-e-sign.js.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-fillable.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-fillable.js +14 -7
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-fillable.js.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-generic.js +9 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-generic.js.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field.js +5 -11
- package/dist/components/pdf-fields-overlay/pdf-overlay-field.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-calculated.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-calculated.js +2 -2
- package/dist/components/pdf-view/pdf-view-calculated.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-data-model.js +2 -2
- package/dist/components/pdf-view/pdf-view-data-model.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-e-sign.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-e-sign.js +1 -1
- package/dist/components/pdf-view/pdf-view-e-sign.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-field-container.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-field-container.js +5 -15
- package/dist/components/pdf-view/pdf-view-field-container.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-fillable.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-fillable.js +22 -33
- package/dist/components/pdf-view/pdf-view-fillable.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-generic.js +1 -1
- package/dist/components/pdf-view/pdf-view-generic.js.map +1 -1
- package/dist/components/pdf-view/pdf-view.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view.js +1 -1
- package/dist/components/pdf-view/pdf-view.js.map +1 -1
- package/dist/constants/field.constants.d.ts +3 -0
- package/dist/constants/field.constants.d.ts.map +1 -1
- package/dist/constants/field.constants.js +3 -0
- package/dist/constants/field.constants.js.map +1 -1
- package/dist/hooks/useLookupOptions.d.ts +24 -8
- package/dist/hooks/useLookupOptions.d.ts.map +1 -1
- package/dist/hooks/useLookupOptions.js +47 -9
- package/dist/hooks/useLookupOptions.js.map +1 -1
- package/dist/interface/host-events.d.ts +27 -10
- package/dist/interface/host-events.d.ts.map +1 -1
- package/dist/interface/host-events.js +10 -10
- package/dist/interface/host-events.js.map +1 -1
- package/dist/interface/types.d.ts +8 -0
- package/dist/interface/types.d.ts.map +1 -1
- package/dist/interface/types.js.map +1 -1
- package/dist/utils/field/get-field-bounds-style.utils.d.ts +20 -0
- package/dist/utils/field/get-field-bounds-style.utils.d.ts.map +1 -0
- package/dist/utils/field/get-field-bounds-style.utils.js +53 -0
- package/dist/utils/field/get-field-bounds-style.utils.js.map +1 -0
- package/dist/utils/field/get-field-text-clip.utils.d.ts +13 -0
- package/dist/utils/field/get-field-text-clip.utils.d.ts.map +1 -0
- package/dist/utils/field/get-field-text-clip.utils.js +25 -0
- package/dist/utils/field/get-field-text-clip.utils.js.map +1 -0
- package/dist/utils/field/get-field-typography.utils.d.ts +10 -0
- package/dist/utils/field/get-field-typography.utils.d.ts.map +1 -0
- package/dist/utils/field/get-field-typography.utils.js +20 -0
- package/dist/utils/field/get-field-typography.utils.js.map +1 -0
- package/dist/utils/field/index.d.ts +3 -0
- package/dist/utils/field/index.d.ts.map +1 -1
- package/dist/utils/field/index.js +3 -0
- package/dist/utils/field/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/display-conditions/condition-row.tsx +8 -1
- package/src/components/display-conditions/condition-value-control.tsx +126 -39
- package/src/components/pdf-fields-overlay/pdf-overlay-field-calculated.tsx +5 -2
- package/src/components/pdf-fields-overlay/pdf-overlay-field-data-model.tsx +2 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-e-sign.tsx +3 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-fillable.tsx +28 -8
- package/src/components/pdf-fields-overlay/pdf-overlay-field-generic.tsx +9 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field.tsx +9 -13
- package/src/components/pdf-view/pdf-view-calculated.tsx +9 -2
- package/src/components/pdf-view/pdf-view-data-model.tsx +2 -2
- package/src/components/pdf-view/pdf-view-e-sign.tsx +3 -4
- package/src/components/pdf-view/pdf-view-field-container.tsx +6 -16
- package/src/components/pdf-view/pdf-view-fillable.tsx +29 -28
- package/src/components/pdf-view/pdf-view-generic.tsx +1 -1
- package/src/components/pdf-view/pdf-view.tsx +4 -1
- package/src/constants/field.constants.ts +5 -0
- package/src/hooks/useLookupOptions.ts +76 -14
- package/src/interface/host-events.ts +27 -15
- package/src/interface/types.ts +8 -0
- package/src/styles/inline-editable.css +1 -0
- package/src/styles/pdf-field-overlay.css +80 -27
- package/src/utils/field/__tests__/get-field-bounds-style.utils.test.ts +50 -0
- package/src/utils/field/__tests__/get-field-text-clip.utils.test.ts +43 -0
- package/src/utils/field/__tests__/get-field-typography.utils.test.ts +56 -0
- package/src/utils/field/get-field-bounds-style.utils.ts +65 -0
- package/src/utils/field/get-field-text-clip.utils.ts +31 -0
- package/src/utils/field/get-field-typography.utils.ts +23 -0
- package/src/utils/field/index.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-events.d.ts","sourceRoot":"","sources":["../../src/interface/host-events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host-events.d.ts","sourceRoot":"","sources":["../../src/interface/host-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,sEAAsE;AACtE,MAAM,WAAW,YAAY;IACzB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACjC,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IAClC,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,iCAAiC;AACjC,eAAO,MAAM,4BAA4B,+CAA+C,CAAC;AACzF,iCAAiC;AACjC,eAAO,MAAM,6BAA6B,gDAAgD,CAAC;AAE3F,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,QAAO,MAExC,CAAC;AAIF,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,GAAI,SAAS,oBAAoB,SAIrE,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,GAAI,UAAU,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,eAcvF,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,yBAAyB,GAAI,UAAU,qBAAqB,SAIxE,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,GAAI,UAAU,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,eAc1F,CAAC"}
|
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
* data — it asks the HOST for it over the EventTarget bus below and renders whatever the host
|
|
7
7
|
* returns.
|
|
8
8
|
*
|
|
9
|
+
* Two host-driven modes are supported (the host decides, the editor adapts):
|
|
10
|
+
* 1. Full-list source (e.g. "state", "jobType"): the host returns every option on the first
|
|
11
|
+
* request and omits `searchable`. The editor caches that list and filters it LOCALLY as the
|
|
12
|
+
* user types — no further requests are sent.
|
|
13
|
+
* 2. Searchable source (e.g. "city"): the list is too large to send at once. The host returns
|
|
14
|
+
* `searchable: true` (typically with an empty list on the first, query-less request). The
|
|
15
|
+
* editor then re-requests with the typed `query` on each keystroke and the host returns a
|
|
16
|
+
* fresh, server-filtered list per query.
|
|
17
|
+
*
|
|
9
18
|
* Transport mirrors the unlayer `displayConditionController` / `lookupOptionsController` pattern: a
|
|
10
19
|
* module-scoped `EventTarget` shared by every consumer of this package (no global `window`
|
|
11
20
|
* pollution, no cross-instance leakage). The host imports `onLookupOptionsRequest` /
|
|
@@ -16,21 +25,12 @@
|
|
|
16
25
|
* - "dte-byod-client-mfe:lookup-options-response" (host -> editor)
|
|
17
26
|
*
|
|
18
27
|
* The host-side resolver is implemented separately (it wires these events to the app's data
|
|
19
|
-
* providers, e.g. job types / states).
|
|
28
|
+
* providers, e.g. job types / states / cities).
|
|
20
29
|
*/
|
|
21
30
|
/** editor -> host event name. */
|
|
22
31
|
export const LOOKUP_OPTIONS_REQUEST_EVENT = 'dte-byod-client-mfe:lookup-options-request';
|
|
23
32
|
/** host -> editor event name. */
|
|
24
33
|
export const LOOKUP_OPTIONS_RESPONSE_EVENT = 'dte-byod-client-mfe:lookup-options-response';
|
|
25
|
-
/**
|
|
26
|
-
* Lookup sources that require the host to search an API per typed query. These keep the free-text
|
|
27
|
-
* input for now (the editor only handles full-list, load-once sources).
|
|
28
|
-
*/
|
|
29
|
-
export const SEARCHABLE_LOOKUP_SOURCES = ['city'];
|
|
30
|
-
/** True when a lookup source is searchable (host-side per-query search) rather than a full list. */
|
|
31
|
-
export const isSearchableLookupSource = (sourceKey) => {
|
|
32
|
-
return !!sourceKey && SEARCHABLE_LOOKUP_SOURCES.includes(sourceKey);
|
|
33
|
-
};
|
|
34
34
|
/** Generate a unique request id for correlating request/response pairs. */
|
|
35
35
|
export const createLookupRequestId = () => {
|
|
36
36
|
return `lookup-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-events.js","sourceRoot":"","sources":["../../src/interface/host-events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host-events.js","sourceRoot":"","sources":["../../src/interface/host-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA2CH,iCAAiC;AACjC,MAAM,CAAC,MAAM,4BAA4B,GAAG,4CAA4C,CAAC;AACzF,iCAAiC;AACjC,MAAM,CAAC,MAAM,6BAA6B,GAAG,6CAA6C,CAAC;AAE3F,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAW,EAAE;IAC9C,OAAO,UAAU,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC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,EAAE,CAAC;YACV,OAAO;QACX,CAAC;QACD,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,mBAAmB,CAAC,gBAAgB,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAE7E,OAAO,GAAG,EAAE;QACR,mBAAmB,CAAC,mBAAmB,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -59,6 +59,12 @@ export interface DisplayConditionGroup {
|
|
|
59
59
|
export interface DisplayConditionSingle {
|
|
60
60
|
id: string;
|
|
61
61
|
value: string;
|
|
62
|
+
/**
|
|
63
|
+
* Human-readable label for `value` when it came from a searchable lookup source. Persisted so a
|
|
64
|
+
* saved condition can render the selected option's label on reopen (the searched list is empty
|
|
65
|
+
* until the user types). Display-only — never used in condition evaluation.
|
|
66
|
+
*/
|
|
67
|
+
valueLabel?: string;
|
|
62
68
|
operator: string;
|
|
63
69
|
dataPointKey: string;
|
|
64
70
|
logicalOperator?: 'and' | 'or';
|
|
@@ -66,6 +72,8 @@ export interface DisplayConditionSingle {
|
|
|
66
72
|
}
|
|
67
73
|
export interface PdfFieldStyles {
|
|
68
74
|
fontSize?: number;
|
|
75
|
+
fontFamily?: string;
|
|
76
|
+
fontWeight?: 'normal' | 'bold';
|
|
69
77
|
}
|
|
70
78
|
export interface PdfField {
|
|
71
79
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/interface/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACrB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,OAAO,YAAY;CACtB;AAED,oBAAY,cAAc;IACtB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,QAAQ,aAAa;CACxB;AAED,MAAM,MAAM,i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sources":["../../src/interface/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACrB,wCAAuB,CAAA;IACvB,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,oCAAmB,CAAA;AACvB,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,2CAAyB,CAAA;IACzB,uCAAqB,CAAA;AACzB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/interface/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACrB,wCAAuB,CAAA;IACvB,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,oCAAmB,CAAA;AACvB,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,2CAAyB,CAAA;IACzB,uCAAqB,CAAA;AACzB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAsHD,kCAAkC;AAClC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAiItD;;GAEG;AAEH,wCAAwC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,EAAE;IACxD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9C,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACtD,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9C,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;IAC1C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;CAC1C,CAAC;AAEX,wCAAwC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC3C,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,SAAS,EAAE;IAChD,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC9C,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC3C,EAAE,KAAK,EAAE,+BAA+B,EAAE,KAAK,EAAE,SAAS,EAAE;IAC5D,EAAE,KAAK,EAAE,4BAA4B,EAAE,KAAK,EAAE,SAAS,EAAE;CACnD,CAAC;AAMX,iDAAiD;AACjD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9C,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;CAChD,CAAC;AAEX,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAwB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PdfField } from '../../interface/types';
|
|
3
|
+
interface FieldBoundsStyleOptions {
|
|
4
|
+
pageOffset?: {
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
};
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Shared absolute-position style for PDF field overlays.
|
|
13
|
+
*
|
|
14
|
+
* Matches the backend `/conversions/templatetopdf` clip rectangle and
|
|
15
|
+
* `PdfView` preview: content-box sizing, top-left alignment,
|
|
16
|
+
* and shared typography (font size / family / weight).
|
|
17
|
+
*/
|
|
18
|
+
export declare const getFieldBoundsStyle: (field: PdfField, options?: FieldBoundsStyleOptions) => CSSProperties;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=get-field-bounds-style.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-bounds-style.utils.d.ts","sourceRoot":"","sources":["../../../src/utils/field/get-field-bounds-style.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAiB,QAAQ,EAAmB,MAAM,uBAAuB,CAAC;AAGjF,UAAU,uBAAuB;IAC7B,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAsBD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC5B,OAAO,QAAQ,EACf,UAAU,uBAAuB,KAClC,aAwBF,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FieldTypeEnum } from '../../interface/types';
|
|
2
|
+
import { getFieldTypographyStyle } from './get-field-typography.utils';
|
|
3
|
+
const getFieldTypeSpecificStyle = (field) => {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
if (!field.subType) {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
const styles = {
|
|
9
|
+
[FieldTypeEnum.fillable]: {
|
|
10
|
+
checkbox: {
|
|
11
|
+
width: 'unset',
|
|
12
|
+
height: 'unset',
|
|
13
|
+
},
|
|
14
|
+
radio: {
|
|
15
|
+
width: 'unset',
|
|
16
|
+
height: 'unset',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
return (_b = (_a = styles[field.type]) === null || _a === void 0 ? void 0 : _a[field.subType]) !== null && _b !== void 0 ? _b : {};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Shared absolute-position style for PDF field overlays.
|
|
24
|
+
*
|
|
25
|
+
* Matches the backend `/conversions/templatetopdf` clip rectangle and
|
|
26
|
+
* `PdfView` preview: content-box sizing, top-left alignment,
|
|
27
|
+
* and shared typography (font size / family / weight).
|
|
28
|
+
*/
|
|
29
|
+
export const getFieldBoundsStyle = (field, options) => {
|
|
30
|
+
const { backgroundColor, borderColor, pageOffset = { left: 0, top: 0 } } = options !== null && options !== void 0 ? options : {};
|
|
31
|
+
return {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
left: pageOffset.left + field.x,
|
|
34
|
+
top: pageOffset.top + field.y,
|
|
35
|
+
width: field.width,
|
|
36
|
+
height: field.height,
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'flex-start',
|
|
39
|
+
justifyContent: 'flex-start',
|
|
40
|
+
boxSizing: 'content-box',
|
|
41
|
+
padding: 4,
|
|
42
|
+
margin: 0,
|
|
43
|
+
minWidth: 0,
|
|
44
|
+
minHeight: 0,
|
|
45
|
+
overflow: 'hidden',
|
|
46
|
+
lineHeight: 1,
|
|
47
|
+
...getFieldTypeSpecificStyle(field),
|
|
48
|
+
...getFieldTypographyStyle(field),
|
|
49
|
+
...(backgroundColor ? { backgroundColor } : {}),
|
|
50
|
+
...(borderColor ? { borderColor } : {}),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=get-field-bounds-style.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-bounds-style.utils.js","sourceRoot":"","sources":["../../../src/utils/field/get-field-bounds-style.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA6B,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAQvE,MAAM,yBAAyB,GAAG,CAAC,KAAe,EAAiB,EAAE;;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG;QACX,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;YACtB,QAAQ,EAAE;gBACN,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,OAAO;aAClB;YACD,KAAK,EAAE;gBACH,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,OAAO;aAClB;SACJ;KAC6D,CAAC;IAEnE,OAAO,MAAA,MAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,0CAAG,KAAK,CAAC,OAAO,CAAC,mCAAI,EAAE,CAAC;AACrD,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,KAAe,EACf,OAAiC,EACpB,EAAE;IACf,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IAEzF,OAAO;QACH,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;QAC/B,GAAG,EAAE,UAAU,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;QAC7B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,YAAY;QACxB,cAAc,EAAE,YAAY;QAC5B,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,CAAC;QACb,GAAG,yBAAyB,CAAC,KAAK,CAAC;QACnC,GAAG,uBAAuB,CAAC,KAAK,CAAC;QACjC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PdfField } from '../../interface/types';
|
|
2
|
+
export type FieldTextClipMode = 'single-line' | 'multiline' | 'wrapped';
|
|
3
|
+
/**
|
|
4
|
+
* Text layout mode for a field overlay.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the backend PDF renderer:
|
|
7
|
+
* - single-line: no wrap, hard clip at the field rect (no ellipsis)
|
|
8
|
+
* - multiline: pre-wrap with word breaks, clip overflow vertically
|
|
9
|
+
* - wrapped: word-wrap for HTML / long prose blocks
|
|
10
|
+
*/
|
|
11
|
+
export declare const getFieldTextClipMode: (field: PdfField) => FieldTextClipMode;
|
|
12
|
+
export declare const getFieldTextClipClassName: (field: PdfField) => string;
|
|
13
|
+
//# sourceMappingURL=get-field-text-clip.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-text-clip.utils.d.ts","sourceRoot":"","sources":["../../../src/utils/field/get-field-text-clip.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAExE;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,QAAQ,KAAG,iBActD,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,OAAO,QAAQ,WAExD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FieldTypeEnum } from '../../interface/types';
|
|
2
|
+
/**
|
|
3
|
+
* Text layout mode for a field overlay.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the backend PDF renderer:
|
|
6
|
+
* - single-line: no wrap, hard clip at the field rect (no ellipsis)
|
|
7
|
+
* - multiline: pre-wrap with word breaks, clip overflow vertically
|
|
8
|
+
* - wrapped: word-wrap for HTML / long prose blocks
|
|
9
|
+
*/
|
|
10
|
+
export const getFieldTextClipMode = (field) => {
|
|
11
|
+
if (field.type === FieldTypeEnum.fillable && field.multiline) {
|
|
12
|
+
return 'multiline';
|
|
13
|
+
}
|
|
14
|
+
if (field.type === FieldTypeEnum.generic && field.subType === 'text') {
|
|
15
|
+
return 'wrapped';
|
|
16
|
+
}
|
|
17
|
+
if (field.type === FieldTypeEnum.dataModel || field.type === FieldTypeEnum.forms) {
|
|
18
|
+
return 'wrapped';
|
|
19
|
+
}
|
|
20
|
+
return 'single-line';
|
|
21
|
+
};
|
|
22
|
+
export const getFieldTextClipClassName = (field) => {
|
|
23
|
+
return `dte-pdf-field-text--${getFieldTextClipMode(field)}`;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=get-field-text-clip.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-text-clip.utils.js","sourceRoot":"","sources":["../../../src/utils/field/get-field-text-clip.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAY,MAAM,uBAAuB,CAAC;AAIhE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAe,EAAqB,EAAE;IACvE,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3D,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,KAAK,EAAE,CAAC;QAC/E,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAe,EAAE,EAAE;IACzD,OAAO,uBAAuB,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;AAChE,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { PdfField } from '../../interface/types';
|
|
3
|
+
/**
|
|
4
|
+
* Typography styles for a field overlay, aligned with the backend PDF renderer.
|
|
5
|
+
*
|
|
6
|
+
* - fontSize is stored in points on `field.styles.fontSize` and converted to pixels
|
|
7
|
+
* - fontFamily / fontWeight use backend defaults unless set per field
|
|
8
|
+
*/
|
|
9
|
+
export declare const getFieldTypographyStyle: (field: PdfField) => CSSProperties;
|
|
10
|
+
//# sourceMappingURL=get-field-typography.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-typography.utils.d.ts","sourceRoot":"","sources":["../../../src/utils/field/get-field-typography.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,QAAQ,KAAG,aAWzD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DEFAULT_FIELD_FONT_FAMILY, DEFAULT_FIELD_FONT_WEIGHT } from '../../constants';
|
|
2
|
+
import { getFieldFontSizeInPixels, supportsFieldFontSize } from './get-field-font-size.utils';
|
|
3
|
+
/**
|
|
4
|
+
* Typography styles for a field overlay, aligned with the backend PDF renderer.
|
|
5
|
+
*
|
|
6
|
+
* - fontSize is stored in points on `field.styles.fontSize` and converted to pixels
|
|
7
|
+
* - fontFamily / fontWeight use backend defaults unless set per field
|
|
8
|
+
*/
|
|
9
|
+
export const getFieldTypographyStyle = (field) => {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
const typography = {
|
|
12
|
+
fontFamily: (_b = (_a = field.styles) === null || _a === void 0 ? void 0 : _a.fontFamily) !== null && _b !== void 0 ? _b : DEFAULT_FIELD_FONT_FAMILY,
|
|
13
|
+
fontWeight: (_d = (_c = field.styles) === null || _c === void 0 ? void 0 : _c.fontWeight) !== null && _d !== void 0 ? _d : DEFAULT_FIELD_FONT_WEIGHT,
|
|
14
|
+
};
|
|
15
|
+
if (supportsFieldFontSize(field)) {
|
|
16
|
+
typography.fontSize = `${getFieldFontSizeInPixels(field)}px`;
|
|
17
|
+
}
|
|
18
|
+
return typography;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=get-field-typography.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-typography.utils.js","sourceRoot":"","sources":["../../../src/utils/field/get-field-typography.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAe,EAAiB,EAAE;;IACtE,MAAM,UAAU,GAAkB;QAC9B,UAAU,EAAE,MAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,UAAU,mCAAI,yBAAyB;QACjE,UAAU,EAAE,MAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,UAAU,mCAAI,yBAAyB;KACpE,CAAC;IAEF,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,UAAU,CAAC,QAAQ,GAAG,GAAG,wBAAwB,CAAC,KAAK,CAAC,IAAI,CAAC;IACjE,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -4,5 +4,8 @@ export * from './field-coordinates.utils';
|
|
|
4
4
|
export * from './field-drag.utils';
|
|
5
5
|
export * from './field-placeholder-text.utils';
|
|
6
6
|
export * from './field-resize.utils';
|
|
7
|
+
export * from './get-field-bounds-style.utils';
|
|
7
8
|
export * from './get-field-font-size.utils';
|
|
9
|
+
export * from './get-field-text-clip.utils';
|
|
10
|
+
export * from './get-field-typography.utils';
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/field/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/field/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC"}
|
|
@@ -4,5 +4,8 @@ export * from './field-coordinates.utils';
|
|
|
4
4
|
export * from './field-drag.utils';
|
|
5
5
|
export * from './field-placeholder-text.utils';
|
|
6
6
|
export * from './field-resize.utils';
|
|
7
|
+
export * from './get-field-bounds-style.utils';
|
|
7
8
|
export * from './get-field-font-size.utils';
|
|
9
|
+
export * from './get-field-text-clip.utils';
|
|
10
|
+
export * from './get-field-typography.utils';
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/field/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/field/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -244,6 +244,7 @@ export function ConditionRow({
|
|
|
244
244
|
: 'is_equal_to'
|
|
245
245
|
: condition.operator,
|
|
246
246
|
value: '',
|
|
247
|
+
valueLabel: undefined,
|
|
247
248
|
});
|
|
248
249
|
};
|
|
249
250
|
|
|
@@ -260,6 +261,7 @@ export function ConditionRow({
|
|
|
260
261
|
formSnapshot: undefined,
|
|
261
262
|
operator: 'is_equal_to',
|
|
262
263
|
value: '',
|
|
264
|
+
valueLabel: undefined,
|
|
263
265
|
});
|
|
264
266
|
};
|
|
265
267
|
|
|
@@ -271,6 +273,7 @@ export function ConditionRow({
|
|
|
271
273
|
formSnapshot: undefined,
|
|
272
274
|
operator: 'is_equal_to',
|
|
273
275
|
value: '',
|
|
276
|
+
valueLabel: undefined,
|
|
274
277
|
});
|
|
275
278
|
if (form) {
|
|
276
279
|
onRequestFormFields?.(form.id);
|
|
@@ -448,6 +451,7 @@ export function ConditionRow({
|
|
|
448
451
|
onChange({
|
|
449
452
|
...condition,
|
|
450
453
|
value: item?.id ?? '',
|
|
454
|
+
valueLabel: undefined,
|
|
451
455
|
})
|
|
452
456
|
}
|
|
453
457
|
filterOptions={{ keys: ['label'] }}
|
|
@@ -471,9 +475,12 @@ export function ConditionRow({
|
|
|
471
475
|
) : (
|
|
472
476
|
<ConditionValueControl
|
|
473
477
|
value={condition.value}
|
|
478
|
+
valueLabel={condition.valueLabel}
|
|
474
479
|
fieldType={fieldType}
|
|
475
480
|
lookupSource={selectedDataPoint?.lookupSource}
|
|
476
|
-
onChange={value
|
|
481
|
+
onChange={(value, valueLabel) =>
|
|
482
|
+
onChange({ ...condition, value, valueLabel })
|
|
483
|
+
}
|
|
477
484
|
/>
|
|
478
485
|
)}
|
|
479
486
|
</Flex>
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { TextField } from '@servicetitan/anvil2';
|
|
2
|
+
import { SelectField, SelectFieldOption, SelectFieldSync } from '@servicetitan/anvil2/beta';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
4
|
import { useLookupOptions } from '../../hooks';
|
|
4
5
|
import type { LookupOption } from '../../interface/host-events';
|
|
5
6
|
|
|
6
7
|
export interface ConditionValueControlProps {
|
|
7
8
|
value: string;
|
|
9
|
+
/** Stored label for `value` when it came from a searchable source (for rehydration display). */
|
|
10
|
+
valueLabel?: string;
|
|
8
11
|
fieldType: 'number' | 'string';
|
|
9
12
|
/** The selected data point's `options.fieldLookupSource`; empty -> free-text input. */
|
|
10
13
|
lookupSource?: string;
|
|
11
|
-
|
|
14
|
+
/** `valueLabel` is provided when the value was picked from a lookup dropdown. */
|
|
15
|
+
onChange: (value: string, valueLabel?: string) => void;
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
const toOption = (option: LookupOption): SelectFieldOption => ({
|
|
19
|
+
id: option.key,
|
|
20
|
+
label: option.label,
|
|
21
|
+
});
|
|
22
|
+
|
|
14
23
|
const sanitizeNumericInput = (raw: string): string => {
|
|
15
24
|
let value = raw.replaceAll(/[^0-9.-]/g, '');
|
|
16
25
|
const isNegative = value.startsWith('-');
|
|
@@ -25,66 +34,144 @@ const sanitizeNumericInput = (raw: string): string => {
|
|
|
25
34
|
return value;
|
|
26
35
|
};
|
|
27
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Renders the value control for a single condition based on the field's lookup source:
|
|
39
|
+
* - `static` -> full list returned by the host, filtered locally (`SelectFieldSync`).
|
|
40
|
+
* - `searchable` -> host searches per typed query (`SelectField` + `loadOptions`).
|
|
41
|
+
* - `idle`/`fallback`/`loading` -> free-text input (never block the user).
|
|
42
|
+
*
|
|
43
|
+
* The selected option's label is reported back via `onChange` so the parent can persist it
|
|
44
|
+
* (`DisplayConditionSingle.valueLabel`) and re-display it on reopen.
|
|
45
|
+
*/
|
|
28
46
|
export function ConditionValueControl({
|
|
29
47
|
fieldType,
|
|
30
48
|
lookupSource,
|
|
31
49
|
onChange,
|
|
32
50
|
value,
|
|
51
|
+
valueLabel,
|
|
33
52
|
}: Readonly<ConditionValueControlProps>) {
|
|
34
|
-
const { options, status } = useLookupOptions(lookupSource);
|
|
53
|
+
const { loadOptions, options, resolveOptions, status } = useLookupOptions(lookupSource);
|
|
35
54
|
|
|
36
|
-
const
|
|
37
|
-
() => options.
|
|
55
|
+
const staticSelected = useMemo<SelectFieldOption | null>(
|
|
56
|
+
() => options.filter(option => option.key === value).map(toOption)[0] ?? null,
|
|
38
57
|
[options, value],
|
|
39
58
|
);
|
|
40
59
|
|
|
60
|
+
const [searchableSelected, setSearchableSelected] = useState<SelectFieldOption | null>(
|
|
61
|
+
value ? { id: value, label: valueLabel ?? value } : null,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// Tracks the key we've already turned into a human-readable label so we don't re-resolve it.
|
|
65
|
+
const resolvedKeyRef = useRef<string | null>(value && valueLabel ? value : null);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setSearchableSelected(prev => {
|
|
69
|
+
if (!value) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
if (prev?.id === value) {
|
|
73
|
+
return prev;
|
|
74
|
+
}
|
|
75
|
+
return { id: value, label: valueLabel ?? value };
|
|
76
|
+
});
|
|
77
|
+
}, [value, valueLabel]);
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* On open, resolve key -> label for a saved searchable value that has no persisted label yet,
|
|
81
|
+
* then persist the resolved label so subsequent opens are instant.
|
|
82
|
+
*/
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (status !== 'searchable' || !value) {
|
|
85
|
+
resolvedKeyRef.current = null;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (valueLabel) {
|
|
89
|
+
resolvedKeyRef.current = value;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (resolvedKeyRef.current === value) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let cancelled = false;
|
|
97
|
+
resolveOptions([value]).then(result => {
|
|
98
|
+
if (cancelled) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const match = result.find(option => option.key === value);
|
|
102
|
+
if (match) {
|
|
103
|
+
resolvedKeyRef.current = value;
|
|
104
|
+
setSearchableSelected({ id: match.key, label: match.label });
|
|
105
|
+
onChange(value, match.label);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return () => {
|
|
110
|
+
cancelled = true;
|
|
111
|
+
};
|
|
112
|
+
}, [status, value, valueLabel, resolveOptions, onChange]);
|
|
113
|
+
|
|
114
|
+
const handleLoadOptions = useCallback(
|
|
115
|
+
async (query: string) => {
|
|
116
|
+
const result = await loadOptions(query);
|
|
117
|
+
return result.map(toOption);
|
|
118
|
+
},
|
|
119
|
+
[loadOptions],
|
|
120
|
+
);
|
|
121
|
+
|
|
41
122
|
if (status === 'loading') {
|
|
42
123
|
return (
|
|
43
124
|
<TextField label="Value" flex={1} disabled value="" placeholder="" aria-label="Value" />
|
|
44
125
|
);
|
|
45
126
|
}
|
|
46
127
|
|
|
47
|
-
|
|
48
|
-
if (status !== 'ready') {
|
|
49
|
-
const handleTextChange = (raw: string) => {
|
|
50
|
-
onChange(fieldType === 'number' ? sanitizeNumericInput(raw) : raw);
|
|
51
|
-
};
|
|
52
|
-
|
|
128
|
+
if (status === 'static') {
|
|
53
129
|
return (
|
|
54
|
-
<
|
|
130
|
+
<SelectFieldSync
|
|
131
|
+
flex={1}
|
|
55
132
|
label="Value"
|
|
133
|
+
placeholder="Search value..."
|
|
134
|
+
options={options.map(toOption)}
|
|
135
|
+
value={staticSelected}
|
|
136
|
+
onSelectedOptionChange={option =>
|
|
137
|
+
onChange(option ? String(option.id) : '', option?.label)
|
|
138
|
+
}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (status === 'searchable') {
|
|
144
|
+
return (
|
|
145
|
+
<SelectField
|
|
56
146
|
flex={1}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
147
|
+
label="Value"
|
|
148
|
+
placeholder="Type to search..."
|
|
149
|
+
initialLoad="open"
|
|
150
|
+
loadOptions={handleLoadOptions}
|
|
151
|
+
value={searchableSelected}
|
|
152
|
+
onSelectedOptionChange={option => {
|
|
153
|
+
resolvedKeyRef.current = option ? String(option.id) : null;
|
|
154
|
+
setSearchableSelected(option);
|
|
155
|
+
onChange(option ? String(option.id) : '', option?.label);
|
|
156
|
+
}}
|
|
62
157
|
/>
|
|
63
158
|
);
|
|
64
159
|
}
|
|
65
160
|
|
|
161
|
+
// idle / fallback (no source, empty, error, or timeout) -> free text.
|
|
162
|
+
const handleTextChange = (raw: string) => {
|
|
163
|
+
onChange(fieldType === 'number' ? sanitizeNumericInput(raw) : raw);
|
|
164
|
+
};
|
|
165
|
+
|
|
66
166
|
return (
|
|
67
|
-
<
|
|
167
|
+
<TextField
|
|
168
|
+
label="Value"
|
|
68
169
|
flex={1}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
>
|
|
76
|
-
<Combobox.SearchField label="Value" placeholder="Search value..." />
|
|
77
|
-
<Combobox.Content>
|
|
78
|
-
{({ items }: { items: LookupOption[] }) => (
|
|
79
|
-
<Combobox.List>
|
|
80
|
-
{items.map((item, i) => (
|
|
81
|
-
<Combobox.Item index={i} item={item} key={item.key}>
|
|
82
|
-
{item.label}
|
|
83
|
-
</Combobox.Item>
|
|
84
|
-
))}
|
|
85
|
-
</Combobox.List>
|
|
86
|
-
)}
|
|
87
|
-
</Combobox.Content>
|
|
88
|
-
</Combobox>
|
|
170
|
+
value={value}
|
|
171
|
+
onChange={e => handleTextChange(e.target.value)}
|
|
172
|
+
placeholder={fieldType === 'number' ? 'e.g. 1.5' : 'Enter value...'}
|
|
173
|
+
aria-label="Value"
|
|
174
|
+
{...(fieldType === 'number' && { inputMode: 'decimal' })}
|
|
175
|
+
/>
|
|
89
176
|
);
|
|
90
177
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, useMemo } from 'react';
|
|
2
2
|
import { PdfField } from '../../interface/types';
|
|
3
|
-
import { formulaToDisplayText } from '../../utils';
|
|
3
|
+
import { formulaToDisplayText, getFieldTextClipClassName } from '../../utils';
|
|
4
4
|
|
|
5
5
|
interface PdfOverlayFieldCalculatedProps {
|
|
6
6
|
field: PdfField;
|
|
@@ -23,7 +23,10 @@ export const PdfOverlayFieldCalculated: FC<PdfOverlayFieldCalculatedProps> = ({
|
|
|
23
23
|
}, [field.formula, field.label, field.path, pathToLabel]);
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<span
|
|
26
|
+
<span
|
|
27
|
+
className={`dte-pdf-field-value ${getFieldTextClipClassName(field)}`}
|
|
28
|
+
title={displayText}
|
|
29
|
+
>
|
|
27
30
|
{displayText}
|
|
28
31
|
{field.required ? '*' : ''}
|
|
29
32
|
</span>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { PdfField } from '../../interface/types';
|
|
3
|
+
import { getFieldTextClipClassName } from '../../utils';
|
|
3
4
|
|
|
4
5
|
interface PdfOverlayFieldDataModelProps {
|
|
5
6
|
field: PdfField;
|
|
@@ -7,7 +8,7 @@ interface PdfOverlayFieldDataModelProps {
|
|
|
7
8
|
|
|
8
9
|
export const PdfOverlayFieldDataModel: FC<PdfOverlayFieldDataModelProps> = ({ field }) => {
|
|
9
10
|
return (
|
|
10
|
-
<span>
|
|
11
|
+
<span className={`dte-pdf-field-value ${getFieldTextClipClassName(field)}`}>
|
|
11
12
|
{field.label ? field.label : field.path}
|
|
12
13
|
{field.required ? '*' : ''}
|
|
13
14
|
</span>
|