qmap-forms 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './types/qmap';
2
+ export * from './services/question-provider';
3
+ export * from './services/question-validator';
4
+ export * as Question from './components/Question.vue';
package/src/lib.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { QuestionValidator } from './services/question-validator';
2
+ import { type Component, type Ref } from 'vue';
3
+ import type { QMAP, QMapEvent } from './types';
4
+ import { Observable } from 'rxjs';
5
+ interface FormOptions {
6
+ showSubmit?: boolean;
7
+ showReset?: boolean;
8
+ showCancel?: boolean;
9
+ scrollPane?: boolean;
10
+ validator?: QuestionValidator;
11
+ extras?: any;
12
+ onSubmit?: ((a: any) => void);
13
+ onCancel?: (() => void);
14
+ onReset?: (() => void);
15
+ }
16
+ interface FormInstance {
17
+ /**
18
+ * The Vue form component
19
+ */
20
+ form: Component;
21
+ /**
22
+ * Input model wrapped in a vue ref
23
+ */
24
+ model: Ref<any>;
25
+ /**
26
+ * Fires full object whenever it changes
27
+ */
28
+ state: Observable<any>;
29
+ /**
30
+ * fires delta event of field that changes and value of that field
31
+ */
32
+ events: Observable<{
33
+ e: QMapEvent;
34
+ v: any;
35
+ }>;
36
+ }
37
+ declare function mount(id: string | HTMLElement, qmaps: QMAP[], model: any, option?: FormOptions): FormInstance;
38
+ export * from './types/qmap';
39
+ declare const _default: {
40
+ Question: import("vue").DefineComponent<{}, {}, any>;
41
+ Form: import("vue").DefineComponent<{}, {}, any>;
42
+ QuestionValidator: typeof QuestionValidator;
43
+ mount: typeof mount;
44
+ };
45
+ export default _default;
@@ -0,0 +1,8 @@
1
+ export interface QuestionProvider {
2
+ questionTypes: {
3
+ [type: string]: any;
4
+ };
5
+ keyPairs?: {
6
+ [type: string]: any;
7
+ };
8
+ }
@@ -0,0 +1,25 @@
1
+ import { BehaviorSubject, Subject } from "rxjs";
2
+ import type { QMAP, QMapEvent } from "../types/qmap";
3
+ export declare class QuestionValidator {
4
+ readonly invalidFields: BehaviorSubject<QMAP[]>;
5
+ readonly isValid: BehaviorSubject<boolean>;
6
+ protected qMaps: QMAP[];
7
+ protected requiredQMaps: QMAP[];
8
+ protected children: QuestionValidator[];
9
+ protected baseQMaps: QMAP[];
10
+ readonly changeEvents: Subject<QMapEvent>;
11
+ protected model: any;
12
+ protected activeQMAPS: Map<string, QMAP>;
13
+ constructor(_baseQMaps: QMAP[], _model: any);
14
+ setQMAPs(q: QMAP[]): void;
15
+ setModel(m: any): void;
16
+ setQMAPsAndModel(q: QMAP[], m: any): void;
17
+ updateEvent(ev?: QMapEvent): void;
18
+ addChild(v: QuestionValidator): void;
19
+ removeChild(v: QuestionValidator): void;
20
+ nestedTypes: string[];
21
+ flattenNode(q: QMAP): QMAP[];
22
+ flattenQMAPs(schema: QMAP[]): QMAP[];
23
+ close(): void;
24
+ get currentQMaps(): QMAP[];
25
+ }
@@ -0,0 +1,5 @@
1
+ import { type Ref } from 'vue';
2
+ import type { QMAP } from '../types/qmap';
3
+ export declare const MyScopeKey: unique symbol;
4
+ export declare function provideBadQMAPS(s: Ref<Set<QMAP>>): void;
5
+ export declare function useBadQMAPS(): Ref<Set<QMAP>>;
@@ -0,0 +1,108 @@
1
+ import type { QuestionProvider } from '../services/question-provider';
2
+ import type { QuestionValidator } from '../services/question-validator';
3
+ export type QMAP = {
4
+ id: string;
5
+ type: string;
6
+ title?: string;
7
+ subtitle?: string;
8
+ required?: boolean;
9
+ default?: any;
10
+ groups?: {
11
+ name: string;
12
+ icon?: string;
13
+ items: QMAP[];
14
+ guid?: string;
15
+ scope?: {
16
+ hideOn?: string[];
17
+ };
18
+ }[];
19
+ items?: QMAP[];
20
+ item?: QMAP;
21
+ values?: {
22
+ title?: string;
23
+ value: any;
24
+ icon?: string;
25
+ colour?: string;
26
+ default?: boolean;
27
+ weight?: number;
28
+ onSelect?: QMAP[];
29
+ guid?: string;
30
+ }[];
31
+ readOnly?: boolean;
32
+ obj_type?: string;
33
+ filter?: any;
34
+ style?: string;
35
+ colour?: string;
36
+ icon?: string;
37
+ scope?: {
38
+ hideOn?: string[];
39
+ readOnlyOn?: string[];
40
+ };
41
+ min?: number;
42
+ max?: number;
43
+ onValue?: QMAP[];
44
+ pos?: string;
45
+ neg?: string;
46
+ onPos?: QMAP[];
47
+ onNeg?: QMAP[];
48
+ ui?: any;
49
+ guid?: string;
50
+ config?: {
51
+ id: string;
52
+ title: string;
53
+ obj_type: string;
54
+ template?: string;
55
+ showAll?: boolean;
56
+ addTemplates?: {
57
+ name: string;
58
+ items: {
59
+ startDate: number;
60
+ endDate: number;
61
+ name?: string;
62
+ status?: string;
63
+ }[];
64
+ }[];
65
+ }[];
66
+ timeline?: {
67
+ mode?: {
68
+ scale: 'hour' | 'minute' | 'day';
69
+ step: number;
70
+ };
71
+ hideBefore?: string;
72
+ hideAfter?: string;
73
+ template?: string;
74
+ defaultDuration?: number;
75
+ timeSettings?: any;
76
+ };
77
+ };
78
+ export interface QuestionProps {
79
+ qMap: QMAP;
80
+ extras?: any;
81
+ modelValue?: any;
82
+ provider?: QuestionProvider;
83
+ validator?: QuestionValidator;
84
+ readOnly?: boolean;
85
+ lite?: boolean;
86
+ }
87
+ export interface QMapEvent {
88
+ qMap: QMAP;
89
+ value: any;
90
+ }
91
+ export interface QuestionEmits {
92
+ (e: 'update:model-value', v: any): void;
93
+ (e: 'change', v: QMapEvent, m: any): void;
94
+ }
95
+ export interface QuestionWidgetEmits {
96
+ (e: 'qmap_change', v: QMapEvent): void;
97
+ (e: 'qmap_subquestions', v?: QMAP[]): void;
98
+ }
99
+ export interface QuestionWidgetProps {
100
+ qMap: QMAP;
101
+ extras?: any;
102
+ model?: any;
103
+ provider?: QuestionProvider;
104
+ validator?: QuestionValidator;
105
+ readOnly?: boolean;
106
+ lite?: boolean;
107
+ style?: string;
108
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.