@fastkit/vui 0.6.12 → 0.6.16
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 +24 -7
- package/dist/tool/vite-plugin.d.ts +2 -2
- package/dist/tool/vite-plugin.d.ts.map +1 -1
- package/dist/vui.cjs.js +814 -51
- package/dist/vui.cjs.prod.js +814 -51
- package/dist/vui.css +453 -0
- package/dist/vui.d.ts +811 -16
- package/dist/vui.esm-bundler.js +773 -53
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/package.json +6 -6
package/dist/vui.esm-bundler.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, resolveVNodeChildOrSlots, useParentFormNode, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useInjectTheme, VStackRoot, VueColorSchemePlugin, installVueStackPlugin } from '@fastkit/vue-kit';
|
|
2
2
|
export * from '@fastkit/vue-kit';
|
|
3
|
-
export {
|
|
4
|
-
import { inject, computed, provide, defineComponent, createVNode, isVNode, ref, withDirectives, vModelSelect } from 'vue';
|
|
3
|
+
export { VDialog, VMenu, VSnackbar } from '@fastkit/vue-kit';
|
|
4
|
+
import { inject, computed, provide, defineComponent, createVNode, mergeProps, watch, isVNode, ref, Fragment, withDirectives, vShow, vModelSelect, createTextVNode } from 'vue';
|
|
5
|
+
import { useScopeColorClass, colorSchemeProps, useColorClasses } from '@fastkit/vue-color-scheme';
|
|
6
|
+
import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableProps, navigationableEmits, useNavigationable, VExpandTransition } from '@fastkit/vue-utils';
|
|
7
|
+
import { VProgressCircular } from '@fastkit/vue-loading';
|
|
8
|
+
export * from '@fastkit/vue-loading';
|
|
5
9
|
export { ICON_NAMES } from '@fastkit/icon-font';
|
|
10
|
+
import { useLink, useRoute } from 'vue-router';
|
|
6
11
|
|
|
7
12
|
const CONTROL_SIZES = ['sm', 'md', 'lg'];
|
|
8
13
|
const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
|
|
@@ -35,8 +40,8 @@ function useVuiColorProvider() {
|
|
|
35
40
|
return parent;
|
|
36
41
|
}
|
|
37
42
|
const vui = useVui();
|
|
38
|
-
const primary = computed(() => vui.
|
|
39
|
-
const error = computed(() => vui.
|
|
43
|
+
const primary = computed(() => vui.setting('primaryScope'));
|
|
44
|
+
const error = computed(() => vui.setting('errorScope'));
|
|
40
45
|
const provider = {
|
|
41
46
|
primary,
|
|
42
47
|
error,
|
|
@@ -231,16 +236,162 @@ function defineFormSelectorComponent(opts) {
|
|
|
231
236
|
});
|
|
232
237
|
}
|
|
233
238
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
function createElevationProps() {
|
|
240
|
+
return createPropsOptions$1({
|
|
241
|
+
elevation: Number,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function useElevation(props, opts = {}) {
|
|
245
|
+
const elevationValue = computed(() => props.elevation == null ? opts.defaultValue : props.elevation);
|
|
246
|
+
const elevationClassName = computed(() => {
|
|
247
|
+
const v = elevationValue.value;
|
|
248
|
+
return v == null ? undefined : `elevation-${v}`;
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
elevationValue,
|
|
252
|
+
elevationClassName,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function createPaperBaseProps() {
|
|
257
|
+
return {
|
|
258
|
+
color: String,
|
|
259
|
+
tag: {
|
|
238
260
|
type: String,
|
|
239
|
-
|
|
261
|
+
default: 'div'
|
|
240
262
|
},
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
263
|
+
...defineSlotsProps$1()
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function createPaperProps() {
|
|
267
|
+
return { ...createElevationProps(),
|
|
268
|
+
...createPaperBaseProps(),
|
|
269
|
+
square: Boolean,
|
|
270
|
+
headerProps: Object,
|
|
271
|
+
bodyProps: Object,
|
|
272
|
+
footerProps: Object
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const VPaper = defineComponent({
|
|
276
|
+
name: 'VPaper',
|
|
277
|
+
props: createPaperProps(),
|
|
278
|
+
|
|
279
|
+
setup(props, ctx) {
|
|
280
|
+
const tag = computed(() => props.tag);
|
|
281
|
+
const elevation = useElevation(props, {
|
|
282
|
+
defaultValue: 1
|
|
283
|
+
});
|
|
284
|
+
const scope = useScopeColorClass(props);
|
|
285
|
+
const classes = computed(() => [elevation.elevationClassName.value, scope.value.className, {
|
|
286
|
+
'v-paper--plain': !scope.value.value,
|
|
287
|
+
'v-paper--has-color': !!scope.value.value,
|
|
288
|
+
'v-paper--square': props.square
|
|
289
|
+
}]);
|
|
290
|
+
const headerProps = computed(() => props.headerProps);
|
|
291
|
+
const bodyProps = computed(() => props.bodyProps);
|
|
292
|
+
const footerProps = computed(() => props.footerProps);
|
|
293
|
+
return () => {
|
|
294
|
+
const TagName = tag.value;
|
|
295
|
+
const header = renderSlotOrEmpty$1(ctx.slots, 'header');
|
|
296
|
+
const footer = renderSlotOrEmpty$1(ctx.slots, 'footer');
|
|
297
|
+
return createVNode(TagName, {
|
|
298
|
+
"class": ['v-paper', classes.value]
|
|
299
|
+
}, {
|
|
300
|
+
default: () => [header && createVNode("div", mergeProps({
|
|
301
|
+
"class": "v-paper__header"
|
|
302
|
+
}, headerProps.value), [header]), createVNode("div", mergeProps({
|
|
303
|
+
"class": "v-paper__body"
|
|
304
|
+
}, bodyProps.value), [renderSlotOrEmpty$1(ctx.slots, 'default')]), footer && createVNode("div", mergeProps({
|
|
305
|
+
"class": "v-paper__footer"
|
|
306
|
+
}, footerProps.value), [footer])]
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
function createCardProps() {
|
|
314
|
+
return { ...createPaperProps()
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
const VCard = defineComponent({
|
|
318
|
+
name: 'VCard',
|
|
319
|
+
props: createCardProps(),
|
|
320
|
+
|
|
321
|
+
setup(props, ctx) {
|
|
322
|
+
const _props = computed(() => props);
|
|
323
|
+
|
|
324
|
+
return () => {
|
|
325
|
+
return createVNode(VPaper, mergeProps({
|
|
326
|
+
"class": "v-card"
|
|
327
|
+
}, _props.value), ctx.slots);
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
const VCardContent = defineComponent({
|
|
334
|
+
name: 'VCardContent',
|
|
335
|
+
|
|
336
|
+
setup(props, ctx) {
|
|
337
|
+
return () => {
|
|
338
|
+
return createVNode("div", {
|
|
339
|
+
"class": "v-card-content"
|
|
340
|
+
}, [renderSlotOrEmpty$1(ctx.slots, 'default')]);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
const VCardActions = defineComponent({
|
|
347
|
+
name: 'VCardActions',
|
|
348
|
+
|
|
349
|
+
setup(props, ctx) {
|
|
350
|
+
return () => {
|
|
351
|
+
return createVNode("div", {
|
|
352
|
+
"class": "v-card-actions"
|
|
353
|
+
}, [renderSlotOrEmpty$1(ctx.slots, 'default')]);
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// prop: RawIconProp<T>,
|
|
360
|
+
// payload: () => T,
|
|
361
|
+
// ): RawIconProp {
|
|
362
|
+
// if (!prop || typeof prop !== 'function') {
|
|
363
|
+
// return prop;
|
|
364
|
+
// }
|
|
365
|
+
// const fn = (gen: IconGenerator): VNodeChild => {
|
|
366
|
+
// const t = payload();
|
|
367
|
+
// return prop(gen, t);
|
|
368
|
+
// };
|
|
369
|
+
// return fn;
|
|
370
|
+
// }
|
|
371
|
+
// export const rawRawIconProp = [String, Function] as PropType<RawIconProp>;
|
|
372
|
+
|
|
373
|
+
const _rawIconProp = [String, Function];
|
|
374
|
+
function rawIconProp() {
|
|
375
|
+
return _rawIconProp;
|
|
376
|
+
}
|
|
377
|
+
function resolveRawIconProp(payload, prop, extraProps) {
|
|
378
|
+
if (!prop) return;
|
|
379
|
+
return typeof prop === 'function' ? prop(input => createVNode(VIcon, mergeProps(input, extraProps), null), payload) : createVNode(VIcon, mergeProps(extraProps, {
|
|
380
|
+
"name": prop
|
|
381
|
+
}), null);
|
|
382
|
+
}
|
|
383
|
+
const iconProps = createPropsOptions$1({
|
|
384
|
+
name: {
|
|
385
|
+
type: String,
|
|
386
|
+
required: true
|
|
387
|
+
},
|
|
388
|
+
rotate: {
|
|
389
|
+
type: Number
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
const VIcon = defineComponent({
|
|
393
|
+
name: 'VIcon',
|
|
394
|
+
props: { ...iconProps
|
|
244
395
|
},
|
|
245
396
|
emits: {},
|
|
246
397
|
|
|
@@ -270,6 +421,464 @@ const VIcon = defineComponent({
|
|
|
270
421
|
|
|
271
422
|
});
|
|
272
423
|
|
|
424
|
+
function resolveRawVButtonIcon(raw, type = 'main') {
|
|
425
|
+
if (!raw) return;
|
|
426
|
+
return typeof raw === 'function' ? raw : () => createVNode(VIcon, {
|
|
427
|
+
"class": ['v-button__icon', `v-button__icon--${type}`],
|
|
428
|
+
"name": raw
|
|
429
|
+
}, null);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
const vueButtonProps = createPropsOptions$1({ ...colorSchemeProps(),
|
|
433
|
+
...navigationableProps,
|
|
434
|
+
spacer: [Boolean, String],
|
|
435
|
+
loading: Boolean,
|
|
436
|
+
rounded: Boolean,
|
|
437
|
+
icon: [String, Function],
|
|
438
|
+
startIcon: [String, Function],
|
|
439
|
+
endIcon: [String, Function],
|
|
440
|
+
...createControlProps()
|
|
441
|
+
});
|
|
442
|
+
const LOADING_SIZE_MAP = {
|
|
443
|
+
sm: 14,
|
|
444
|
+
md: 20,
|
|
445
|
+
lg: 28
|
|
446
|
+
};
|
|
447
|
+
const VButton = defineComponent({
|
|
448
|
+
name: 'VButton',
|
|
449
|
+
props: vueButtonProps,
|
|
450
|
+
emits: { ...navigationableEmits
|
|
451
|
+
},
|
|
452
|
+
|
|
453
|
+
setup(props, ctx) {
|
|
454
|
+
const vui = useVui();
|
|
455
|
+
const control = useControl(props);
|
|
456
|
+
const defaults = vui.setting('buttonDefault');
|
|
457
|
+
const icon = computed(() => {
|
|
458
|
+
const _icon = resolveRawVButtonIcon(props.icon);
|
|
459
|
+
|
|
460
|
+
return _icon && _icon();
|
|
461
|
+
});
|
|
462
|
+
const startIcon = computed(() => {
|
|
463
|
+
const _icon = resolveRawVButtonIcon(props.startIcon, 'start');
|
|
464
|
+
|
|
465
|
+
return _icon && _icon();
|
|
466
|
+
});
|
|
467
|
+
const endIcon = computed(() => {
|
|
468
|
+
const _icon = resolveRawVButtonIcon(props.endIcon, 'end');
|
|
469
|
+
|
|
470
|
+
return _icon && _icon();
|
|
471
|
+
});
|
|
472
|
+
const color = useColorClasses({
|
|
473
|
+
color: () => props.color || defaults.color,
|
|
474
|
+
variant: () => props.variant || (icon.value ? vui.setting('plainVariant') : defaults.variant)
|
|
475
|
+
});
|
|
476
|
+
const isPlain = computed(() => color.variant.value.value === vui.setting('plainVariant') && color.color.value.value === defaults.color);
|
|
477
|
+
const navigationable = useNavigationable(props);
|
|
478
|
+
const isLoading = computed(() => props.loading);
|
|
479
|
+
const isDisabled = computed(() => props.disabled);
|
|
480
|
+
const isRounded = computed(() => props.rounded || !!icon.value);
|
|
481
|
+
const spacer = computed(() => {
|
|
482
|
+
const _spacer = props.spacer;
|
|
483
|
+
if (!_spacer) return;
|
|
484
|
+
return _spacer === true ? 'left' : _spacer;
|
|
485
|
+
});
|
|
486
|
+
const classes = computed(() => [color.colorClasses.value, navigationable.value.classes, spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, {
|
|
487
|
+
'v-button--loading': isLoading.value,
|
|
488
|
+
'v-button--icon': !!icon.value,
|
|
489
|
+
'v-button--rounded': isRounded.value,
|
|
490
|
+
'v-button--plain': isPlain.value
|
|
491
|
+
}]);
|
|
492
|
+
return () => {
|
|
493
|
+
const {
|
|
494
|
+
Tag,
|
|
495
|
+
attrs
|
|
496
|
+
} = navigationable.value;
|
|
497
|
+
const children = renderSlotOrEmpty$1(ctx.slots, 'default');
|
|
498
|
+
const _attrs = { ...attrs
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
if (isDisabled.value) {
|
|
502
|
+
_attrs.disabled = true;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return createVNode(Tag, mergeProps({
|
|
506
|
+
"class": ['v-button', classes.value]
|
|
507
|
+
}, _attrs, {
|
|
508
|
+
"onClick": ev => {
|
|
509
|
+
if (isDisabled.value || isLoading.value) {
|
|
510
|
+
ev.preventDefault();
|
|
511
|
+
|
|
512
|
+
if (isDisabled.value) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
ctx.emit('click', ev);
|
|
518
|
+
}
|
|
519
|
+
}), {
|
|
520
|
+
default: () => [createVNode("span", {
|
|
521
|
+
"class": "v-button__content"
|
|
522
|
+
}, [startIcon.value, children, icon.value, endIcon.value]), isLoading.value && createVNode(VProgressCircular, {
|
|
523
|
+
"class": "v-button__loading",
|
|
524
|
+
"indeterminate": true,
|
|
525
|
+
"size": LOADING_SIZE_MAP[control.size.value]
|
|
526
|
+
}, null)]
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
function createListTileProps() {
|
|
534
|
+
const icon = rawIconProp();
|
|
535
|
+
return { ...navigationableProps,
|
|
536
|
+
...createPropsOptions$1({
|
|
537
|
+
startIcon: icon,
|
|
538
|
+
endIcon: icon,
|
|
539
|
+
fallbackTag: {
|
|
540
|
+
type: String,
|
|
541
|
+
default: 'div'
|
|
542
|
+
},
|
|
543
|
+
startIconEmptySpace: Boolean,
|
|
544
|
+
color: String
|
|
545
|
+
})
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
const listTileEmits = { ...navigationableEmits,
|
|
549
|
+
changeActive: isActive => true
|
|
550
|
+
};
|
|
551
|
+
const VListTile = defineComponent({
|
|
552
|
+
name: 'VListTile',
|
|
553
|
+
props: createListTileProps(),
|
|
554
|
+
emits: { ...listTileEmits
|
|
555
|
+
},
|
|
556
|
+
|
|
557
|
+
setup(props, ctx) {
|
|
558
|
+
const startIcon = computed(() => {
|
|
559
|
+
let icon = resolveRawIconProp(false, props.startIcon);
|
|
560
|
+
|
|
561
|
+
if (!icon && props.startIconEmptySpace) {
|
|
562
|
+
icon = resolveRawIconProp(false, '$empty');
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return icon;
|
|
566
|
+
});
|
|
567
|
+
const endIcon = computed(() => resolveRawIconProp(false, props.endIcon));
|
|
568
|
+
const navigationable = useNavigationable(props, () => props.fallbackTag, ctx);
|
|
569
|
+
const hasTo = computed(() => !!props.to);
|
|
570
|
+
const link = useLink({
|
|
571
|
+
to: props.to || ''
|
|
572
|
+
});
|
|
573
|
+
const isActive = computed(() => {
|
|
574
|
+
if (!hasTo.value) return false;
|
|
575
|
+
return link.isActive.value;
|
|
576
|
+
});
|
|
577
|
+
const color = useScopeColorClass(props);
|
|
578
|
+
const classes = computed(() => {
|
|
579
|
+
const _color = color.value;
|
|
580
|
+
const hasColor = !!_color.value;
|
|
581
|
+
const _navigationable = navigationable.value;
|
|
582
|
+
const clickable = _navigationable.clickable;
|
|
583
|
+
return [color.value.className, _navigationable.classes, {
|
|
584
|
+
'v-list-tile--clickable': clickable,
|
|
585
|
+
'v-list-tile--plain': !hasColor,
|
|
586
|
+
'v-list-tile--has-color': hasColor,
|
|
587
|
+
'v-list-tile--active': isActive.value
|
|
588
|
+
}];
|
|
589
|
+
});
|
|
590
|
+
watch(() => isActive.value, isActive => {
|
|
591
|
+
ctx.emit('changeActive', isActive);
|
|
592
|
+
}, {
|
|
593
|
+
immediate: true
|
|
594
|
+
});
|
|
595
|
+
return () => {
|
|
596
|
+
const _startIcon = startIcon.value;
|
|
597
|
+
const _endIcon = endIcon.value;
|
|
598
|
+
const {
|
|
599
|
+
Tag,
|
|
600
|
+
attrs
|
|
601
|
+
} = navigationable.value;
|
|
602
|
+
return createVNode(Tag, mergeProps({
|
|
603
|
+
"class": ['v-list-tile', classes.value]
|
|
604
|
+
}, attrs, {
|
|
605
|
+
"onClick": ev => {
|
|
606
|
+
ctx.emit('click', ev);
|
|
607
|
+
}
|
|
608
|
+
}), {
|
|
609
|
+
default: () => [_startIcon && createVNode("span", {
|
|
610
|
+
"class": "v-list-tile__icon v-list-tile__icon--start"
|
|
611
|
+
}, [_startIcon]), createVNode("span", {
|
|
612
|
+
"class": "v-list-tile__body"
|
|
613
|
+
}, [renderSlotOrEmpty$1(ctx.slots, 'default')]), _endIcon && createVNode("span", {
|
|
614
|
+
"class": "v-list-tile__icon v-list-tile__icon--end"
|
|
615
|
+
}, [_endIcon])]
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
const VDrawerLayout = defineComponent({
|
|
623
|
+
name: 'VDrawerLayout',
|
|
624
|
+
props: { ...createPaperBaseProps()
|
|
625
|
+
},
|
|
626
|
+
|
|
627
|
+
setup(props, ctx) {
|
|
628
|
+
return () => {
|
|
629
|
+
const paperProps = computed(() => ({
|
|
630
|
+
color: props.color,
|
|
631
|
+
tag: props.tag
|
|
632
|
+
}));
|
|
633
|
+
return createVNode(VPaper, mergeProps({
|
|
634
|
+
"class": "v-drawer-layout"
|
|
635
|
+
}, paperProps.value, {
|
|
636
|
+
"square": true,
|
|
637
|
+
"headerProps": {
|
|
638
|
+
class: 'v-drawer-layout__header'
|
|
639
|
+
},
|
|
640
|
+
"bodyProps": {
|
|
641
|
+
class: 'v-drawer-layout__body'
|
|
642
|
+
},
|
|
643
|
+
"footerProps": {
|
|
644
|
+
class: 'v-drawer-layout__footer'
|
|
645
|
+
}
|
|
646
|
+
}), ctx.slots);
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
function _isSlot$5(s) {
|
|
653
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function createNavigationItemProps() {
|
|
657
|
+
return { ...createListTileProps(),
|
|
658
|
+
match: String
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function resolveNavigationItemInput(input) {
|
|
662
|
+
let label = input.label;
|
|
663
|
+
const props = { ...input
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
if (typeof label === 'function') {
|
|
667
|
+
label = label();
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
delete props.label;
|
|
671
|
+
return {
|
|
672
|
+
label,
|
|
673
|
+
props
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function renderNavigationItemInput(input, extraProps) {
|
|
677
|
+
const {
|
|
678
|
+
label,
|
|
679
|
+
props
|
|
680
|
+
} = resolveNavigationItemInput(input);
|
|
681
|
+
return createVNode(VNavigationItem, { ...props,
|
|
682
|
+
...extraProps
|
|
683
|
+
}, _isSlot$5(label) ? label : {
|
|
684
|
+
default: () => [label]
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
const VNavigationItem = defineComponent({
|
|
688
|
+
name: 'VNavigationItem',
|
|
689
|
+
inheritAttrs: false,
|
|
690
|
+
props: { ...createNavigationItemProps(),
|
|
691
|
+
children: Array
|
|
692
|
+
},
|
|
693
|
+
emits: { ...listTileEmits
|
|
694
|
+
},
|
|
695
|
+
|
|
696
|
+
setup(props, ctx) {
|
|
697
|
+
const vui = useVui();
|
|
698
|
+
const opened = ref(false);
|
|
699
|
+
const children = computed(() => {
|
|
700
|
+
const c = props.children;
|
|
701
|
+
return c && c.length ? c : undefined;
|
|
702
|
+
});
|
|
703
|
+
const to = computed(() => props.to);
|
|
704
|
+
const match = computed(() => {
|
|
705
|
+
const {
|
|
706
|
+
match,
|
|
707
|
+
to
|
|
708
|
+
} = props;
|
|
709
|
+
if (match) return match;
|
|
710
|
+
if (!to) return;
|
|
711
|
+
if (typeof to === 'string') return to;
|
|
712
|
+
return to.path;
|
|
713
|
+
});
|
|
714
|
+
const classes = computed(() => [{
|
|
715
|
+
'v-navigation-item--opened': opened.value
|
|
716
|
+
}]);
|
|
717
|
+
const route = useRoute(); // const classes = computed(() => [
|
|
718
|
+
// // {
|
|
719
|
+
// // 'v-navigation-item--matched': matched.value,
|
|
720
|
+
// // },
|
|
721
|
+
// ]);
|
|
722
|
+
|
|
723
|
+
watch(() => route.path, newPath => {
|
|
724
|
+
const c = children.value;
|
|
725
|
+
const m = match.value;
|
|
726
|
+
|
|
727
|
+
if (!c || !m) {
|
|
728
|
+
// matched.value = false;
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (newPath.match(m)) {
|
|
733
|
+
open(); // matched.value = true;
|
|
734
|
+
} else {
|
|
735
|
+
close(); // matched.value = false;
|
|
736
|
+
}
|
|
737
|
+
}, {
|
|
738
|
+
immediate: true
|
|
739
|
+
}); // const iconPayload = () => opened.value;
|
|
740
|
+
|
|
741
|
+
const _props = computed(() => {
|
|
742
|
+
const c = children.value;
|
|
743
|
+
let {
|
|
744
|
+
endIcon
|
|
745
|
+
} = props;
|
|
746
|
+
|
|
747
|
+
if (c && !endIcon) {
|
|
748
|
+
endIcon = vui.icon('navigationExpand');
|
|
749
|
+
|
|
750
|
+
if (typeof endIcon === 'string') {
|
|
751
|
+
const name = endIcon;
|
|
752
|
+
|
|
753
|
+
endIcon = gen => {
|
|
754
|
+
return gen({
|
|
755
|
+
name,
|
|
756
|
+
rotate: opened.value ? 180 : 0
|
|
757
|
+
});
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
const __props = { ...props,
|
|
763
|
+
endIcon
|
|
764
|
+
};
|
|
765
|
+
delete __props.children; // const _activeClass = props.activeClass;
|
|
766
|
+
// const activeClass = `v-navigation-item--active${
|
|
767
|
+
// _activeClass ? ` ${_activeClass}` : ''
|
|
768
|
+
// }`;
|
|
769
|
+
|
|
770
|
+
return { ...__props // activeClass,
|
|
771
|
+
// startIcon: toRawIconProp(__props.startIcon, iconPayload),
|
|
772
|
+
// endIcon: toRawIconProp(__props.endIcon, iconPayload),
|
|
773
|
+
|
|
774
|
+
};
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
function open() {
|
|
778
|
+
opened.value = true;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function close() {
|
|
782
|
+
opened.value = false;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function toggle() {
|
|
786
|
+
return opened.value ? close() : open();
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
const onClick = ev => {
|
|
790
|
+
if (!to.value) {
|
|
791
|
+
toggle();
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
ctx.emit('click', ev);
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
const onChangeActive = isActive => {
|
|
798
|
+
// if (isActive) {
|
|
799
|
+
// // open();
|
|
800
|
+
// // if (typeof window !== 'undefined') {
|
|
801
|
+
// // // open();
|
|
802
|
+
// // // console.log('hoge', window);
|
|
803
|
+
// // setTimeout(() => {
|
|
804
|
+
// // open();
|
|
805
|
+
// // }, 1000);
|
|
806
|
+
// // }
|
|
807
|
+
// // open();
|
|
808
|
+
// // console.log(props);
|
|
809
|
+
// // setTimeout(() => {
|
|
810
|
+
// // open();
|
|
811
|
+
// // }, 500);
|
|
812
|
+
// }
|
|
813
|
+
ctx.emit('changeActive', isActive);
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
return () => {
|
|
817
|
+
let _slot;
|
|
818
|
+
|
|
819
|
+
const _children = children.value;
|
|
820
|
+
const fallbackTag = _children ? 'button' : undefined;
|
|
821
|
+
return createVNode(Fragment, null, [createVNode(VListTile, mergeProps(_props.value, {
|
|
822
|
+
"fallbackTag": fallbackTag,
|
|
823
|
+
"endIcon": _props.value.endIcon,
|
|
824
|
+
"class": ['v-navigation-item', classes.value],
|
|
825
|
+
"onClick": onClick,
|
|
826
|
+
"onChangeActive": onChangeActive
|
|
827
|
+
}), _isSlot$5(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
828
|
+
default: () => [_slot]
|
|
829
|
+
}), _children && createVNode(VExpandTransition, null, {
|
|
830
|
+
default: () => [withDirectives(createVNode("div", {
|
|
831
|
+
"class": "v-navigation-item__expand"
|
|
832
|
+
}, [_children.map(child => renderNavigationItemInput(child, {
|
|
833
|
+
startIconEmptySpace: _props.value.startIconEmptySpace // onClick,
|
|
834
|
+
// onChangeActive,
|
|
835
|
+
|
|
836
|
+
}))]), [[vShow, opened.value]])]
|
|
837
|
+
})]);
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
const VNavigation = defineComponent({
|
|
844
|
+
name: 'VNavigation',
|
|
845
|
+
props: {
|
|
846
|
+
items: {
|
|
847
|
+
type: Array,
|
|
848
|
+
required: true
|
|
849
|
+
},
|
|
850
|
+
color: String,
|
|
851
|
+
startIconEmptySpace: {
|
|
852
|
+
type: Boolean,
|
|
853
|
+
default: true
|
|
854
|
+
},
|
|
855
|
+
caption: [String, Function]
|
|
856
|
+
},
|
|
857
|
+
|
|
858
|
+
setup(props, ctx) {
|
|
859
|
+
const items = computed(() => props.items);
|
|
860
|
+
const color = useScopeColorClass(props);
|
|
861
|
+
const classes = computed(() => [color.value.className]);
|
|
862
|
+
const startIconEmptySpace = computed(() => props.startIconEmptySpace);
|
|
863
|
+
const caption = computed(() => {
|
|
864
|
+
const c = props.caption;
|
|
865
|
+
return typeof c === 'function' ? c() : c;
|
|
866
|
+
});
|
|
867
|
+
return () => {
|
|
868
|
+
const $caption = caption.value;
|
|
869
|
+
return createVNode("nav", {
|
|
870
|
+
"class": ['v-navigation', classes.value]
|
|
871
|
+
}, [!!$caption && createVNode("div", {
|
|
872
|
+
"class": "v-navigation__caption"
|
|
873
|
+
}, [$caption]), items.value.map(item => renderNavigationItemInput(item, {
|
|
874
|
+
class: 'v-navigation__item',
|
|
875
|
+
startIconEmptySpace: startIconEmptySpace.value
|
|
876
|
+
}))]);
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
});
|
|
881
|
+
|
|
273
882
|
const VCheckable = defineComponent({
|
|
274
883
|
name: 'VCheckable',
|
|
275
884
|
props: {
|
|
@@ -363,7 +972,7 @@ const VCheckbox = defineComponent({
|
|
|
363
972
|
|
|
364
973
|
});
|
|
365
974
|
|
|
366
|
-
function _isSlot$
|
|
975
|
+
function _isSlot$4(s) {
|
|
367
976
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
368
977
|
}
|
|
369
978
|
|
|
@@ -375,7 +984,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
|
|
|
375
984
|
itemRenderer: ({
|
|
376
985
|
attrs,
|
|
377
986
|
slots
|
|
378
|
-
}) => createVNode(VCheckbox, attrs, _isSlot$
|
|
987
|
+
}) => createVNode(VCheckbox, attrs, _isSlot$4(slots) ? slots : {
|
|
379
988
|
default: () => [slots]
|
|
380
989
|
})
|
|
381
990
|
});
|
|
@@ -427,7 +1036,7 @@ const VRadio = defineComponent({
|
|
|
427
1036
|
|
|
428
1037
|
});
|
|
429
1038
|
|
|
430
|
-
function _isSlot$
|
|
1039
|
+
function _isSlot$3(s) {
|
|
431
1040
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
432
1041
|
}
|
|
433
1042
|
|
|
@@ -438,7 +1047,7 @@ const VRadioGroup = defineFormSelectorComponent({
|
|
|
438
1047
|
itemRenderer: ({
|
|
439
1048
|
attrs,
|
|
440
1049
|
slots
|
|
441
|
-
}) => createVNode(VRadio, attrs, _isSlot$
|
|
1050
|
+
}) => createVNode(VRadio, attrs, _isSlot$3(slots) ? slots : {
|
|
442
1051
|
default: () => [slots]
|
|
443
1052
|
})
|
|
444
1053
|
});
|
|
@@ -500,7 +1109,7 @@ const VSwitch = defineComponent({
|
|
|
500
1109
|
|
|
501
1110
|
});
|
|
502
1111
|
|
|
503
|
-
function _isSlot$
|
|
1112
|
+
function _isSlot$2(s) {
|
|
504
1113
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
505
1114
|
}
|
|
506
1115
|
|
|
@@ -512,7 +1121,7 @@ const VSwitchGroup = defineFormSelectorComponent({
|
|
|
512
1121
|
itemRenderer: ({
|
|
513
1122
|
attrs,
|
|
514
1123
|
slots
|
|
515
|
-
}) => createVNode(VSwitch, attrs, _isSlot$
|
|
1124
|
+
}) => createVNode(VSwitch, attrs, _isSlot$2(slots) ? slots : {
|
|
516
1125
|
default: () => [slots]
|
|
517
1126
|
})
|
|
518
1127
|
});
|
|
@@ -1055,7 +1664,7 @@ const VForm = defineComponent({
|
|
|
1055
1664
|
|
|
1056
1665
|
});
|
|
1057
1666
|
|
|
1058
|
-
function _isSlot(s) {
|
|
1667
|
+
function _isSlot$1(s) {
|
|
1059
1668
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1060
1669
|
}
|
|
1061
1670
|
|
|
@@ -1067,7 +1676,93 @@ const VApp = defineComponent({
|
|
|
1067
1676
|
return () => {
|
|
1068
1677
|
let _slot;
|
|
1069
1678
|
|
|
1070
|
-
return createVNode(VStackRoot, null, _isSlot(_slot = renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
|
|
1679
|
+
return createVNode(VStackRoot, null, _isSlot$1(_slot = renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
|
|
1680
|
+
default: () => [_slot]
|
|
1681
|
+
});
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
});
|
|
1686
|
+
|
|
1687
|
+
const VToolbar = defineComponent({
|
|
1688
|
+
name: 'VToolbar',
|
|
1689
|
+
props: { ...createElevationProps(),
|
|
1690
|
+
...colorSchemeProps(),
|
|
1691
|
+
dense: Boolean
|
|
1692
|
+
},
|
|
1693
|
+
|
|
1694
|
+
setup(props, ctx) {
|
|
1695
|
+
const vui = useVui();
|
|
1696
|
+
const elevation = useElevation(props, {
|
|
1697
|
+
defaultValue: 4
|
|
1698
|
+
});
|
|
1699
|
+
const dense = computed(() => props.dense);
|
|
1700
|
+
const color = useColorClasses({
|
|
1701
|
+
color: () => props.color,
|
|
1702
|
+
variant: () => props.variant || vui.setting('containedVariant')
|
|
1703
|
+
});
|
|
1704
|
+
const classes = computed(() => {
|
|
1705
|
+
return [elevation.elevationClassName.value, color.colorClasses.value, {
|
|
1706
|
+
'v-toolbar--plain': !color.color.value.value,
|
|
1707
|
+
'v-toolbar--dense': dense.value
|
|
1708
|
+
}];
|
|
1709
|
+
});
|
|
1710
|
+
return () => {
|
|
1711
|
+
return createVNode("div", {
|
|
1712
|
+
"class": ['v-toolbar', classes.value]
|
|
1713
|
+
}, [renderSlotOrEmpty$1(ctx.slots, 'default')]);
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1719
|
+
const VToolbarMenu = defineComponent({
|
|
1720
|
+
name: 'VToolbarMenu',
|
|
1721
|
+
props: {
|
|
1722
|
+
edge: {
|
|
1723
|
+
type: String,
|
|
1724
|
+
required: true
|
|
1725
|
+
}
|
|
1726
|
+
},
|
|
1727
|
+
|
|
1728
|
+
setup(props, ctx) {
|
|
1729
|
+
const edge = computed(() => props.edge);
|
|
1730
|
+
return () => {
|
|
1731
|
+
const children = renderSlotOrEmpty$1(ctx.slots, 'default');
|
|
1732
|
+
const hasChildren = !!children && children.length > 0;
|
|
1733
|
+
return createVNode("div", {
|
|
1734
|
+
"class": ['v-toolbar-menu', `v-toolbar-menu--${edge.value}`, {
|
|
1735
|
+
[`v-toolbar-menu--empty`]: !hasChildren
|
|
1736
|
+
}]
|
|
1737
|
+
}, [children]);
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
});
|
|
1742
|
+
|
|
1743
|
+
function _isSlot(s) {
|
|
1744
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
const VToolbarTitle = defineComponent({
|
|
1748
|
+
name: 'VToolbarTitle',
|
|
1749
|
+
props: {
|
|
1750
|
+
tag: {
|
|
1751
|
+
type: String,
|
|
1752
|
+
default: 'span'
|
|
1753
|
+
}
|
|
1754
|
+
},
|
|
1755
|
+
|
|
1756
|
+
setup(props, ctx) {
|
|
1757
|
+
const _TagName = computed(() => props.tag);
|
|
1758
|
+
|
|
1759
|
+
return () => {
|
|
1760
|
+
let _slot;
|
|
1761
|
+
|
|
1762
|
+
const TagName = _TagName.value;
|
|
1763
|
+
return createVNode(TagName, {
|
|
1764
|
+
"class": "v-toolbar-title"
|
|
1765
|
+
}, _isSlot(_slot = renderSlotOrEmpty$1(ctx.slots, 'default')) ? _slot : {
|
|
1071
1766
|
default: () => [_slot]
|
|
1072
1767
|
});
|
|
1073
1768
|
};
|
|
@@ -1091,8 +1786,8 @@ class VuiService {
|
|
|
1091
1786
|
this.textareaRows = textareaRows;
|
|
1092
1787
|
this.requiredChip = requiredChip;
|
|
1093
1788
|
}
|
|
1094
|
-
|
|
1095
|
-
return this.options.
|
|
1789
|
+
setting(key) {
|
|
1790
|
+
return this.options.uiSettings[key];
|
|
1096
1791
|
}
|
|
1097
1792
|
icon(iconType) {
|
|
1098
1793
|
return this.options.icons[iconType];
|
|
@@ -1110,36 +1805,61 @@ class VuiService {
|
|
|
1110
1805
|
}
|
|
1111
1806
|
}
|
|
1112
1807
|
|
|
1113
|
-
class VuiPlugin {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1808
|
+
class VuiPlugin {
|
|
1809
|
+
static installedApps = new Set();
|
|
1810
|
+
|
|
1811
|
+
static install(app, opts) {
|
|
1812
|
+
const {
|
|
1813
|
+
installedApps
|
|
1814
|
+
} = this;
|
|
1815
|
+
if (installedApps.has(app)) return;
|
|
1816
|
+
const unmountApp = app.unmount;
|
|
1817
|
+
installedApps.add(app);
|
|
1818
|
+
const {
|
|
1819
|
+
colorScheme,
|
|
1820
|
+
stack,
|
|
1821
|
+
uiSettings
|
|
1822
|
+
} = opts; // ColorScheme
|
|
1823
|
+
|
|
1824
|
+
const vueColorSchemePlugin = new VueColorSchemePlugin(colorScheme);
|
|
1825
|
+
app.use(vueColorSchemePlugin); // Stack
|
|
1826
|
+
|
|
1827
|
+
installVueStackPlugin(app, {
|
|
1828
|
+
actions: {
|
|
1829
|
+
ok: ({
|
|
1830
|
+
bindings
|
|
1831
|
+
}) => createVNode(VButton, mergeProps(uiSettings.dialogOk, bindings), {
|
|
1832
|
+
default: () => [createTextVNode("OK")]
|
|
1833
|
+
}),
|
|
1834
|
+
cancel: ({
|
|
1835
|
+
bindings
|
|
1836
|
+
}) => createVNode(VButton, mergeProps(uiSettings.dialogCancel, bindings), {
|
|
1837
|
+
default: () => [createTextVNode("CANCEL")]
|
|
1838
|
+
}),
|
|
1839
|
+
close: ({
|
|
1840
|
+
bindings
|
|
1841
|
+
}) => createVNode(VButton, mergeProps(uiSettings.dialogClose, bindings), {
|
|
1842
|
+
default: () => [createTextVNode("CLOSE")]
|
|
1843
|
+
}),
|
|
1844
|
+
...(stack ? stack.actions : {})
|
|
1845
|
+
},
|
|
1846
|
+
...stack
|
|
1847
|
+
}); // Vui
|
|
1848
|
+
|
|
1849
|
+
const $vui = new VuiService(opts);
|
|
1850
|
+
app.provide(VuiInjectionKey, $vui);
|
|
1851
|
+
app.config.globalProperties.$vui = $vui;
|
|
1852
|
+
|
|
1853
|
+
app.unmount = function () {
|
|
1854
|
+
installedApps.delete(app);
|
|
1855
|
+
delete app.config.globalProperties.$vui;
|
|
1856
|
+
unmountApp();
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
}
|
|
1861
|
+
function installVuiPlugin(app, opts) {
|
|
1862
|
+
return app.use(VuiPlugin, opts);
|
|
1143
1863
|
}
|
|
1144
1864
|
|
|
1145
|
-
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, VApp, VCheckbox, VCheckboxGroup, VForm, VIcon, VOption, VOptionGroup, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTextField, VTextarea, VuiInjectionKey, VuiPlugin, VuiService, createControlFieldProviderProps, createControlProps, defineFormSelectorComponent, installVuiPlugin, useControl, useControlField };
|
|
1865
|
+
export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, VApp, VButton, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VDrawerLayout, VForm, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPaper, VRadio, VRadioGroup, VSelect, VSwitch, VSwitchGroup, VTextField, VTextarea, VToolbar, 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, VuiColorProviderInjectionKey, VuiControlFieldInjectionKey, VuiControlInjectionKey, VuiInjectionKey, VuiPlugin, VuiService, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|