@fastkit/vui 0.7.12 → 0.7.19
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 +124 -69
- package/dist/vui.cjs.prod.js +124 -69
- package/dist/vui.css +45 -17
- package/dist/vui.d.ts +155 -0
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/dist/vui.mjs +125 -73
- package/package.json +6 -6
- package/src/components/VFormControl/VFormControl.scss +42 -0
- package/src/components/VFormControl/VFormControl.tsx +69 -4
- package/src/components/VSelect/VSelect.tsx +2 -0
- package/src/components/VTextField/VTextField.tsx +2 -0
- package/src/components/VTextarea/VTextarea.tsx +2 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +2 -0
- package/src/components/index.ts +1 -0
- package/src/components/kits.ts +1 -1
- package/src/composables/form-selector.tsx +2 -0
- package/src/service.tsx +1 -0
- package/src/tool/vite-plugin.ts +1 -0
- package/dist/assets/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
- package/src/assets/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/VButton/.DS_Store +0 -0
- package/src/components/VCheckboxGroup/.DS_Store +0 -0
- package/src/components/VHero/.DS_Store +0 -0
- package/src/components/VRadio/.DS_Store +0 -0
- package/src/components/VRadioGroup/.DS_Store +0 -0
- package/src/components/VSwitchGroup/.DS_Store +0 -0
- package/src/components/VTabs/.DS_Store +0 -0
- package/src/components/VToolbar/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/.DS_Store +0 -0
- package/src/composables/.DS_Store +0 -0
- package/src/styles/.DS_Store +0 -0
- package/src/tool/.DS_Store +0 -0
package/dist/vui.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, resolveVStackDynamicInput, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
1
|
+
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, resolveVStackDynamicInput, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
2
2
|
export * from '@fastkit/vue-kit';
|
|
3
|
-
export { VDialog, VMenu, VSnackbar } from '@fastkit/vue-kit';
|
|
4
|
-
import { inject, computed, provide,
|
|
3
|
+
export { VDialog, VMenu, VSnackbar, VTooltip } from '@fastkit/vue-kit';
|
|
4
|
+
import { inject, computed, provide, createVNode, mergeProps, defineComponent, isVNode, cloneVNode, ref, watch, withDirectives, createTextVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, onMounted, onBeforeUnmount, Transition } from 'vue';
|
|
5
5
|
import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
|
|
6
6
|
import { createPropsOptions as createPropsOptions$1, htmlAttributesPropOptions, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableInheritProps, VLink, isFragment, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
|
|
7
7
|
import { getDocumentScroller as getDocumentScroller$1 } from '@fastkit/vue-scroller';
|
|
@@ -134,10 +134,99 @@ function useControlField(props, opts = {}) {
|
|
|
134
134
|
return provider;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// prop: RawIconProp<T>,
|
|
138
|
+
// payload: () => T,
|
|
139
|
+
// ): RawIconProp {
|
|
140
|
+
// if (!prop || typeof prop !== 'function') {
|
|
141
|
+
// return prop;
|
|
142
|
+
// }
|
|
143
|
+
// const fn = (gen: IconGenerator): VNodeChild => {
|
|
144
|
+
// const t = payload();
|
|
145
|
+
// return prop(gen, t);
|
|
146
|
+
// };
|
|
147
|
+
// return fn;
|
|
148
|
+
// }
|
|
149
|
+
// export const rawRawIconProp = [String, Function] as PropType<RawIconProp>;
|
|
150
|
+
|
|
151
|
+
const _rawIconProp = [String, Function];
|
|
152
|
+
function rawIconProp() {
|
|
153
|
+
return _rawIconProp;
|
|
154
|
+
}
|
|
155
|
+
function resolveRawIconProp(payload, prop, extraProps) {
|
|
156
|
+
if (!prop) return;
|
|
157
|
+
return typeof prop === 'function' ? prop(input => createVNode(VIcon, mergeProps(input, extraProps), null), payload) : createVNode(VIcon, mergeProps(extraProps, {
|
|
158
|
+
"name": prop
|
|
159
|
+
}), null);
|
|
160
|
+
}
|
|
161
|
+
const iconProps = createPropsOptions$1({
|
|
162
|
+
name: {
|
|
163
|
+
type: String,
|
|
164
|
+
required: true
|
|
165
|
+
},
|
|
166
|
+
rotate: {
|
|
167
|
+
type: Number
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const VIcon = defineComponent({
|
|
171
|
+
name: 'VIcon',
|
|
172
|
+
props: { ...iconProps
|
|
173
|
+
},
|
|
174
|
+
emits: {},
|
|
175
|
+
|
|
176
|
+
setup(props, ctx) {
|
|
177
|
+
const iconName = computed(() => props.name);
|
|
178
|
+
const clickable = computed(() => typeof ctx.attrs.onClick !== 'undefined');
|
|
179
|
+
const classes = computed(() => [{
|
|
180
|
+
'v-icon--clickable': clickable.value
|
|
181
|
+
}]);
|
|
182
|
+
const bodyClasses = computed(() => `icon-${iconName.value}`);
|
|
183
|
+
const bodyStyles = computed(() => {
|
|
184
|
+
const {
|
|
185
|
+
rotate
|
|
186
|
+
} = props;
|
|
187
|
+
if (!rotate) return;
|
|
188
|
+
return {
|
|
189
|
+
transform: `rotate(${rotate}deg)`
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
return () => createVNode("span", {
|
|
193
|
+
"class": [`v-icon notranslate`, classes.value]
|
|
194
|
+
}, [createVNode("i", {
|
|
195
|
+
"class": ['v-icon__body icon', bodyClasses.value],
|
|
196
|
+
"style": bodyStyles.value
|
|
197
|
+
}, null)]);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
});
|
|
201
|
+
|
|
137
202
|
const {
|
|
138
203
|
props: props$8,
|
|
139
204
|
emits: emits$8
|
|
140
205
|
} = createFormControlSettings();
|
|
206
|
+
function createRequiredChipRenderer(required, props, vui = useVui()) {
|
|
207
|
+
return () => {
|
|
208
|
+
if (!required()) return;
|
|
209
|
+
let chip;
|
|
210
|
+
const {
|
|
211
|
+
requiredChip
|
|
212
|
+
} = props;
|
|
213
|
+
if (requiredChip === false) return;
|
|
214
|
+
|
|
215
|
+
if (requiredChip) {
|
|
216
|
+
if (typeof requiredChip === 'string') {
|
|
217
|
+
chip = requiredChip;
|
|
218
|
+
} else if (typeof requiredChip === 'function') {
|
|
219
|
+
chip = requiredChip();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (chip === undefined) {
|
|
224
|
+
chip = vui.getRequiredChip();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return chip;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
141
230
|
const VFormControl = defineComponent({
|
|
142
231
|
name: 'VFormControl',
|
|
143
232
|
props: { ...props$8,
|
|
@@ -146,9 +235,14 @@ const VFormControl = defineComponent({
|
|
|
146
235
|
emits: emits$8,
|
|
147
236
|
|
|
148
237
|
setup(props, ctx) {
|
|
149
|
-
const control = useFormControl(props, ctx);
|
|
150
|
-
ctx.expose(control.expose());
|
|
151
238
|
const vui = useVui();
|
|
239
|
+
const control = useFormControl(props, ctx, {
|
|
240
|
+
hinttipPrepend: () => createVNode(VIcon, {
|
|
241
|
+
"class": "v-form-control__label__hinttip__icon",
|
|
242
|
+
"name": vui.icon('hinttip')
|
|
243
|
+
}, null)
|
|
244
|
+
});
|
|
245
|
+
ctx.expose(control.expose());
|
|
152
246
|
const colorProvider = useVuiColorProvider();
|
|
153
247
|
const classes = computed(() => [{
|
|
154
248
|
'v-form-control--validating': control.validating,
|
|
@@ -163,10 +257,12 @@ const VFormControl = defineComponent({
|
|
|
163
257
|
'v-form-control--invalid': control.invalid,
|
|
164
258
|
'v-form-control--valid': control.valid
|
|
165
259
|
}, colorProvider.className(control.invalid && !control.readonly ? 'error' : 'primary')]);
|
|
260
|
+
const getRequiredChip = createRequiredChipRenderer(() => control.required, props, vui);
|
|
166
261
|
return () => {
|
|
167
262
|
const label = control.renderLabel();
|
|
168
263
|
const message = control.renderMessage();
|
|
169
264
|
const appends = control.renderInfoAppends();
|
|
265
|
+
const hinttip = control.renderHinttip();
|
|
170
266
|
return createVNode("div", {
|
|
171
267
|
"class": ['v-form-control', classes.value]
|
|
172
268
|
}, [label && createVNode("label", {
|
|
@@ -174,7 +270,18 @@ const VFormControl = defineComponent({
|
|
|
174
270
|
"onClick": ev => {
|
|
175
271
|
ctx.emit('clickLabel', ev, control);
|
|
176
272
|
}
|
|
177
|
-
}, [label,
|
|
273
|
+
}, [label, getRequiredChip(), hinttip && createVNode(VTooltip, {
|
|
274
|
+
"top": true,
|
|
275
|
+
"openOnHover": false
|
|
276
|
+
}, {
|
|
277
|
+
default: () => [createVNode("div", {
|
|
278
|
+
"class": "v-form-control__label__hinttip__hint"
|
|
279
|
+
}, [hinttip.hint])],
|
|
280
|
+
activator: ctx => createVNode("a", mergeProps({
|
|
281
|
+
"class": "v-form-control__label__hinttip",
|
|
282
|
+
"href": "javascript:void(0)"
|
|
283
|
+
}, ctx.attrs), [hinttip.tip])
|
|
284
|
+
})]), createVNode("div", {
|
|
178
285
|
"class": "v-form-control__body"
|
|
179
286
|
}, [renderSlotOrEmpty(ctx.slots, 'default', control), !props.hiddenInfo && createVNode("div", {
|
|
180
287
|
"class": "v-form-control__info"
|
|
@@ -234,7 +341,9 @@ function defineFormSelectorComponent(opts) {
|
|
|
234
341
|
'v-form-selector--stacked': this.stacked
|
|
235
342
|
}],
|
|
236
343
|
"label": this.label,
|
|
237
|
-
"hint": this.hint
|
|
344
|
+
"hint": this.hint,
|
|
345
|
+
"hinttip": this.hinttip,
|
|
346
|
+
"requiredChip": this.requiredChip
|
|
238
347
|
}, { ...this.$slots,
|
|
239
348
|
default: () => createVNode("div", {
|
|
240
349
|
"class": "v-form-selector__body"
|
|
@@ -562,71 +671,6 @@ const VCardActions = defineComponent({
|
|
|
562
671
|
|
|
563
672
|
});
|
|
564
673
|
|
|
565
|
-
// prop: RawIconProp<T>,
|
|
566
|
-
// payload: () => T,
|
|
567
|
-
// ): RawIconProp {
|
|
568
|
-
// if (!prop || typeof prop !== 'function') {
|
|
569
|
-
// return prop;
|
|
570
|
-
// }
|
|
571
|
-
// const fn = (gen: IconGenerator): VNodeChild => {
|
|
572
|
-
// const t = payload();
|
|
573
|
-
// return prop(gen, t);
|
|
574
|
-
// };
|
|
575
|
-
// return fn;
|
|
576
|
-
// }
|
|
577
|
-
// export const rawRawIconProp = [String, Function] as PropType<RawIconProp>;
|
|
578
|
-
|
|
579
|
-
const _rawIconProp = [String, Function];
|
|
580
|
-
function rawIconProp() {
|
|
581
|
-
return _rawIconProp;
|
|
582
|
-
}
|
|
583
|
-
function resolveRawIconProp(payload, prop, extraProps) {
|
|
584
|
-
if (!prop) return;
|
|
585
|
-
return typeof prop === 'function' ? prop(input => createVNode(VIcon, mergeProps(input, extraProps), null), payload) : createVNode(VIcon, mergeProps(extraProps, {
|
|
586
|
-
"name": prop
|
|
587
|
-
}), null);
|
|
588
|
-
}
|
|
589
|
-
const iconProps = createPropsOptions$1({
|
|
590
|
-
name: {
|
|
591
|
-
type: String,
|
|
592
|
-
required: true
|
|
593
|
-
},
|
|
594
|
-
rotate: {
|
|
595
|
-
type: Number
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
const VIcon = defineComponent({
|
|
599
|
-
name: 'VIcon',
|
|
600
|
-
props: { ...iconProps
|
|
601
|
-
},
|
|
602
|
-
emits: {},
|
|
603
|
-
|
|
604
|
-
setup(props, ctx) {
|
|
605
|
-
const iconName = computed(() => props.name);
|
|
606
|
-
const clickable = computed(() => typeof ctx.attrs.onClick !== 'undefined');
|
|
607
|
-
const classes = computed(() => [{
|
|
608
|
-
'v-icon--clickable': clickable.value
|
|
609
|
-
}]);
|
|
610
|
-
const bodyClasses = computed(() => `icon-${iconName.value}`);
|
|
611
|
-
const bodyStyles = computed(() => {
|
|
612
|
-
const {
|
|
613
|
-
rotate
|
|
614
|
-
} = props;
|
|
615
|
-
if (!rotate) return;
|
|
616
|
-
return {
|
|
617
|
-
transform: `rotate(${rotate}deg)`
|
|
618
|
-
};
|
|
619
|
-
});
|
|
620
|
-
return () => createVNode("span", {
|
|
621
|
-
"class": [`v-icon notranslate`, classes.value]
|
|
622
|
-
}, [createVNode("i", {
|
|
623
|
-
"class": ['v-icon__body icon', bodyClasses.value],
|
|
624
|
-
"style": bodyStyles.value
|
|
625
|
-
}, null)]);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
});
|
|
629
|
-
|
|
630
674
|
function resolveRawVButtonIcon(raw, type = 'main') {
|
|
631
675
|
if (!raw) return;
|
|
632
676
|
return typeof raw === 'function' ? raw : () => createVNode(VIcon, {
|
|
@@ -2035,7 +2079,9 @@ const VSelect = defineComponent({
|
|
|
2035
2079
|
"class": ['v-select', this.classes],
|
|
2036
2080
|
"label": this.label,
|
|
2037
2081
|
"hint": this.hint,
|
|
2082
|
+
"hinttip": this.hinttip,
|
|
2038
2083
|
"hiddenInfo": this.hiddenInfo,
|
|
2084
|
+
"requiredChip": this.requiredChip,
|
|
2039
2085
|
"onClickLabel": ev => {
|
|
2040
2086
|
this.focus();
|
|
2041
2087
|
}
|
|
@@ -2169,6 +2215,8 @@ const VTextField = defineComponent({
|
|
|
2169
2215
|
"class": ['v-text-field', this.classes],
|
|
2170
2216
|
"label": this.label,
|
|
2171
2217
|
"hint": this.hint,
|
|
2218
|
+
"hinttip": this.hinttip,
|
|
2219
|
+
"requiredChip": this.requiredChip,
|
|
2172
2220
|
"onClickLabel": ev => {
|
|
2173
2221
|
this.focus();
|
|
2174
2222
|
}
|
|
@@ -2229,7 +2277,9 @@ const VTextarea = defineComponent({
|
|
|
2229
2277
|
"class": ['v-textarea', this.classes],
|
|
2230
2278
|
"label": this.label,
|
|
2231
2279
|
"hint": this.hint,
|
|
2280
|
+
"hinttip": this.hinttip,
|
|
2232
2281
|
"hiddenInfo": this.hiddenInfo,
|
|
2282
|
+
"requiredChip": this.requiredChip,
|
|
2233
2283
|
"onClickLabel": ev => {
|
|
2234
2284
|
this.focus();
|
|
2235
2285
|
}
|
|
@@ -2451,7 +2501,9 @@ const VWysiwygEditor = defineComponent({
|
|
|
2451
2501
|
}],
|
|
2452
2502
|
"label": this.label,
|
|
2453
2503
|
"hint": this.hint,
|
|
2504
|
+
"hinttip": this.hinttip,
|
|
2454
2505
|
"hiddenInfo": this.hiddenInfo,
|
|
2506
|
+
"requiredChip": this.requiredChip,
|
|
2455
2507
|
"onClickLabel": ev => {
|
|
2456
2508
|
this.focus('start', {
|
|
2457
2509
|
scrollIntoView: true
|
|
@@ -4263,4 +4315,4 @@ function installVuiPlugin(app, opts) {
|
|
|
4263
4315
|
return app.use(VuiPlugin, opts);
|
|
4264
4316
|
}
|
|
4265
4317
|
|
|
4266
|
-
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
|
4318
|
+
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTabs, VTextField, VTextarea, VToolbar, VToolbarEdge, VToolbarMenu, VToolbarTitle, VUI_CHECKBOX_GROUP_SYMBOL, VUI_CHECKBOX_SYMBOL, VUI_FORM_SYMBOL, VUI_OPTION_SYMBOL, VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL, VUI_SELECT_SYMBOL, VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL, VUI_TEXTAREA_SYMBOL, VUI_TEXT_FIELD_SYMBOL, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, WysiwygBulletListTool, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastkit/vui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.19",
|
|
4
4
|
"description": "@fastkit/vui",
|
|
5
5
|
"buildOptions": {
|
|
6
6
|
"name": "Vui",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"vue": "^3.2.26"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fastkit/color-scheme": "0.7.
|
|
36
|
-
"@fastkit/icon-font": "0.7.
|
|
37
|
-
"@fastkit/tiny-logger": "0.7.
|
|
38
|
-
"@fastkit/vite-kit": "0.7.
|
|
39
|
-
"@fastkit/vue-kit": "0.7.
|
|
35
|
+
"@fastkit/color-scheme": "0.7.19",
|
|
36
|
+
"@fastkit/icon-font": "0.7.19",
|
|
37
|
+
"@fastkit/tiny-logger": "0.7.19",
|
|
38
|
+
"@fastkit/vite-kit": "0.7.19",
|
|
39
|
+
"@fastkit/vue-kit": "0.7.19",
|
|
40
40
|
"@tiptap/extension-link": "^2.0.0-beta.35",
|
|
41
41
|
"@tiptap/extension-underline": "^2.0.0-beta.22",
|
|
42
42
|
"@tiptap/starter-kit": "^2.0.0-beta.168",
|
|
@@ -19,12 +19,54 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&__label {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
22
24
|
align-self: flex-start;
|
|
23
25
|
font-size: var(--control-label-font-size);
|
|
24
26
|
font-weight: var(--control-label-font-weight);
|
|
25
27
|
line-height: var(--control-label-height);
|
|
26
28
|
color: var(--my-label-color);
|
|
27
29
|
letter-spacing: 0.00938em;
|
|
30
|
+
|
|
31
|
+
&__hinttip {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
margin-top: -0.2em;
|
|
35
|
+
margin-left: 0.6em;
|
|
36
|
+
// font-size: calc(var(--root-em) * 0.5);
|
|
37
|
+
font-size: 80%;
|
|
38
|
+
line-height: 1;
|
|
39
|
+
color: inherit;
|
|
40
|
+
// color: var(--palette-muted);
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
letter-spacing: normal;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
|
|
45
|
+
// &:hover,
|
|
46
|
+
// &:focus {
|
|
47
|
+
// text-decoration: underline;
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
&__icon {
|
|
51
|
+
position: relative;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
font-size: 120%;
|
|
56
|
+
text-decoration: none !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:hover &__icon,
|
|
60
|
+
&:focus &__icon {
|
|
61
|
+
&::before {
|
|
62
|
+
opacity: 0.1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&__hint {
|
|
67
|
+
font-size: calc(var(--root-em) * 0.75);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
28
70
|
}
|
|
29
71
|
|
|
30
72
|
// &--disabled &__body {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './VFormControl.scss';
|
|
2
|
-
import { computed, defineComponent } from 'vue';
|
|
2
|
+
import { computed, defineComponent, VNodeChild } from 'vue';
|
|
3
3
|
import {
|
|
4
4
|
createFormControlSettings,
|
|
5
5
|
useFormControl,
|
|
@@ -7,11 +7,41 @@ import {
|
|
|
7
7
|
defineSlotsProps,
|
|
8
8
|
FormControl,
|
|
9
9
|
renderSlotOrEmpty,
|
|
10
|
+
RequiredChipSource,
|
|
10
11
|
} from '@fastkit/vue-kit';
|
|
11
12
|
import { useVuiColorProvider, useVui } from '../../injections';
|
|
13
|
+
import type { VuiService } from '../../service';
|
|
14
|
+
import { VIcon } from '../VIcon';
|
|
15
|
+
import { VTooltip } from '../kits';
|
|
12
16
|
|
|
13
17
|
const { props, emits } = createFormControlSettings();
|
|
14
18
|
|
|
19
|
+
export function createRequiredChipRenderer(
|
|
20
|
+
required: () => boolean,
|
|
21
|
+
props: {
|
|
22
|
+
requiredChip?: RequiredChipSource;
|
|
23
|
+
},
|
|
24
|
+
vui: VuiService = useVui(),
|
|
25
|
+
) {
|
|
26
|
+
return () => {
|
|
27
|
+
if (!required()) return;
|
|
28
|
+
let chip: VNodeChild;
|
|
29
|
+
const { requiredChip } = props;
|
|
30
|
+
if (requiredChip === false) return;
|
|
31
|
+
if (requiredChip) {
|
|
32
|
+
if (typeof requiredChip === 'string') {
|
|
33
|
+
chip = requiredChip;
|
|
34
|
+
} else if (typeof requiredChip === 'function') {
|
|
35
|
+
chip = requiredChip();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (chip === undefined) {
|
|
39
|
+
chip = vui.getRequiredChip();
|
|
40
|
+
}
|
|
41
|
+
return chip;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
15
45
|
export const VFormControl = defineComponent({
|
|
16
46
|
name: 'VFormControl',
|
|
17
47
|
props: {
|
|
@@ -24,10 +54,18 @@ export const VFormControl = defineComponent({
|
|
|
24
54
|
},
|
|
25
55
|
emits,
|
|
26
56
|
setup(props, ctx) {
|
|
27
|
-
const
|
|
57
|
+
const vui = useVui();
|
|
58
|
+
const control = useFormControl(props, ctx, {
|
|
59
|
+
hinttipPrepend: () => (
|
|
60
|
+
<VIcon
|
|
61
|
+
class="v-form-control__label__hinttip__icon"
|
|
62
|
+
name={vui.icon('hinttip')}
|
|
63
|
+
/>
|
|
64
|
+
),
|
|
65
|
+
});
|
|
66
|
+
|
|
28
67
|
ctx.expose(control.expose());
|
|
29
68
|
|
|
30
|
-
const vui = useVui();
|
|
31
69
|
const colorProvider = useVuiColorProvider();
|
|
32
70
|
|
|
33
71
|
const classes = computed(() => [
|
|
@@ -49,10 +87,18 @@ export const VFormControl = defineComponent({
|
|
|
49
87
|
),
|
|
50
88
|
]);
|
|
51
89
|
|
|
90
|
+
const getRequiredChip = createRequiredChipRenderer(
|
|
91
|
+
() => control.required,
|
|
92
|
+
props,
|
|
93
|
+
vui,
|
|
94
|
+
);
|
|
95
|
+
|
|
52
96
|
return () => {
|
|
53
97
|
const label = control.renderLabel();
|
|
54
98
|
const message = control.renderMessage();
|
|
55
99
|
const appends = control.renderInfoAppends();
|
|
100
|
+
const hinttip = control.renderHinttip();
|
|
101
|
+
|
|
56
102
|
return (
|
|
57
103
|
<div class={['v-form-control', classes.value]}>
|
|
58
104
|
{label && (
|
|
@@ -62,7 +108,26 @@ export const VFormControl = defineComponent({
|
|
|
62
108
|
ctx.emit('clickLabel', ev, control);
|
|
63
109
|
}}>
|
|
64
110
|
{label}
|
|
65
|
-
{
|
|
111
|
+
{getRequiredChip()}
|
|
112
|
+
{hinttip && (
|
|
113
|
+
<VTooltip
|
|
114
|
+
top
|
|
115
|
+
openOnHover={false}
|
|
116
|
+
v-slots={{
|
|
117
|
+
activator: (ctx) => (
|
|
118
|
+
<a
|
|
119
|
+
class="v-form-control__label__hinttip"
|
|
120
|
+
href="javascript:void(0)"
|
|
121
|
+
{...ctx.attrs}>
|
|
122
|
+
{hinttip.tip}
|
|
123
|
+
</a>
|
|
124
|
+
),
|
|
125
|
+
}}>
|
|
126
|
+
<div class="v-form-control__label__hinttip__hint">
|
|
127
|
+
{hinttip.hint}
|
|
128
|
+
</div>
|
|
129
|
+
</VTooltip>
|
|
130
|
+
)}
|
|
66
131
|
</label>
|
|
67
132
|
)}
|
|
68
133
|
<div class="v-form-control__body">
|
|
@@ -115,7 +115,9 @@ export const VSelect = defineComponent({
|
|
|
115
115
|
class={['v-select', this.classes]}
|
|
116
116
|
label={this.label}
|
|
117
117
|
hint={this.hint}
|
|
118
|
+
hinttip={this.hinttip}
|
|
118
119
|
hiddenInfo={this.hiddenInfo}
|
|
120
|
+
requiredChip={this.requiredChip}
|
|
119
121
|
onClickLabel={(ev) => {
|
|
120
122
|
this.focus();
|
|
121
123
|
}}
|
|
@@ -57,7 +57,9 @@ export const VTextarea = defineComponent({
|
|
|
57
57
|
class={['v-textarea', this.classes]}
|
|
58
58
|
label={this.label}
|
|
59
59
|
hint={this.hint}
|
|
60
|
+
hinttip={this.hinttip}
|
|
60
61
|
hiddenInfo={this.hiddenInfo}
|
|
62
|
+
requiredChip={this.requiredChip}
|
|
61
63
|
onClickLabel={(ev) => {
|
|
62
64
|
this.focus();
|
|
63
65
|
}}
|
|
@@ -235,7 +235,9 @@ export const VWysiwygEditor = defineComponent({
|
|
|
235
235
|
]}
|
|
236
236
|
label={this.label}
|
|
237
237
|
hint={this.hint}
|
|
238
|
+
hinttip={this.hinttip}
|
|
238
239
|
hiddenInfo={this.hiddenInfo}
|
|
240
|
+
requiredChip={this.requiredChip}
|
|
239
241
|
onClickLabel={(ev) => {
|
|
240
242
|
this.focus('start', { scrollIntoView: true });
|
|
241
243
|
}}
|
package/src/components/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './VDrawerLayout';
|
|
|
11
11
|
export * from './VHero';
|
|
12
12
|
// export * from './VAccordion';
|
|
13
13
|
export * from './VNavigation';
|
|
14
|
+
export * from './VFormControl';
|
|
14
15
|
export * from './VCheckbox';
|
|
15
16
|
export * from './VCheckboxGroup';
|
|
16
17
|
export * from './VRadio';
|
package/src/components/kits.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { VDialog, VMenu, VSnackbar } from '@fastkit/vue-kit';
|
|
1
|
+
export { VDialog, VMenu, VSnackbar, VTooltip } from '@fastkit/vue-kit';
|
package/src/service.tsx
CHANGED
package/src/tool/vite-plugin.ts
CHANGED
|
@@ -170,6 +170,7 @@ export function viteVuiPlugin(
|
|
|
170
170
|
editorLinkOff: 'mdi-link-off' as any,
|
|
171
171
|
editorUndo: 'mdi-undo-variant' as any,
|
|
172
172
|
editorRedo: 'mdi-redo-variant' as any,
|
|
173
|
+
hinttip: 'mdi-help-circle-outline' as any,
|
|
173
174
|
// navigationExpand: (gen, active) => {
|
|
174
175
|
// return gen({
|
|
175
176
|
// name: 'mdi-menu-down' as any,
|
package/dist/assets/.DS_Store
DELETED
|
Binary file
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/assets/.DS_Store
DELETED
|
Binary file
|
package/src/components/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/styles/.DS_Store
DELETED
|
Binary file
|
package/src/tool/.DS_Store
DELETED
|
Binary file
|