@embedpdf/plugin-form 2.14.4 → 3.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/LICENSE +192 -21
  2. package/dist/index.cjs +1416 -2
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +277 -0
  5. package/dist/index.d.ts +277 -1
  6. package/dist/index.js +1398 -1779
  7. package/dist/index.js.map +1 -1
  8. package/package.json +24 -61
  9. package/dist/lib/actions.d.ts +0 -33
  10. package/dist/lib/form-plugin.d.ts +0 -59
  11. package/dist/lib/handlers/checkbox.handler.d.ts +0 -3
  12. package/dist/lib/handlers/combobox.handler.d.ts +0 -3
  13. package/dist/lib/handlers/index.d.ts +0 -5
  14. package/dist/lib/handlers/listbox.handler.d.ts +0 -3
  15. package/dist/lib/handlers/radio-button.handler.d.ts +0 -3
  16. package/dist/lib/handlers/text-field.handler.d.ts +0 -3
  17. package/dist/lib/index.d.ts +0 -10
  18. package/dist/lib/manifest.d.ts +0 -4
  19. package/dist/lib/reducer.d.ts +0 -6
  20. package/dist/lib/tools.d.ts +0 -457
  21. package/dist/lib/types.d.ts +0 -98
  22. package/dist/preact/adapter.d.ts +0 -13
  23. package/dist/preact/annotation.d.ts +0 -1
  24. package/dist/preact/core.d.ts +0 -1
  25. package/dist/preact/index.cjs +0 -2
  26. package/dist/preact/index.cjs.map +0 -1
  27. package/dist/preact/index.d.ts +0 -1
  28. package/dist/preact/index.js +0 -1359
  29. package/dist/preact/index.js.map +0 -1
  30. package/dist/react/adapter.d.ts +0 -6
  31. package/dist/react/annotation.d.ts +0 -1
  32. package/dist/react/core.d.ts +0 -1
  33. package/dist/react/index.cjs +0 -2
  34. package/dist/react/index.cjs.map +0 -1
  35. package/dist/react/index.d.ts +0 -1
  36. package/dist/react/index.js +0 -1358
  37. package/dist/react/index.js.map +0 -1
  38. package/dist/shared/components/annotations/form-checkbox.d.ts +0 -12
  39. package/dist/shared/components/annotations/form-combobox.d.ts +0 -12
  40. package/dist/shared/components/annotations/form-listbox.d.ts +0 -12
  41. package/dist/shared/components/annotations/form-radio-button.d.ts +0 -12
  42. package/dist/shared/components/annotations/form-text-field.d.ts +0 -12
  43. package/dist/shared/components/fields/checkbox.d.ts +0 -2
  44. package/dist/shared/components/fields/combobox.d.ts +0 -2
  45. package/dist/shared/components/fields/listbox.d.ts +0 -2
  46. package/dist/shared/components/fields/push-button.d.ts +0 -2
  47. package/dist/shared/components/fields/radio-button.d.ts +0 -2
  48. package/dist/shared/components/fields/style.d.ts +0 -6
  49. package/dist/shared/components/fields/text.d.ts +0 -2
  50. package/dist/shared/components/fill-mode/combobox-fill-mode.d.ts +0 -3
  51. package/dist/shared/components/fill-mode/listbox-fill-mode.d.ts +0 -3
  52. package/dist/shared/components/fill-mode/push-button-fill-mode.d.ts +0 -3
  53. package/dist/shared/components/fill-mode/radio-button-fill-mode.d.ts +0 -3
  54. package/dist/shared/components/fill-mode/text-fill-mode.d.ts +0 -3
  55. package/dist/shared/components/fill-mode/toggle-fill-mode.d.ts +0 -3
  56. package/dist/shared/components/form-renderer-registration.d.ts +0 -5
  57. package/dist/shared/components/form-renderers.d.ts +0 -9
  58. package/dist/shared/components/index.d.ts +0 -2
  59. package/dist/shared/components/render-widget.d.ts +0 -12
  60. package/dist/shared/components/types.d.ts +0 -42
  61. package/dist/shared/hooks/index.d.ts +0 -1
  62. package/dist/shared/hooks/use-form-widget-state.d.ts +0 -12
  63. package/dist/shared/hooks/use-form.d.ts +0 -16
  64. package/dist/shared/index.d.ts +0 -4
  65. package/dist/shared-preact/components/annotations/form-checkbox.d.ts +0 -12
  66. package/dist/shared-preact/components/annotations/form-combobox.d.ts +0 -12
  67. package/dist/shared-preact/components/annotations/form-listbox.d.ts +0 -12
  68. package/dist/shared-preact/components/annotations/form-radio-button.d.ts +0 -12
  69. package/dist/shared-preact/components/annotations/form-text-field.d.ts +0 -12
  70. package/dist/shared-preact/components/fields/checkbox.d.ts +0 -2
  71. package/dist/shared-preact/components/fields/combobox.d.ts +0 -2
  72. package/dist/shared-preact/components/fields/listbox.d.ts +0 -2
  73. package/dist/shared-preact/components/fields/push-button.d.ts +0 -2
  74. package/dist/shared-preact/components/fields/radio-button.d.ts +0 -2
  75. package/dist/shared-preact/components/fields/style.d.ts +0 -6
  76. package/dist/shared-preact/components/fields/text.d.ts +0 -2
  77. package/dist/shared-preact/components/fill-mode/combobox-fill-mode.d.ts +0 -3
  78. package/dist/shared-preact/components/fill-mode/listbox-fill-mode.d.ts +0 -3
  79. package/dist/shared-preact/components/fill-mode/push-button-fill-mode.d.ts +0 -3
  80. package/dist/shared-preact/components/fill-mode/radio-button-fill-mode.d.ts +0 -3
  81. package/dist/shared-preact/components/fill-mode/text-fill-mode.d.ts +0 -3
  82. package/dist/shared-preact/components/fill-mode/toggle-fill-mode.d.ts +0 -3
  83. package/dist/shared-preact/components/form-renderer-registration.d.ts +0 -5
  84. package/dist/shared-preact/components/form-renderers.d.ts +0 -9
  85. package/dist/shared-preact/components/index.d.ts +0 -2
  86. package/dist/shared-preact/components/render-widget.d.ts +0 -12
  87. package/dist/shared-preact/components/types.d.ts +0 -42
  88. package/dist/shared-preact/hooks/index.d.ts +0 -1
  89. package/dist/shared-preact/hooks/use-form-widget-state.d.ts +0 -12
  90. package/dist/shared-preact/hooks/use-form.d.ts +0 -16
  91. package/dist/shared-preact/index.d.ts +0 -4
  92. package/dist/shared-react/components/annotations/form-checkbox.d.ts +0 -12
  93. package/dist/shared-react/components/annotations/form-combobox.d.ts +0 -12
  94. package/dist/shared-react/components/annotations/form-listbox.d.ts +0 -12
  95. package/dist/shared-react/components/annotations/form-radio-button.d.ts +0 -12
  96. package/dist/shared-react/components/annotations/form-text-field.d.ts +0 -12
  97. package/dist/shared-react/components/fields/checkbox.d.ts +0 -2
  98. package/dist/shared-react/components/fields/combobox.d.ts +0 -2
  99. package/dist/shared-react/components/fields/listbox.d.ts +0 -2
  100. package/dist/shared-react/components/fields/push-button.d.ts +0 -2
  101. package/dist/shared-react/components/fields/radio-button.d.ts +0 -2
  102. package/dist/shared-react/components/fields/style.d.ts +0 -6
  103. package/dist/shared-react/components/fields/text.d.ts +0 -2
  104. package/dist/shared-react/components/fill-mode/combobox-fill-mode.d.ts +0 -3
  105. package/dist/shared-react/components/fill-mode/listbox-fill-mode.d.ts +0 -3
  106. package/dist/shared-react/components/fill-mode/push-button-fill-mode.d.ts +0 -3
  107. package/dist/shared-react/components/fill-mode/radio-button-fill-mode.d.ts +0 -3
  108. package/dist/shared-react/components/fill-mode/text-fill-mode.d.ts +0 -3
  109. package/dist/shared-react/components/fill-mode/toggle-fill-mode.d.ts +0 -3
  110. package/dist/shared-react/components/form-renderer-registration.d.ts +0 -5
  111. package/dist/shared-react/components/form-renderers.d.ts +0 -9
  112. package/dist/shared-react/components/index.d.ts +0 -2
  113. package/dist/shared-react/components/render-widget.d.ts +0 -12
  114. package/dist/shared-react/components/types.d.ts +0 -42
  115. package/dist/shared-react/hooks/index.d.ts +0 -1
  116. package/dist/shared-react/hooks/use-form-widget-state.d.ts +0 -12
  117. package/dist/shared-react/hooks/use-form.d.ts +0 -16
  118. package/dist/shared-react/index.d.ts +0 -4
  119. package/dist/svelte/components/FormRendererRegistration.svelte.d.ts +0 -18
  120. package/dist/svelte/components/RenderWidget.svelte.d.ts +0 -11
  121. package/dist/svelte/components/annotations/FormCheckbox.svelte.d.ts +0 -5
  122. package/dist/svelte/components/annotations/FormCombobox.svelte.d.ts +0 -5
  123. package/dist/svelte/components/annotations/FormListbox.svelte.d.ts +0 -5
  124. package/dist/svelte/components/annotations/FormRadioButton.svelte.d.ts +0 -5
  125. package/dist/svelte/components/annotations/FormTextField.svelte.d.ts +0 -5
  126. package/dist/svelte/components/fields/ComboboxField.svelte.d.ts +0 -4
  127. package/dist/svelte/components/fields/ListboxField.svelte.d.ts +0 -4
  128. package/dist/svelte/components/fields/TextField.svelte.d.ts +0 -4
  129. package/dist/svelte/components/fill-mode/ComboboxFillMode.svelte.d.ts +0 -5
  130. package/dist/svelte/components/fill-mode/ListboxFillMode.svelte.d.ts +0 -5
  131. package/dist/svelte/components/fill-mode/RadioButtonFillMode.svelte.d.ts +0 -5
  132. package/dist/svelte/components/fill-mode/TextFillMode.svelte.d.ts +0 -5
  133. package/dist/svelte/components/fill-mode/ToggleFillMode.svelte.d.ts +0 -5
  134. package/dist/svelte/components/form-renderers.d.ts +0 -9
  135. package/dist/svelte/components/previews/CheckboxPreview.svelte.d.ts +0 -9
  136. package/dist/svelte/components/previews/ListboxPreview.svelte.d.ts +0 -9
  137. package/dist/svelte/components/previews/RadioButtonPreview.svelte.d.ts +0 -9
  138. package/dist/svelte/components/previews/TextFieldPreview.svelte.d.ts +0 -9
  139. package/dist/svelte/hooks/index.d.ts +0 -2
  140. package/dist/svelte/hooks/use-form-widget-state.svelte.d.ts +0 -12
  141. package/dist/svelte/hooks/use-form.svelte.d.ts +0 -14
  142. package/dist/svelte/index.cjs +0 -2
  143. package/dist/svelte/index.cjs.map +0 -1
  144. package/dist/svelte/index.d.ts +0 -3
  145. package/dist/svelte/index.js +0 -1567
  146. package/dist/svelte/index.js.map +0 -1
  147. package/dist/vue/components/annotations/form-checkbox.vue.d.ts +0 -6
  148. package/dist/vue/components/annotations/form-combobox.vue.d.ts +0 -6
  149. package/dist/vue/components/annotations/form-listbox.vue.d.ts +0 -6
  150. package/dist/vue/components/annotations/form-radio-button.vue.d.ts +0 -6
  151. package/dist/vue/components/annotations/form-text-field.vue.d.ts +0 -6
  152. package/dist/vue/components/fields/combobox-field.vue.d.ts +0 -4
  153. package/dist/vue/components/fields/listbox-field.vue.d.ts +0 -4
  154. package/dist/vue/components/fields/style.d.ts +0 -6
  155. package/dist/vue/components/fields/text-field.vue.d.ts +0 -4
  156. package/dist/vue/components/fill-mode/combobox-fill-mode.vue.d.ts +0 -6
  157. package/dist/vue/components/fill-mode/listbox-fill-mode.vue.d.ts +0 -6
  158. package/dist/vue/components/fill-mode/radio-button-fill-mode.vue.d.ts +0 -6
  159. package/dist/vue/components/fill-mode/text-fill-mode.vue.d.ts +0 -6
  160. package/dist/vue/components/fill-mode/toggle-fill-mode.vue.d.ts +0 -6
  161. package/dist/vue/components/form-renderer-registration.vue.d.ts +0 -13
  162. package/dist/vue/components/form-renderers.d.ts +0 -3
  163. package/dist/vue/components/previews/checkbox-preview.vue.d.ts +0 -10
  164. package/dist/vue/components/previews/listbox-preview.vue.d.ts +0 -10
  165. package/dist/vue/components/previews/radio-button-preview.vue.d.ts +0 -10
  166. package/dist/vue/components/previews/text-field-preview.vue.d.ts +0 -10
  167. package/dist/vue/components/render-widget.vue.d.ts +0 -15
  168. package/dist/vue/hooks/index.d.ts +0 -2
  169. package/dist/vue/hooks/use-form-widget-state.d.ts +0 -12
  170. package/dist/vue/hooks/use-form.d.ts +0 -12
  171. package/dist/vue/index.cjs +0 -2
  172. package/dist/vue/index.cjs.map +0 -1
  173. package/dist/vue/index.d.ts +0 -3
  174. package/dist/vue/index.js +0 -1643
  175. package/dist/vue/index.js.map +0 -1
package/dist/vue/index.js DELETED
@@ -1,1643 +0,0 @@
1
- import { createPluginPackage } from "@embedpdf/core";
2
- import { initialDocumentState, FormPlugin, FormPluginPackage as FormPluginPackage$1 } from "@embedpdf/plugin-form";
3
- export * from "@embedpdf/plugin-form";
4
- import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, toDisplayString, createElementVNode, createCommentVNode, watch, toValue, watchEffect, unref, createVNode, createBlock, renderSlot } from "vue";
5
- import { useIOSZoomPrevention, createRenderer, useRegisterRenderers } from "@embedpdf/plugin-annotation/vue";
6
- import { PDF_FORM_FIELD_TYPE, PDF_FORM_FIELD_FLAG, standardFontCssProperties, isWidgetChecked, ignore, PdfErrorCode, PdfAnnotationSubtype } from "@embedpdf/models";
7
- import { useCapability, usePlugin } from "@embedpdf/core/vue";
8
- import { deepToRaw } from "@embedpdf/utils/vue";
9
- const _hoisted_1$a = {
10
- key: 0,
11
- style: { "position": "relative", "width": "100%", "height": "100%" }
12
- };
13
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
14
- __name: "form-text-field",
15
- props: {
16
- annotation: {},
17
- currentObject: {},
18
- isSelected: { type: Boolean },
19
- isEditing: { type: Boolean },
20
- scale: {},
21
- pageIndex: {},
22
- documentId: {},
23
- onClick: { type: Function },
24
- appearanceActive: { type: Boolean }
25
- },
26
- setup(__props) {
27
- const props = __props;
28
- const isHovered = ref(false);
29
- const object = computed(() => props.currentObject);
30
- const field = computed(() => object.value.field);
31
- const isTextField = computed(() => field.value.type === PDF_FORM_FIELD_TYPE.TEXTFIELD);
32
- const value = computed(
33
- () => isTextField.value ? field.value.value : ""
34
- );
35
- const isComb = computed(
36
- () => isTextField.value && !!(field.value.flag & PDF_FORM_FIELD_FLAG.TEXT_COMB) && !!field.value.maxLen
37
- );
38
- const isMultiline = computed(
39
- () => isTextField.value && !!(field.value.flag & PDF_FORM_FIELD_FLAG.TEXT_MULTIPLINE)
40
- );
41
- const maxLen = computed(
42
- () => isTextField.value ? field.value.maxLen : void 0
43
- );
44
- const borderWidth = computed(() => (object.value.strokeWidth ?? 1) * props.scale);
45
- const fontCss = computed(() => standardFontCssProperties(object.value.fontFamily));
46
- const fontSize = computed(() => (object.value.fontSize ?? 12) * props.scale);
47
- const fontColor = computed(() => object.value.fontColor ?? "#000000");
48
- const cellWidth = computed(
49
- () => isComb.value && maxLen.value ? object.value.rect.size.width * props.scale / maxLen.value : 0
50
- );
51
- const chars = computed(() => (value.value ?? "").split(""));
52
- return (_ctx, _cache) => {
53
- return openBlock(), createElementBlock("div", {
54
- onPointerdown: _cache[0] || (_cache[0] = (e) => {
55
- var _a;
56
- if (!props.isSelected) (_a = props.onClick) == null ? void 0 : _a.call(props, e);
57
- }),
58
- onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
59
- onMouseleave: _cache[2] || (_cache[2] = ($event) => isHovered.value = false),
60
- style: normalizeStyle({
61
- position: "absolute",
62
- inset: "0",
63
- background: object.value.color ?? "rgba(255, 255, 255, 0.9)",
64
- border: `${borderWidth.value}px solid ${object.value.strokeColor ?? "rgba(0, 0, 0, 0.2)"}`,
65
- outline: isHovered.value || props.isSelected ? "1px solid rgba(66, 133, 244, 0.5)" : "none",
66
- outlineOffset: "-1px",
67
- boxSizing: "border-box",
68
- pointerEvents: "auto",
69
- cursor: props.isSelected ? "move" : "pointer",
70
- display: "flex",
71
- alignItems: isMultiline.value ? "flex-start" : "center",
72
- overflow: "hidden",
73
- padding: !isComb.value ? `${borderWidth.value}px ${borderWidth.value}px` : void 0
74
- })
75
- }, [
76
- isComb.value && maxLen.value ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
77
- (openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: maxLen.value }), (_, i) => {
78
- return openBlock(), createElementBlock("span", {
79
- key: i,
80
- style: normalizeStyle({
81
- position: "absolute",
82
- top: "0",
83
- left: `${i * cellWidth.value}px`,
84
- width: `${cellWidth.value}px`,
85
- height: "100%",
86
- display: "flex",
87
- alignItems: "center",
88
- justifyContent: "center",
89
- borderRight: i < maxLen.value - 1 ? `1px solid ${object.value.strokeColor ?? "rgba(0, 0, 0, 0.2)"}` : "none",
90
- boxSizing: "border-box",
91
- fontSize: `${fontSize.value}px`,
92
- fontFamily: fontCss.value.fontFamily,
93
- fontWeight: fontCss.value.fontWeight,
94
- fontStyle: fontCss.value.fontStyle,
95
- color: fontColor.value,
96
- lineHeight: "1.2"
97
- })
98
- }, toDisplayString(chars.value[i] || ""), 5);
99
- }), 128))
100
- ])) : (openBlock(), createElementBlock("span", {
101
- key: 1,
102
- style: normalizeStyle({
103
- fontSize: `${fontSize.value}px`,
104
- fontFamily: fontCss.value.fontFamily,
105
- fontWeight: fontCss.value.fontWeight,
106
- fontStyle: fontCss.value.fontStyle,
107
- color: fontColor.value,
108
- lineHeight: "1.2",
109
- display: "block",
110
- width: "100%",
111
- whiteSpace: isMultiline.value ? "pre-wrap" : "nowrap",
112
- wordBreak: isMultiline.value ? "break-word" : "normal",
113
- overflowWrap: isMultiline.value ? "break-word" : "normal",
114
- overflow: "hidden",
115
- textOverflow: isMultiline.value ? "clip" : "ellipsis"
116
- })
117
- }, toDisplayString(value.value), 5))
118
- ], 36);
119
- };
120
- }
121
- });
122
- const _hoisted_1$9 = {
123
- key: 0,
124
- viewBox: "0 0 100 100",
125
- style: { "width": "100%", "height": "100%" }
126
- };
127
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
128
- __name: "form-checkbox",
129
- props: {
130
- annotation: {},
131
- currentObject: {},
132
- isSelected: { type: Boolean },
133
- isEditing: { type: Boolean },
134
- scale: {},
135
- pageIndex: {},
136
- documentId: {},
137
- onClick: { type: Function },
138
- appearanceActive: { type: Boolean }
139
- },
140
- setup(__props) {
141
- const props = __props;
142
- const isHovered = ref(false);
143
- const object = computed(() => props.currentObject);
144
- const isChecked = computed(() => isWidgetChecked(object.value));
145
- const borderWidth = computed(() => (object.value.strokeWidth ?? 1) * props.scale);
146
- return (_ctx, _cache) => {
147
- return openBlock(), createElementBlock("div", {
148
- onPointerdown: _cache[0] || (_cache[0] = (e) => {
149
- var _a;
150
- if (!props.isSelected) (_a = props.onClick) == null ? void 0 : _a.call(props, e);
151
- }),
152
- onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
153
- onMouseleave: _cache[2] || (_cache[2] = ($event) => isHovered.value = false),
154
- style: normalizeStyle({
155
- position: "absolute",
156
- inset: "0",
157
- background: object.value.color ?? "#FFFFFF",
158
- border: `${borderWidth.value}px solid ${object.value.strokeColor ?? "#000000"}`,
159
- outline: isHovered.value || props.isSelected ? "1px solid rgba(66, 133, 244, 0.5)" : "none",
160
- outlineOffset: "-1px",
161
- boxSizing: "border-box",
162
- pointerEvents: "auto",
163
- cursor: props.isSelected ? "move" : "pointer",
164
- display: "flex",
165
- alignItems: "center",
166
- justifyContent: "center"
167
- })
168
- }, [
169
- isChecked.value ? (openBlock(), createElementBlock("svg", _hoisted_1$9, [..._cache[3] || (_cache[3] = [
170
- createElementVNode("path", {
171
- d: "M28 48C27.45 50.21 29.45 63.13 30 67C30.55 69.21 34.58 72 39 72C44.52 71.45 76.55 32.55 76 32C77.1 31.45 76 25 76 25C74.34 22.24 68 25.45 68 26C68 26 43.55 53 43 53C41.34 53 40.55 41.1 40 40C33.37 36.69 29.1 45.79 28 48Z",
172
- fill: "#000000"
173
- }, null, -1)
174
- ])])) : createCommentVNode("", true)
175
- ], 36);
176
- };
177
- }
178
- });
179
- const _hoisted_1$8 = {
180
- key: 0,
181
- style: {
182
- width: "50%",
183
- height: "50%",
184
- borderRadius: "50%",
185
- background: "#000000"
186
- }
187
- };
188
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
189
- __name: "form-radio-button",
190
- props: {
191
- annotation: {},
192
- currentObject: {},
193
- isSelected: { type: Boolean },
194
- isEditing: { type: Boolean },
195
- scale: {},
196
- pageIndex: {},
197
- documentId: {},
198
- onClick: { type: Function },
199
- appearanceActive: { type: Boolean }
200
- },
201
- setup(__props) {
202
- const props = __props;
203
- const isHovered = ref(false);
204
- const object = computed(() => props.currentObject);
205
- const isChecked = computed(() => isWidgetChecked(object.value));
206
- const borderWidth = computed(() => (object.value.strokeWidth ?? 1) * props.scale);
207
- return (_ctx, _cache) => {
208
- return openBlock(), createElementBlock("div", {
209
- onPointerdown: _cache[0] || (_cache[0] = (e) => {
210
- var _a;
211
- if (!props.isSelected) (_a = props.onClick) == null ? void 0 : _a.call(props, e);
212
- }),
213
- onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
214
- onMouseleave: _cache[2] || (_cache[2] = ($event) => isHovered.value = false),
215
- style: normalizeStyle({
216
- position: "absolute",
217
- inset: "0",
218
- background: object.value.color ?? "#FFFFFF",
219
- border: `${borderWidth.value}px solid ${object.value.strokeColor ?? "#000000"}`,
220
- borderRadius: "50%",
221
- outline: isHovered.value || props.isSelected ? "1px solid rgba(66, 133, 244, 0.5)" : "none",
222
- outlineOffset: "-1px",
223
- boxSizing: "border-box",
224
- pointerEvents: "auto",
225
- cursor: props.isSelected ? "move" : "pointer",
226
- display: "flex",
227
- alignItems: "center",
228
- justifyContent: "center"
229
- })
230
- }, [
231
- isChecked.value ? (openBlock(), createElementBlock("div", _hoisted_1$8)) : createCommentVNode("", true)
232
- ], 36);
233
- };
234
- }
235
- });
236
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
237
- __name: "form-combobox",
238
- props: {
239
- annotation: {},
240
- currentObject: {},
241
- isSelected: { type: Boolean },
242
- isEditing: { type: Boolean },
243
- scale: {},
244
- pageIndex: {},
245
- documentId: {},
246
- onClick: { type: Function },
247
- appearanceActive: { type: Boolean }
248
- },
249
- setup(__props) {
250
- const props = __props;
251
- const isHovered = ref(false);
252
- const object = computed(() => props.currentObject);
253
- const field = computed(() => object.value.field);
254
- const options = computed(
255
- () => field.value.type === PDF_FORM_FIELD_TYPE.COMBOBOX ? field.value.options : []
256
- );
257
- const selectedLabel = computed(() => {
258
- var _a;
259
- return ((_a = options.value.find((o) => o.isSelected)) == null ? void 0 : _a.label) ?? "";
260
- });
261
- const borderWidth = computed(() => (object.value.strokeWidth ?? 1) * props.scale);
262
- const fontSize = computed(() => (object.value.fontSize ?? 12) * props.scale);
263
- const fontCss = computed(() => standardFontCssProperties(object.value.fontFamily));
264
- return (_ctx, _cache) => {
265
- return openBlock(), createElementBlock("div", {
266
- onPointerdown: _cache[0] || (_cache[0] = (e) => {
267
- var _a;
268
- if (!props.isSelected) (_a = props.onClick) == null ? void 0 : _a.call(props, e);
269
- }),
270
- onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
271
- onMouseleave: _cache[2] || (_cache[2] = ($event) => isHovered.value = false),
272
- style: normalizeStyle({
273
- position: "absolute",
274
- inset: "0",
275
- background: object.value.color ?? "#FFFFFF",
276
- border: `${borderWidth.value}px solid ${object.value.strokeColor ?? "#000000"}`,
277
- outline: isHovered.value || props.isSelected ? "1px solid rgba(66, 133, 244, 0.5)" : "none",
278
- outlineOffset: "-1px",
279
- boxSizing: "border-box",
280
- pointerEvents: "auto",
281
- cursor: props.isSelected ? "move" : "pointer",
282
- display: "flex",
283
- alignItems: "center",
284
- overflow: "hidden"
285
- })
286
- }, [
287
- createElementVNode("span", {
288
- style: normalizeStyle({
289
- flex: "1",
290
- padding: `0 ${4 * props.scale}px`,
291
- fontSize: `${fontSize.value}px`,
292
- fontFamily: fontCss.value.fontFamily,
293
- fontWeight: fontCss.value.fontWeight,
294
- fontStyle: fontCss.value.fontStyle,
295
- color: object.value.fontColor ?? "#000000",
296
- whiteSpace: "nowrap",
297
- overflow: "hidden",
298
- textOverflow: "ellipsis"
299
- })
300
- }, toDisplayString(selectedLabel.value), 5),
301
- createElementVNode("div", {
302
- style: normalizeStyle({
303
- width: `${13 * props.scale}px`,
304
- minWidth: `${13 * props.scale}px`,
305
- height: "100%",
306
- display: "flex",
307
- alignItems: "center",
308
- justifyContent: "center",
309
- borderLeft: `1px solid ${object.value.strokeColor ?? "#000000"}`
310
- })
311
- }, [
312
- (openBlock(), createElementBlock("svg", {
313
- viewBox: "0 0 10 6",
314
- style: normalizeStyle({ width: `${8 * props.scale}px`, height: `${5 * props.scale}px` }),
315
- fill: "currentColor"
316
- }, [..._cache[3] || (_cache[3] = [
317
- createElementVNode("path", { d: "M0 0 L5 6 L10 0 Z" }, null, -1)
318
- ])], 4))
319
- ], 4)
320
- ], 36);
321
- };
322
- }
323
- });
324
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
325
- __name: "form-listbox",
326
- props: {
327
- annotation: {},
328
- currentObject: {},
329
- isSelected: { type: Boolean },
330
- isEditing: { type: Boolean },
331
- scale: {},
332
- pageIndex: {},
333
- documentId: {},
334
- onClick: { type: Function },
335
- appearanceActive: { type: Boolean }
336
- },
337
- setup(__props) {
338
- const props = __props;
339
- const isHovered = ref(false);
340
- const object = computed(() => props.currentObject);
341
- const field = computed(() => object.value.field);
342
- const options = computed(
343
- () => field.value.type === PDF_FORM_FIELD_TYPE.LISTBOX ? field.value.options : []
344
- );
345
- const borderWidth = computed(() => (object.value.strokeWidth ?? 1) * props.scale);
346
- const fontSize = computed(() => (object.value.fontSize ?? 12) * props.scale);
347
- const lineHeight = computed(() => fontSize.value * 1.2);
348
- const fontCss = computed(() => standardFontCssProperties(object.value.fontFamily));
349
- return (_ctx, _cache) => {
350
- return openBlock(), createElementBlock("div", {
351
- onPointerdown: _cache[0] || (_cache[0] = (e) => {
352
- var _a;
353
- if (!props.isSelected) (_a = props.onClick) == null ? void 0 : _a.call(props, e);
354
- }),
355
- onMouseenter: _cache[1] || (_cache[1] = ($event) => isHovered.value = true),
356
- onMouseleave: _cache[2] || (_cache[2] = ($event) => isHovered.value = false),
357
- style: normalizeStyle({
358
- position: "absolute",
359
- inset: "0",
360
- background: object.value.color ?? "#FFFFFF",
361
- border: `${borderWidth.value}px solid ${object.value.strokeColor ?? "#000000"}`,
362
- outline: isHovered.value || props.isSelected ? "1px solid rgba(66, 133, 244, 0.5)" : "none",
363
- outlineOffset: "-1px",
364
- boxSizing: "border-box",
365
- pointerEvents: "auto",
366
- cursor: props.isSelected ? "move" : "pointer",
367
- overflow: "hidden",
368
- display: "flex",
369
- flexDirection: "column"
370
- })
371
- }, [
372
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (opt, i) => {
373
- return openBlock(), createElementBlock("div", {
374
- key: i,
375
- style: normalizeStyle({
376
- padding: `0 ${4 * props.scale}px`,
377
- fontSize: `${fontSize.value}px`,
378
- lineHeight: `${lineHeight.value}px`,
379
- fontFamily: fontCss.value.fontFamily,
380
- fontWeight: fontCss.value.fontWeight,
381
- fontStyle: fontCss.value.fontStyle,
382
- color: opt.isSelected ? "#FFFFFF" : object.value.fontColor ?? "#000000",
383
- background: opt.isSelected ? "rgba(0, 51, 113, 1)" : "transparent",
384
- whiteSpace: "nowrap",
385
- overflow: "hidden",
386
- textOverflow: "ellipsis"
387
- })
388
- }, toDisplayString(opt.label), 5);
389
- }), 128))
390
- ], 36);
391
- };
392
- }
393
- });
394
- const useFormPlugin = () => usePlugin(FormPlugin.id);
395
- const useFormCapability = () => useCapability(FormPlugin.id);
396
- const useFormDocumentState = (documentId) => {
397
- const { provides } = useFormCapability();
398
- const state = ref({ ...initialDocumentState });
399
- watch(
400
- [provides, () => toValue(documentId)],
401
- ([providesValue, docId], _, onCleanup) => {
402
- if (providesValue && docId) {
403
- const scope = providesValue.forDocument(docId);
404
- state.value = scope.getState();
405
- const unsubscribe = scope.onStateChange((newState) => {
406
- state.value = newState;
407
- });
408
- onCleanup(unsubscribe);
409
- } else {
410
- state.value = { ...initialDocumentState };
411
- }
412
- },
413
- { immediate: true }
414
- );
415
- return {
416
- state,
417
- provides: computed(() => {
418
- var _a;
419
- return ((_a = provides.value) == null ? void 0 : _a.forDocument(toValue(documentId))) ?? null;
420
- })
421
- };
422
- };
423
- function useFormWidgetState(props) {
424
- const { provides: formProvides } = useFormCapability();
425
- const renderKey = ref(0);
426
- const scope = computed(() => {
427
- var _a;
428
- return ((_a = formProvides.value) == null ? void 0 : _a.forDocument(props.documentId)) ?? null;
429
- });
430
- const annotation = computed(() => props.currentObject);
431
- const field = computed(() => annotation.value.field);
432
- const scale = computed(() => props.scale);
433
- const pageIndex = computed(() => props.pageIndex);
434
- const isReadOnly = computed(() => !!(field.value.flag & PDF_FORM_FIELD_FLAG.READONLY));
435
- watchEffect((onCleanup) => {
436
- const s = scope.value;
437
- if (!s) return;
438
- const id = annotation.value.id;
439
- const unsubscribe = s.onFieldValueChange((event) => {
440
- if (event.annotationId === id) {
441
- renderKey.value++;
442
- }
443
- });
444
- onCleanup(unsubscribe);
445
- });
446
- function handleChangeField(newField) {
447
- const s = scope.value;
448
- if (!s) return;
449
- s.setFormFieldValues(pageIndex.value, annotation.value, newField);
450
- }
451
- return {
452
- annotation,
453
- field,
454
- scale,
455
- pageIndex,
456
- scope,
457
- handleChangeField,
458
- renderKey,
459
- isReadOnly
460
- };
461
- }
462
- const _hoisted_1$7 = ["src"];
463
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
464
- __name: "render-widget",
465
- props: {
466
- pageIndex: {},
467
- annotation: {},
468
- scaleFactor: { default: 1 },
469
- renderKey: { default: 0 },
470
- style: { default: () => ({}) }
471
- },
472
- setup(__props) {
473
- const props = __props;
474
- const { provides: formProvides } = useFormCapability();
475
- const imageUrl = ref(null);
476
- let prevUrl = null;
477
- const annotationId = computed(() => props.annotation.id);
478
- const rectWidth = computed(() => props.annotation.rect.size.width);
479
- const rectHeight = computed(() => props.annotation.rect.size.height);
480
- watch(
481
- () => [
482
- props.pageIndex,
483
- props.scaleFactor,
484
- props.renderKey,
485
- annotationId.value,
486
- rectWidth.value,
487
- rectHeight.value,
488
- formProvides.value
489
- ],
490
- (_, __, onCleanup) => {
491
- const fp = formProvides.value;
492
- if (!fp) return;
493
- const task = fp.renderWidget({
494
- pageIndex: props.pageIndex,
495
- annotation: deepToRaw(props.annotation),
496
- options: {
497
- scaleFactor: props.scaleFactor,
498
- dpr: window.devicePixelRatio
499
- }
500
- });
501
- task.wait((blob) => {
502
- const url = URL.createObjectURL(blob);
503
- if (prevUrl) {
504
- URL.revokeObjectURL(prevUrl);
505
- }
506
- prevUrl = url;
507
- imageUrl.value = url;
508
- }, ignore);
509
- onCleanup(() => {
510
- task.abort({
511
- code: PdfErrorCode.Cancelled,
512
- message: "canceled render task"
513
- });
514
- if (prevUrl) {
515
- URL.revokeObjectURL(prevUrl);
516
- prevUrl = null;
517
- }
518
- });
519
- },
520
- { immediate: true }
521
- );
522
- return (_ctx, _cache) => {
523
- return imageUrl.value ? (openBlock(), createElementBlock("img", {
524
- key: 0,
525
- src: imageUrl.value,
526
- alt: "",
527
- style: normalizeStyle({ width: "100%", height: "100%", display: "block", ...__props.style })
528
- }, null, 12, _hoisted_1$7)) : createCommentVNode("", true);
529
- };
530
- }
531
- });
532
- const baseStyle = {
533
- position: "absolute",
534
- top: 0,
535
- left: 0,
536
- padding: 0,
537
- margin: 0,
538
- width: "100%",
539
- height: "100%"
540
- };
541
- const baseInputStyle = {
542
- ...baseStyle,
543
- borderRadius: 0,
544
- outline: "none",
545
- boxSizing: "border-box"
546
- };
547
- const inputStyle = baseInputStyle;
548
- const selectStyle = {
549
- ...baseInputStyle,
550
- cursor: "inherit"
551
- };
552
- const textareaStyle = {
553
- ...baseInputStyle,
554
- resize: "none",
555
- lineHeight: 1.14
556
- };
557
- const _hoisted_1$6 = ["required", "disabled", "type", "name", "aria-label", "value", "maxlength"];
558
- const _hoisted_2$1 = ["required", "disabled", "type", "name", "aria-label", "value", "maxlength"];
559
- const _hoisted_3 = ["required", "disabled", "name", "aria-label", "value", "maxlength"];
560
- const _hoisted_4 = ["required", "disabled", "name", "aria-label", "value", "maxlength"];
561
- const _hoisted_5 = ["required", "disabled", "type", "name", "aria-label", "value", "maxlength"];
562
- const _hoisted_6 = ["required", "disabled", "type", "name", "aria-label", "value", "maxlength"];
563
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
564
- __name: "text-field",
565
- props: {
566
- scale: {},
567
- pageIndex: {},
568
- isEditable: { type: Boolean },
569
- onChangeField: { type: Function },
570
- onFocus: { type: Function },
571
- onBlur: { type: Function },
572
- inputRef: { type: Function },
573
- syncExternalValue: { type: Boolean },
574
- annotation: {}
575
- },
576
- setup(__props) {
577
- const props = __props;
578
- const field = computed(() => props.annotation.field);
579
- const flag = computed(() => field.value.flag);
580
- const name = computed(() => field.value.name);
581
- const value = computed(() => field.value.value);
582
- const localValue = ref(value.value);
583
- watch(value, (v) => {
584
- if (!props.syncExternalValue) return;
585
- localValue.value = v;
586
- });
587
- function changeValue(evt) {
588
- var _a;
589
- const newValue = evt.target.value;
590
- localValue.value = newValue;
591
- (_a = props.onChangeField) == null ? void 0 : _a.call(props, { ...field.value, value: newValue });
592
- }
593
- const bw = computed(() => (props.annotation.strokeWidth ?? 0) * props.scale);
594
- const fontCss = computed(() => standardFontCssProperties(props.annotation.fontFamily));
595
- const computedFontPx = computed(() => props.annotation.fontSize * props.scale);
596
- const iosCompensation = useIOSZoomPrevention(computedFontPx, true);
597
- const visualStyle = computed(() => ({
598
- backgroundColor: props.annotation.color ?? "transparent",
599
- borderStyle: "solid",
600
- borderColor: props.annotation.strokeColor ?? "transparent",
601
- borderWidth: `${bw.value}px`,
602
- color: props.annotation.fontColor,
603
- ...fontCss.value,
604
- fontSize: `${iosCompensation.value.adjustedFontPx}px`,
605
- padding: `${bw.value}px ${bw.value}px`
606
- }));
607
- const isDisabled = computed(
608
- () => !props.isEditable || !!(flag.value & PDF_FORM_FIELD_FLAG.READONLY)
609
- );
610
- const isRequired = computed(() => !!(flag.value & PDF_FORM_FIELD_FLAG.REQUIRED));
611
- const isPassword = computed(() => !!(flag.value & PDF_FORM_FIELD_FLAG.TEXT_PASSWORD));
612
- const isMultipleLine = computed(() => !!(flag.value & PDF_FORM_FIELD_FLAG.TEXT_MULTIPLINE));
613
- const isComb = computed(() => !!(flag.value & PDF_FORM_FIELD_FLAG.TEXT_COMB));
614
- const maxLen = computed(() => field.value.maxLen);
615
- const cellWidth = computed(
616
- () => isComb.value && maxLen.value ? props.annotation.rect.size.width * props.scale / maxLen.value : 0
617
- );
618
- const chars = computed(() => (localValue.value || "").split(""));
619
- const caretIndex = computed(() => chars.value.length);
620
- const caretVisible = ref(true);
621
- let caretInterval;
622
- watch(
623
- caretIndex,
624
- () => {
625
- caretVisible.value = true;
626
- clearInterval(caretInterval);
627
- caretInterval = setInterval(() => {
628
- caretVisible.value = !caretVisible.value;
629
- }, 530);
630
- },
631
- { immediate: true }
632
- );
633
- const combContainerStyle = computed(() => ({
634
- position: "relative",
635
- width: "100%",
636
- height: "100%",
637
- borderRadius: 0,
638
- boxSizing: "border-box",
639
- backgroundColor: props.annotation.color ?? "transparent",
640
- borderStyle: "solid",
641
- borderColor: props.annotation.strokeColor ?? "transparent",
642
- borderWidth: `${bw.value}px`
643
- }));
644
- const cellFontStyle = computed(() => ({
645
- color: props.annotation.fontColor,
646
- ...fontCss.value,
647
- fontSize: `${iosCompensation.value.adjustedFontPx}px`
648
- }));
649
- function setInputRef(el) {
650
- var _a;
651
- (_a = props.inputRef) == null ? void 0 : _a.call(props, el);
652
- }
653
- return (_ctx, _cache) => {
654
- return isComb.value && maxLen.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
655
- unref(iosCompensation).wrapperStyle ? (openBlock(), createElementBlock("div", {
656
- key: 0,
657
- style: normalizeStyle(unref(iosCompensation).wrapperStyle)
658
- }, [
659
- createElementVNode("div", {
660
- style: normalizeStyle(combContainerStyle.value)
661
- }, [
662
- createElementVNode("input", {
663
- ref: setInputRef,
664
- required: isRequired.value,
665
- disabled: isDisabled.value,
666
- type: isPassword.value ? "password" : "text",
667
- name: name.value,
668
- "aria-label": name.value,
669
- value: localValue.value,
670
- maxlength: maxLen.value,
671
- onFocus: _cache[0] || (_cache[0] = ($event) => {
672
- var _a;
673
- return (_a = props.onFocus) == null ? void 0 : _a.call(props);
674
- }),
675
- onInput: changeValue,
676
- onBlur: _cache[1] || (_cache[1] = ($event) => {
677
- var _a;
678
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
679
- }),
680
- style: {
681
- position: "absolute",
682
- top: 0,
683
- left: 0,
684
- width: "100%",
685
- height: "100%",
686
- opacity: 0,
687
- padding: 0,
688
- margin: 0,
689
- border: "none",
690
- zIndex: 1
691
- }
692
- }, null, 40, _hoisted_1$6),
693
- (openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: maxLen.value }), (_, i) => {
694
- return openBlock(), createElementBlock("span", {
695
- key: i,
696
- style: normalizeStyle({
697
- ...cellFontStyle.value,
698
- position: "absolute",
699
- top: 0,
700
- height: "100%",
701
- display: "flex",
702
- alignItems: "center",
703
- justifyContent: "center",
704
- pointerEvents: "none",
705
- left: `${i * cellWidth.value}px`,
706
- width: `${cellWidth.value}px`
707
- })
708
- }, toDisplayString(chars.value[i] || ""), 5);
709
- }), 128)),
710
- caretIndex.value < maxLen.value ? (openBlock(), createElementBlock("span", {
711
- key: 0,
712
- style: normalizeStyle({
713
- position: "absolute",
714
- top: "15%",
715
- height: "70%",
716
- width: "1px",
717
- backgroundColor: "black",
718
- pointerEvents: "none",
719
- left: `${caretIndex.value * cellWidth.value + cellWidth.value / 2}px`,
720
- opacity: caretVisible.value ? 1 : 0
721
- })
722
- }, null, 4)) : createCommentVNode("", true)
723
- ], 4)
724
- ], 4)) : (openBlock(), createElementBlock("div", {
725
- key: 1,
726
- style: normalizeStyle(combContainerStyle.value)
727
- }, [
728
- createElementVNode("input", {
729
- ref: setInputRef,
730
- required: isRequired.value,
731
- disabled: isDisabled.value,
732
- type: isPassword.value ? "password" : "text",
733
- name: name.value,
734
- "aria-label": name.value,
735
- value: localValue.value,
736
- maxlength: maxLen.value,
737
- onFocus: _cache[2] || (_cache[2] = ($event) => {
738
- var _a;
739
- return (_a = props.onFocus) == null ? void 0 : _a.call(props);
740
- }),
741
- onInput: changeValue,
742
- onBlur: _cache[3] || (_cache[3] = ($event) => {
743
- var _a;
744
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
745
- }),
746
- style: {
747
- position: "absolute",
748
- top: 0,
749
- left: 0,
750
- width: "100%",
751
- height: "100%",
752
- opacity: 0,
753
- padding: 0,
754
- margin: 0,
755
- border: "none",
756
- zIndex: 1
757
- }
758
- }, null, 40, _hoisted_2$1),
759
- (openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: maxLen.value }), (_, i) => {
760
- return openBlock(), createElementBlock("span", {
761
- key: i,
762
- style: normalizeStyle({
763
- ...cellFontStyle.value,
764
- position: "absolute",
765
- top: 0,
766
- height: "100%",
767
- display: "flex",
768
- alignItems: "center",
769
- justifyContent: "center",
770
- pointerEvents: "none",
771
- left: `${i * cellWidth.value}px`,
772
- width: `${cellWidth.value}px`
773
- })
774
- }, toDisplayString(chars.value[i] || ""), 5);
775
- }), 128)),
776
- caretIndex.value < maxLen.value ? (openBlock(), createElementBlock("span", {
777
- key: 0,
778
- style: normalizeStyle({
779
- position: "absolute",
780
- top: "15%",
781
- height: "70%",
782
- width: "1px",
783
- backgroundColor: "black",
784
- pointerEvents: "none",
785
- left: `${caretIndex.value * cellWidth.value + cellWidth.value / 2}px`,
786
- opacity: caretVisible.value ? 1 : 0
787
- })
788
- }, null, 4)) : createCommentVNode("", true)
789
- ], 4))
790
- ], 64)) : isMultipleLine.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
791
- unref(iosCompensation).wrapperStyle ? (openBlock(), createElementBlock("div", {
792
- key: 0,
793
- style: normalizeStyle(unref(iosCompensation).wrapperStyle)
794
- }, [
795
- createElementVNode("textarea", {
796
- ref: setInputRef,
797
- required: isRequired.value,
798
- disabled: isDisabled.value,
799
- name: name.value,
800
- "aria-label": name.value,
801
- value: localValue.value,
802
- maxlength: maxLen.value,
803
- onFocus: _cache[4] || (_cache[4] = ($event) => {
804
- var _a;
805
- return (_a = props.onFocus) == null ? void 0 : _a.call(props);
806
- }),
807
- onInput: changeValue,
808
- onBlur: _cache[5] || (_cache[5] = ($event) => {
809
- var _a;
810
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
811
- }),
812
- style: normalizeStyle({ ...unref(textareaStyle), ...visualStyle.value })
813
- }, null, 44, _hoisted_3)
814
- ], 4)) : (openBlock(), createElementBlock("textarea", {
815
- key: 1,
816
- ref: setInputRef,
817
- required: isRequired.value,
818
- disabled: isDisabled.value,
819
- name: name.value,
820
- "aria-label": name.value,
821
- value: localValue.value,
822
- maxlength: maxLen.value,
823
- onFocus: _cache[6] || (_cache[6] = ($event) => {
824
- var _a;
825
- return (_a = props.onFocus) == null ? void 0 : _a.call(props);
826
- }),
827
- onInput: changeValue,
828
- onBlur: _cache[7] || (_cache[7] = ($event) => {
829
- var _a;
830
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
831
- }),
832
- style: normalizeStyle({ ...unref(textareaStyle), ...visualStyle.value })
833
- }, null, 44, _hoisted_4))
834
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
835
- unref(iosCompensation).wrapperStyle ? (openBlock(), createElementBlock("div", {
836
- key: 0,
837
- style: normalizeStyle(unref(iosCompensation).wrapperStyle)
838
- }, [
839
- createElementVNode("input", {
840
- ref: setInputRef,
841
- required: isRequired.value,
842
- disabled: isDisabled.value,
843
- type: isPassword.value ? "password" : "text",
844
- name: name.value,
845
- "aria-label": name.value,
846
- value: localValue.value,
847
- maxlength: maxLen.value,
848
- onFocus: _cache[8] || (_cache[8] = ($event) => {
849
- var _a;
850
- return (_a = props.onFocus) == null ? void 0 : _a.call(props);
851
- }),
852
- onInput: changeValue,
853
- onBlur: _cache[9] || (_cache[9] = ($event) => {
854
- var _a;
855
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
856
- }),
857
- style: normalizeStyle({ ...unref(inputStyle), ...visualStyle.value })
858
- }, null, 44, _hoisted_5)
859
- ], 4)) : (openBlock(), createElementBlock("input", {
860
- key: 1,
861
- ref: setInputRef,
862
- required: isRequired.value,
863
- disabled: isDisabled.value,
864
- type: isPassword.value ? "password" : "text",
865
- name: name.value,
866
- "aria-label": name.value,
867
- value: localValue.value,
868
- maxlength: maxLen.value,
869
- onFocus: _cache[10] || (_cache[10] = ($event) => {
870
- var _a;
871
- return (_a = props.onFocus) == null ? void 0 : _a.call(props);
872
- }),
873
- onInput: changeValue,
874
- onBlur: _cache[11] || (_cache[11] = ($event) => {
875
- var _a;
876
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
877
- }),
878
- style: normalizeStyle({ ...unref(inputStyle), ...visualStyle.value })
879
- }, null, 44, _hoisted_6))
880
- ], 64));
881
- };
882
- }
883
- });
884
- const _hoisted_1$5 = { style: {
885
- width: "100%",
886
- height: "100%",
887
- overflow: "hidden",
888
- position: "relative",
889
- pointerEvents: "auto",
890
- outline: "none"
891
- } };
892
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
893
- __name: "text-fill-mode",
894
- props: {
895
- annotation: {},
896
- currentObject: {},
897
- isSelected: { type: Boolean },
898
- isEditing: { type: Boolean },
899
- scale: {},
900
- pageIndex: {},
901
- documentId: {},
902
- onClick: { type: Function },
903
- appearanceActive: { type: Boolean }
904
- },
905
- setup(__props) {
906
- const props = __props;
907
- const ws = useFormWidgetState(props);
908
- const { state: formState } = useFormDocumentState(() => props.documentId);
909
- const editing = ref(false);
910
- const inputEl = ref(null);
911
- const isFocused = computed(() => formState.value.selectedFieldId === ws.annotation.value.id);
912
- watch(isFocused, (focused) => {
913
- if (focused && inputEl.value && document.activeElement !== inputEl.value) {
914
- inputEl.value.focus();
915
- }
916
- });
917
- function handleFocus() {
918
- var _a;
919
- if (ws.isReadOnly.value) return;
920
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
921
- editing.value = true;
922
- }
923
- function handleBlur() {
924
- var _a, _b;
925
- editing.value = false;
926
- if (((_a = ws.scope.value) == null ? void 0 : _a.getSelectedFieldId()) === ws.annotation.value.id) {
927
- (_b = ws.scope.value) == null ? void 0 : _b.deselectField();
928
- }
929
- }
930
- function handleInputRef(el) {
931
- inputEl.value = el;
932
- }
933
- return (_ctx, _cache) => {
934
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
935
- createVNode(_sfc_main$d, {
936
- pageIndex: unref(ws).pageIndex.value,
937
- annotation: unref(ws).annotation.value,
938
- scaleFactor: unref(ws).scale.value,
939
- renderKey: unref(ws).renderKey.value,
940
- style: normalizeStyle({
941
- position: "absolute",
942
- inset: "0",
943
- pointerEvents: "none",
944
- visibility: editing.value ? "hidden" : "visible"
945
- })
946
- }, null, 8, ["pageIndex", "annotation", "scaleFactor", "renderKey", "style"]),
947
- createElementVNode("div", {
948
- style: normalizeStyle({
949
- position: "absolute",
950
- inset: "0",
951
- zIndex: 1,
952
- opacity: editing.value ? 1 : 0
953
- })
954
- }, [
955
- createVNode(_sfc_main$c, {
956
- annotation: unref(ws).annotation.value,
957
- scale: unref(ws).scale.value,
958
- pageIndex: unref(ws).pageIndex.value,
959
- isEditable: true,
960
- onChangeField: unref(ws).handleChangeField,
961
- syncExternalValue: !editing.value,
962
- onFocus: handleFocus,
963
- onBlur: handleBlur,
964
- inputRef: handleInputRef
965
- }, null, 8, ["annotation", "scale", "pageIndex", "onChangeField", "syncExternalValue"])
966
- ], 4)
967
- ]);
968
- };
969
- }
970
- });
971
- const _hoisted_1$4 = ["tabindex"];
972
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
973
- __name: "toggle-fill-mode",
974
- props: {
975
- annotation: {},
976
- currentObject: {},
977
- isSelected: { type: Boolean },
978
- isEditing: { type: Boolean },
979
- scale: {},
980
- pageIndex: {},
981
- documentId: {},
982
- onClick: { type: Function },
983
- appearanceActive: { type: Boolean }
984
- },
985
- setup(__props) {
986
- const props = __props;
987
- const ws = useFormWidgetState(props);
988
- const { state: formState } = useFormDocumentState(() => props.documentId);
989
- const wrapperEl = ref(null);
990
- const isFocused = computed(() => formState.value.selectedFieldId === ws.annotation.value.id);
991
- watch(isFocused, (focused) => {
992
- if (focused && wrapperEl.value && document.activeElement !== wrapperEl.value) {
993
- wrapperEl.value.focus();
994
- }
995
- });
996
- function toggle() {
997
- if (ws.isReadOnly.value) return;
998
- const checked = isWidgetChecked(ws.annotation.value);
999
- const newValue = checked ? "Off" : ws.annotation.value.exportValue ?? "Yes";
1000
- ws.handleChangeField({ ...ws.field.value, value: newValue });
1001
- }
1002
- function handleClick() {
1003
- var _a;
1004
- if (ws.isReadOnly.value) return;
1005
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
1006
- toggle();
1007
- }
1008
- function handleFocus() {
1009
- var _a;
1010
- if (ws.isReadOnly.value) return;
1011
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
1012
- }
1013
- function handleBlur() {
1014
- var _a, _b;
1015
- if (((_a = ws.scope.value) == null ? void 0 : _a.getSelectedFieldId()) === ws.annotation.value.id) {
1016
- (_b = ws.scope.value) == null ? void 0 : _b.deselectField();
1017
- }
1018
- }
1019
- function handleKeyDown(e) {
1020
- if (e.key === " " || e.key === "Enter") {
1021
- e.preventDefault();
1022
- toggle();
1023
- }
1024
- }
1025
- return (_ctx, _cache) => {
1026
- return openBlock(), createElementBlock("div", {
1027
- ref_key: "wrapperEl",
1028
- ref: wrapperEl,
1029
- tabindex: unref(ws).isReadOnly.value ? -1 : 0,
1030
- onClick: handleClick,
1031
- onFocus: handleFocus,
1032
- onBlur: handleBlur,
1033
- onKeydown: handleKeyDown,
1034
- style: normalizeStyle({
1035
- width: "100%",
1036
- height: "100%",
1037
- overflow: "hidden",
1038
- cursor: unref(ws).isReadOnly.value ? "default" : "pointer",
1039
- pointerEvents: "auto",
1040
- outline: isFocused.value ? "2px solid rgba(66, 133, 244, 0.8)" : "none",
1041
- outlineOffset: "-2px"
1042
- })
1043
- }, [
1044
- createVNode(_sfc_main$d, {
1045
- pageIndex: unref(ws).pageIndex.value,
1046
- annotation: unref(ws).annotation.value,
1047
- scaleFactor: unref(ws).scale.value,
1048
- renderKey: unref(ws).renderKey.value,
1049
- style: { pointerEvents: "none" }
1050
- }, null, 8, ["pageIndex", "annotation", "scaleFactor", "renderKey"])
1051
- ], 44, _hoisted_1$4);
1052
- };
1053
- }
1054
- });
1055
- const _hoisted_1$3 = ["tabindex"];
1056
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1057
- __name: "radio-button-fill-mode",
1058
- props: {
1059
- annotation: {},
1060
- currentObject: {},
1061
- isSelected: { type: Boolean },
1062
- isEditing: { type: Boolean },
1063
- scale: {},
1064
- pageIndex: {},
1065
- documentId: {},
1066
- onClick: { type: Function },
1067
- appearanceActive: { type: Boolean }
1068
- },
1069
- setup(__props) {
1070
- const props = __props;
1071
- const ws = useFormWidgetState(props);
1072
- const { state: formState } = useFormDocumentState(() => props.documentId);
1073
- const wrapperEl = ref(null);
1074
- const isFocused = computed(() => formState.value.selectedFieldId === ws.annotation.value.id);
1075
- watch(isFocused, (focused) => {
1076
- if (focused && wrapperEl.value && document.activeElement !== wrapperEl.value) {
1077
- wrapperEl.value.focus();
1078
- }
1079
- });
1080
- function selectRadio() {
1081
- if (ws.isReadOnly.value) return;
1082
- if (!isWidgetChecked(ws.annotation.value) && ws.annotation.value.exportValue) {
1083
- ws.handleChangeField({ ...ws.field.value, value: ws.annotation.value.exportValue });
1084
- }
1085
- }
1086
- function handleClick() {
1087
- var _a;
1088
- if (ws.isReadOnly.value) return;
1089
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
1090
- selectRadio();
1091
- }
1092
- function handleFocus() {
1093
- var _a;
1094
- if (ws.isReadOnly.value) return;
1095
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
1096
- }
1097
- function handleBlur() {
1098
- var _a, _b;
1099
- if (((_a = ws.scope.value) == null ? void 0 : _a.getSelectedFieldId()) === ws.annotation.value.id) {
1100
- (_b = ws.scope.value) == null ? void 0 : _b.deselectField();
1101
- }
1102
- }
1103
- function handleKeyDown(e) {
1104
- if (e.key === " " || e.key === "Enter") {
1105
- e.preventDefault();
1106
- selectRadio();
1107
- }
1108
- }
1109
- return (_ctx, _cache) => {
1110
- return openBlock(), createElementBlock("div", {
1111
- ref_key: "wrapperEl",
1112
- ref: wrapperEl,
1113
- tabindex: unref(ws).isReadOnly.value ? -1 : 0,
1114
- onClick: handleClick,
1115
- onFocus: handleFocus,
1116
- onBlur: handleBlur,
1117
- onKeydown: handleKeyDown,
1118
- style: normalizeStyle({
1119
- width: "100%",
1120
- height: "100%",
1121
- overflow: "hidden",
1122
- cursor: unref(ws).isReadOnly.value ? "default" : "pointer",
1123
- pointerEvents: "auto",
1124
- outline: isFocused.value ? "2px solid rgba(66, 133, 244, 0.8)" : "none",
1125
- outlineOffset: "-2px"
1126
- })
1127
- }, [
1128
- createVNode(_sfc_main$d, {
1129
- pageIndex: unref(ws).pageIndex.value,
1130
- annotation: unref(ws).annotation.value,
1131
- scaleFactor: unref(ws).scale.value,
1132
- renderKey: unref(ws).renderKey.value,
1133
- style: { pointerEvents: "none" }
1134
- }, null, 8, ["pageIndex", "annotation", "scaleFactor", "renderKey"])
1135
- ], 44, _hoisted_1$3);
1136
- };
1137
- }
1138
- });
1139
- const _hoisted_1$2 = ["required", "disabled", "name", "aria-label"];
1140
- const _hoisted_2 = ["value", "selected"];
1141
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1142
- __name: "combobox-field",
1143
- props: {
1144
- scale: {},
1145
- pageIndex: {},
1146
- isEditable: { type: Boolean },
1147
- onChangeField: { type: Function },
1148
- onFocus: { type: Function },
1149
- onBlur: { type: Function },
1150
- inputRef: { type: Function },
1151
- syncExternalValue: { type: Boolean },
1152
- annotation: {}
1153
- },
1154
- setup(__props) {
1155
- const props = __props;
1156
- const field = computed(() => props.annotation.field);
1157
- const flag = computed(() => field.value.flag);
1158
- const options = computed(() => field.value.options);
1159
- const name = computed(() => field.value.alternateName || field.value.name);
1160
- const isDisabled = computed(
1161
- () => !props.isEditable || !!(flag.value & PDF_FORM_FIELD_FLAG.READONLY)
1162
- );
1163
- const isRequired = computed(() => !!(flag.value & PDF_FORM_FIELD_FLAG.REQUIRED));
1164
- const selectedIndex = computed(() => options.value.findIndex((o) => o.isSelected));
1165
- function handleChange(evt) {
1166
- var _a;
1167
- const select = evt.target;
1168
- const updatedOptions = options.value.map((opt, i) => ({
1169
- ...opt,
1170
- isSelected: i === select.selectedIndex
1171
- }));
1172
- (_a = props.onChangeField) == null ? void 0 : _a.call(props, { ...field.value, options: updatedOptions });
1173
- }
1174
- function setInputRef(el) {
1175
- var _a;
1176
- (_a = props.inputRef) == null ? void 0 : _a.call(props, el);
1177
- }
1178
- return (_ctx, _cache) => {
1179
- return openBlock(), createElementBlock("select", {
1180
- ref: setInputRef,
1181
- required: isRequired.value,
1182
- disabled: isDisabled.value,
1183
- name: name.value,
1184
- "aria-label": name.value,
1185
- onChange: handleChange,
1186
- onBlur: _cache[0] || (_cache[0] = ($event) => {
1187
- var _a;
1188
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
1189
- }),
1190
- style: normalizeStyle({ ...unref(selectStyle), opacity: 0 })
1191
- }, [
1192
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option, index) => {
1193
- return openBlock(), createElementBlock("option", {
1194
- key: index,
1195
- value: option.label,
1196
- selected: index === selectedIndex.value
1197
- }, toDisplayString(option.label), 9, _hoisted_2);
1198
- }), 128))
1199
- ], 44, _hoisted_1$2);
1200
- };
1201
- }
1202
- });
1203
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1204
- __name: "combobox-fill-mode",
1205
- props: {
1206
- annotation: {},
1207
- currentObject: {},
1208
- isSelected: { type: Boolean },
1209
- isEditing: { type: Boolean },
1210
- scale: {},
1211
- pageIndex: {},
1212
- documentId: {},
1213
- onClick: { type: Function },
1214
- appearanceActive: { type: Boolean }
1215
- },
1216
- setup(__props) {
1217
- const props = __props;
1218
- const ws = useFormWidgetState(props);
1219
- const { state: formState } = useFormDocumentState(() => props.documentId);
1220
- const wrapperEl = ref(null);
1221
- const selectEl = ref(null);
1222
- const isFocused = computed(() => formState.value.selectedFieldId === ws.annotation.value.id);
1223
- watch(isFocused, (focused) => {
1224
- if (focused && wrapperEl.value && !wrapperEl.value.contains(document.activeElement)) {
1225
- (selectEl.value ?? wrapperEl.value).focus();
1226
- }
1227
- });
1228
- function handleFocus() {
1229
- var _a;
1230
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
1231
- }
1232
- function handleBlur() {
1233
- requestAnimationFrame(() => {
1234
- var _a, _b, _c;
1235
- if ((_a = wrapperEl.value) == null ? void 0 : _a.contains(document.activeElement)) return;
1236
- if (((_b = ws.scope.value) == null ? void 0 : _b.getSelectedFieldId()) === ws.annotation.value.id) {
1237
- (_c = ws.scope.value) == null ? void 0 : _c.deselectField();
1238
- }
1239
- });
1240
- }
1241
- function selectInputRef(el) {
1242
- selectEl.value = el;
1243
- }
1244
- return (_ctx, _cache) => {
1245
- return openBlock(), createElementBlock("div", {
1246
- ref_key: "wrapperEl",
1247
- ref: wrapperEl,
1248
- onFocus: handleFocus,
1249
- onBlur: handleBlur,
1250
- style: normalizeStyle({
1251
- width: "100%",
1252
- height: "100%",
1253
- overflow: "hidden",
1254
- cursor: unref(ws).isReadOnly.value ? "default" : "pointer",
1255
- pointerEvents: "auto",
1256
- outline: isFocused.value ? "2px solid rgba(66, 133, 244, 0.8)" : "none",
1257
- outlineOffset: "-2px"
1258
- })
1259
- }, [
1260
- createVNode(_sfc_main$d, {
1261
- pageIndex: unref(ws).pageIndex.value,
1262
- annotation: unref(ws).annotation.value,
1263
- scaleFactor: unref(ws).scale.value,
1264
- renderKey: unref(ws).renderKey.value,
1265
- style: { pointerEvents: "none" }
1266
- }, null, 8, ["pageIndex", "annotation", "scaleFactor", "renderKey"]),
1267
- createVNode(_sfc_main$8, {
1268
- annotation: unref(ws).annotation.value,
1269
- scale: unref(ws).scale.value,
1270
- pageIndex: unref(ws).pageIndex.value,
1271
- isEditable: true,
1272
- onChangeField: unref(ws).handleChangeField,
1273
- inputRef: selectInputRef
1274
- }, null, 8, ["annotation", "scale", "pageIndex", "onChangeField"])
1275
- ], 36);
1276
- };
1277
- }
1278
- });
1279
- const _hoisted_1$1 = ["onClick"];
1280
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1281
- __name: "listbox-field",
1282
- props: {
1283
- scale: {},
1284
- pageIndex: {},
1285
- isEditable: { type: Boolean },
1286
- onChangeField: { type: Function },
1287
- onFocus: { type: Function },
1288
- onBlur: { type: Function },
1289
- inputRef: { type: Function },
1290
- syncExternalValue: { type: Boolean },
1291
- annotation: {}
1292
- },
1293
- setup(__props) {
1294
- const props = __props;
1295
- const field = computed(() => props.annotation.field);
1296
- const flag = computed(() => field.value.flag);
1297
- const options = computed(() => field.value.options);
1298
- const isDisabled = computed(
1299
- () => !props.isEditable || !!(flag.value & PDF_FORM_FIELD_FLAG.READONLY)
1300
- );
1301
- const isMultipleChoice = computed(() => !!(flag.value & PDF_FORM_FIELD_FLAG.CHOICE_MULTL_SELECT));
1302
- const bw = computed(() => (props.annotation.strokeWidth ?? 0) * props.scale);
1303
- const fontSize = computed(() => (props.annotation.fontSize ?? 12) * props.scale);
1304
- const lineHeight = computed(() => fontSize.value * 1.2);
1305
- const fontCss = computed(() => standardFontCssProperties(props.annotation.fontFamily));
1306
- const containerStyle = computed(() => ({
1307
- position: "absolute",
1308
- top: 0,
1309
- left: 0,
1310
- width: "100%",
1311
- height: "100%",
1312
- background: props.annotation.color ?? "#FFFFFF",
1313
- borderStyle: "solid",
1314
- borderColor: props.annotation.strokeColor ?? "#000000",
1315
- borderWidth: `${bw.value}px`,
1316
- boxSizing: "border-box",
1317
- overflow: "auto",
1318
- display: "flex",
1319
- flexDirection: "column",
1320
- outline: "none"
1321
- }));
1322
- function handleOptionClick(clickedIndex) {
1323
- var _a;
1324
- if (isDisabled.value) return;
1325
- const updatedOptions = options.value.map((opt, i) => ({
1326
- ...opt,
1327
- isSelected: isMultipleChoice.value ? i === clickedIndex ? !opt.isSelected : opt.isSelected : i === clickedIndex
1328
- }));
1329
- (_a = props.onChangeField) == null ? void 0 : _a.call(props, { ...field.value, options: updatedOptions });
1330
- }
1331
- function setInputRef(el) {
1332
- var _a;
1333
- (_a = props.inputRef) == null ? void 0 : _a.call(props, el);
1334
- }
1335
- return (_ctx, _cache) => {
1336
- return openBlock(), createElementBlock("div", {
1337
- ref: setInputRef,
1338
- onBlur: _cache[0] || (_cache[0] = ($event) => {
1339
- var _a;
1340
- return (_a = props.onBlur) == null ? void 0 : _a.call(props);
1341
- }),
1342
- style: normalizeStyle(containerStyle.value)
1343
- }, [
1344
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (opt, i) => {
1345
- return openBlock(), createElementBlock("div", {
1346
- key: i,
1347
- onClick: ($event) => handleOptionClick(i),
1348
- style: normalizeStyle({
1349
- padding: `0 ${4 * props.scale}px`,
1350
- fontSize: `${fontSize.value}px`,
1351
- lineHeight: `${lineHeight.value}px`,
1352
- fontFamily: fontCss.value.fontFamily,
1353
- fontWeight: fontCss.value.fontWeight,
1354
- fontStyle: fontCss.value.fontStyle,
1355
- color: opt.isSelected ? "#FFFFFF" : props.annotation.fontColor ?? "#000000",
1356
- background: opt.isSelected ? "rgba(0, 51, 113, 1)" : "transparent",
1357
- whiteSpace: "nowrap",
1358
- overflow: "hidden",
1359
- textOverflow: "ellipsis",
1360
- cursor: isDisabled.value ? "default" : "pointer"
1361
- })
1362
- }, toDisplayString(opt.label), 13, _hoisted_1$1);
1363
- }), 128))
1364
- ], 36);
1365
- };
1366
- }
1367
- });
1368
- const _hoisted_1 = ["tabindex"];
1369
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1370
- __name: "listbox-fill-mode",
1371
- props: {
1372
- annotation: {},
1373
- currentObject: {},
1374
- isSelected: { type: Boolean },
1375
- isEditing: { type: Boolean },
1376
- scale: {},
1377
- pageIndex: {},
1378
- documentId: {},
1379
- onClick: { type: Function },
1380
- appearanceActive: { type: Boolean }
1381
- },
1382
- setup(__props) {
1383
- const props = __props;
1384
- const ws = useFormWidgetState(props);
1385
- const { state: formState } = useFormDocumentState(() => props.documentId);
1386
- const editing = ref(false);
1387
- const wrapperEl = ref(null);
1388
- const isFocused = computed(() => formState.value.selectedFieldId === ws.annotation.value.id);
1389
- watch(isFocused, (focused) => {
1390
- if (focused && wrapperEl.value && !wrapperEl.value.contains(document.activeElement)) {
1391
- wrapperEl.value.focus();
1392
- }
1393
- });
1394
- function handleFocus() {
1395
- var _a;
1396
- if (ws.isReadOnly.value) return;
1397
- (_a = ws.scope.value) == null ? void 0 : _a.selectField(ws.annotation.value.id);
1398
- editing.value = true;
1399
- }
1400
- function handleBlur() {
1401
- requestAnimationFrame(() => {
1402
- var _a, _b, _c;
1403
- if ((_a = wrapperEl.value) == null ? void 0 : _a.contains(document.activeElement)) return;
1404
- editing.value = false;
1405
- if (((_b = ws.scope.value) == null ? void 0 : _b.getSelectedFieldId()) === ws.annotation.value.id) {
1406
- (_c = ws.scope.value) == null ? void 0 : _c.deselectField();
1407
- }
1408
- });
1409
- }
1410
- return (_ctx, _cache) => {
1411
- return openBlock(), createElementBlock("div", {
1412
- ref_key: "wrapperEl",
1413
- ref: wrapperEl,
1414
- tabindex: unref(ws).isReadOnly.value ? -1 : 0,
1415
- onFocus: handleFocus,
1416
- onBlur: handleBlur,
1417
- style: normalizeStyle({
1418
- width: "100%",
1419
- height: "100%",
1420
- overflow: "hidden",
1421
- cursor: unref(ws).isReadOnly.value ? "default" : "pointer",
1422
- pointerEvents: "auto",
1423
- outline: isFocused.value && !editing.value ? "2px solid rgba(66, 133, 244, 0.8)" : "none",
1424
- outlineOffset: "-2px"
1425
- })
1426
- }, [
1427
- createVNode(_sfc_main$6, {
1428
- annotation: unref(ws).annotation.value,
1429
- scale: unref(ws).scale.value,
1430
- pageIndex: unref(ws).pageIndex.value,
1431
- isEditable: true,
1432
- onChangeField: unref(ws).handleChangeField
1433
- }, null, 8, ["annotation", "scale", "pageIndex", "onChangeField"]),
1434
- !editing.value ? (openBlock(), createBlock(_sfc_main$d, {
1435
- key: 0,
1436
- pageIndex: unref(ws).pageIndex.value,
1437
- annotation: unref(ws).annotation.value,
1438
- scaleFactor: unref(ws).scale.value,
1439
- renderKey: unref(ws).renderKey.value,
1440
- style: { pointerEvents: "none" }
1441
- }, null, 8, ["pageIndex", "annotation", "scaleFactor", "renderKey"])) : createCommentVNode("", true)
1442
- ], 44, _hoisted_1);
1443
- };
1444
- }
1445
- });
1446
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1447
- __name: "text-field-preview",
1448
- props: {
1449
- data: {},
1450
- bounds: {},
1451
- scale: {}
1452
- },
1453
- setup(__props) {
1454
- const props = __props;
1455
- const style = computed(() => ({
1456
- position: "absolute",
1457
- left: 0,
1458
- top: 0,
1459
- width: `${props.bounds.size.width * props.scale}px`,
1460
- height: `${props.bounds.size.height * props.scale}px`,
1461
- border: "1px dashed rgba(66, 133, 244, 0.6)",
1462
- backgroundColor: "rgba(255, 255, 255, 0.9)",
1463
- boxSizing: "border-box",
1464
- display: "flex",
1465
- alignItems: "center",
1466
- padding: `0 ${2 * props.scale}px`,
1467
- overflow: "hidden"
1468
- }));
1469
- return (_ctx, _cache) => {
1470
- return openBlock(), createElementBlock("div", {
1471
- style: normalizeStyle(style.value)
1472
- }, null, 4);
1473
- };
1474
- }
1475
- });
1476
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1477
- __name: "checkbox-preview",
1478
- props: {
1479
- data: {},
1480
- bounds: {},
1481
- scale: {}
1482
- },
1483
- setup(__props) {
1484
- const props = __props;
1485
- const style = computed(() => ({
1486
- position: "absolute",
1487
- left: 0,
1488
- top: 0,
1489
- width: `${props.bounds.size.width * props.scale}px`,
1490
- height: `${props.bounds.size.height * props.scale}px`,
1491
- border: "1px dashed rgba(66, 133, 244, 0.6)",
1492
- backgroundColor: "rgba(255, 255, 255, 0.9)",
1493
- boxSizing: "border-box",
1494
- display: "flex",
1495
- alignItems: "center",
1496
- justifyContent: "center"
1497
- }));
1498
- return (_ctx, _cache) => {
1499
- return openBlock(), createElementBlock("div", {
1500
- style: normalizeStyle(style.value)
1501
- }, null, 4);
1502
- };
1503
- }
1504
- });
1505
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1506
- __name: "radio-button-preview",
1507
- props: {
1508
- data: {},
1509
- bounds: {},
1510
- scale: {}
1511
- },
1512
- setup(__props) {
1513
- const props = __props;
1514
- const style = computed(() => ({
1515
- position: "absolute",
1516
- left: 0,
1517
- top: 0,
1518
- width: `${props.bounds.size.width * props.scale}px`,
1519
- height: `${props.bounds.size.height * props.scale}px`,
1520
- border: "1px dashed rgba(66, 133, 244, 0.6)",
1521
- backgroundColor: "rgba(255, 255, 255, 0.9)",
1522
- borderRadius: "50%",
1523
- boxSizing: "border-box",
1524
- display: "flex",
1525
- alignItems: "center",
1526
- justifyContent: "center"
1527
- }));
1528
- return (_ctx, _cache) => {
1529
- return openBlock(), createElementBlock("div", {
1530
- style: normalizeStyle(style.value)
1531
- }, null, 4);
1532
- };
1533
- }
1534
- });
1535
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1536
- __name: "listbox-preview",
1537
- props: {
1538
- data: {},
1539
- bounds: {},
1540
- scale: {}
1541
- },
1542
- setup(__props) {
1543
- const props = __props;
1544
- const style = computed(() => ({
1545
- position: "absolute",
1546
- left: 0,
1547
- top: 0,
1548
- width: `${props.bounds.size.width * props.scale}px`,
1549
- height: `${props.bounds.size.height * props.scale}px`,
1550
- border: "1px dashed rgba(66, 133, 244, 0.6)",
1551
- backgroundColor: "rgba(255, 255, 255, 0.9)",
1552
- boxSizing: "border-box",
1553
- display: "flex",
1554
- flexDirection: "column",
1555
- overflow: "hidden"
1556
- }));
1557
- return (_ctx, _cache) => {
1558
- return openBlock(), createElementBlock("div", {
1559
- style: normalizeStyle(style.value)
1560
- }, null, 4);
1561
- };
1562
- }
1563
- });
1564
- const formRenderers = [
1565
- createRenderer({
1566
- id: "formTextField",
1567
- matches: (a) => {
1568
- var _a;
1569
- return a.type === PdfAnnotationSubtype.WIDGET && ((_a = a.field) == null ? void 0 : _a.type) === PDF_FORM_FIELD_TYPE.TEXTFIELD;
1570
- },
1571
- component: _sfc_main$i,
1572
- renderPreview: _sfc_main$4,
1573
- interactionDefaults: { isDraggable: false, isResizable: true, isRotatable: false },
1574
- useAppearanceStream: false,
1575
- renderLocked: _sfc_main$b
1576
- }),
1577
- createRenderer({
1578
- id: "formCheckbox",
1579
- matches: (a) => {
1580
- var _a;
1581
- return a.type === PdfAnnotationSubtype.WIDGET && ((_a = a.field) == null ? void 0 : _a.type) === PDF_FORM_FIELD_TYPE.CHECKBOX;
1582
- },
1583
- component: _sfc_main$h,
1584
- renderPreview: _sfc_main$3,
1585
- interactionDefaults: { isDraggable: false, isResizable: true, isRotatable: false },
1586
- useAppearanceStream: false,
1587
- renderLocked: _sfc_main$a
1588
- }),
1589
- createRenderer({
1590
- id: "formRadioButton",
1591
- matches: (a) => {
1592
- var _a;
1593
- return a.type === PdfAnnotationSubtype.WIDGET && ((_a = a.field) == null ? void 0 : _a.type) === PDF_FORM_FIELD_TYPE.RADIOBUTTON;
1594
- },
1595
- component: _sfc_main$g,
1596
- renderPreview: _sfc_main$2,
1597
- interactionDefaults: { isDraggable: false, isResizable: true, isRotatable: false },
1598
- useAppearanceStream: false,
1599
- renderLocked: _sfc_main$9
1600
- }),
1601
- createRenderer({
1602
- id: "formCombobox",
1603
- matches: (a) => {
1604
- var _a;
1605
- return a.type === PdfAnnotationSubtype.WIDGET && ((_a = a.field) == null ? void 0 : _a.type) === PDF_FORM_FIELD_TYPE.COMBOBOX;
1606
- },
1607
- component: _sfc_main$f,
1608
- renderPreview: _sfc_main$4,
1609
- interactionDefaults: { isDraggable: false, isResizable: true, isRotatable: false },
1610
- useAppearanceStream: false,
1611
- renderLocked: _sfc_main$7
1612
- }),
1613
- createRenderer({
1614
- id: "formListbox",
1615
- matches: (a) => {
1616
- var _a;
1617
- return a.type === PdfAnnotationSubtype.WIDGET && ((_a = a.field) == null ? void 0 : _a.type) === PDF_FORM_FIELD_TYPE.LISTBOX;
1618
- },
1619
- component: _sfc_main$e,
1620
- renderPreview: _sfc_main$1,
1621
- interactionDefaults: { isDraggable: false, isResizable: true, isRotatable: false },
1622
- useAppearanceStream: false,
1623
- renderLocked: _sfc_main$5
1624
- })
1625
- ];
1626
- const _sfc_main = /* @__PURE__ */ defineComponent({
1627
- __name: "form-renderer-registration",
1628
- setup(__props) {
1629
- useRegisterRenderers(formRenderers);
1630
- return (_ctx, _cache) => {
1631
- return renderSlot(_ctx.$slots, "default");
1632
- };
1633
- }
1634
- });
1635
- const FormPluginPackage = createPluginPackage(FormPluginPackage$1).addUtility(_sfc_main).build();
1636
- export {
1637
- FormPluginPackage,
1638
- useFormCapability,
1639
- useFormDocumentState,
1640
- useFormPlugin,
1641
- useFormWidgetState
1642
- };
1643
- //# sourceMappingURL=index.js.map