quasar-ui-danx 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/README.md +24 -109
  2. package/demo/.eslintrc.cjs +15 -0
  3. package/demo/.prettierrc.json +8 -0
  4. package/demo/.vscode/extensions.json +7 -0
  5. package/demo/README.md +45 -0
  6. package/demo/env.d.ts +5 -0
  7. package/demo/index.html +13 -0
  8. package/demo/package.json +42 -0
  9. package/demo/public/favicon.ico +0 -0
  10. package/demo/src/App.vue +86 -0
  11. package/demo/src/assets/base.css +86 -0
  12. package/demo/src/assets/logo.svg +1 -0
  13. package/demo/src/assets/main.css +35 -0
  14. package/demo/src/components/DemoActionTable/demoTableActions.ts +26 -0
  15. package/demo/src/components/DemoActionTable/demoTableCallbacks.ts +109 -0
  16. package/demo/src/components/DemoActionTable/demoTableColumns.ts +34 -0
  17. package/demo/src/components/DemoActionTable/demoTableFilterFields.ts +40 -0
  18. package/demo/src/components/HelloWorld.vue +41 -0
  19. package/demo/src/components/TheWelcome.vue +88 -0
  20. package/demo/src/components/WelcomeItem.vue +87 -0
  21. package/demo/src/components/__tests__/HelloWorld.spec.ts +11 -0
  22. package/demo/src/components/icons/IconCommunity.vue +7 -0
  23. package/demo/src/components/icons/IconDocumentation.vue +7 -0
  24. package/demo/src/components/icons/IconEcosystem.vue +7 -0
  25. package/demo/src/components/icons/IconSupport.vue +7 -0
  26. package/demo/src/components/icons/IconTooling.vue +19 -0
  27. package/demo/src/main.ts +11 -0
  28. package/demo/src/router/index.ts +28 -0
  29. package/demo/src/views/AboutView.vue +15 -0
  30. package/demo/src/views/DemoView.vue +17 -0
  31. package/demo/src/views/HomeView.vue +9 -0
  32. package/demo/tsconfig.app.json +14 -0
  33. package/demo/tsconfig.json +19 -0
  34. package/demo/tsconfig.node.json +19 -0
  35. package/demo/tsconfig.vitest.json +11 -0
  36. package/demo/vite.config.ts +18 -0
  37. package/demo/vitest.config.ts +14 -0
  38. package/dist/components/ActionTable/Columns/index.d.ts +4 -0
  39. package/dist/components/ActionTable/Filters/index.d.ts +6 -0
  40. package/dist/components/ActionTable/Form/Fields/index.d.ts +24 -0
  41. package/dist/components/ActionTable/Form/index.d.ts +2 -0
  42. package/dist/components/ActionTable/Layouts/ActionTableLayout.vue.d.ts +12 -0
  43. package/dist/components/ActionTable/Layouts/index.d.ts +1 -0
  44. package/dist/components/ActionTable/index.d.ts +12 -0
  45. package/dist/components/ActionTable/listControls.d.ts +50 -0
  46. package/dist/components/ActionTable/listHelpers.d.ts +12 -0
  47. package/dist/components/ActionTable/tableColumns.d.ts +8 -0
  48. package/dist/components/AuditHistory/index.d.ts +2 -0
  49. package/dist/components/DragAndDrop/dragAndDrop.d.ts +111 -0
  50. package/dist/components/DragAndDrop/index.d.ts +4 -0
  51. package/dist/components/DragAndDrop/listDragAndDrop.d.ts +74 -0
  52. package/dist/components/PanelsDrawer/index.d.ts +3 -0
  53. package/dist/components/Utility/Buttons/index.d.ts +2 -0
  54. package/dist/components/Utility/Controls/index.d.ts +1 -0
  55. package/dist/components/Utility/Dialogs/index.d.ts +5 -0
  56. package/dist/components/Utility/Files/index.d.ts +2 -0
  57. package/dist/components/Utility/Formats/index.d.ts +5 -0
  58. package/dist/components/Utility/Layouts/index.d.ts +2 -0
  59. package/dist/components/Utility/Popovers/index.d.ts +2 -0
  60. package/dist/components/Utility/Tabs/index.d.ts +2 -0
  61. package/dist/components/Utility/Tools/index.d.ts +3 -0
  62. package/dist/components/Utility/Transitions/index.d.ts +3 -0
  63. package/dist/components/Utility/index.d.ts +10 -0
  64. package/dist/components/index.d.ts +5 -0
  65. package/dist/config/index.d.ts +8 -0
  66. package/dist/danx.es.js +6 -6
  67. package/dist/danx.umd.js +2 -2
  68. package/dist/helpers/FileUpload.d.ts +107 -0
  69. package/dist/helpers/FlashMessages.d.ts +24 -0
  70. package/dist/helpers/actions.d.ts +58 -0
  71. package/dist/helpers/array.d.ts +16 -0
  72. package/dist/helpers/compatibility.d.ts +8 -0
  73. package/dist/helpers/date.d.ts +1 -0
  74. package/dist/helpers/download.d.ts +1 -0
  75. package/dist/helpers/downloadPdf.d.ts +24 -0
  76. package/dist/helpers/files.d.ts +1 -0
  77. package/dist/helpers/formats.d.ts +112 -0
  78. package/dist/helpers/http.d.ts +23 -0
  79. package/dist/helpers/index.d.ts +15 -0
  80. package/dist/helpers/multiFileUpload.d.ts +11 -0
  81. package/dist/helpers/singleFileUpload.d.ts +11 -0
  82. package/dist/helpers/storage.d.ts +2 -0
  83. package/dist/helpers/utils.d.ts +46 -0
  84. package/dist/svg/index.d.ts +12 -0
  85. package/dist/vendor/tinymce-config.d.ts +1 -0
  86. package/package.json +6 -5
  87. package/src/helpers/FileUpload.ts +16 -7
  88. package/tsconfig.json +24 -13
  89. package/vite.config.js +7 -1
@@ -0,0 +1,107 @@
1
+ export type FileUploadOptions = {
2
+ directory: string;
3
+ presignedUploadUrl: (...params: any) => "";
4
+ uploadCompletedUrl: (...params: any) => "";
5
+ };
6
+ export type UploadedFile = {
7
+ id: string;
8
+ name: string;
9
+ size: number;
10
+ type: string;
11
+ progress: number;
12
+ location: string;
13
+ blobUrl: string;
14
+ };
15
+ export declare class FileUpload {
16
+ files: UploadedFile[];
17
+ fileUploads: never[];
18
+ onErrorCb: null;
19
+ onProgressCb: null;
20
+ onCompleteCb: null;
21
+ onAllCompleteCb: null;
22
+ options: FileUploadOptions | {};
23
+ constructor(files: UploadedFile[] | UploadedFile, options?: FileUploadOptions | {});
24
+ /**
25
+ * Prepares all files for upload and provides an id and blobUrl for each file
26
+ */
27
+ prepare(): void;
28
+ /**
29
+ * Callback for when all files have been uploaded
30
+ */
31
+ onAllComplete(cb: any): this;
32
+ /**
33
+ * Callback fired once for each file upon successful completion of upload
34
+ * @param cb
35
+ * @returns {FileUpload}
36
+ */
37
+ onComplete(cb: any): this;
38
+ /**
39
+ * Callback fired each time there is an upload progress update for a file
40
+ * @param cb
41
+ * @returns {FileUpload}
42
+ */
43
+ onProgress(cb: any): this;
44
+ /**
45
+ * Callback fired when an error occurs during upload
46
+ * @param cb
47
+ * @returns {FileUpload}
48
+ */
49
+ onError(cb: any): this;
50
+ /**
51
+ * Handles the error events / fires the callback if it is set
52
+ * @param e
53
+ * @param file
54
+ * @param error
55
+ */
56
+ errorHandler(e: any, file: any, error?: null): void;
57
+ /**
58
+ * Resolve the locations of all the files
59
+ * @returns {Promise<FileUpload>}
60
+ */
61
+ resolveLocation(waitMessage?: null): Promise<this>;
62
+ /**
63
+ * Fires the progress callback
64
+ * @param fileUpload
65
+ * @param progress
66
+ */
67
+ fireProgressCallback(fileUpload: any, progress: any): void;
68
+ /**
69
+ * Fires the complete callback
70
+ * @param fileUpload
71
+ * @param uploadedFile
72
+ */
73
+ fireCompleteCallback(fileUpload: any, uploadedFile: any): void;
74
+ /**
75
+ * Check if all files have been uploaded and call the callback if they have
76
+ */
77
+ checkAllComplete(): void;
78
+ /**
79
+ * Returns a native JS object that is easier to work with than the File objects (no weird behavior of missing
80
+ * properties, easily printable, etc.)
81
+ * @param file
82
+ * @returns {{size, name, progress, location, blobUrl: *, id, type}}
83
+ */
84
+ wrapFile(file: any): {
85
+ id: any;
86
+ name: any;
87
+ size: any;
88
+ type: any;
89
+ progress: any;
90
+ location: any;
91
+ blobUrl: any;
92
+ };
93
+ /**
94
+ * Registers all the callbacks requested for the XHR / post-processing of file uploads
95
+ */
96
+ setXhrCallbacks(): void;
97
+ /**
98
+ * Mark the presigned upload as completed and return the file resource from the platform server
99
+ * @param fileUpload
100
+ * @returns {Promise<void>}
101
+ */
102
+ completePresignedUpload(fileUpload: any): Promise<any>;
103
+ /**
104
+ * Start uploading all files
105
+ */
106
+ upload(): Promise<void>;
107
+ }
@@ -0,0 +1,24 @@
1
+ export declare class FlashMessages {
2
+ static notify: any;
3
+ static PROP_DEFINITIONS: {
4
+ successMsg: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ errorMsg: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ warningMsg: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ };
17
+ static enable(msgProps: any): void;
18
+ static send(message: any, options?: {}): void;
19
+ static success(message: any, options?: {}): void;
20
+ static error(message: any, options?: {}): void;
21
+ static warning(message: any, options?: {}): void;
22
+ static combine(type: any, messages: any, options?: {}): void;
23
+ }
24
+ export declare const notify: FlashMessages;
@@ -0,0 +1,58 @@
1
+ import { VNode } from 'vue';
2
+
3
+ interface ActionOptions {
4
+ name?: string;
5
+ label?: string;
6
+ menu?: boolean;
7
+ batch?: boolean;
8
+ category?: string;
9
+ class?: string;
10
+ trigger?: (target: object[] | object, input: any) => Promise<any>;
11
+ activeTarget?: any;
12
+ vnode?: (target: object[] | object) => VNode;
13
+ enabled?: (target: object) => boolean;
14
+ batchEnabled?: (targets: object[]) => boolean;
15
+ optimistic?: (action: ActionOptions, target: object, input: any) => void;
16
+ onAction?: (action: string | null, target: object, input: any) => Promise<any>;
17
+ onBatchAction?: (action: string | null, targets: object[], input: any) => Promise<any>;
18
+ onStart?: (action: ActionOptions | null, targets: object, input: any) => boolean;
19
+ onSuccess?: (action: string | null, targets: object, input: any) => any;
20
+ onError?: (action: string | null, targets: object, input: any) => any;
21
+ onFinish?: (action: string | null, targets: object, input: any) => any;
22
+ }
23
+ export declare const activeActionVnode: import('vue').ShallowRef<null>;
24
+ /**
25
+ * Hook to perform an action on a set of targets
26
+ * This helper allows you to perform actions by name on a set of targets using a provided list of actions
27
+ *
28
+ * @param actions
29
+ * @param {ActionOptions} globalOptions
30
+ */
31
+ export declare function useActions(actions: ActionOptions[], globalOptions?: ActionOptions): {
32
+ actions: {
33
+ name?: string | undefined;
34
+ label?: string | undefined;
35
+ menu?: boolean | undefined;
36
+ batch?: boolean | undefined;
37
+ category?: string | undefined;
38
+ class?: string | undefined;
39
+ trigger?: ((target: object | object[], input: any) => Promise<any>) | undefined;
40
+ activeTarget?: any;
41
+ vnode?: ((target: object | object[]) => VNode<import('vue').RendererNode, import('vue').RendererElement, {
42
+ [key: string]: any;
43
+ }>) | undefined;
44
+ enabled?: ((target: object) => boolean) | undefined;
45
+ batchEnabled?: ((targets: object[]) => boolean) | undefined;
46
+ optimistic?: ((action: ActionOptions, target: object, input: any) => void) | undefined;
47
+ onAction?: ((action: string | null, target: object, input: any) => Promise<any>) | undefined;
48
+ onBatchAction?: ((action: string | null, targets: object[], input: any) => Promise<any>) | undefined;
49
+ onStart?: ((action: ActionOptions | null, targets: object, input: any) => boolean) | undefined;
50
+ onSuccess?: ((action: string | null, targets: object, input: any) => any) | undefined;
51
+ onError?: ((action: string | null, targets: object, input: any) => any) | undefined;
52
+ onFinish?: ((action: string | null, targets: object, input: any) => any) | undefined;
53
+ }[];
54
+ isSavingTarget: (target: any) => boolean;
55
+ filterActions: (filters: object) => ActionOptions[];
56
+ performAction: (name: string | object, target: object[] | object, input?: any) => Promise<any>;
57
+ };
58
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ *
3
+ * @param array
4
+ * @param item
5
+ * @param newItem
6
+ * @returns {*[]}
7
+ */
8
+ export declare function replace(array: any, item: any, newItem?: undefined): any[];
9
+ export declare function remove(array: any, item: any): any[];
10
+ /**
11
+ * Remove duplicate items from an array using a callback to compare 2 elements
12
+ * @param array
13
+ * @param cb
14
+ * @returns {*}
15
+ */
16
+ export declare function uniqueBy(array: any, cb: any): any;
@@ -0,0 +1,8 @@
1
+ export declare function useCompatibility(requestLocation?: boolean): {
2
+ isLocationSupported: boolean;
3
+ isCompatible: import('vue').ComputedRef<boolean>;
4
+ geolocationError: null;
5
+ hasLocation: null;
6
+ location: import('vue').ComputedRef<any>;
7
+ waitForLocation: (maxWait?: number) => Promise<import('vue').ComputedRef<any> | null>;
8
+ };
@@ -0,0 +1 @@
1
+ export declare function diffInDays(date1: any, date2: any): any;
@@ -0,0 +1 @@
1
+ export declare function download(data: any, strFileName: any, strMimeType: any): any;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Asynchronously load a file from the URL and trigger a download in the browser
3
+ *
4
+ * @param url
5
+ * @param filename
6
+ * @param postParams
7
+ * @returns {Promise<void>}
8
+ */
9
+ export declare function downloadFile(url: any, filename?: string, postParams?: null): Promise<void>;
10
+ /**
11
+ * Downloads a file from a response object w/ a file attachment
12
+ *
13
+ * @param response
14
+ * @param filename
15
+ */
16
+ export declare function downloadFileResponse(response: any, filename?: string): Promise<void>;
17
+ /**
18
+ * Get a header from a response object
19
+ * @param response
20
+ * @param header
21
+ * @param defaultValue
22
+ * @returns {*}
23
+ */
24
+ export declare function getResponseHeader(response: any, header: any, defaultValue: any): any;
@@ -0,0 +1 @@
1
+ export declare function resolveFileLocation(file: any, waitMessage?: null): Promise<any>;
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Converts a date string from the server's time zone to the user's time zone.
3
+ * @param {String} dateTimeString
4
+ * @returns {DateTime}
5
+ */
6
+ export declare function localizedDateTime(dateTimeString: any): any;
7
+ /**
8
+ * Converts a date string from the user's time zone to the server's time zone.
9
+ * @param dateTimeString
10
+ * @returns {DateTime}
11
+ */
12
+ export declare function remoteDateTime(dateTimeString: any): any;
13
+ /**
14
+ * @param {DateTime|String} dateTime
15
+ * @returns {DateTime|*}
16
+ */
17
+ export declare function parseDateTime(dateTime: any): any;
18
+ /**
19
+ * Parses a Quasar formatted date string into a Luxon DateTime object
20
+ * @param date
21
+ * @param format
22
+ * @returns {DateTime}
23
+ */
24
+ export declare function parseQDate(date: any, format?: string): any;
25
+ /**
26
+ * Parses a Quasar formatted date/time string into a Luxon DateTime object
27
+ * @param date
28
+ * @param format
29
+ * @returns {DateTime}
30
+ */
31
+ export declare function parseQDateTime(date: any, format?: string): any;
32
+ /**
33
+ * Formats a Luxon DateTime object into a Quasar formatted date string
34
+ * @param date
35
+ * @returns {string}
36
+ */
37
+ export declare function fQDate(date: any): any;
38
+ /**
39
+ *
40
+ * @param {String} dateTimeString
41
+ * @param options
42
+ * @returns {string}
43
+ */
44
+ export declare function fLocalizedDateTime(dateTimeString: any, options?: {}): any;
45
+ /**
46
+ * Formats a date/time object or string into a human-readable format
47
+ *
48
+ * @param {String|Object} dateTime
49
+ * @param format
50
+ * @param {String|null} empty
51
+ * @returns {string}
52
+ */
53
+ export declare function fDateTime(dateTime?: null, { format, empty }?: {
54
+ format?: string | undefined;
55
+ empty?: string | undefined;
56
+ }): any;
57
+ /**
58
+ * Formats a date/time object or string into the best format for DB input
59
+ * @param dateTime
60
+ * @returns {string}
61
+ */
62
+ export declare function dbDateTime(dateTime?: null): any;
63
+ /**
64
+ * Formats a date object or string into a human-readable format
65
+ * @param {String|Object} dateTime
66
+ * @param {String|null} empty
67
+ * @param format
68
+ * @returns {string}
69
+ */
70
+ export declare function fDate(dateTime: any, { empty, format }?: {
71
+ empty?: string | undefined;
72
+ format?: string | undefined;
73
+ }): any;
74
+ /**
75
+ * Formats a number of seconds into Hours / Minutes / Seconds or just Minutes and Seconds
76
+ *
77
+ * @param second
78
+ * @returns {string}
79
+ */
80
+ export declare function fSecondsToTime(second: any): string;
81
+ /**
82
+ * Formats an amount into USD currency format
83
+ * @param amount
84
+ * @returns {string}
85
+ */
86
+ export declare function fCurrency(amount: any): string;
87
+ /**
88
+ * Formats a number into a human-readable format
89
+ * @param number
90
+ * @param options
91
+ * @returns {string}
92
+ */
93
+ export declare function fNumber(number: any, options?: {}): string;
94
+ /**
95
+ * Truncates the string by removing chars from the middle of the string
96
+ * @param str
97
+ * @param maxLength
98
+ * @returns {string|*}
99
+ */
100
+ export declare function centerTruncate(str: any, maxLength: any): any;
101
+ /**
102
+ * Formats a number into a percentage
103
+ * @param num
104
+ * @param options
105
+ * @returns {string}
106
+ */
107
+ export declare function fPercent(num: any, options?: {
108
+ multiplier: number;
109
+ maximumFractionDigits: number;
110
+ NaN: string;
111
+ }): string;
112
+ export declare function fPhone(value: any): any;
@@ -0,0 +1,23 @@
1
+ export declare const request: {
2
+ get(url: any, options?: {}): Promise<any>;
3
+ post(url: any, data?: {}, options?: {}): Promise<any>;
4
+ };
5
+ /**
6
+ * Fetches a resource list applying the filter. If there is a selected resource,
7
+ * stores that resource from the already populated list. If that resource does not exist
8
+ * also fetches that resource record from the endpoint, then adds it to the list if it
9
+ * does not exist in the filtered list
10
+ *
11
+ * @param fetchFn
12
+ * @param list
13
+ * @param id
14
+ * @param filter
15
+ * @returns {Promise<void>}
16
+ */
17
+ export declare function fetchResourceListWithSelected(fetchFn: any, list: any, id: any, filter: any): Promise<void>;
18
+ /**
19
+ * Returns the value of the URL parameter (if it is set)
20
+ * @param key
21
+ * @param url
22
+ */
23
+ export declare function getUrlParam(key: any, url?: undefined): string | null;
@@ -0,0 +1,15 @@
1
+ export * from './array';
2
+ export * from './compatibility';
3
+ export * from './date';
4
+ export * from './download';
5
+ export * from './downloadPdf';
6
+ export * from './files';
7
+ export * from './FileUpload';
8
+ export * from './FlashMessages';
9
+ export * from './formats';
10
+ export * from './http';
11
+ export * from './multiFileUpload';
12
+ export * from './actions';
13
+ export * from './singleFileUpload';
14
+ export * from './storage';
15
+ export * from './utils';
@@ -0,0 +1,11 @@
1
+ import { FileUploadOptions } from './FileUpload';
2
+
3
+ export declare function useMultiFileUpload(options: FileUploadOptions): {
4
+ onClear: () => void;
5
+ onRemove: (file: any) => void;
6
+ onComplete: (cb: any) => void;
7
+ onFilesChange: (cb: any) => void;
8
+ onDrop: (e: any) => void;
9
+ onFilesSelected: (e: any) => void;
10
+ uploadedFiles: import('vue').Ref<never[]>;
11
+ };
@@ -0,0 +1,11 @@
1
+ import { FileUploadOptions } from './FileUpload';
2
+
3
+ export declare function useSingleFileUpload(options?: FileUploadOptions): {
4
+ isFileUploaded: import('vue').ComputedRef<null>;
5
+ onClear: () => void;
6
+ onComplete: (cb: any) => void;
7
+ onFileChange: (cb: any) => void;
8
+ onDrop: (e: any) => void;
9
+ onFileSelected: (e: any) => void;
10
+ uploadedFile: import('vue').Ref<null>;
11
+ };
@@ -0,0 +1,2 @@
1
+ export declare function setItem(key: any, value: any): void;
2
+ export declare function getItem(key: any, defaultValue?: null): any;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Sleep function to be used in conjuction with async await:
3
+ *
4
+ * eg: await sleep(5000);
5
+ *
6
+ * @param delay
7
+ * @returns {Promise<any>}
8
+ */
9
+ export declare function sleep(delay: any): Promise<unknown>;
10
+ /**
11
+ * Wait for a ref to have a value and then resolve the promise
12
+ *
13
+ * @param ref
14
+ * @param value
15
+ * @returns {Promise<void>}
16
+ */
17
+ export declare function waitForRef(ref: any, value: any): Promise<void>;
18
+ /**
19
+ * Returns a number that is constrained to the given range.
20
+ * @param min
21
+ * @param max
22
+ * @param value
23
+ * @returns {number}
24
+ */
25
+ export declare function minmax(min: any, max: any, value: any): number;
26
+ /**
27
+ * Convert meters to miles
28
+ * @param meters
29
+ * @returns {number}
30
+ */
31
+ export declare function metersToMiles(meters: any): number;
32
+ /**
33
+ * Convert miles to meters
34
+ * @param miles
35
+ * @returns {number}
36
+ */
37
+ export declare function milesToMeters(miles: any): number;
38
+ /**
39
+ * Parses a string for Lat and Long coords
40
+ * @param location
41
+ * @returns {null|{lng: number, lat: number}}
42
+ */
43
+ export declare function parseCoords(location: any): {
44
+ lat: number;
45
+ lng: number;
46
+ } | null;
@@ -0,0 +1,12 @@
1
+ export { default as CaretDownIcon } from './CaretDownIcon.svg';
2
+ export { default as DragHandleDotsIcon } from './DragHandleDotsIcon.svg';
3
+ export { default as DragHandleIcon } from './DragHandleIcon.svg';
4
+ export { default as FilterIcon } from './FilterIcon.svg';
5
+ export { default as ImageIcon } from './ImageIcon.svg';
6
+ export { default as PdfIcon } from './PdfIcon.svg';
7
+ export { default as PercentIcon } from './PercentIcon.svg';
8
+ export { default as SkipNextIcon } from './SkipNextIcon.svg';
9
+ export { default as SkipPreviousIcon } from './SkipPreviousIcon.svg';
10
+ export { default as TrashIcon } from './TrashIcon.svg';
11
+ export { default as WarningIcon } from './WarningIcon.svg';
12
+ export { default as XIcon } from './XIcon.svg';
@@ -0,0 +1 @@
1
+ export declare const apiKey = "YOUR_API_KEY";
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
- "main": "dist/dan.es.js",
9
- "module": "dist/dan.es.js",
8
+ "main": "dist/danx.es.js",
9
+ "module": "dist/danx.es.js",
10
10
  "scripts": {
11
- "dev": "vite",
11
+ "dev": "cd dev && quasar dev && cd ..",
12
12
  "build": "vite build",
13
13
  "preview": "vite preview"
14
14
  },
@@ -32,8 +32,9 @@
32
32
  "ts-node": "^10.9.2",
33
33
  "typescript": "^5.4.4",
34
34
  "vite": "^5.2.8",
35
+ "vite-plugin-dts": "^3.8.1",
35
36
  "vite-svg-loader": "^5.1.0",
36
- "vue": "^3.0.0",
37
+ "vue": "^3.4.21",
37
38
  "vue-router": "^4.0.0"
38
39
  },
39
40
  "dependencies": {
@@ -4,21 +4,31 @@ import { resolveFileLocation } from "./files";
4
4
  import { FlashMessages } from "./FlashMessages";
5
5
 
6
6
  export type FileUploadOptions = {
7
- directory: string,
8
- presignedUploadUrl: (...params) => "",
9
- uploadCompletedUrl: (...params) => "",
7
+ directory?: string,
8
+ presignedUploadUrl?: (...params: any) => "",
9
+ uploadCompletedUrl?: (...params: any) => "",
10
10
  };
11
11
 
12
+ export type UploadedFile = {
13
+ id: string,
14
+ name: string,
15
+ size: number,
16
+ type: string,
17
+ progress: number,
18
+ location: string,
19
+ blobUrl: string
20
+ }
21
+
12
22
  export class FileUpload {
13
- files: { id: string, blobUrl: string }[] = [];
23
+ files: UploadedFile[] = [];
14
24
  fileUploads = [];
15
25
  onErrorCb = null;
16
26
  onProgressCb = null;
17
27
  onCompleteCb = null;
18
28
  onAllCompleteCb = null;
19
- options: FileUploadOptions = null;
29
+ options: FileUploadOptions = {};
20
30
 
21
- constructor(files, options: FileUploadOptions = null) {
31
+ constructor(files: UploadedFile[] | UploadedFile, options: FileUploadOptions = {}) {
22
32
  if (!Array.isArray(files) && !(files instanceof FileList)) {
23
33
  files = [files];
24
34
  }
@@ -31,7 +41,6 @@ export class FileUpload {
31
41
 
32
42
  this.options = {
33
43
  ...danxOptions.fileUpload,
34
- ...this.options,
35
44
  ...options
36
45
  };
37
46
 
package/tsconfig.json CHANGED
@@ -1,32 +1,41 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "outDir": "./dist",
4
- "declaration": true,
5
- // Specify ECMAScript target version
3
+ // Compile down to ESNext (or choose your target version)
6
4
  "target": "esnext",
7
- // Specify module code generation
5
+ // Use ES modules
8
6
  "module": "esnext",
7
+ // Library files to be included in the compilation
8
+ "lib": [
9
+ "dom",
10
+ "esnext"
11
+ ],
12
+ // Generate corresponding '.d.ts' file
13
+ "declaration": true,
14
+ // Output directory for the compiled files
15
+ "outDir": "./dist",
16
+ // Root directory of your source files
17
+ "rootDir": "./src",
9
18
  // Enable all strict type-checking options
10
- "strict": false,
11
- // Enables compatibility with Babel-imported CommonJS modules
19
+ "strict": true,
20
+ // Enables compatibility with Babel-style module imports
12
21
  "esModuleInterop": true,
13
- "resolveJsonModule": true,
22
+ // Skip type checking of all declaration files (*.d.ts)
23
+ "skipLibCheck": true,
24
+ // Disallow inconsistently-cased references to the same file
25
+ "forceConsistentCasingInFileNames": true,
14
26
  // Resolve modules using Node.js style
15
27
  "moduleResolution": "node",
16
28
  // Allow default imports from modules with no default export
17
29
  "allowSyntheticDefaultImports": true,
18
30
  // Enables experimental support for decorators
19
31
  "experimentalDecorators": true,
20
- // Skip type checking of all declaration files (*.d.ts)
21
- "skipLibCheck": true,
32
+ // Enables source map generation for the compiled files (useful for debugging)
22
33
  "sourceMap": true,
23
- // Disallow inconsistently-cased references to the same file.
24
- "forceConsistentCasingInFileNames": true,
25
34
  // Base directory to resolve non-relative module names,
26
35
  "baseUrl": "./",
27
36
  "paths": {
28
37
  "@/*": [
29
- "./dev/src/*"
38
+ "./src/*"
30
39
  ]
31
40
  }
32
41
  },
@@ -38,6 +47,8 @@
38
47
  ],
39
48
  "exclude": [
40
49
  "node_modules",
41
- "dist"
50
+ "dist",
51
+ "demo",
52
+ "**/*.spec.ts"
42
53
  ]
43
54
  }
package/vite.config.js CHANGED
@@ -1,10 +1,16 @@
1
1
  import vue from '@vitejs/plugin-vue';
2
2
  import { resolve } from 'path';
3
3
  import { defineConfig } from 'vite';
4
+ import dts from 'vite-plugin-dts';
4
5
  import svgLoader from 'vite-svg-loader';
5
6
 
6
7
  export default defineConfig({
7
- plugins: [vue(), svgLoader()],
8
+ plugins: [vue(), svgLoader(), dts({
9
+ compilerOptions: {
10
+ noImplicitAny: false,
11
+ suppressImplicitAnyIndexErrors: true
12
+ }
13
+ })],
8
14
  resolve: {
9
15
  extensions: ['.mjs', '.js', '.ts', '.mts', '.jsx', '.tsx', '.json', '.vue', '.svg']
10
16
  },