@fastkit/vui 0.7.54 → 0.7.57
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/tool/index.js +1 -0
- package/dist/tool/vite-plugin.d.ts.map +1 -1
- package/dist/vui.cjs.js +119 -33
- package/dist/vui.cjs.prod.js +119 -33
- package/dist/vui.css +11 -0
- package/dist/vui.d.ts +179 -91
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/dist/vui.mjs +120 -35
- package/package.json +6 -6
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/VButton/VButton.tsx +0 -1
- package/src/components/VControlField/VControlField.tsx +23 -6
- package/src/components/VDataTable/VDataTable.tsx +5 -5
- package/src/components/VFormControl/VFormControl.tsx +6 -1
- package/src/components/VSelect/VSelect.tsx +67 -15
- package/src/components/VTextField/VTextField.tsx +1 -0
- package/src/components/VTextarea/VTextarea.tsx +1 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +7 -2
- package/src/composables/control.ts +1 -0
- package/src/composables/form-selector.scss +13 -0
- package/src/composables/form-selector.tsx +48 -1
- package/src/schemes/control.ts +6 -0
- package/src/service.tsx +6 -2
- package/src/tool/vite-plugin.ts +1 -0
|
@@ -100,8 +100,12 @@ export const VWysiwygEditor = defineComponent({
|
|
|
100
100
|
() => props.modelValue,
|
|
101
101
|
(modelValue) => {
|
|
102
102
|
const $editor = editor.value;
|
|
103
|
-
if (!$editor) return;
|
|
104
|
-
|
|
103
|
+
if (!$editor || $editor.getHTML() === modelValue) return;
|
|
104
|
+
|
|
105
|
+
$editor.commands.setContent(
|
|
106
|
+
modelValue == null ? '' : modelValue,
|
|
107
|
+
false,
|
|
108
|
+
);
|
|
105
109
|
textRef.value = $editor.getText();
|
|
106
110
|
},
|
|
107
111
|
);
|
|
@@ -255,6 +259,7 @@ export const VWysiwygEditor = defineComponent({
|
|
|
255
259
|
autoHeight
|
|
256
260
|
startAdornment={this.startAdornment}
|
|
257
261
|
endAdornment={this.endAdornment}
|
|
262
|
+
size={this.size}
|
|
258
263
|
// onClickHost={(ev) => {
|
|
259
264
|
// this.focus();
|
|
260
265
|
// }}
|
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
&__placeholder {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
margin-top: 8px;
|
|
10
|
+
font-style: italic;
|
|
11
|
+
opacity: 0.5;
|
|
12
|
+
|
|
13
|
+
&--error {
|
|
14
|
+
color: var(--main-color);
|
|
15
|
+
opacity: 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
6
19
|
&--stacked &__body {
|
|
7
20
|
display: flex;
|
|
8
21
|
flex-direction: column;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './form-selector.scss';
|
|
2
|
-
import { VNodeChild, defineComponent } from 'vue';
|
|
2
|
+
import { VNodeChild, defineComponent, PropType, computed } from 'vue';
|
|
3
3
|
import {
|
|
4
4
|
defineSlotsProps,
|
|
5
5
|
TypedSlot,
|
|
@@ -11,9 +11,14 @@ import {
|
|
|
11
11
|
ResolvedFormSelectorItemData,
|
|
12
12
|
FormNodeControl,
|
|
13
13
|
renderSlotOrEmpty,
|
|
14
|
+
VNodeChildOrSlot,
|
|
15
|
+
resolveVNodeChildOrSlots,
|
|
14
16
|
} from '@fastkit/vue-kit';
|
|
15
17
|
import { createControlProps, useControl } from './control';
|
|
16
18
|
import { VFormControl } from '../components/VFormControl';
|
|
19
|
+
import { useVui } from '../injections';
|
|
20
|
+
import { VProgressCircular } from '../components/loading';
|
|
21
|
+
import { CONTROL_LOADING_SPINNER_SIZES } from '../schemes';
|
|
17
22
|
|
|
18
23
|
export interface DefineFormSelectorComponentOptions {
|
|
19
24
|
name: string;
|
|
@@ -51,6 +56,10 @@ export function defineFormSelectorComponent(
|
|
|
51
56
|
type: Boolean,
|
|
52
57
|
default: true,
|
|
53
58
|
},
|
|
59
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
60
|
+
loadingMessage: {} as PropType<VNodeChildOrSlot>,
|
|
61
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
62
|
+
failedToLoadItemsMessage: {} as PropType<VNodeChildOrSlot>,
|
|
54
63
|
...defineSlotsProps<FormControlSlots>(),
|
|
55
64
|
},
|
|
56
65
|
emits,
|
|
@@ -60,9 +69,28 @@ export function defineFormSelectorComponent(
|
|
|
60
69
|
defaultMultiple,
|
|
61
70
|
});
|
|
62
71
|
const control = useControl(props);
|
|
72
|
+
const vui = useVui();
|
|
73
|
+
const loadingMessageRef = computed(() => {
|
|
74
|
+
const slot = resolveVNodeChildOrSlots(
|
|
75
|
+
props.loadingMessage,
|
|
76
|
+
vui.setting('loadingMessage'),
|
|
77
|
+
'Loading...',
|
|
78
|
+
);
|
|
79
|
+
return slot && slot(vui);
|
|
80
|
+
});
|
|
81
|
+
const failedToLoadItemsMessageRef = computed(() => {
|
|
82
|
+
const slot = resolveVNodeChildOrSlots(
|
|
83
|
+
props.failedToLoadItemsMessage,
|
|
84
|
+
vui.setting('failedToLoadDataMessage'),
|
|
85
|
+
'Failed to load data.',
|
|
86
|
+
);
|
|
87
|
+
return slot && slot(vui);
|
|
88
|
+
});
|
|
63
89
|
return {
|
|
64
90
|
...selectorControl.expose(),
|
|
65
91
|
...control,
|
|
92
|
+
loadingMessageRef,
|
|
93
|
+
failedToLoadItemsMessageRef,
|
|
66
94
|
};
|
|
67
95
|
},
|
|
68
96
|
render() {
|
|
@@ -84,10 +112,29 @@ export function defineFormSelectorComponent(
|
|
|
84
112
|
hint={this.hint}
|
|
85
113
|
hinttip={this.hinttip}
|
|
86
114
|
requiredChip={this.requiredChip}
|
|
115
|
+
error={selectorControl.itemsLoadFailed}
|
|
87
116
|
v-slots={{
|
|
88
117
|
...this.$slots,
|
|
89
118
|
default: () => (
|
|
90
119
|
<div class="v-form-selector__body">
|
|
120
|
+
{selectorControl.itemsLoadFailed && (
|
|
121
|
+
<div
|
|
122
|
+
key="failed"
|
|
123
|
+
class="v-form-selector__placeholder v-form-selector__placeholder--error">
|
|
124
|
+
{this.failedToLoadItemsMessageRef}
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
{selectorControl.itemsLoading && (
|
|
128
|
+
<div key="loading" class="v-form-selector__placeholder">
|
|
129
|
+
<VProgressCircular
|
|
130
|
+
indeterminate
|
|
131
|
+
class="mr-1"
|
|
132
|
+
size={CONTROL_LOADING_SPINNER_SIZES[this.size || 'md']}
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
{this.loadingMessageRef}
|
|
136
|
+
</div>
|
|
137
|
+
)}
|
|
91
138
|
{this.propItems.map((attrs) => {
|
|
92
139
|
const selected = selectorControl.isSelected(attrs.value);
|
|
93
140
|
return itemRenderer({
|
package/src/schemes/control.ts
CHANGED
|
@@ -5,3 +5,9 @@ export type ControlSize = typeof CONTROL_SIZES[number];
|
|
|
5
5
|
export const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'] as const;
|
|
6
6
|
|
|
7
7
|
export type ControlFieldVariant = typeof CONTROL_FIELD_VARIANTS[number];
|
|
8
|
+
|
|
9
|
+
export const CONTROL_LOADING_SPINNER_SIZES: Record<ControlSize, number> = {
|
|
10
|
+
sm: 16,
|
|
11
|
+
md: 20,
|
|
12
|
+
lg: 24,
|
|
13
|
+
};
|
package/src/service.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type VueStackService,
|
|
9
9
|
type VDialogProps,
|
|
10
10
|
type VStackControl,
|
|
11
|
+
type VNodeChildOrSlot,
|
|
11
12
|
resolveVStackDynamicInput,
|
|
12
13
|
} from '@fastkit/vue-kit';
|
|
13
14
|
import type { Router } from 'vue-router';
|
|
@@ -60,8 +61,10 @@ export interface VuiServiceUISettings {
|
|
|
60
61
|
variant?: ColorVariant;
|
|
61
62
|
};
|
|
62
63
|
hinttipDelay?: FormControlHinttipDelay;
|
|
63
|
-
noDataMessage?:
|
|
64
|
-
noResultsMessage?:
|
|
64
|
+
noDataMessage?: VNodeChildOrSlot;
|
|
65
|
+
noResultsMessage?: VNodeChildOrSlot;
|
|
66
|
+
loadingMessage?: VNodeChildOrSlot;
|
|
67
|
+
failedToLoadDataMessage?: VNodeChildOrSlot;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
export type RawVuiServiceUISettings = Partial<VuiServiceUISettings>;
|
|
@@ -102,6 +105,7 @@ export interface VuiServiceIconSettings {
|
|
|
102
105
|
editorRedo: IconName;
|
|
103
106
|
hinttip: IconName;
|
|
104
107
|
clear: IconName;
|
|
108
|
+
reload: IconName;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
export type RawVuiServiceIconSettings = Partial<VuiServiceIconSettings>;
|
package/src/tool/vite-plugin.ts
CHANGED
|
@@ -173,6 +173,7 @@ export function viteVuiPlugin(
|
|
|
173
173
|
editorRedo: 'mdi-redo-variant' as any,
|
|
174
174
|
hinttip: 'mdi-help-circle-outline' as any,
|
|
175
175
|
clear: 'mdi-close' as any,
|
|
176
|
+
reload: 'mdi-reload' as any,
|
|
176
177
|
// navigationExpand: (gen, active) => {
|
|
177
178
|
// return gen({
|
|
178
179
|
// name: 'mdi-menu-down' as any,
|