@signal24/vue-foundation 4.16.0 → 4.17.0

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.
Files changed (46) hide show
  1. package/demo/components/demo-root.vue +21 -0
  2. package/demo/components/demo-vf-smart-select.vue +28 -0
  3. package/demo/index.html +14 -0
  4. package/demo/index.ts +10 -0
  5. package/demo/vite.config.ts +23 -0
  6. package/dist/demo/components/demo-root.vue.d.ts +2 -0
  7. package/dist/demo/components/demo-vf-smart-select.vue.d.ts +2 -0
  8. package/dist/demo/index.d.ts +1 -0
  9. package/dist/demo/vite.config.d.ts +2 -0
  10. package/dist/src/components/index.d.ts +5 -5
  11. package/dist/src/components/overlay-anchor.vue.d.ts +1 -1
  12. package/dist/src/components/overlay-container.d.ts +1 -1
  13. package/dist/src/components/toast-helpers.d.ts +1 -1
  14. package/dist/src/components/vf-ajax-select.vue.d.ts +26 -0
  15. package/dist/src/components/{alert-modal.vue.d.ts → vf-alert-modal.vue.d.ts} +1 -1
  16. package/dist/src/components/{ez-smart-select.vue.d.ts → vf-ez-smart-select.vue.d.ts} +13 -5
  17. package/dist/src/components/{modal.vue.d.ts → vf-modal.vue.d.ts} +1 -1
  18. package/dist/src/components/vf-smart-select.vue.d.ts +47 -0
  19. package/dist/src/components/{toast.vue.d.ts → vf-toast.vue.d.ts} +1 -1
  20. package/dist/vue-foundation.es.js +828 -893
  21. package/eslint.config.mjs +67 -0
  22. package/package.json +10 -8
  23. package/src/components/alert-helpers.ts +1 -1
  24. package/src/components/index.ts +5 -5
  25. package/src/components/overlay-container.ts +5 -1
  26. package/src/components/toast-helpers.ts +1 -1
  27. package/src/components/vf-ajax-select.vue +61 -0
  28. package/src/components/{alert-modal.vue → vf-alert-modal.vue} +5 -5
  29. package/src/components/{ez-smart-select.vue → vf-ez-smart-select.vue} +12 -8
  30. package/src/components/{modal.vue → vf-modal.vue} +3 -3
  31. package/src/components/vf-smart-select.vue +585 -0
  32. package/src/directives/duration.ts +3 -3
  33. package/src/directives/hotkey.ts +1 -0
  34. package/src/filters/index.ts +1 -0
  35. package/src/helpers/array.ts +1 -0
  36. package/src/helpers/error.ts +4 -0
  37. package/src/helpers/object.ts +1 -0
  38. package/tsconfig.app.json +1 -1
  39. package/tsconfig.node.json +1 -1
  40. package/tsconfig.vitest.json +2 -2
  41. package/.eslintrc.cjs +0 -35
  42. package/dist/src/components/ajax-select.vue.d.ts +0 -19
  43. package/dist/src/components/smart-select.vue.d.ts +0 -115
  44. package/src/components/ajax-select.vue +0 -75
  45. package/src/components/smart-select.vue +0 -609
  46. /package/src/components/{toast.vue → vf-toast.vue} +0 -0
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "extends": "./tsconfig.app.json",
3
- "exclude": [],
4
3
  "compilerOptions": {
5
4
  "composite": false,
6
5
  "lib": [],
7
6
  "types": ["node", "jsdom"],
8
7
  "emitDeclarationOnly": false,
9
- "noEmit": true
8
+ "noEmit": true,
9
+ "rootDir": "."
10
10
  }
11
11
  }
package/.eslintrc.cjs DELETED
@@ -1,35 +0,0 @@
1
- /* eslint-env node */
2
- require('@rushstack/eslint-patch/modern-module-resolution');
3
-
4
- module.exports = {
5
- root: true,
6
- extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-typescript', '@vue/eslint-config-prettier'],
7
- overrides: [
8
- {
9
- files: ['cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'],
10
- extends: ['plugin:cypress/recommended']
11
- },
12
- {
13
- files: ['vite.config.*', 'vitest.config.*', 'cypress.config.*', 'playwright.config.*'],
14
- env: {
15
- node: true
16
- }
17
- }
18
- ],
19
- parserOptions: {
20
- ecmaVersion: 'latest'
21
- },
22
- plugins: ['unused-imports', 'simple-import-sort'],
23
- rules: {
24
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
25
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
26
- 'simple-import-sort/imports': 'error',
27
- 'simple-import-sort/exports': 'error',
28
- 'prettier/prettier': 'warn',
29
- 'no-unused-vars': 'off',
30
- 'unused-imports/no-unused-imports': 'error',
31
- 'unused-imports/no-unused-vars': ['warn', { vars: 'all', varsIgnorePattern: '^_', args: 'all', argsIgnorePattern: '^_' }],
32
- 'vue/multi-word-component-names': 'off',
33
- 'vue/no-reserved-component-names': 'off'
34
- }
35
- };
@@ -1,19 +0,0 @@
1
- type GenericObject = {
2
- [key: string]: any;
3
- };
4
- declare const _default: import("vue").DefineComponent<{}, {
5
- props: import("vue").DefineProps<import("@vue/shared").LooseRequired<{
6
- modelValue: any;
7
- loadFn: () => Promise<GenericObject[]>;
8
- nullText?: string;
9
- loadingText?: string;
10
- displayKey?: string;
11
- preprocesor?: (option: GenericObject) => string;
12
- }>, "modelValue">;
13
- options: import("vue").Ref<GenericObject[] | null, GenericObject[] | null>;
14
- renderOptions: import("vue").ComputedRef<any[] | null>;
15
- selectedItem: import("vue").Ref<GenericObject | null, GenericObject | null>;
16
- }, {}, {}, {
17
- load(): Promise<void>;
18
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}>;
19
- export default _default;
@@ -1,115 +0,0 @@
1
- import type { PropType } from 'vue';
2
- export type GenericObject = {
3
- [key: string]: any;
4
- };
5
- export interface OptionDescriptor {
6
- key: string | Symbol;
7
- title: string;
8
- subtitle?: string | null;
9
- searchContent?: string;
10
- ref?: GenericObject;
11
- }
12
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
13
- modelValue: {
14
- type: PropType<any>;
15
- default: null;
16
- };
17
- loadOptions: PropType<(searchText: string | null) => Promise<GenericObject[]>>;
18
- options: PropType<GenericObject[]>;
19
- prependOptions: PropType<GenericObject[]>;
20
- appendOptions: PropType<GenericObject[]>;
21
- onCreateItem: PropType<(searchText: string) => void>;
22
- preload: PropType<boolean>;
23
- remoteSearch: PropType<boolean>;
24
- searchFields: PropType<string[]>;
25
- placeholder: PropType<string>;
26
- keyExtractor: PropType<(option: any) => string | symbol>;
27
- valueExtractor: PropType<(option: any) => any>;
28
- formatter: {
29
- type: PropType<(option: any) => string>;
30
- required: true;
31
- };
32
- subtitleFormatter: PropType<(option: any) => string>;
33
- nullTitle: PropType<string>;
34
- noResultsText: PropType<string>;
35
- disabled: PropType<boolean>;
36
- optionsListId: PropType<string>;
37
- debug: PropType<boolean>;
38
- required: PropType<boolean>;
39
- }>, {}, {
40
- isLoading: boolean;
41
- isLoaded: boolean;
42
- loadedOptions: GenericObject[];
43
- isSearching: boolean;
44
- searchText: string;
45
- selectedOption: GenericObject | null;
46
- selectedOptionTitle: string | null;
47
- shouldDisplayOptions: boolean;
48
- highlightedOptionKey: string | Symbol | null;
49
- shouldShowCreateOption: boolean;
50
- }, {
51
- /**
52
- * EFFECTIVE PROPS
53
- */
54
- effectivePrependOptions(): GenericObject[];
55
- effectiveAppendOptions(): GenericObject[];
56
- effectiveDisabled(): boolean;
57
- effectivePlaceholder(): string;
58
- effectiveNoResultsText(): string;
59
- effectiveKeyExtractor(): ((option: any) => any) | undefined;
60
- /**
61
- * OPTIONS GENERATION
62
- */
63
- allOptions(): GenericObject[];
64
- optionsDescriptors(): OptionDescriptor[];
65
- effectiveOptions(): OptionDescriptor[];
66
- }, {
67
- loadRemoteOptions(): Promise<void>;
68
- reloadOptions(): Promise<void>;
69
- reloadOptionsIfSearching(): void;
70
- handleKeyDown(e: KeyboardEvent): void;
71
- handleInputFocused(): void;
72
- setHighlightedOptionKey(useFirstItemAsFallback?: boolean): void;
73
- getOptionKey(option: GenericObject): string | Symbol;
74
- getOptionDescriptor(option: GenericObject): OptionDescriptor | null;
75
- handleInputBlurred(): void;
76
- handleOptionsDisplayed(): void;
77
- teleportOptionsContainer(): void;
78
- highlightInitialOption(): void;
79
- handleOptionHover(option: OptionDescriptor): void;
80
- incrementHighlightedOption(increment: number): void;
81
- selectOption(option: OptionDescriptor): void;
82
- handleValueChanged(): void;
83
- addRemoteOption(option: GenericObject): void;
84
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
85
- optionsLoaded: (options: any[]) => void;
86
- 'update:modelValue': (value: any) => void;
87
- }, string, import("vue").PublicProps, Readonly<{
88
- modelValue: any;
89
- formatter: (option: any) => string;
90
- } & {
91
- options?: GenericObject[] | undefined;
92
- disabled?: boolean | undefined;
93
- required?: boolean | undefined;
94
- loadOptions?: ((searchText: string | null) => Promise<GenericObject[]>) | undefined;
95
- prependOptions?: GenericObject[] | undefined;
96
- appendOptions?: GenericObject[] | undefined;
97
- onCreateItem?: ((searchText: string) => void) | undefined;
98
- preload?: boolean | undefined;
99
- remoteSearch?: boolean | undefined;
100
- searchFields?: string[] | undefined;
101
- placeholder?: string | undefined;
102
- keyExtractor?: ((option: any) => string | symbol) | undefined;
103
- valueExtractor?: ((option: any) => any) | undefined;
104
- subtitleFormatter?: ((option: any) => string) | undefined;
105
- nullTitle?: string | undefined;
106
- noResultsText?: string | undefined;
107
- optionsListId?: string | undefined;
108
- debug?: boolean | undefined;
109
- } & {
110
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
111
- onOptionsLoaded?: ((options: any[]) => any) | undefined;
112
- }>, {
113
- modelValue: any;
114
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}>;
115
- export default _default;
@@ -1,75 +0,0 @@
1
- <template>
2
- <select v-if="!renderOptions" disabled>
3
- <option>{{ props.loadingText || 'Loading...' }}</option>
4
- </select>
5
- <select v-else v-model="selectedItem">
6
- <option v-if="props.nullText" :value="null">{{ props.nullText }}</option>
7
- <option v-for="(renderOption, index) in renderOptions" :key="index" :value="options?.[index]">
8
- {{ renderOption }}
9
- </option>
10
- </select>
11
- </template>
12
-
13
- <script lang="ts">
14
- import { computed, defineComponent, defineEmits, defineProps, ref } from 'vue';
15
-
16
- // todo: make type safe when Vue alpha is released
17
-
18
- type GenericObject = { [key: string]: any };
19
-
20
- export default defineComponent({
21
- setup() {
22
- const props = defineProps<{
23
- modelValue: any;
24
- loadFn: () => Promise<GenericObject[]>;
25
- nullText?: string;
26
- loadingText?: string;
27
- displayKey?: string;
28
- preprocesor?: (option: GenericObject) => string;
29
- }>();
30
-
31
- defineEmits(['update:modelValue']);
32
-
33
- const options = ref<GenericObject[] | null>(null);
34
- const renderOptions = computed(() => {
35
- if (!options.value) {
36
- return null;
37
- }
38
-
39
- const result = options.value.map(option => {
40
- return props.preprocesor ? props.preprocesor(option) : option[props.displayKey ?? ''];
41
- });
42
-
43
- return result;
44
- });
45
-
46
- const selectedItem = ref<GenericObject | null>(props.modelValue ?? null);
47
-
48
- return { props, options, renderOptions, selectedItem };
49
- },
50
-
51
- watch: {
52
- loadFn() {
53
- this.load();
54
- },
55
-
56
- selectedItem() {
57
- this.$emit('update:modelValue', this.selectedItem);
58
- },
59
-
60
- modelValue() {
61
- this.selectedItem = this.props.modelValue;
62
- }
63
- },
64
-
65
- mounted() {
66
- this.load();
67
- },
68
-
69
- methods: {
70
- async load() {
71
- this.options = await this.props.loadFn();
72
- }
73
- }
74
- });
75
- </script>