@signal24/vue-foundation 4.6.1 → 4.7.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/dist/src/components/alert-modal.vue.d.ts +48 -25
- package/dist/src/components/ez-smart-select.vue.d.ts +38 -23
- package/dist/src/components/modal.vue.d.ts +38 -23
- package/dist/src/components/overlay-anchor.vue.d.ts +19 -16
- package/dist/src/components/toast.vue.d.ts +42 -13
- package/dist/src/helpers/openapi.d.ts +3 -1
- package/dist/vue-foundation.css +1 -1
- package/dist/vue-foundation.es.js +366 -360
- package/package.json +21 -21
- package/src/components/modal.vue +22 -3
- package/src/directives/tooltip.ts +4 -1
- package/src/helpers/openapi.ts +36 -28
- package/src/hooks/infinite-scroll.ts +4 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signal24/vue-foundation",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.7.1",
|
|
5
5
|
"description": "Common components, directives, and helpers for Vue 3 apps",
|
|
6
6
|
"module": "./dist/vue-foundation.es.js",
|
|
7
7
|
"bin": {
|
|
@@ -39,37 +39,37 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"date-fns": "^2.30.0",
|
|
41
41
|
"lodash": "^4.17.21",
|
|
42
|
-
"type-fest": "^
|
|
42
|
+
"type-fest": "^4.1.0",
|
|
43
43
|
"uuid": "^9.0.0",
|
|
44
44
|
"vue": "^3.3.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@nabla/vite-plugin-eslint": "^1.5.0",
|
|
48
|
-
"@rushstack/eslint-patch": "^1.3.
|
|
49
|
-
"@tsconfig/node18": "^2.0
|
|
48
|
+
"@rushstack/eslint-patch": "^1.3.2",
|
|
49
|
+
"@tsconfig/node18": "^18.2.0",
|
|
50
50
|
"@types/jsdom": "^21.1.1",
|
|
51
|
-
"@types/lodash": "^4.14.
|
|
52
|
-
"@types/node": "^18.
|
|
53
|
-
"@types/uuid": "^9.0.
|
|
51
|
+
"@types/lodash": "^4.14.196",
|
|
52
|
+
"@types/node": "^18.17.1",
|
|
53
|
+
"@types/uuid": "^9.0.2",
|
|
54
54
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
55
|
-
"@vue/eslint-config-prettier": "^
|
|
55
|
+
"@vue/eslint-config-prettier": "^8.0.0",
|
|
56
56
|
"@vue/eslint-config-typescript": "^11.0.3",
|
|
57
|
-
"@vue/test-utils": "^2.
|
|
57
|
+
"@vue/test-utils": "^2.4.1",
|
|
58
58
|
"@vue/tsconfig": "^0.4.0",
|
|
59
|
-
"cypress": "^12.
|
|
60
|
-
"eslint": "^8.
|
|
59
|
+
"cypress": "^12.17.2",
|
|
60
|
+
"eslint": "^8.46.0",
|
|
61
61
|
"eslint-plugin-cypress": "^2.13.3",
|
|
62
62
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
63
|
-
"eslint-plugin-unused-imports": "^
|
|
64
|
-
"eslint-plugin-vue": "^9.
|
|
65
|
-
"jsdom": "^22.
|
|
66
|
-
"openapi-typescript-codegen": "^0.
|
|
67
|
-
"prettier": "^
|
|
68
|
-
"sass": "^1.
|
|
63
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
64
|
+
"eslint-plugin-vue": "^9.16.1",
|
|
65
|
+
"jsdom": "^22.1.0",
|
|
66
|
+
"openapi-typescript-codegen": "^0.25.0",
|
|
67
|
+
"prettier": "^3.0.0",
|
|
68
|
+
"sass": "^1.64.2",
|
|
69
69
|
"start-server-and-test": "^2.0.0",
|
|
70
|
-
"typescript": "~5.
|
|
71
|
-
"vite": "^4.
|
|
72
|
-
"vitest": "^0.
|
|
73
|
-
"vue-tsc": "^1.
|
|
70
|
+
"typescript": "~5.1.6",
|
|
71
|
+
"vite": "^4.4.7",
|
|
72
|
+
"vitest": "^0.33.0",
|
|
73
|
+
"vue-tsc": "^1.8.8"
|
|
74
74
|
}
|
|
75
75
|
}
|
package/src/components/modal.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :id="id" class="vf-overlay vf-modal-wrap" :class="
|
|
2
|
+
<div :id="id" class="vf-overlay vf-modal-wrap" :class="classList" ref="overlay">
|
|
3
3
|
<form action="." class="vf-modal" :class="{ scrolls }" @submit.prevent="$emit('formSubmit')" ref="form">
|
|
4
4
|
<div v-if="$slots.header" class="vf-modal-header">
|
|
5
5
|
<slot name="header" />
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script lang="ts" setup>
|
|
19
|
-
import {
|
|
19
|
+
import { compact } from 'lodash';
|
|
20
|
+
import { computed, getCurrentInstance, onBeforeUnmount, onMounted, ref } from 'vue';
|
|
20
21
|
|
|
21
22
|
import { maskForm, unmaskForm } from '../helpers/mask';
|
|
22
23
|
import { dismissOverlayInjectionByInternalInstance } from './overlay-container';
|
|
@@ -32,11 +33,17 @@ const props = defineProps<{
|
|
|
32
33
|
}>();
|
|
33
34
|
|
|
34
35
|
defineEmits(['formSubmit']);
|
|
35
|
-
defineExpose({ mask, unmask });
|
|
36
|
+
defineExpose({ mask, unmask, hide, unhide });
|
|
36
37
|
|
|
37
38
|
const overlay = ref<HTMLElement>();
|
|
38
39
|
const form = ref<HTMLFormElement>();
|
|
39
40
|
|
|
41
|
+
const isHidden = ref(false);
|
|
42
|
+
|
|
43
|
+
const classList = computed(() => {
|
|
44
|
+
return compact([props.class, isHidden.value && 'hidden']);
|
|
45
|
+
});
|
|
46
|
+
|
|
40
47
|
onMounted(() => {
|
|
41
48
|
document.body.classList.add('vf-modal-open');
|
|
42
49
|
|
|
@@ -80,6 +87,14 @@ function mask() {
|
|
|
80
87
|
function unmask() {
|
|
81
88
|
unmaskForm(form.value!);
|
|
82
89
|
}
|
|
90
|
+
|
|
91
|
+
function hide() {
|
|
92
|
+
isHidden.value = true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function unhide() {
|
|
96
|
+
isHidden.value = false;
|
|
97
|
+
}
|
|
83
98
|
</script>
|
|
84
99
|
|
|
85
100
|
<style lang="scss">
|
|
@@ -90,6 +105,10 @@ function unmask() {
|
|
|
90
105
|
width: 100%;
|
|
91
106
|
height: 100%;
|
|
92
107
|
z-index: 100;
|
|
108
|
+
|
|
109
|
+
&.hidden {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
93
112
|
}
|
|
94
113
|
|
|
95
114
|
.vf-modal-wrap {
|
|
@@ -60,7 +60,10 @@ class VfTooltip {
|
|
|
60
60
|
private handleTargetMouseEnterWithContext = this.handleTargetMouseEnter.bind(this);
|
|
61
61
|
private handleTargetMouseLeaveWithContext = this.handleTargetMouseLeave.bind(this);
|
|
62
62
|
|
|
63
|
-
constructor(
|
|
63
|
+
constructor(
|
|
64
|
+
private el: HTMLElement,
|
|
65
|
+
private config: ITooltipOptions
|
|
66
|
+
) {
|
|
64
67
|
el.addEventListener('mouseenter', this.handleTargetMouseEnterWithContext);
|
|
65
68
|
el.addEventListener('mouseleave', this.handleTargetMouseLeaveWithContext);
|
|
66
69
|
}
|
package/src/helpers/openapi.ts
CHANGED
|
@@ -41,8 +41,10 @@ export declare class ICancelablePromise<T = any> {
|
|
|
41
41
|
|
|
42
42
|
interface IWrappedApiClientOptions<P extends ICancelablePromise = ICancelablePromise, Arguments extends unknown[] = any[]> {
|
|
43
43
|
apiClient: IApiClient;
|
|
44
|
+
wrapper?: (options: IRequestOptions, fn: (options: IRequestOptions) => P) => P;
|
|
44
45
|
onRequest?: (options: IRequestOptions) => IRequestOptions;
|
|
45
46
|
onError?: (err: Error, options: IRequestOptions) => Error | null | void;
|
|
47
|
+
afterRequest?: (options: IRequestOptions) => void;
|
|
46
48
|
CancelablePromise: new (...arguments_: Arguments) => P;
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -50,36 +52,42 @@ export function isApiError(err: any): err is IApiError {
|
|
|
50
52
|
return err instanceof Error && 'status' in err && 'body' in err;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
export function installApiClientInterceptors({ apiClient, onRequest, onError, CancelablePromise }: IWrappedApiClientOptions) {
|
|
55
|
+
export function installApiClientInterceptors({ apiClient, wrapper, onRequest, onError, afterRequest, CancelablePromise }: IWrappedApiClientOptions) {
|
|
54
56
|
const originalRequest = apiClient.request.request.bind(apiClient.request);
|
|
57
|
+
const resolvedWrapper = wrapper ?? ((options, fn) => fn(options));
|
|
55
58
|
apiClient.request.request = (options: IRequestOptions) => {
|
|
56
|
-
options
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
59
|
+
return resolvedWrapper(options, options => {
|
|
60
|
+
options = rewriteOptionsForFileUpload(options);
|
|
61
|
+
|
|
62
|
+
if (onRequest) {
|
|
63
|
+
options = onRequest(options);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return new CancelablePromise((resolve: (value: any) => void, reject: (err: any) => void, onCancel: (handler: () => void) => void) => {
|
|
67
|
+
const promise = originalRequest(options);
|
|
68
|
+
onCancel(promise.cancel);
|
|
69
|
+
promise
|
|
70
|
+
.then(resolve)
|
|
71
|
+
.catch(err => {
|
|
72
|
+
if (isApiError(err) && typeof err.body === 'object' && 'error' in err.body) {
|
|
73
|
+
if (err.status === 422) {
|
|
74
|
+
return reject(new UserError(err.body.error));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
err.message = `${err.body.error} (${err.status})`;
|
|
78
|
+
}
|
|
79
|
+
if (onError) {
|
|
80
|
+
const handlerResult = onError(err, options);
|
|
81
|
+
if (handlerResult === null) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (handlerResult instanceof Error) {
|
|
85
|
+
return reject(handlerResult);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
reject(err);
|
|
89
|
+
})
|
|
90
|
+
.finally(() => afterRequest?.(options));
|
|
83
91
|
});
|
|
84
92
|
});
|
|
85
93
|
};
|
|
@@ -80,7 +80,10 @@ function discoverScrollableAncestorEl(el: Element): Element | null {
|
|
|
80
80
|
export class InfiniteScrollHandler {
|
|
81
81
|
isTripped = false;
|
|
82
82
|
|
|
83
|
-
constructor(
|
|
83
|
+
constructor(
|
|
84
|
+
private el: Element,
|
|
85
|
+
private handler: (e: Event) => void
|
|
86
|
+
) {
|
|
84
87
|
this.install();
|
|
85
88
|
}
|
|
86
89
|
|