@signal24/vue-foundation 4.15.1 → 4.16.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/ajax-select.vue.d.ts +7 -7
- package/dist/src/components/alert-modal.vue.d.ts +13 -22
- package/dist/src/components/ez-smart-select.vue.d.ts +12 -21
- package/dist/src/components/modal.vue.d.ts +32 -29
- package/dist/src/components/overlay-anchor.vue.d.ts +14 -14
- package/dist/src/components/overlay-container.d.ts +1 -1
- package/dist/src/components/smart-select.vue.d.ts +27 -32
- package/dist/src/components/toast.vue.d.ts +3 -12
- package/dist/src/directives/hotkey.d.ts +2 -0
- package/dist/src/directives/index.d.ts +2 -0
- package/dist/src/filters/index.d.ts +1 -12
- package/dist/vue-foundation.es.js +495 -468
- package/package.json +28 -28
- package/src/components/alert-modal.vue +1 -1
- package/src/components/ez-smart-select.vue +1 -1
- package/src/components/modal.vue +2 -2
- package/src/directives/hotkey.ts +52 -0
- package/src/directives/index.ts +3 -0
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.16.1",
|
|
5
5
|
"description": "Common components, directives, and helpers for Vue 3 apps",
|
|
6
6
|
"module": "./dist/vue-foundation.es.js",
|
|
7
7
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"uuid": "^
|
|
37
|
+
"uuid": "^10.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@signal24/openapi-client-codegen": "^1.1.0",
|
|
@@ -43,37 +43,37 @@
|
|
|
43
43
|
"vue": "^3.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@nabla/vite-plugin-eslint": "^2.0.
|
|
47
|
-
"@rushstack/eslint-patch": "^1.
|
|
46
|
+
"@nabla/vite-plugin-eslint": "^2.0.4",
|
|
47
|
+
"@rushstack/eslint-patch": "^1.10.4",
|
|
48
48
|
"@signal24/openapi-client-codegen": "^1.1.0",
|
|
49
|
-
"@tsconfig/node20": "^20.1.
|
|
50
|
-
"@types/jsdom": "^21.1.
|
|
51
|
-
"@types/lodash": "^4.
|
|
52
|
-
"@types/node": "^20.
|
|
53
|
-
"@types/uuid": "^
|
|
54
|
-
"@vitejs/plugin-vue": "^5.
|
|
49
|
+
"@tsconfig/node20": "^20.1.4",
|
|
50
|
+
"@types/jsdom": "^21.1.7",
|
|
51
|
+
"@types/lodash": "^4.17.7",
|
|
52
|
+
"@types/node": "^20.16.3",
|
|
53
|
+
"@types/uuid": "^10.0.0",
|
|
54
|
+
"@vitejs/plugin-vue": "^5.1.3",
|
|
55
55
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
56
56
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
57
|
-
"@vue/test-utils": "^2.4.
|
|
57
|
+
"@vue/test-utils": "^2.4.6",
|
|
58
58
|
"@vue/tsconfig": "^0.5.1",
|
|
59
|
-
"cypress": "^13.
|
|
60
|
-
"date-fns": "^3.0
|
|
61
|
-
"eslint": "^8.
|
|
62
|
-
"eslint-plugin-cypress": "^3.
|
|
63
|
-
"eslint-plugin-simple-import-sort": "^12.1.
|
|
64
|
-
"eslint-plugin-unused-imports": "^4.
|
|
65
|
-
"eslint-plugin-vue": "^9.
|
|
66
|
-
"jsdom": "^
|
|
59
|
+
"cypress": "^13.14.1",
|
|
60
|
+
"date-fns": "^3.6.0",
|
|
61
|
+
"eslint": "^8.57.0",
|
|
62
|
+
"eslint-plugin-cypress": "^3.5.0",
|
|
63
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
64
|
+
"eslint-plugin-unused-imports": "^4.1.3",
|
|
65
|
+
"eslint-plugin-vue": "^9.28.0",
|
|
66
|
+
"jsdom": "^25.0.0",
|
|
67
67
|
"lodash": "^4.17.21",
|
|
68
|
-
"prettier": "^3.
|
|
69
|
-
"sass": "^1.
|
|
70
|
-
"start-server-and-test": "^2.0.
|
|
71
|
-
"type-fest": "^4.
|
|
72
|
-
"typescript": "~5.
|
|
73
|
-
"vite": "^5.
|
|
74
|
-
"vitest": "^
|
|
75
|
-
"vue": "^3.
|
|
76
|
-
"vue-tsc": "^1.
|
|
68
|
+
"prettier": "^3.3.3",
|
|
69
|
+
"sass": "^1.77.8",
|
|
70
|
+
"start-server-and-test": "^2.0.5",
|
|
71
|
+
"type-fest": "^4.26.0",
|
|
72
|
+
"typescript": "~5.5.4",
|
|
73
|
+
"vite": "^5.4.3",
|
|
74
|
+
"vitest": "^2.0.5",
|
|
75
|
+
"vue": "^3.5.0",
|
|
76
|
+
"vue-tsc": "^2.1.4"
|
|
77
77
|
},
|
|
78
78
|
"packageManager": "yarn@4.0.2"
|
|
79
79
|
}
|
|
@@ -46,6 +46,6 @@ watch(
|
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
watch(selectedItem, value => {
|
|
49
|
-
emit('update:modelValue', value ? computedOpts.value.find(o => isEqual(o, value))?.value ?? null : null);
|
|
49
|
+
emit('update:modelValue', value ? (computedOpts.value.find(o => isEqual(o, value))?.value ?? null) : null);
|
|
50
50
|
});
|
|
51
51
|
</script>
|
package/src/components/modal.vue
CHANGED
|
@@ -29,7 +29,7 @@ const props = defineProps<{
|
|
|
29
29
|
closeOnMaskClick?: boolean;
|
|
30
30
|
scrolls?: boolean;
|
|
31
31
|
closeX?: boolean;
|
|
32
|
-
class?: string;
|
|
32
|
+
class?: string | string[];
|
|
33
33
|
}>();
|
|
34
34
|
|
|
35
35
|
defineEmits(['formSubmit']);
|
|
@@ -41,7 +41,7 @@ const form = ref<HTMLFormElement>();
|
|
|
41
41
|
const isHidden = ref(false);
|
|
42
42
|
|
|
43
43
|
const classList = computed(() => {
|
|
44
|
-
return compact([props.class, isHidden.value && 'hidden']);
|
|
44
|
+
return compact([...(Array.isArray(props.class) ? props.class : [props.class]), isHidden.value && 'hidden']);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
onMounted(() => {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { last } from 'lodash';
|
|
2
|
+
import type { DirectiveBinding, ObjectDirective } from 'vue';
|
|
3
|
+
|
|
4
|
+
export const vHotkey: ObjectDirective<HTMLButtonElement, string> = {
|
|
5
|
+
mounted: setup,
|
|
6
|
+
updated: reset,
|
|
7
|
+
unmounted: teardown
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const ElementsByHotkey = new Map<string, HTMLButtonElement[]>();
|
|
11
|
+
|
|
12
|
+
function setup(el: HTMLButtonElement, binding: DirectiveBinding<string>) {
|
|
13
|
+
if (ElementsByHotkey.size === 0) {
|
|
14
|
+
window.addEventListener('keydown', handleKeydown);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ElementsByHotkey.set(binding.value.toLowerCase(), [...(ElementsByHotkey.get(binding.value.toLowerCase()) ?? []), el]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function teardown(el: HTMLButtonElement, binding: DirectiveBinding<string>) {
|
|
21
|
+
const elements = ElementsByHotkey.get(binding.value.toLowerCase());
|
|
22
|
+
if (elements) {
|
|
23
|
+
const index = elements.indexOf(el);
|
|
24
|
+
if (index !== -1) {
|
|
25
|
+
elements.splice(index, 1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (elements.length === 0) {
|
|
29
|
+
ElementsByHotkey.delete(binding.value.toLowerCase());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (ElementsByHotkey.size === 0) {
|
|
34
|
+
window.removeEventListener('keydown', handleKeydown);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function reset(el: HTMLButtonElement, binding: DirectiveBinding<string>) {
|
|
39
|
+
teardown(el, binding);
|
|
40
|
+
setup(el, binding);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
44
|
+
if (typeof event.key !== 'string') return;
|
|
45
|
+
const hotkey = event.key.toLowerCase();
|
|
46
|
+
const elements = ElementsByHotkey.get(hotkey);
|
|
47
|
+
if (elements) {
|
|
48
|
+
const element = last(elements);
|
|
49
|
+
element?.click();
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/directives/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { vDateInput } from './date-input';
|
|
|
6
6
|
import { vDatetime } from './datetime';
|
|
7
7
|
import { vDisabled } from './disabled';
|
|
8
8
|
import { vDuration } from './duration';
|
|
9
|
+
import { vHotkey } from './hotkey';
|
|
9
10
|
import { vInfiniteScroll } from './infinite-scroll';
|
|
10
11
|
import { vReadonly } from './readonly';
|
|
11
12
|
import { vTooltip } from './tooltip';
|
|
@@ -18,6 +19,7 @@ declare module 'vue' {
|
|
|
18
19
|
vDatetime: typeof vDatetime;
|
|
19
20
|
vDisabled: typeof vDisabled;
|
|
20
21
|
vDuration: typeof vDuration;
|
|
22
|
+
vHotkey: typeof vHotkey;
|
|
21
23
|
vInfiniteScroll: typeof vInfiniteScroll;
|
|
22
24
|
vReadonly: typeof vReadonly;
|
|
23
25
|
vTooltip: typeof vTooltip;
|
|
@@ -31,6 +33,7 @@ export function registerDirectives(app: App<Element>): void {
|
|
|
31
33
|
app.directive('datetime', vDatetime);
|
|
32
34
|
app.directive('disabled', vDisabled);
|
|
33
35
|
app.directive('duration', vDuration);
|
|
36
|
+
app.directive('hotkey', vHotkey);
|
|
34
37
|
app.directive('infinite-scroll', vInfiniteScroll);
|
|
35
38
|
app.directive('readonly', vReadonly);
|
|
36
39
|
app.directive('tooltip', vTooltip);
|