@antcde/component-library 0.1.25-rc.9 → 0.1.25

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.
@@ -0,0 +1,111 @@
1
+ export declare enum InputTypes {
2
+ text = "text",
3
+ autocomplete = "autocomplete",
4
+ password = "password",
5
+ email = "email",
6
+ number = "number",
7
+ url = "url",
8
+ tel = "tel",
9
+ date = "date",
10
+ time = "time",
11
+ datetime_local = "datetime-local",
12
+ week = "week",
13
+ month = "month",
14
+ color = "color",
15
+ checkbox = "checkbox",
16
+ radio = "radio",
17
+ file = "file",
18
+ range = "range",
19
+ search = "search",
20
+ hidden = "hidden",
21
+ image = "image",
22
+ button = "button",
23
+ submit = "submit",
24
+ reset = "reset",
25
+ select = "select",
26
+ textarea = "textarea",
27
+ textfield = "text-field",
28
+ datepicker = "datepicker",
29
+ timepicker = "timepicker",
30
+ datetimepicker = "datetimepicker",
31
+ switch = "switch",
32
+ slider = "slider",
33
+ rate = "rate",
34
+ upload = "upload",
35
+ cascader = "cascader",
36
+ combobox = "combobox",
37
+ custom = "custom"
38
+ }
39
+ /** These render one identical v-text-field, differing only in the html type. */
40
+ export declare const TEXT_FIELD_TYPES: string[];
41
+ export interface SelectItem {
42
+ id: string;
43
+ title: string;
44
+ value: string;
45
+ }
46
+ export interface BaseAntInputProps {
47
+ topMargin?: string;
48
+ required?: boolean;
49
+ /**
50
+ * Text for the required marker's tooltip and screen-reader label. Pass this to
51
+ * keep the component off the host's translation keys; when omitted it falls
52
+ * back to `common.requiredField`, and to English if the host lacks that key.
53
+ */
54
+ requiredLabel?: string;
55
+ readonly?: boolean;
56
+ label?: string;
57
+ /**
58
+ * Accessible name for usages with no visible `label`. Ignored when `label` is
59
+ * set — the visible text is the name in that case.
60
+ */
61
+ ariaLabel?: string;
62
+ /**
63
+ * HTML autofill token (`username`, `current-password`, `given-name`, …).
64
+ * Needed as an explicit prop because the field branches bind props one by one
65
+ * rather than spreading `$attrs`, so a bare attribute never reached the input.
66
+ */
67
+ autocomplete?: string;
68
+ /**
69
+ * One of `InputTypes`' VALUES, not its keys. The field renderer compares this
70
+ * against `InputTypes.x` directly, and two members disagree between the two
71
+ * (`textfield` -> `text-field`, `datetime_local` -> `datetime-local`), so
72
+ * key-based typing let a caller write a `type` no branch could ever match.
73
+ */
74
+ type?: `${InputTypes}`;
75
+ id?: string;
76
+ /**
77
+ * Native form-control name. Consumers already passed this, but it was not a
78
+ * declared prop and the branches bind props one by one, so it landed on the
79
+ * wrapper div and never reached the input.
80
+ */
81
+ name?: string;
82
+ rows?: number;
83
+ options?: string[];
84
+ hideDetails?: boolean;
85
+ defaultValue?: string;
86
+ disabled?: boolean;
87
+ placeholder?: string;
88
+ rules?: any[];
89
+ color?: string;
90
+ density?: 'default' | 'comfortable' | 'compact';
91
+ hint?: string;
92
+ prefix?: string;
93
+ suffix?: string;
94
+ /** `null` clears it; normalised to `undefined` before Vuetify sees it. */
95
+ prependIcon?: null | string;
96
+ appendIcon?: string;
97
+ prependInnerIcon?: string;
98
+ appendInnerIcon?: string;
99
+ clearable?: boolean;
100
+ errorMessages?: string[];
101
+ persistentHint?: boolean;
102
+ items?: SelectItem[];
103
+ autofocus?: boolean;
104
+ }
105
+ /** Props the field renderer needs on top of the public ones. */
106
+ export interface BaseAntInputFieldProps extends BaseAntInputProps {
107
+ /** Resolved id — the `<label for>` in the parent points at this. */
108
+ inputId: string;
109
+ /** Resolved accessible name, or undefined when a visible label supplies it. */
110
+ fieldAriaLabel?: string;
111
+ }
@@ -1,82 +1,5 @@
1
- type __VLS_Props = Props;
2
- declare enum InputTypes {
3
- text = "text",
4
- autocomplete = "autocomplete",
5
- password = "password",
6
- email = "email",
7
- number = "number",
8
- url = "url",
9
- tel = "tel",
10
- date = "date",
11
- time = "time",
12
- datetime_local = "datetime-local",
13
- week = "week",
14
- month = "month",
15
- color = "color",
16
- checkbox = "checkbox",
17
- radio = "radio",
18
- file = "file",
19
- range = "range",
20
- search = "search",
21
- hidden = "hidden",
22
- image = "image",
23
- button = "button",
24
- submit = "submit",
25
- reset = "reset",
26
- select = "select",
27
- textarea = "textarea",
28
- textfield = "text-field",
29
- datepicker = "datepicker",
30
- timepicker = "timepicker",
31
- datetimepicker = "datetimepicker",
32
- switch = "switch",
33
- slider = "slider",
34
- rate = "rate",
35
- upload = "upload",
36
- cascader = "cascader",
37
- combobox = "combobox",
38
- custom = "custom"
39
- }
40
- interface Props {
41
- topMargin?: string;
42
- required?: boolean;
43
- /**
44
- * Text for the required marker's tooltip and screen-reader label. Pass this to
45
- * keep the component off the host's translation keys; when omitted it falls
46
- * back to `common.requiredField`, and to English if the host lacks that key.
47
- */
48
- requiredLabel?: string;
49
- readonly?: boolean;
50
- label?: string;
51
- type?: keyof typeof InputTypes;
52
- id?: string;
53
- rows?: number;
54
- options?: string[];
55
- hideDetails?: boolean;
56
- defaultValue?: string;
57
- disabled?: boolean;
58
- placeholder?: string;
59
- rules?: any[];
60
- color?: string;
61
- density?: 'default' | 'comfortable' | 'compact';
62
- hint?: string;
63
- prefix?: string;
64
- suffix?: string;
65
- prependIcon?: null | string;
66
- appendIcon?: string;
67
- prependInnerIcon?: string;
68
- appendInnerIcon?: string;
69
- clearable?: boolean;
70
- errorMessages?: string[];
71
- persistentHint?: boolean;
72
- items?: {
73
- id: string;
74
- title: string;
75
- value: string;
76
- }[];
77
- style?: CSSStyleDeclaration;
78
- autofocus?: boolean;
79
- }
1
+ import { BaseAntInputProps } from './BaseAntInput.types';
2
+ type __VLS_Props = BaseAntInputProps;
80
3
  type __VLS_PublicProps = {
81
4
  modelValue?: any;
82
5
  } & __VLS_Props;
@@ -110,7 +33,6 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
110
33
  color: string;
111
34
  topMargin: string;
112
35
  readonly: boolean;
113
- id: string;
114
36
  disabled: boolean;
115
37
  density: "default" | "comfortable" | "compact";
116
38
  clearable: boolean;
@@ -1,7 +1,13 @@
1
1
  type __VLS_Props = {
2
2
  small?: boolean;
3
+ /** Mirror BaseAppCard's `fluid`: fill the grid cell instead of the fixed 128px tile. */
4
+ fluid?: boolean;
5
+ /** Grid position — varies the title-bar width so a row doesn't read as identical bars. */
6
+ index?: number;
3
7
  };
4
8
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
9
  small: boolean;
10
+ fluid: boolean;
11
+ index: number;
6
12
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
7
13
  export default _default;
@@ -1,26 +1,28 @@
1
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
1
+ import { ResizePanelSide } from './useResizePanel';
2
+ type __VLS_Props = {
2
3
  minWidth?: number;
3
4
  maxWidth?: number | null;
4
- defaultWidth: number;
5
+ defaultWidth?: number;
5
6
  minHeight?: number;
6
7
  maxHeight?: number | null;
7
8
  defaultHeight?: number;
8
- side: string;
9
+ side?: ResizePanelSide;
9
10
  collapsible?: boolean;
10
- }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
+ };
12
+ declare function __VLS_template(): {
13
+ attrs: Partial<{}>;
14
+ slots: {
15
+ default?(_: {}): any;
16
+ };
17
+ refs: {};
18
+ rootEl: HTMLDivElement;
19
+ };
20
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
21
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
22
  resize: (...args: any[]) => void;
12
23
  "resize-end": (...args: any[]) => void;
13
24
  collapse: (...args: any[]) => void;
14
- }, string, import('vue').PublicProps, Readonly<{
15
- minWidth?: number;
16
- maxWidth?: number | null;
17
- defaultWidth: number;
18
- minHeight?: number;
19
- maxHeight?: number | null;
20
- defaultHeight?: number;
21
- side: string;
22
- collapsible?: boolean;
23
- }> & Readonly<{
25
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
24
26
  onResize?: ((...args: any[]) => any) | undefined;
25
27
  "onResize-end"?: ((...args: any[]) => any) | undefined;
26
28
  onCollapse?: ((...args: any[]) => any) | undefined;
@@ -31,11 +33,10 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
31
33
  defaultWidth: number;
32
34
  minHeight: number;
33
35
  defaultHeight: number;
34
- side: string;
36
+ side: ResizePanelSide;
35
37
  collapsible: boolean;
36
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>, {
37
- default?(_: {}): any;
38
- }>;
38
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
39
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
40
  export default _default;
40
41
  type __VLS_WithTemplateSlots<T, S> = T & {
41
42
  new (): {
@@ -0,0 +1,36 @@
1
+ import { BaseAntInputFieldProps } from './BaseAntInput.types';
2
+ type __VLS_Props = BaseAntInputFieldProps;
3
+ type __VLS_PublicProps = {
4
+ modelValue?: unknown;
5
+ } & __VLS_Props;
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: {
9
+ input?(_: {}): any;
10
+ };
11
+ refs: {};
12
+ rootEl: HTMLDivElement;
13
+ };
14
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
16
+ "click:append-inner": (value: any) => any;
17
+ "click:prepend-inner": (value: any) => any;
18
+ "click:append": (value: any) => any;
19
+ "click:prepend": (value: any) => any;
20
+ "update:model-value": (value: any) => any;
21
+ "update:modelValue": (value: unknown) => any;
22
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onClick:append-inner"?: ((value: any) => any) | undefined;
24
+ "onClick:prepend-inner"?: ((value: any) => any) | undefined;
25
+ "onClick:append"?: ((value: any) => any) | undefined;
26
+ "onClick:prepend"?: ((value: any) => any) | undefined;
27
+ "onUpdate:model-value"?: ((value: any) => any) | undefined;
28
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
30
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
31
+ export default _default;
32
+ type __VLS_WithTemplateSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -7,6 +7,12 @@ type __VLS_Props = {
7
7
  * back to `common.requiredField`, and to English if the host lacks that key.
8
8
  */
9
9
  requiredLabel?: string;
10
+ /**
11
+ * Id of the field this labels. Renders a real `<label for>`, which is what
12
+ * makes the visible text the field's accessible name — as a bare `<span>` it
13
+ * was decorative, and every field under it announced as unlabelled.
14
+ */
15
+ inputId?: string;
10
16
  };
11
17
  declare function __VLS_template(): {
12
18
  attrs: Partial<{}>;
@@ -0,0 +1,38 @@
1
+ import { StyleValue } from 'vue';
2
+ export declare const SIDE_TOP = "top";
3
+ export declare const SIDE_BOTTOM = "bottom";
4
+ export declare const SIDE_LEFT = "left";
5
+ export declare const SIDE_RIGHT = "right";
6
+ export type ResizePanelSide = typeof SIDE_TOP | typeof SIDE_BOTTOM | typeof SIDE_LEFT | typeof SIDE_RIGHT;
7
+ export interface ResizePanelSize {
8
+ width: number;
9
+ height: number;
10
+ }
11
+ export interface ResizePanelOptions {
12
+ minWidth: number;
13
+ maxWidth: number | null;
14
+ defaultWidth: number;
15
+ minHeight: number;
16
+ maxHeight: number | null;
17
+ defaultHeight: number;
18
+ side: ResizePanelSide;
19
+ collapsible: boolean;
20
+ }
21
+ /**
22
+ * Mirrors the three events `BaseResizePanel` declares, so a wrong payload is a
23
+ * type error here rather than a silently ignored listener argument.
24
+ */
25
+ export interface ResizePanelEmit {
26
+ (event: 'resize', size: ResizePanelSize): void;
27
+ (event: 'resize-end', size: ResizePanelSize): void;
28
+ (event: 'collapse'): void;
29
+ }
30
+ /** Reads `props` live, so it must be the reactive props object, not a snapshot. */
31
+ export declare function useResizePanel(props: ResizePanelOptions, emit: ResizePanelEmit): {
32
+ isBottom: import('vue').ComputedRef<boolean>;
33
+ isLeft: import('vue').ComputedRef<boolean>;
34
+ isVertical: import('vue').ComputedRef<boolean>;
35
+ isResizing: import('vue').ComputedRef<boolean>;
36
+ mergedStyles: import('vue').ComputedRef<StyleValue>;
37
+ startResize: (e: any) => void;
38
+ };
@@ -1,4 +1,4 @@
1
- import type { PDFDocumentProxy, PDFPageProxy, RenderTask } from 'pdfjs-dist'
1
+ import type { PDFDocumentLoadingTask, PDFDocumentProxy, PDFPageProxy, RenderTask } from 'pdfjs-dist'
2
2
  import type { Ref } from 'vue'
3
3
  // The worker is a static asset reference, not a module import — it costs a URL
4
4
  // string here and is fetched only once pdf.js actually starts. Resolving it in
@@ -43,6 +43,17 @@ export function usePdfDocument(source: Ref<string | null | undefined>) {
43
43
  const error = ref<PdfLoadError | null>(null)
44
44
 
45
45
  let renderTask: RenderTask | null = null
46
+ /**
47
+ * Teardown happens through the loading task, not the document.
48
+ *
49
+ * pdf.js 6 removed `PDFDocumentProxy.destroy()`, which was only ever
50
+ * `return this.loadingTask.destroy()` — so this is the same call one level up,
51
+ * not a change of behaviour. Optional chaining does not save the old form:
52
+ * `doc.value?.destroy()` guards the document being null, not the method being
53
+ * gone, so on v6 it threw a TypeError out of an un-awaited path and left the
54
+ * viewer on a spinner from the second document onwards.
55
+ */
56
+ let loadingTask: PDFDocumentLoadingTask | null = null
46
57
  /** Guards against a slow load resolving after the source has moved on. */
47
58
  let loadToken = 0
48
59
 
@@ -53,10 +64,34 @@ export function usePdfDocument(source: Ref<string | null | undefined>) {
53
64
 
54
65
  async function destroyDoc() {
55
66
  cancelRender()
56
- const current = doc.value
67
+ const task = loadingTask
68
+ loadingTask = null
57
69
  doc.value = null
58
70
  page.value = null
59
- await current?.destroy().catch(() => { /* teardown is best-effort */ })
71
+ await task?.destroy().catch(() => { /* teardown is best-effort */ })
72
+ }
73
+
74
+ /**
75
+ * The source went empty, so nothing should end up on screen.
76
+ *
77
+ * Bumping `loadToken` is the whole point and is not optional: it is the only
78
+ * thing that stops a load still inside `await loadPdfJs()` from carrying on
79
+ * to fetch a URL that is no longer selected. Tearing down alone did not do
80
+ * it — at that moment `loadingTask` has not been assigned yet, so there is
81
+ * nothing to destroy, and the pending load went on to commit a document over
82
+ * an empty source. `onBeforeUnmount` has always bumped the token for exactly
83
+ * this reason; this path simply did not.
84
+ *
85
+ * The increment cannot live in destroyDoc(): `load()` calls that immediately
86
+ * after taking its own token, so incrementing there would invalidate every
87
+ * load the moment it started.
88
+ */
89
+ async function clear() {
90
+ loadToken++
91
+ isLoading.value = false
92
+ // An empty viewer must not keep the previous document's failure on screen.
93
+ error.value = null
94
+ await destroyDoc()
60
95
  }
61
96
 
62
97
  async function load(url: string) {
@@ -67,14 +102,23 @@ export function usePdfDocument(source: Ref<string | null | undefined>) {
67
102
 
68
103
  try {
69
104
  const pdfjs = await loadPdfJs()
105
+ // Checked before getDocument, not after: the first load pays a dynamic
106
+ // import for a ~500 kB chunk, which is a wide enough window for the
107
+ // source to change underneath. Re-checking here means a superseded load
108
+ // never opens a request, rather than opening one and discarding it.
109
+ if (token !== loadToken)
110
+ return
70
111
  // Range and streaming are switched off on purpose. The DMS stream endpoint
71
112
  // is a Laravel StreamedResponse, which does not serve HTTP 206 — leaving
72
113
  // partial loading on means pdf.js probes for it on every document and then
73
114
  // has to unwind. One plain GET is both faster here and predictable.
74
115
  const task = pdfjs.getDocument({ url, disableRange: true, disableStream: true })
116
+ loadingTask = task
75
117
  const loaded = await task.promise
76
118
  if (token !== loadToken) {
77
- await loaded.destroy().catch(() => {})
119
+ await task.destroy().catch(() => {})
120
+ if (loadingTask === task)
121
+ loadingTask = null
78
122
  return
79
123
  }
80
124
  doc.value = loaded
@@ -169,7 +213,7 @@ export function usePdfDocument(source: Ref<string | null | undefined>) {
169
213
  if (url)
170
214
  void load(url)
171
215
  else
172
- void destroyDoc()
216
+ void clear()
173
217
  }, { immediate: true })
174
218
 
175
219
  onBeforeUnmount(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antcde/component-library",
3
3
  "type": "module",
4
- "version": "0.1.25-rc.9",
4
+ "version": "0.1.25",
5
5
  "description": "Helper to use ant components in Vue 3",
6
6
  "author": "CollaborAll",
7
7
  "exports": {
@@ -190,24 +190,24 @@
190
190
  "dependencies": {
191
191
  "@arcgis/core": "^4.34.8",
192
192
  "@mdi/font": "^7.4.47",
193
- "@tiptap/extension-link": "^3.30.3",
194
- "@tiptap/extension-mention": "^3.30.3",
195
- "@tiptap/extension-placeholder": "^3.30.3",
196
- "@tiptap/starter-kit": "^3.30.3",
197
- "@tiptap/suggestion": "^3.30.3",
198
- "@tiptap/vue-3": "^3.30.3",
193
+ "@tiptap/extension-link": "^3.31.0",
194
+ "@tiptap/extension-mention": "^3.31.0",
195
+ "@tiptap/extension-placeholder": "^3.31.0",
196
+ "@tiptap/starter-kit": "^3.31.0",
197
+ "@tiptap/suggestion": "^3.31.0",
198
+ "@tiptap/vue-3": "^3.30.6",
199
199
  "@vue-flow/background": "^1.3.2",
200
200
  "@vue-flow/core": "^1.48.2",
201
201
  "@vue-flow/minimap": "^1.5.4",
202
202
  "@vueuse/core": "^14.4.0",
203
- "pdfjs-dist": "^5.7.284",
204
- "qs": "^6.15.3",
203
+ "pdfjs-dist": "^6.3.289",
204
+ "qs": "^6.16.0",
205
205
  "sanitize-html": "^2.17.7",
206
- "vue-i18n": "^11.4.9"
206
+ "vue-i18n": "^11.4.10"
207
207
  },
208
208
  "devDependencies": {
209
- "@antcde/connect-ts": "0.4.27-rc.9",
210
- "@antcde/vue-utils": "0.2.22-rc.9",
209
+ "@antcde/connect-ts": "0.4.27",
210
+ "@antcde/vue-utils": "0.2.22",
211
211
  "@arcgis/core": "^4.30.9",
212
212
  "@iconify-json/mdi": "^1.2.3",
213
213
  "@iconify/vue": "^5.0.1",
@@ -217,9 +217,9 @@
217
217
  "@types/node": "^25.9.5",
218
218
  "@types/qs": "^6.15.1",
219
219
  "@vitejs/plugin-vue": "^6.0.8",
220
- "@vue/test-utils": "^2.4.11",
220
+ "@vue/test-utils": "^2.5.0",
221
221
  "@vue/tsconfig": "^0.9.1",
222
- "happy-dom": "^20.11.6",
222
+ "happy-dom": "^20.12.0",
223
223
  "pinia": "^3.0.4",
224
224
  "sass": "^1.103.1",
225
225
  "typescript": "~6.0.3",
@@ -229,7 +229,7 @@
229
229
  "vite-plugin-dts": "^4.5.4",
230
230
  "vite-plugin-vuetify": "^2.1.3",
231
231
  "vitest": "^4.1.11",
232
- "vue": "^3.5.41",
232
+ "vue": "^3.5.42",
233
233
  "vue-tsc": "^3.3.11"
234
234
  }
235
235
  }