@servicetitan/dte-pdf-editor 1.73.0 → 1.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/display-conditions/condition-row.d.ts +1 -1
- package/dist/components/display-conditions/condition-row.d.ts.map +1 -1
- package/dist/components/display-conditions/display-condition.d.ts +1 -1
- package/dist/components/display-conditions/display-condition.d.ts.map +1 -1
- package/dist/components/display-conditions/display-condition.js.map +1 -1
- package/dist/components/field-config-panel/advanced-settings.d.ts +1 -1
- package/dist/components/field-config-panel/advanced-settings.d.ts.map +1 -1
- package/dist/components/field-config-panel/field-config-panel-overlay.d.ts +1 -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.d.ts +1 -1
- package/dist/components/field-config-panel/field-config-panel.d.ts.map +1 -1
- package/dist/components/field-config-panel/field-sidebar.d.ts +1 -1
- package/dist/components/field-config-panel/field-sidebar.d.ts.map +1 -1
- package/dist/components/field-config-panel/field-sidebar.js.map +1 -1
- package/dist/components/field-config-panel/formula-generator.d.ts +1 -1
- package/dist/components/field-config-panel/formula-generator.d.ts.map +1 -1
- package/dist/components/field-config-panel/formula-modal.d.ts +1 -1
- package/dist/components/field-config-panel/formula-modal.d.ts.map +1 -1
- package/dist/components/field-config-panel/formula-workspace.d.ts +1 -1
- package/dist/components/field-config-panel/formula-workspace.d.ts.map +1 -1
- package/dist/components/field-config-panel/result-type-selector.d.ts +1 -1
- package/dist/components/field-config-panel/result-type-selector.d.ts.map +1 -1
- package/dist/components/field-config-panel/table-configs.d.ts +1 -1
- package/dist/components/field-config-panel/table-configs.d.ts.map +1 -1
- package/dist/components/field-sidebar/calculated-field-type-list.d.ts +1 -1
- package/dist/components/field-sidebar/calculated-field-type-list.d.ts.map +1 -1
- package/dist/components/field-sidebar/data-model-field-type-list.d.ts +1 -1
- package/dist/components/field-sidebar/data-model-field-type-list.d.ts.map +1 -1
- package/dist/components/field-sidebar/e-sign-field-type-list.d.ts +1 -1
- package/dist/components/field-sidebar/e-sign-field-type-list.d.ts.map +1 -1
- package/dist/components/field-sidebar/field-sidebar.d.ts +1 -1
- package/dist/components/field-sidebar/field-sidebar.d.ts.map +1 -1
- package/dist/components/field-sidebar/fillable-field-type-list.d.ts +1 -1
- package/dist/components/field-sidebar/fillable-field-type-list.d.ts.map +1 -1
- package/dist/components/field-sidebar/form-fields-type-list.d.ts +1 -1
- package/dist/components/field-sidebar/form-fields-type-list.d.ts.map +1 -1
- package/dist/components/field-sidebar/generic-field-type-list.d.ts +1 -1
- package/dist/components/field-sidebar/generic-field-type-list.d.ts.map +1 -1
- package/dist/components/pdf-canvas/pdf-canvas.d.ts +1 -1
- package/dist/components/pdf-canvas/pdf-canvas.d.ts.map +1 -1
- package/dist/components/pdf-editor/pdf-editor.d.ts +1 -1
- package/dist/components/pdf-editor/pdf-editor.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-fields-overlay.d.ts +1 -1
- package/dist/components/pdf-fields-overlay/pdf-fields-overlay.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-calculated.d.ts +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-data-model.d.ts +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-e-sign.d.ts +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-fillable.d.ts +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-generic.d.ts +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field-generic.d.ts.map +1 -1
- package/dist/components/pdf-fields-overlay/pdf-overlay-field.d.ts +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.map +1 -1
- package/dist/components/pdf-view/pdf-view-calculated.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view-calculated.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-data-model.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view-data-model.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-e-sign.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view-e-sign.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-field-container.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view-field-container.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-fillable.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view-fillable.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view-fillable.js.map +1 -1
- package/dist/components/pdf-view/pdf-view-generic.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view-generic.d.ts.map +1 -1
- package/dist/components/pdf-view/pdf-view.d.ts +1 -1
- package/dist/components/pdf-view/pdf-view.d.ts.map +1 -1
- package/dist/constants/field.constants.d.ts +1 -1
- package/dist/constants/field.constants.d.ts.map +1 -1
- package/dist/hooks/useFieldDrag.d.ts +1 -1
- package/dist/hooks/useFieldDrag.d.ts.map +1 -1
- package/dist/hooks/useFieldResize.d.ts +1 -1
- package/dist/hooks/useFieldResize.d.ts.map +1 -1
- package/dist/hooks/useFormFields.d.ts +1 -1
- package/dist/hooks/useFormFields.d.ts.map +1 -1
- package/dist/hooks/usePdfFieldDnD.d.ts +1 -1
- package/dist/hooks/usePdfFieldDnD.d.ts.map +1 -1
- package/dist/hooks/usePdfFieldSelection.d.ts +1 -1
- package/dist/hooks/usePdfFieldSelection.d.ts.map +1 -1
- package/dist/styles/field-sidebar.css +2 -3
- package/dist/utils/conditions/evaluate.utils.d.ts +1 -1
- package/dist/utils/conditions/evaluate.utils.d.ts.map +1 -1
- package/dist/utils/conditions/schema-data-points.utils.d.ts +1 -1
- package/dist/utils/conditions/schema-data-points.utils.d.ts.map +1 -1
- package/dist/utils/data-model/extract-fields.utils.d.ts +1 -1
- package/dist/utils/data-model/extract-fields.utils.d.ts.map +1 -1
- package/dist/utils/data-model/resolve-values.utils.d.ts +1 -1
- package/dist/utils/data-model/resolve-values.utils.d.ts.map +1 -1
- package/dist/utils/field/field-drag.utils.d.ts +1 -1
- package/dist/utils/field/field-drag.utils.d.ts.map +1 -1
- package/dist/utils/field/field-placeholder-text.utils.d.ts +1 -1
- package/dist/utils/field/field-placeholder-text.utils.d.ts.map +1 -1
- package/dist/utils/field/field-resize.utils.d.ts +1 -1
- package/dist/utils/field/field-resize.utils.d.ts.map +1 -1
- package/dist/utils/field/get-field-bounds-style.utils.d.ts +1 -1
- package/dist/utils/field/get-field-bounds-style.utils.d.ts.map +1 -1
- package/dist/utils/field/get-field-bounds-style.utils.js.map +1 -1
- package/dist/utils/field/get-field-font-size.utils.d.ts +1 -1
- package/dist/utils/field/get-field-font-size.utils.d.ts.map +1 -1
- package/dist/utils/field/get-field-font-size.utils.js.map +1 -1
- package/dist/utils/field/get-field-text-clip.utils.d.ts +1 -1
- package/dist/utils/field/get-field-text-clip.utils.d.ts.map +1 -1
- package/dist/utils/field/get-field-text-clip.utils.js.map +1 -1
- package/dist/utils/field/get-field-typography.utils.d.ts +1 -1
- package/dist/utils/field/get-field-typography.utils.d.ts.map +1 -1
- package/dist/utils/formula/evaluate-formula.utils.d.ts +1 -1
- package/dist/utils/formula/evaluate-formula.utils.d.ts.map +1 -1
- package/dist/utils/formula/expression.utils.d.ts +1 -1
- package/dist/utils/formula/expression.utils.d.ts.map +1 -1
- package/dist/utils/formula/form-fields.utils.d.ts +1 -1
- package/dist/utils/formula/form-fields.utils.d.ts.map +1 -1
- package/dist/utils/formula/format-calculated-result.utils.d.ts +1 -1
- package/dist/utils/formula/format-calculated-result.utils.d.ts.map +1 -1
- package/dist/utils/formula/validate-formula.utils.d.ts +1 -1
- package/dist/utils/formula/validate-formula.utils.d.ts.map +1 -1
- package/dist/utils/pdf/pdfjs-init.js +9 -1
- package/dist/utils/pdf/pdfjs-init.js.map +1 -1
- package/dist/utils/recipients/map-colors.d.ts +1 -1
- package/dist/utils/recipients/map-colors.d.ts.map +1 -1
- package/dist/utils/shared/sample-data.utils.d.ts +1 -1
- package/dist/utils/shared/sample-data.utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/field-types/date-fields.test.ts +3 -3
- package/src/__tests__/field-types/display-condition-fields.test.ts +5 -5
- package/src/__tests__/field-types/e-sign-fields.test.ts +2 -2
- package/src/__tests__/field-types/fillable-fields.test.ts +2 -4
- package/src/__tests__/field-types/form-fields.test.ts +10 -18
- package/src/__tests__/field-types/formula-fields.test.ts +6 -11
- package/src/__tests__/field-types/merge-tag-fields.test.ts +1 -5
- package/src/components/display-conditions/condition-row.tsx +6 -6
- package/src/components/display-conditions/display-condition.tsx +11 -12
- package/src/components/field-config-panel/advanced-settings.tsx +1 -1
- package/src/components/field-config-panel/field-config-panel-overlay.tsx +5 -5
- package/src/components/field-config-panel/field-config-panel.tsx +5 -5
- package/src/components/field-config-panel/field-sidebar.tsx +5 -1
- package/src/components/field-config-panel/formula-generator.tsx +8 -8
- package/src/components/field-config-panel/formula-modal.tsx +7 -7
- package/src/components/field-config-panel/formula-workspace.tsx +1 -1
- package/src/components/field-config-panel/result-type-selector.tsx +1 -1
- package/src/components/field-config-panel/table-configs.tsx +1 -1
- package/src/components/field-sidebar/calculated-field-type-list.tsx +1 -1
- package/src/components/field-sidebar/data-model-field-type-list.tsx +1 -1
- package/src/components/field-sidebar/e-sign-field-type-list.tsx +1 -1
- package/src/components/field-sidebar/field-sidebar.tsx +3 -3
- package/src/components/field-sidebar/fillable-field-type-list.tsx +1 -1
- package/src/components/field-sidebar/form-fields-type-list.tsx +1 -1
- package/src/components/field-sidebar/generic-field-type-list.tsx +1 -1
- package/src/components/pdf-canvas/pdf-canvas.tsx +1 -1
- package/src/components/pdf-editor/pdf-editor.tsx +5 -5
- package/src/components/pdf-fields-overlay/pdf-fields-overlay.tsx +1 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-calculated.tsx +1 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-data-model.tsx +1 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-e-sign.tsx +1 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-fillable.tsx +1 -1
- package/src/components/pdf-fields-overlay/pdf-overlay-field-generic.tsx +3 -3
- package/src/components/pdf-fields-overlay/pdf-overlay-field.tsx +1 -1
- package/src/components/pdf-view/pdf-view-calculated.tsx +1 -1
- package/src/components/pdf-view/pdf-view-data-model.tsx +1 -1
- package/src/components/pdf-view/pdf-view-e-sign.tsx +1 -1
- package/src/components/pdf-view/pdf-view-field-container.tsx +1 -1
- package/src/components/pdf-view/pdf-view-fillable.tsx +6 -1
- package/src/components/pdf-view/pdf-view-generic.tsx +3 -3
- package/src/components/pdf-view/pdf-view.tsx +5 -5
- package/src/constants/field.constants.ts +4 -4
- package/src/hooks/useFieldDrag.ts +1 -1
- package/src/hooks/useFieldResize.ts +1 -1
- package/src/hooks/useFormFields.ts +4 -4
- package/src/hooks/usePdfFieldDnD.ts +3 -3
- package/src/hooks/usePdfFieldSelection.ts +1 -1
- package/src/styles/field-sidebar.css +2 -3
- package/src/utils/conditions/__tests__/evaluate.utils.test.ts +16 -24
- package/src/utils/conditions/__tests__/schema-data-points.utils.test.ts +7 -2
- package/src/utils/conditions/evaluate.utils.ts +4 -4
- package/src/utils/conditions/schema-data-points.utils.ts +1 -1
- package/src/utils/data-model/__tests__/extract-fields.utils.test.ts +1 -1
- package/src/utils/data-model/__tests__/resolve-values.utils.test.ts +1 -1
- package/src/utils/data-model/extract-fields.utils.ts +7 -7
- package/src/utils/data-model/resolve-values.utils.ts +1 -1
- package/src/utils/field/__tests__/field-placeholder-text.utils.test.ts +1 -1
- package/src/utils/field/__tests__/get-field-bounds-style.utils.test.ts +1 -1
- package/src/utils/field/__tests__/get-field-text-clip.utils.test.ts +4 -4
- package/src/utils/field/__tests__/get-field-typography.utils.test.ts +1 -1
- package/src/utils/field/field-drag.utils.ts +1 -1
- package/src/utils/field/field-placeholder-text.utils.ts +1 -1
- package/src/utils/field/field-resize.utils.ts +1 -1
- package/src/utils/field/get-field-bounds-style.utils.ts +1 -1
- package/src/utils/field/get-field-font-size.utils.ts +1 -1
- package/src/utils/field/get-field-text-clip.utils.ts +1 -1
- package/src/utils/field/get-field-typography.utils.ts +1 -1
- package/src/utils/formula/__tests__/evaluate-formula.utils.test.ts +2 -6
- package/src/utils/formula/__tests__/expression.utils.test.ts +4 -11
- package/src/utils/formula/__tests__/form-fields.utils.test.ts +4 -4
- package/src/utils/formula/__tests__/format-calculated-result.utils.test.ts +6 -6
- package/src/utils/formula/__tests__/validate-formula.utils.test.ts +6 -10
- package/src/utils/formula/evaluate-formula.utils.ts +4 -4
- package/src/utils/formula/expression.utils.ts +4 -4
- package/src/utils/formula/form-fields.utils.ts +8 -8
- package/src/utils/formula/format-calculated-result.utils.ts +1 -1
- package/src/utils/formula/validate-formula.utils.ts +1 -1
- package/src/utils/pdf/pdfjs-init.ts +11 -1
- package/src/utils/recipients/__tests__/map-colors.test.ts +1 -1
- package/src/utils/recipients/map-colors.ts +1 -1
- package/src/utils/shared/sample-data.utils.ts +1 -1
- package/src/vite-env.d.ts +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DisplayConditionSingle,
|
|
3
|
-
DisplayConditionState,
|
|
4
|
-
} from '../../../interface/types';
|
|
1
|
+
import { type DisplayConditionSingle, type DisplayConditionState } from '../../../interface/types';
|
|
5
2
|
import { evaluateDisplayCondition } from '../evaluate.utils';
|
|
6
3
|
|
|
7
|
-
const buildCondition = (
|
|
4
|
+
const buildCondition = (
|
|
5
|
+
overrides: Partial<DisplayConditionSingle> = {},
|
|
6
|
+
): DisplayConditionSingle => ({
|
|
8
7
|
id: 'c1',
|
|
9
8
|
dataPointKey: 'name',
|
|
10
9
|
operator: 'is_equal_to',
|
|
@@ -50,9 +49,7 @@ describe('evaluateDisplayCondition', () => {
|
|
|
50
49
|
['ends_with', 'John', 'hn', true],
|
|
51
50
|
['ends_with', 'John', 'Do', false],
|
|
52
51
|
])('%s "%s" vs "%s" returns %s', (operator, actual, expected, result) => {
|
|
53
|
-
const state = buildState([
|
|
54
|
-
buildCondition({ operator, value: expected }),
|
|
55
|
-
]);
|
|
52
|
+
const state = buildState([buildCondition({ operator, value: expected })]);
|
|
56
53
|
expect(subject(state, { name: actual })).toBe(result);
|
|
57
54
|
});
|
|
58
55
|
});
|
|
@@ -82,9 +79,7 @@ describe('evaluateDisplayCondition', () => {
|
|
|
82
79
|
['num_lte', 5, '5', true],
|
|
83
80
|
['num_lte', 6, '5', false],
|
|
84
81
|
])('%s with %p vs "%s" returns %s', (operator, actual, value, expected) => {
|
|
85
|
-
const state = buildState([
|
|
86
|
-
buildCondition({ dataPointKey: 'amount', operator, value }),
|
|
87
|
-
]);
|
|
82
|
+
const state = buildState([buildCondition({ dataPointKey: 'amount', operator, value })]);
|
|
88
83
|
expect(subject(state, { amount: actual })).toBe(expected);
|
|
89
84
|
});
|
|
90
85
|
});
|
|
@@ -167,18 +162,15 @@ describe('evaluateDisplayCondition', () => {
|
|
|
167
162
|
['is_equal_to', false, false],
|
|
168
163
|
['is_not_equal_to', true, false],
|
|
169
164
|
['is_not_equal_to', false, true],
|
|
170
|
-
])(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
expect(subject(state, { agree: actual })).toBe(expected);
|
|
181
|
-
},
|
|
182
|
-
);
|
|
165
|
+
])('%s against "true" with session %p returns %s', (operator, actual, expected) => {
|
|
166
|
+
const state = buildState([
|
|
167
|
+
buildCondition({
|
|
168
|
+
dataPointKey: 'agree',
|
|
169
|
+
operator,
|
|
170
|
+
value: 'true',
|
|
171
|
+
}),
|
|
172
|
+
]);
|
|
173
|
+
expect(subject(state, { agree: actual })).toBe(expected);
|
|
174
|
+
});
|
|
183
175
|
});
|
|
184
176
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldTypeEnum, PdfField, SchemaObject } from '../../../interface/types';
|
|
1
|
+
import { FieldTypeEnum, type PdfField, type SchemaObject } from '../../../interface/types';
|
|
2
2
|
import {
|
|
3
3
|
getDataPointOptions,
|
|
4
4
|
getDocumentFieldsDataPointOptions,
|
|
@@ -167,7 +167,12 @@ describe('getDocumentFieldsDataPointOptions', () => {
|
|
|
167
167
|
label: 'No',
|
|
168
168
|
groupName: 'Payment Method',
|
|
169
169
|
}),
|
|
170
|
-
buildField({
|
|
170
|
+
buildField({
|
|
171
|
+
id: 'text-1',
|
|
172
|
+
path: 'fillable_signer1_name',
|
|
173
|
+
label: 'Name',
|
|
174
|
+
subType: 'text',
|
|
175
|
+
}),
|
|
171
176
|
];
|
|
172
177
|
|
|
173
178
|
expect(subject(fields)).toEqual([
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ConditionOperator,
|
|
3
|
-
DataModelValues,
|
|
4
|
-
DisplayConditionGroup,
|
|
5
|
-
DisplayConditionState,
|
|
2
|
+
type ConditionOperator,
|
|
3
|
+
type DataModelValues,
|
|
4
|
+
type DisplayConditionGroup,
|
|
5
|
+
type DisplayConditionState,
|
|
6
6
|
VALUE_LESS_OPERATORS,
|
|
7
7
|
} from '../../interface/types';
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldTypeEnum, SchemaObject } from '../../../interface/types';
|
|
1
|
+
import { FieldTypeEnum, type SchemaObject } from '../../../interface/types';
|
|
2
2
|
import { extractGroupedFieldsFromDataModel } from '../extract-fields.utils';
|
|
3
3
|
|
|
4
4
|
const emptySchema: SchemaObject = { type: 'object', properties: {} };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DataModelFieldGroup,
|
|
2
|
+
type DataModelFieldGroup,
|
|
3
3
|
FieldTypeEnum,
|
|
4
|
-
FieldTypeOption,
|
|
5
|
-
SchemaFieldType,
|
|
6
|
-
SchemaNode,
|
|
7
|
-
SchemaObject,
|
|
8
|
-
SchemaSimpleDate,
|
|
9
|
-
SchemaSimpleNumber,
|
|
4
|
+
type FieldTypeOption,
|
|
5
|
+
type SchemaFieldType,
|
|
6
|
+
type SchemaNode,
|
|
7
|
+
type SchemaObject,
|
|
8
|
+
type SchemaSimpleDate,
|
|
9
|
+
type SchemaSimpleNumber,
|
|
10
10
|
} from '../../interface/types';
|
|
11
11
|
|
|
12
12
|
function isSchemaSimpleNumber(node: SchemaNode): node is SchemaSimpleNumber {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldTypeEnum, PdfField } from '../../../interface/types';
|
|
1
|
+
import { FieldTypeEnum, type PdfField } from '../../../interface/types';
|
|
2
2
|
import { getFieldPlaceholderText } from '../field-placeholder-text.utils';
|
|
3
3
|
|
|
4
4
|
const buildField = (overrides: Partial<PdfField> = {}): PdfField => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ESignFieldType, FieldTypeEnum, PdfField } from '../../../interface/types';
|
|
1
|
+
import { ESignFieldType, FieldTypeEnum, type PdfField } from '../../../interface/types';
|
|
2
2
|
import { pointsToPixels } from '../../pdf';
|
|
3
3
|
import { getFieldBoundsStyle } from '../get-field-bounds-style.utils';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldTypeEnum, PdfField } from '../../../interface/types';
|
|
1
|
+
import { FieldTypeEnum, type PdfField } from '../../../interface/types';
|
|
2
2
|
import { getFieldTextClipClassName, getFieldTextClipMode } from '../get-field-text-clip.utils';
|
|
3
3
|
|
|
4
4
|
const buildField = (overrides: Partial<PdfField> = {}): PdfField => ({
|
|
@@ -27,9 +27,9 @@ describe('getFieldTextClipMode', () => {
|
|
|
27
27
|
|
|
28
28
|
test('uses wrapped for data model and generic text fields', () => {
|
|
29
29
|
expect(subject(buildField({ type: FieldTypeEnum.dataModel }))).toBe('wrapped');
|
|
30
|
-
expect(
|
|
31
|
-
|
|
32
|
-
)
|
|
30
|
+
expect(subject(buildField({ type: FieldTypeEnum.generic, subType: 'text' }))).toBe(
|
|
31
|
+
'wrapped',
|
|
32
|
+
);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ESignFieldType, FieldTypeEnum, PdfField } from '../../../interface/types';
|
|
1
|
+
import { ESignFieldType, FieldTypeEnum, type PdfField } from '../../../interface/types';
|
|
2
2
|
import { DEFAULT_FIELD_FONT_FAMILY, DEFAULT_FIELD_FONT_WEIGHT } from '../../../constants';
|
|
3
3
|
import { pointsToPixels } from '../../pdf';
|
|
4
4
|
import { getFieldTypographyStyle } from '../get-field-typography.utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DragEvent, RefObject } from 'react';
|
|
2
|
-
import { PdfField } from '../../interface/types';
|
|
2
|
+
import { type PdfField } from '../../interface/types';
|
|
3
3
|
import { getPageDimensions, getPageNumberFromClientY, getPagePosition } from '../pdf';
|
|
4
4
|
|
|
5
5
|
interface DragOffset {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { DISABLE_FIELD_RESIZE, FIELD_CONSTANTS } from '../../constants';
|
|
3
|
-
import { PdfField } from '../../interface/types';
|
|
3
|
+
import { type PdfField } from '../../interface/types';
|
|
4
4
|
import { getPageDimensions, getPagePosition } from '../pdf';
|
|
5
5
|
|
|
6
6
|
interface ResizeStartData {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import { FieldTypeEnum, PdfField, PdfFieldSubType } from '../../interface/types';
|
|
2
|
+
import { FieldTypeEnum, type PdfField, type PdfFieldSubType } from '../../interface/types';
|
|
3
3
|
import { getFieldTypographyStyle } from './get-field-typography.utils';
|
|
4
4
|
|
|
5
5
|
interface FieldBoundsStyleOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_FIELD_FONT_SIZE } from '../../constants';
|
|
2
|
-
import { FieldTypeEnum, PdfField } from '../../interface/types';
|
|
2
|
+
import { FieldTypeEnum, type PdfField } from '../../interface/types';
|
|
3
3
|
import { pointsToPixels } from '../pdf';
|
|
4
4
|
|
|
5
5
|
export const supportsFieldFontSize = (field: Pick<PdfField, 'type' | 'subType'>) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { DEFAULT_FIELD_FONT_FAMILY, DEFAULT_FIELD_FONT_WEIGHT } from '../../constants';
|
|
3
|
-
import { PdfField } from '../../interface/types';
|
|
3
|
+
import { type PdfField } from '../../interface/types';
|
|
4
4
|
import { getFieldFontSizeInPixels, supportsFieldFontSize } from './get-field-font-size.utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import { DataModelValues, StructuredFormula } from '../../../interface/types';
|
|
2
|
-
import {
|
|
3
|
-
evaluateFormula,
|
|
4
|
-
hasDivisionByZero,
|
|
5
|
-
valueToNumber,
|
|
6
|
-
} from '../evaluate-formula.utils';
|
|
1
|
+
import { type DataModelValues, type StructuredFormula } from '../../../interface/types';
|
|
2
|
+
import { evaluateFormula, hasDivisionByZero, valueToNumber } from '../evaluate-formula.utils';
|
|
7
3
|
|
|
8
4
|
const f = (tokens: StructuredFormula['tokens']): StructuredFormula => ({ tokens });
|
|
9
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StructuredFormula } from '../../../interface/types';
|
|
1
|
+
import { type StructuredFormula } from '../../../interface/types';
|
|
2
2
|
import {
|
|
3
3
|
normalizeMergeTags,
|
|
4
4
|
parseExpression,
|
|
@@ -60,11 +60,8 @@ describe('tokenizeExpression', () => {
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
describe('parseExpression', () => {
|
|
63
|
-
const subject = (
|
|
64
|
-
expression
|
|
65
|
-
validPaths: Set<string>,
|
|
66
|
-
knownDateFields?: Set<string>,
|
|
67
|
-
) => parseExpression(expression, validPaths, knownDateFields);
|
|
63
|
+
const subject = (expression: string, validPaths: Set<string>, knownDateFields?: Set<string>) =>
|
|
64
|
+
parseExpression(expression, validPaths, knownDateFields);
|
|
68
65
|
|
|
69
66
|
test('drops unknown field identifiers', () => {
|
|
70
67
|
const validPaths = new Set(['known.path']);
|
|
@@ -78,11 +75,7 @@ describe('parseExpression', () => {
|
|
|
78
75
|
});
|
|
79
76
|
|
|
80
77
|
test('marks known date fields with fieldType date', () => {
|
|
81
|
-
const tokens = subject(
|
|
82
|
-
'a.date + 1',
|
|
83
|
-
new Set(['a.date']),
|
|
84
|
-
new Set(['a.date']),
|
|
85
|
-
);
|
|
78
|
+
const tokens = subject('a.date + 1', new Set(['a.date']), new Set(['a.date']));
|
|
86
79
|
expect(tokens[0]).toEqual({ type: 'field', path: 'a.date', fieldType: 'date' });
|
|
87
80
|
});
|
|
88
81
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DataPointOption,
|
|
2
|
+
type DataPointOption,
|
|
3
3
|
FieldTypeEnum,
|
|
4
|
-
FormFieldInfo,
|
|
5
|
-
FormFieldsByFormIdI,
|
|
6
|
-
FormInfo,
|
|
4
|
+
type FormFieldInfo,
|
|
5
|
+
type FormFieldsByFormIdI,
|
|
6
|
+
type FormInfo,
|
|
7
7
|
} from '../../../interface/types';
|
|
8
8
|
import {
|
|
9
9
|
buildFormFieldKey,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CalculatedFieldFormat,
|
|
3
|
-
CalculatedFormatForDate,
|
|
4
|
-
CalculatedFormatForNumber,
|
|
2
|
+
type CalculatedFieldFormat,
|
|
3
|
+
type CalculatedFormatForDate,
|
|
4
|
+
type CalculatedFormatForNumber,
|
|
5
5
|
} from '../../../interface/types';
|
|
6
6
|
import { formatCalculatedResult } from '../format-calculated-result.utils';
|
|
7
7
|
|
|
@@ -38,9 +38,9 @@ describe('formatCalculatedResult', () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
test('floors when roundingMode is floor', () => {
|
|
41
|
-
expect(
|
|
42
|
-
|
|
43
|
-
);
|
|
41
|
+
expect(
|
|
42
|
+
subject(1.999, { ...baseNumberFormat, decimals: 0, roundingMode: 'floor' }),
|
|
43
|
+
).toBe('1');
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
test('ceils when roundingMode is ceil', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StructuredFormula } from '../../../interface/types';
|
|
1
|
+
import { type StructuredFormula } from '../../../interface/types';
|
|
2
2
|
import { validateFormula } from '../validate-formula.utils';
|
|
3
3
|
|
|
4
4
|
const f = (tokens: StructuredFormula['tokens']): StructuredFormula => ({ tokens });
|
|
@@ -111,9 +111,7 @@ describe('validateFormula', () => {
|
|
|
111
111
|
]),
|
|
112
112
|
new Set(),
|
|
113
113
|
);
|
|
114
|
-
expect(
|
|
115
|
-
result.errors.some(e => e.includes('start with an operand')),
|
|
116
|
-
).toBe(true);
|
|
114
|
+
expect(result.errors.some(e => e.includes('start with an operand'))).toBe(true);
|
|
117
115
|
});
|
|
118
116
|
|
|
119
117
|
test('reports formula ending with operator', () => {
|
|
@@ -124,9 +122,7 @@ describe('validateFormula', () => {
|
|
|
124
122
|
]),
|
|
125
123
|
new Set(),
|
|
126
124
|
);
|
|
127
|
-
expect(
|
|
128
|
-
result.errors.some(e => e.includes('end with an operand')),
|
|
129
|
-
).toBe(true);
|
|
125
|
+
expect(result.errors.some(e => e.includes('end with an operand'))).toBe(true);
|
|
130
126
|
});
|
|
131
127
|
|
|
132
128
|
test('reports invalid number value', () => {
|
|
@@ -145,9 +141,9 @@ describe('validateFormula', () => {
|
|
|
145
141
|
|
|
146
142
|
test.each(['*', '/'] as const)('rejects %s operator with date fields', operator => {
|
|
147
143
|
const result = subject(dateFieldFormula(operator), new Set(['d']), new Set(['d']));
|
|
148
|
-
expect(
|
|
149
|
-
|
|
150
|
-
)
|
|
144
|
+
expect(result.errors.some(e => e.includes('Multiply') && e.includes('divide'))).toBe(
|
|
145
|
+
true,
|
|
146
|
+
);
|
|
151
147
|
});
|
|
152
148
|
|
|
153
149
|
test('allows + and - with date fields', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DataModelValues,
|
|
3
|
-
FormulaOperator,
|
|
4
|
-
FormulaToken,
|
|
5
|
-
StructuredFormula,
|
|
2
|
+
type DataModelValues,
|
|
3
|
+
type FormulaOperator,
|
|
4
|
+
type FormulaToken,
|
|
5
|
+
type StructuredFormula,
|
|
6
6
|
} from '../../interface/types';
|
|
7
7
|
import { resolvePdfDataValues } from '../data-model';
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
FormFieldsByFormIdI,
|
|
3
|
-
FormInfo,
|
|
4
|
-
FormulaToken,
|
|
5
|
-
StructuredFormula,
|
|
2
|
+
type FormFieldsByFormIdI,
|
|
3
|
+
type FormInfo,
|
|
4
|
+
type FormulaToken,
|
|
5
|
+
type StructuredFormula,
|
|
6
6
|
} from '../../interface/types';
|
|
7
7
|
import { tryBuildFormFieldFormulaSnapshot } from './form-fields.utils';
|
|
8
8
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DataPointOption,
|
|
2
|
+
type DataPointOption,
|
|
3
3
|
FieldTypeEnum,
|
|
4
|
-
FieldTypeOption,
|
|
5
|
-
FormFieldInfo,
|
|
6
|
-
FormFieldsByFormIdI,
|
|
7
|
-
FormFieldType,
|
|
8
|
-
FormInfo,
|
|
9
|
-
FormulaFieldFormSnapshot,
|
|
10
|
-
SchemaFieldType,
|
|
4
|
+
type FieldTypeOption,
|
|
5
|
+
type FormFieldInfo,
|
|
6
|
+
type FormFieldsByFormIdI,
|
|
7
|
+
type FormFieldType,
|
|
8
|
+
type FormInfo,
|
|
9
|
+
type FormulaFieldFormSnapshot,
|
|
10
|
+
type SchemaFieldType,
|
|
11
11
|
} from '../../interface/types';
|
|
12
12
|
|
|
13
13
|
export const FORM_FIELD_TYPES_FOR_CALC = ['date', 'number'] as FormFieldType[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_DATE_FORMAT, MAX_DATE_DISPLAY_RANGE_YEARS } from '../../constants';
|
|
2
|
-
import { CalculatedFieldFormat, CalculatedFormatForNumber } from '../../interface/types';
|
|
2
|
+
import { type CalculatedFieldFormat, type CalculatedFormatForNumber } from '../../interface/types';
|
|
3
3
|
|
|
4
4
|
const roundValue = (
|
|
5
5
|
value: number,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_DATE_CALC_DAYS } from '../../constants';
|
|
2
|
-
import { FormulaToken, StructuredFormula } from '../../interface/types';
|
|
2
|
+
import { type FormulaToken, type StructuredFormula } from '../../interface/types';
|
|
3
3
|
|
|
4
4
|
export interface FormulaValidationResult {
|
|
5
5
|
valid: boolean;
|
|
@@ -14,7 +14,17 @@ import { pdfjs } from 'react-pdf';
|
|
|
14
14
|
*
|
|
15
15
|
* Using unpkg CDN - reliable and works with webpack dev server
|
|
16
16
|
* unpkg serves npm packages directly, matching the exact version from package.json
|
|
17
|
+
*
|
|
18
|
+
* react-pdf@10's own index.js unconditionally sets workerSrc to the bare, unresolvable
|
|
19
|
+
* specifier 'pdf.worker.mjs' as soon as it's imported (before this module's side effect runs,
|
|
20
|
+
* since callers always `import { ... } from 'react-pdf'` first) - a truthy but broken value, so
|
|
21
|
+
* a plain `!workerSrc` guard never fires and this override never applies. Override react-pdf's
|
|
22
|
+
* own known-bad default explicitly rather than just checking for "unset".
|
|
17
23
|
*/
|
|
18
|
-
if (
|
|
24
|
+
if (
|
|
25
|
+
typeof window !== 'undefined' &&
|
|
26
|
+
(!pdfjs.GlobalWorkerOptions.workerSrc ||
|
|
27
|
+
pdfjs.GlobalWorkerOptions.workerSrc === 'pdf.worker.mjs')
|
|
28
|
+
) {
|
|
19
29
|
pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
|
|
20
30
|
}
|
package/src/vite-env.d.ts
CHANGED