@fastkit/vui 0.8.17 → 0.9.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.
- package/LICENSE +21 -0
- package/README.md +4 -1
- package/dist/vui.cjs.js +73 -31
- package/dist/vui.cjs.prod.js +73 -31
- package/dist/vui.css +6 -0
- package/dist/vui.d.ts +83 -49
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/dist/vui.mjs +74 -34
- package/package.json +20 -9
- package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +1 -1
- package/src/components/VBusyImage/VBusyImage.tsx +3 -3
- package/src/components/VButton/VButton.scss +8 -0
- package/src/components/VButton/VButton.tsx +9 -0
- package/src/components/VDataTable/VDataTable.tsx +9 -5
- package/src/components/VListTile/VListTile.tsx +4 -2
- package/src/components/VNavigation/VNavigation.tsx +13 -4
- package/src/components/VNavigation/VNavigationItem.tsx +25 -7
- package/src/components/VSelect/VSelect.tsx +20 -9
- package/src/service.tsx +7 -2
package/dist/vui.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, resolveVNodeChildOrSlots, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, useParentFormNode,
|
|
1
|
+
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, resolveVNodeChildOrSlots, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, useParentFormNode, useKeyboard, VMenu, createTextInputSettings, useTextInputControl, createTextareaSettings, useTextareaControl, createFormSettings, useForm, getDocumentScroller, useVScrollerRef, VScroller, useInjectTheme, VStackRoot, resolveVStackDynamicInput, VueColorSchemePlugin, installVueStackPlugin, onAppUnmount } from '@fastkit/vue-kit';
|
|
2
2
|
export * from '@fastkit/vue-kit';
|
|
3
3
|
export { VDialog, VMenu, VSnackbar, VTooltip } from '@fastkit/vue-kit';
|
|
4
4
|
import { inject, computed, provide, createVNode, mergeProps, defineComponent, Fragment, isVNode, ref, watch, onMounted, onBeforeUnmount, cloneVNode, withDirectives, createTextVNode, vShow, onBeforeUpdate, vModelSelect, nextTick, Transition, reactive } from 'vue';
|
|
5
|
-
import { useRouter, RouterLink,
|
|
5
|
+
import { useRouter, RouterLink, useRoute, useLink } from 'vue-router';
|
|
6
6
|
import { createPropsOptions as createPropsOptions$1, renderSlotOrEmpty as renderSlotOrEmpty$1, defineSlotsProps as defineSlotsProps$1, htmlAttributesPropOptions, navigationableInheritProps, useNavigationable, VLink, isFragment, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
|
|
7
7
|
import { getDocumentScroller as getDocumentScroller$1 } from '@fastkit/vue-scroller';
|
|
8
8
|
import { VProgressCircular } from '@fastkit/vue-loading';
|
|
@@ -522,7 +522,7 @@ const VBusyImage = defineComponent({
|
|
|
522
522
|
},
|
|
523
523
|
|
|
524
524
|
setup(props, ctx) {
|
|
525
|
-
const loadStateRef = ref(props.cover &&
|
|
525
|
+
const loadStateRef = ref(props.cover && isAvailableSrc(ctx.attrs.src) ? 'loading' : 'pending');
|
|
526
526
|
const attrsRef = computed(() => splitAttrs(ctx.attrs));
|
|
527
527
|
const isPendingRef = computed(() => loadStateRef.value === 'pending');
|
|
528
528
|
const isLoadingRef = computed(() => loadStateRef.value === 'loading');
|
|
@@ -592,7 +592,7 @@ const VBusyImage = defineComponent({
|
|
|
592
592
|
watch(() => ctx.attrs.src, value => {
|
|
593
593
|
coverImageRef.value = undefined;
|
|
594
594
|
|
|
595
|
-
if (
|
|
595
|
+
if (isAvailableSrc(value)) {
|
|
596
596
|
loadStateRef.value = 'loading';
|
|
597
597
|
|
|
598
598
|
if (props.cover) {
|
|
@@ -684,7 +684,7 @@ function imageIsReady(image) {
|
|
|
684
684
|
return image.naturalWidth + image.naturalHeight > 0 ? 'load' : 'error';
|
|
685
685
|
}
|
|
686
686
|
|
|
687
|
-
function
|
|
687
|
+
function isAvailableSrc(src) {
|
|
688
688
|
return typeof src === 'string' && src !== '';
|
|
689
689
|
}
|
|
690
690
|
|
|
@@ -1137,6 +1137,8 @@ const VCardActions = defineComponent({
|
|
|
1137
1137
|
|
|
1138
1138
|
});
|
|
1139
1139
|
|
|
1140
|
+
const BUTTON_ALIGNS = ['left', 'center', 'right'];
|
|
1141
|
+
|
|
1140
1142
|
function resolveRawVButtonIcon(raw, type = 'main') {
|
|
1141
1143
|
if (!raw) return;
|
|
1142
1144
|
return typeof raw === 'function' ? raw : () => createVNode(VIcon, {
|
|
@@ -1153,6 +1155,10 @@ const vueButtonProps = createPropsOptions$1({ ...htmlAttributesPropOptions,
|
|
|
1153
1155
|
icon: [String, Function],
|
|
1154
1156
|
startIcon: [String, Function],
|
|
1155
1157
|
endIcon: [String, Function],
|
|
1158
|
+
align: {
|
|
1159
|
+
type: String,
|
|
1160
|
+
default: 'center'
|
|
1161
|
+
},
|
|
1156
1162
|
...createControlProps()
|
|
1157
1163
|
});
|
|
1158
1164
|
const LOADING_SIZE_MAP = {
|
|
@@ -1200,7 +1206,7 @@ const VButton = defineComponent({
|
|
|
1200
1206
|
return _spacer === true ? 'left' : _spacer;
|
|
1201
1207
|
});
|
|
1202
1208
|
const classes = computed(() => [color.colorClasses.value, // navigationable.value.classes,
|
|
1203
|
-
spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, {
|
|
1209
|
+
spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, `v-button--align-${props.align}`, {
|
|
1204
1210
|
'v-button--loading': isLoading.value,
|
|
1205
1211
|
'v-button--icon': !!icon.value,
|
|
1206
1212
|
'v-button--rounded': props.rounded,
|
|
@@ -1611,6 +1617,7 @@ const VListTile = defineComponent({
|
|
|
1611
1617
|
},
|
|
1612
1618
|
|
|
1613
1619
|
setup(props, ctx) {
|
|
1620
|
+
const vui = useVui();
|
|
1614
1621
|
const startIcon = computed(() => {
|
|
1615
1622
|
let icon = resolveRawIconProp(false, props.startIcon);
|
|
1616
1623
|
|
|
@@ -1622,7 +1629,7 @@ const VListTile = defineComponent({
|
|
|
1622
1629
|
});
|
|
1623
1630
|
const endIcon = computed(() => resolveRawIconProp(false, props.endIcon));
|
|
1624
1631
|
const hasTo = computed(() => !!ctx.attrs.to);
|
|
1625
|
-
const link = useLink({
|
|
1632
|
+
const link = vui.useLink({
|
|
1626
1633
|
to: ctx.attrs.to || ''
|
|
1627
1634
|
});
|
|
1628
1635
|
const isActive = computed(() => {
|
|
@@ -1750,7 +1757,7 @@ function _isSlot$c(s) {
|
|
|
1750
1757
|
|
|
1751
1758
|
function createNavigationItemProps() {
|
|
1752
1759
|
return { ...createListTileProps(),
|
|
1753
|
-
match: String,
|
|
1760
|
+
match: [String, Array],
|
|
1754
1761
|
depth: {
|
|
1755
1762
|
type: Number,
|
|
1756
1763
|
default: 0
|
|
@@ -1789,6 +1796,12 @@ function renderNavigationItemInput(input, extraProps) {
|
|
|
1789
1796
|
default: () => [label]
|
|
1790
1797
|
});
|
|
1791
1798
|
}
|
|
1799
|
+
const TRIM_END_SLASH_RE = /\/$/;
|
|
1800
|
+
|
|
1801
|
+
function trimEndSlash(sorce) {
|
|
1802
|
+
return sorce ? sorce.replace(TRIM_END_SLASH_RE, '') : sorce;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1792
1805
|
const VNavigationItem = defineComponent({
|
|
1793
1806
|
name: 'VNavigationItem',
|
|
1794
1807
|
inheritAttrs: false,
|
|
@@ -1813,10 +1826,15 @@ const VNavigationItem = defineComponent({
|
|
|
1813
1826
|
const {
|
|
1814
1827
|
to
|
|
1815
1828
|
} = ctx.attrs;
|
|
1816
|
-
|
|
1829
|
+
|
|
1830
|
+
if (match) {
|
|
1831
|
+
return (Array.isArray(match) ? match : [match]).map(trimEndSlash);
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1817
1834
|
if (!to) return;
|
|
1818
|
-
|
|
1819
|
-
return
|
|
1835
|
+
const toPath = typeof to === 'string' ? to : to.path;
|
|
1836
|
+
if (!toPath) return;
|
|
1837
|
+
return [trimEndSlash(toPath)];
|
|
1820
1838
|
});
|
|
1821
1839
|
const classes = computed(() => [{
|
|
1822
1840
|
'v-navigation-item--opened': opened.value,
|
|
@@ -1832,16 +1850,25 @@ const VNavigationItem = defineComponent({
|
|
|
1832
1850
|
const c = children.value;
|
|
1833
1851
|
const m = match.value;
|
|
1834
1852
|
|
|
1835
|
-
if (!c || !m) {
|
|
1853
|
+
if (!c || !m || !m.length) {
|
|
1836
1854
|
// matched.value = false;
|
|
1837
1855
|
return;
|
|
1838
1856
|
}
|
|
1839
1857
|
|
|
1840
|
-
|
|
1858
|
+
const trimedNewPath = trimEndSlash(newPath);
|
|
1859
|
+
|
|
1860
|
+
if (m.some(_ => trimedNewPath.match(_))) {
|
|
1841
1861
|
open(); // matched.value = true;
|
|
1842
1862
|
} else {
|
|
1843
1863
|
close(); // matched.value = false;
|
|
1844
|
-
}
|
|
1864
|
+
} // if (trimEndSlash(newPath).match(m)) {
|
|
1865
|
+
// open();
|
|
1866
|
+
// // matched.value = true;
|
|
1867
|
+
// } else {
|
|
1868
|
+
// close();
|
|
1869
|
+
// // matched.value = false;
|
|
1870
|
+
// }
|
|
1871
|
+
|
|
1845
1872
|
}, {
|
|
1846
1873
|
immediate: true
|
|
1847
1874
|
}); // const iconPayload = () => opened.value;
|
|
@@ -1960,9 +1987,8 @@ const VNavigationItem = defineComponent({
|
|
|
1960
1987
|
|
|
1961
1988
|
});
|
|
1962
1989
|
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
props: {
|
|
1990
|
+
function createNavigationProps() {
|
|
1991
|
+
return createPropsOptions$1({
|
|
1966
1992
|
items: {
|
|
1967
1993
|
type: Array,
|
|
1968
1994
|
required: true
|
|
@@ -1973,7 +1999,11 @@ const VNavigation = defineComponent({
|
|
|
1973
1999
|
default: true
|
|
1974
2000
|
},
|
|
1975
2001
|
caption: [String, Function]
|
|
1976
|
-
}
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
const VNavigation = defineComponent({
|
|
2005
|
+
name: 'VNavigation',
|
|
2006
|
+
props: createNavigationProps(),
|
|
1977
2007
|
|
|
1978
2008
|
setup(props, ctx) {
|
|
1979
2009
|
const items = computed(() => props.items);
|
|
@@ -2477,9 +2507,9 @@ function _isSlot$8(s) {
|
|
|
2477
2507
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
2478
2508
|
}
|
|
2479
2509
|
|
|
2480
|
-
const ARROW_KEY_TYPES =
|
|
2481
|
-
const CHOICE_KEY_TYPES =
|
|
2482
|
-
const KEYBORD_EVENT_TYPES =
|
|
2510
|
+
const ARROW_KEY_TYPES = useKeyboard.Key(['ArrowUp', 'ArrowDown']);
|
|
2511
|
+
const CHOICE_KEY_TYPES = useKeyboard.Key(['Enter', ' ']);
|
|
2512
|
+
const KEYBORD_EVENT_TYPES = useKeyboard.Key([...ARROW_KEY_TYPES, ...CHOICE_KEY_TYPES]);
|
|
2483
2513
|
const {
|
|
2484
2514
|
props: props$3,
|
|
2485
2515
|
emits: emits$3
|
|
@@ -2496,7 +2526,8 @@ const VSelect = defineComponent({
|
|
|
2496
2526
|
placeholder: String,
|
|
2497
2527
|
loadingMessage: {},
|
|
2498
2528
|
failedToLoadItemsMessage: {}
|
|
2499
|
-
})
|
|
2529
|
+
}),
|
|
2530
|
+
closeOnNavigation: Boolean
|
|
2500
2531
|
},
|
|
2501
2532
|
emits: emits$3,
|
|
2502
2533
|
|
|
@@ -2537,6 +2568,7 @@ const VSelect = defineComponent({
|
|
|
2537
2568
|
};
|
|
2538
2569
|
|
|
2539
2570
|
const renderSelections = selectedItems => {
|
|
2571
|
+
const selectionSlot = ctx.slots.selection;
|
|
2540
2572
|
const children = [];
|
|
2541
2573
|
|
|
2542
2574
|
if (inputControl.itemsLoadFailed) {
|
|
@@ -2553,7 +2585,11 @@ const VSelect = defineComponent({
|
|
|
2553
2585
|
children.push(vui.selectionSeparator());
|
|
2554
2586
|
}
|
|
2555
2587
|
|
|
2556
|
-
|
|
2588
|
+
const child = selectionSlot ? selectionSlot({
|
|
2589
|
+
item,
|
|
2590
|
+
index
|
|
2591
|
+
}) : item.renderDefaultSlot();
|
|
2592
|
+
children.push(child);
|
|
2557
2593
|
});
|
|
2558
2594
|
} else if (props.placeholder != null) {
|
|
2559
2595
|
children.push(createVNode("span", {
|
|
@@ -2654,14 +2690,14 @@ const VSelect = defineComponent({
|
|
|
2654
2690
|
}
|
|
2655
2691
|
};
|
|
2656
2692
|
|
|
2657
|
-
const
|
|
2693
|
+
const keyboardEventHandler = ev => {
|
|
2658
2694
|
if (ARROW_KEY_TYPES.includes(ev.key)) return arrowKeyHandler(ev);
|
|
2659
2695
|
if (CHOICE_KEY_TYPES.includes(ev.key)) return choiceKeyHandler(ev);
|
|
2660
2696
|
};
|
|
2661
2697
|
|
|
2662
|
-
|
|
2698
|
+
useKeyboard([{
|
|
2663
2699
|
key: KEYBORD_EVENT_TYPES,
|
|
2664
|
-
handler:
|
|
2700
|
+
handler: keyboardEventHandler
|
|
2665
2701
|
}], {
|
|
2666
2702
|
autorun: true
|
|
2667
2703
|
});
|
|
@@ -2722,6 +2758,7 @@ const VSelect = defineComponent({
|
|
|
2722
2758
|
default: () => createVNode(VMenu, {
|
|
2723
2759
|
"width": "fit",
|
|
2724
2760
|
"maxWidth": "fit",
|
|
2761
|
+
"closeOnNavigation": this.closeOnNavigation,
|
|
2725
2762
|
"distance": 0,
|
|
2726
2763
|
"alwaysRender": true,
|
|
2727
2764
|
"modelValue": this.menuOpened,
|
|
@@ -4435,7 +4472,7 @@ const VBreadcrumbs = defineComponent({
|
|
|
4435
4472
|
text
|
|
4436
4473
|
} = item;
|
|
4437
4474
|
const {
|
|
4438
|
-
disabled = vui.location.match(to) || !vui.location.
|
|
4475
|
+
disabled = vui.location.match(to) || !vui.location.isAvailable(to)
|
|
4439
4476
|
} = item;
|
|
4440
4477
|
return { ...item,
|
|
4441
4478
|
disabled,
|
|
@@ -4963,7 +5000,9 @@ const VDataTable = defineComponent({
|
|
|
4963
5000
|
}
|
|
4964
5001
|
|
|
4965
5002
|
vui.location.pushQuery({ ...queries,
|
|
4966
|
-
|
|
5003
|
+
...(usePaigingRef.value ? {
|
|
5004
|
+
[props.pageQuery]: 1
|
|
5005
|
+
} : undefined)
|
|
4967
5006
|
});
|
|
4968
5007
|
}
|
|
4969
5008
|
|
|
@@ -5089,8 +5128,8 @@ const VDataTable = defineComponent({
|
|
|
5089
5128
|
const {
|
|
5090
5129
|
defaultOrder,
|
|
5091
5130
|
ascQueryValue
|
|
5092
|
-
} = props;
|
|
5093
|
-
|
|
5131
|
+
} = props; // const usePaiging = usePaigingRef.value;
|
|
5132
|
+
|
|
5094
5133
|
const children = headersRef.value.map(header => {
|
|
5095
5134
|
const {
|
|
5096
5135
|
label,
|
|
@@ -5129,7 +5168,7 @@ const VDataTable = defineComponent({
|
|
|
5129
5168
|
|
|
5130
5169
|
const sortActive = sortBy === sortQuery;
|
|
5131
5170
|
|
|
5132
|
-
if (sortQuery
|
|
5171
|
+
if (sortQuery) {
|
|
5133
5172
|
const isASC = sortActive ? isASCRef.value : defaultOrder === ascQueryValue;
|
|
5134
5173
|
headerChildren.unshift(createVNode(VIcon, {
|
|
5135
5174
|
"class": "v-data-table__table__sort-icon v-data-table__table__sort-icon--empty",
|
|
@@ -5154,9 +5193,9 @@ const VDataTable = defineComponent({
|
|
|
5154
5193
|
return createVNode("th", {
|
|
5155
5194
|
"class": classes,
|
|
5156
5195
|
"key": header.key,
|
|
5157
|
-
"tabindex": sortQuery
|
|
5196
|
+
"tabindex": sortQuery ? 0 : undefined,
|
|
5158
5197
|
"onClick": ev => {
|
|
5159
|
-
if (!sortQuery
|
|
5198
|
+
if (!sortQuery) return;
|
|
5160
5199
|
handleClickSortHeader(header);
|
|
5161
5200
|
}
|
|
5162
5201
|
}, [createVNode("div", {
|
|
@@ -5536,6 +5575,7 @@ class VuiService {
|
|
|
5536
5575
|
router: this.router
|
|
5537
5576
|
});
|
|
5538
5577
|
this.stack = stackService;
|
|
5578
|
+
this.useLink = options.useLink || useLink;
|
|
5539
5579
|
}
|
|
5540
5580
|
|
|
5541
5581
|
configure(options) {
|
|
@@ -5734,4 +5774,4 @@ function installVuiPlugin(app, opts) {
|
|
|
5734
5774
|
return app.use(VuiPlugin, opts);
|
|
5735
5775
|
}
|
|
5736
5776
|
|
|
5737
|
-
export { ARROW_KEY_TYPES, AVATAR_SIZES, CHIP_SIZES, CHOICE_KEY_TYPES, CONTROL_FIELD_VARIANTS, CONTROL_LOADING_SPINNER_SIZES, CONTROL_SIZES, KEYBORD_EVENT_TYPES, PAGINATION_ALIGNS, VApp, VAvatar, VBreadcrumbs, VBusyImage, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VChip, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VNumberField, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSkeltonLoaderBone, 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, WysiwygColorExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, configureDataTableDefaults, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, createWysiwygColorTool, createWysiwygExtension, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions, splitAttrs, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
|
5777
|
+
export { ARROW_KEY_TYPES, AVATAR_SIZES, BUTTON_ALIGNS, CHIP_SIZES, CHOICE_KEY_TYPES, CONTROL_FIELD_VARIANTS, CONTROL_LOADING_SPINNER_SIZES, CONTROL_SIZES, KEYBORD_EVENT_TYPES, PAGINATION_ALIGNS, VApp, VAvatar, VBreadcrumbs, VBusyImage, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VChip, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VNumberField, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, VSkeltonLoaderBone, 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, WysiwygColorExtension, WysiwygEditorInitializeContext, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, configureDataTableDefaults, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createNavigationProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, createWysiwygColorTool, createWysiwygExtension, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions, splitAttrs, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
package/package.json
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastkit/vui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "A simple, extensible UI kit for Vue applications.",
|
|
5
5
|
"buildOptions": {
|
|
6
6
|
"name": "Vui",
|
|
7
7
|
"tool": true
|
|
8
8
|
},
|
|
9
|
+
"_docs": {
|
|
10
|
+
"scope": "vue",
|
|
11
|
+
"feature": "ui",
|
|
12
|
+
"description": {
|
|
13
|
+
"en": "A simple, extensible UI kit for Vue applications.",
|
|
14
|
+
"ja": "Vueアプリケーション用のシンプルで拡張可能なUIキット。"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
9
17
|
"main": "index.js",
|
|
10
18
|
"module": "dist/vui.mjs",
|
|
11
19
|
"files": [
|
|
@@ -19,7 +27,10 @@
|
|
|
19
27
|
"url": "git+https://github.com/dadajam4/fastkit.git"
|
|
20
28
|
},
|
|
21
29
|
"keywords": [
|
|
22
|
-
"fastkit"
|
|
30
|
+
"fastkit",
|
|
31
|
+
"vue",
|
|
32
|
+
"ui",
|
|
33
|
+
"component"
|
|
23
34
|
],
|
|
24
35
|
"author": "dadajam4",
|
|
25
36
|
"license": "MIT",
|
|
@@ -32,15 +43,15 @@
|
|
|
32
43
|
"vue": "^3.2.37"
|
|
33
44
|
},
|
|
34
45
|
"dependencies": {
|
|
35
|
-
"@fastkit/color-scheme": "0.
|
|
36
|
-
"@fastkit/icon-font": "0.
|
|
37
|
-
"@fastkit/tiny-logger": "0.
|
|
38
|
-
"@fastkit/vite-kit": "0.
|
|
39
|
-
"@fastkit/vue-kit": "0.
|
|
46
|
+
"@fastkit/color-scheme": "0.9.0",
|
|
47
|
+
"@fastkit/icon-font": "0.9.0",
|
|
48
|
+
"@fastkit/tiny-logger": "0.9.0",
|
|
49
|
+
"@fastkit/vite-kit": "0.9.0",
|
|
50
|
+
"@fastkit/vue-kit": "0.9.0",
|
|
40
51
|
"@tiptap/extension-link": "^2.0.0-beta.43",
|
|
41
52
|
"@tiptap/extension-underline": "^2.0.0-beta.25",
|
|
42
53
|
"@tiptap/extension-text-style": "^2.0.0-beta.26",
|
|
43
|
-
"@tiptap/starter-kit": "^2.0.0-beta.
|
|
54
|
+
"@tiptap/starter-kit": "^2.0.0-beta.191",
|
|
44
55
|
"@tiptap/vue-3": "^2.0.0-beta.96",
|
|
45
56
|
"eta": "^1.12.3",
|
|
46
57
|
"fs-extra": "^9.1.0"
|
|
@@ -45,7 +45,7 @@ export const VBreadcrumbs = defineComponent({
|
|
|
45
45
|
return items.map((item) => {
|
|
46
46
|
const { to, text } = item;
|
|
47
47
|
const {
|
|
48
|
-
disabled = vui.location.match(to) || !vui.location.
|
|
48
|
+
disabled = vui.location.match(to) || !vui.location.isAvailable(to),
|
|
49
49
|
} = item;
|
|
50
50
|
return {
|
|
51
51
|
...item,
|
|
@@ -96,7 +96,7 @@ export const VBusyImage = defineComponent({
|
|
|
96
96
|
},
|
|
97
97
|
setup(props, ctx) {
|
|
98
98
|
const loadStateRef = ref<BusyImageLoadState>(
|
|
99
|
-
props.cover &&
|
|
99
|
+
props.cover && isAvailableSrc(ctx.attrs.src as any)
|
|
100
100
|
? 'loading'
|
|
101
101
|
: 'pending',
|
|
102
102
|
);
|
|
@@ -173,7 +173,7 @@ export const VBusyImage = defineComponent({
|
|
|
173
173
|
() => ctx.attrs.src as string | null | undefined,
|
|
174
174
|
(value) => {
|
|
175
175
|
coverImageRef.value = undefined;
|
|
176
|
-
if (
|
|
176
|
+
if (isAvailableSrc(value)) {
|
|
177
177
|
loadStateRef.value = 'loading';
|
|
178
178
|
if (props.cover) {
|
|
179
179
|
loadImage(value)
|
|
@@ -273,6 +273,6 @@ function imageIsReady(image: HTMLImageElement): 'load' | 'error' | false {
|
|
|
273
273
|
return image.naturalWidth + image.naturalHeight > 0 ? 'load' : 'error';
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
function
|
|
276
|
+
function isAvailableSrc(src: string | null | undefined): src is string {
|
|
277
277
|
return typeof src === 'string' && src !== '';
|
|
278
278
|
}
|
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
transition: 0.3s cubic-bezier(0.25, 0.8, 0.5, 1), color 1ms;
|
|
39
39
|
appearance: none;
|
|
40
40
|
|
|
41
|
+
&--align-left {
|
|
42
|
+
justify-content: flex-start;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--align-right {
|
|
46
|
+
justify-content: flex-end;
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
&--plain {
|
|
42
50
|
color: inherit !important;
|
|
43
51
|
// color: inherit !important;
|
|
@@ -30,6 +30,10 @@ export type VButtonIcon = () => VNodeChild;
|
|
|
30
30
|
|
|
31
31
|
export type RawVButtonIcon = IconName | VButtonIcon;
|
|
32
32
|
|
|
33
|
+
export const BUTTON_ALIGNS = ['left', 'center', 'right'] as const;
|
|
34
|
+
|
|
35
|
+
export type VButtonAlign = typeof BUTTON_ALIGNS[number];
|
|
36
|
+
|
|
33
37
|
function resolveRawVButtonIcon(
|
|
34
38
|
raw?: RawVButtonIcon,
|
|
35
39
|
type: 'main' | 'start' | 'end' = 'main',
|
|
@@ -54,6 +58,10 @@ export const vueButtonProps = createPropsOptions({
|
|
|
54
58
|
icon: [String, Function] as PropType<RawVButtonIcon>,
|
|
55
59
|
startIcon: [String, Function] as PropType<RawVButtonIcon>,
|
|
56
60
|
endIcon: [String, Function] as PropType<RawVButtonIcon>,
|
|
61
|
+
align: {
|
|
62
|
+
type: String as PropType<VButtonAlign>,
|
|
63
|
+
default: 'center',
|
|
64
|
+
},
|
|
57
65
|
...createControlProps(),
|
|
58
66
|
});
|
|
59
67
|
|
|
@@ -115,6 +123,7 @@ export const VButton = defineComponent({
|
|
|
115
123
|
// navigationable.value.classes,
|
|
116
124
|
spacer.value ? `v-button--spacer-${spacer.value}` : undefined,
|
|
117
125
|
`v-button--${control.size.value}`,
|
|
126
|
+
`v-button--align-${props.align}`,
|
|
118
127
|
{
|
|
119
128
|
'v-button--loading': isLoading.value,
|
|
120
129
|
'v-button--icon': !!icon.value,
|
|
@@ -401,7 +401,11 @@ export const VDataTable = defineComponent({
|
|
|
401
401
|
|
|
402
402
|
vui.location.pushQuery({
|
|
403
403
|
...queries,
|
|
404
|
-
|
|
404
|
+
...(usePaigingRef.value
|
|
405
|
+
? {
|
|
406
|
+
[props.pageQuery]: 1,
|
|
407
|
+
}
|
|
408
|
+
: undefined),
|
|
405
409
|
});
|
|
406
410
|
}
|
|
407
411
|
|
|
@@ -530,7 +534,7 @@ export const VDataTable = defineComponent({
|
|
|
530
534
|
const isIndeterminate = isIndeterminateRef.value;
|
|
531
535
|
const isAllSelected = isAllSelectedRef.value;
|
|
532
536
|
const { defaultOrder, ascQueryValue } = props;
|
|
533
|
-
const usePaiging = usePaigingRef.value;
|
|
537
|
+
// const usePaiging = usePaigingRef.value;
|
|
534
538
|
|
|
535
539
|
const children = headersRef.value.map((header) => {
|
|
536
540
|
const { label, sortQuery, align, key } = header;
|
|
@@ -567,7 +571,7 @@ export const VDataTable = defineComponent({
|
|
|
567
571
|
|
|
568
572
|
const sortActive = sortBy === sortQuery;
|
|
569
573
|
|
|
570
|
-
if (sortQuery
|
|
574
|
+
if (sortQuery) {
|
|
571
575
|
const isASC = sortActive
|
|
572
576
|
? isASCRef.value
|
|
573
577
|
: defaultOrder === ascQueryValue;
|
|
@@ -615,9 +619,9 @@ export const VDataTable = defineComponent({
|
|
|
615
619
|
<th
|
|
616
620
|
class={classes}
|
|
617
621
|
key={header.key}
|
|
618
|
-
tabindex={sortQuery
|
|
622
|
+
tabindex={sortQuery ? 0 : undefined}
|
|
619
623
|
onClick={(ev) => {
|
|
620
|
-
if (!sortQuery
|
|
624
|
+
if (!sortQuery) return;
|
|
621
625
|
handleClickSortHeader(header, ev);
|
|
622
626
|
}}>
|
|
623
627
|
<div class="v-data-table__table__cell__tile">{headerChildren}</div>
|
|
@@ -14,8 +14,9 @@ import {
|
|
|
14
14
|
createPropsOptions,
|
|
15
15
|
} from '@fastkit/vue-utils';
|
|
16
16
|
import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
|
|
17
|
-
import { useLink } from 'vue-router';
|
|
17
|
+
// import { useLink } from 'vue-router';
|
|
18
18
|
import { VLink } from '@fastkit/vue-utils';
|
|
19
|
+
import { useVui } from '../../injections';
|
|
19
20
|
|
|
20
21
|
export function createListTileProps() {
|
|
21
22
|
const icon = rawIconProp();
|
|
@@ -47,6 +48,7 @@ export const VListTile = defineComponent({
|
|
|
47
48
|
...listTileEmits,
|
|
48
49
|
},
|
|
49
50
|
setup(props, ctx) {
|
|
51
|
+
const vui = useVui();
|
|
50
52
|
const startIcon: ComputedRef<VNodeChild> = computed(() => {
|
|
51
53
|
let icon = resolveRawIconProp(false, props.startIcon);
|
|
52
54
|
if (!icon && props.startIconEmptySpace) {
|
|
@@ -60,7 +62,7 @@ export const VListTile = defineComponent({
|
|
|
60
62
|
|
|
61
63
|
const hasTo = computed(() => !!ctx.attrs.to);
|
|
62
64
|
|
|
63
|
-
const link = useLink({ to: (ctx.attrs.to as any) || '' });
|
|
65
|
+
const link = vui.useLink({ to: (ctx.attrs.to as any) || '' });
|
|
64
66
|
|
|
65
67
|
const isActive = computed(() => {
|
|
66
68
|
if (!hasTo.value) return false;
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
renderNavigationItemInput,
|
|
13
13
|
} from './VNavigationItem';
|
|
14
14
|
import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
|
|
15
|
+
import { createPropsOptions, ExtractPropInput } from '@fastkit/vue-utils';
|
|
15
16
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
props: {
|
|
17
|
+
export function createNavigationProps() {
|
|
18
|
+
return createPropsOptions({
|
|
19
19
|
items: {
|
|
20
20
|
type: Array as PropType<NavigationItemInput[]>,
|
|
21
21
|
required: true,
|
|
@@ -26,7 +26,16 @@ export const VNavigation = defineComponent({
|
|
|
26
26
|
default: true,
|
|
27
27
|
},
|
|
28
28
|
caption: [String, Function] as PropType<VNodeChild | (() => VNodeChild)>,
|
|
29
|
-
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type NavigationInput = ExtractPropInput<
|
|
33
|
+
ReturnType<typeof createNavigationProps>
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export const VNavigation = defineComponent({
|
|
37
|
+
name: 'VNavigation',
|
|
38
|
+
props: createNavigationProps(),
|
|
30
39
|
setup(props, ctx) {
|
|
31
40
|
const items = computed(() => props.items);
|
|
32
41
|
const color = useScopeColorClass(props);
|
|
@@ -22,7 +22,7 @@ import { ScopeName } from '@fastkit/color-scheme';
|
|
|
22
22
|
export function createNavigationItemProps() {
|
|
23
23
|
return {
|
|
24
24
|
...createListTileProps(),
|
|
25
|
-
match: String,
|
|
25
|
+
match: [String, Array] as PropType<string | string[]>,
|
|
26
26
|
depth: {
|
|
27
27
|
type: Number,
|
|
28
28
|
default: 0,
|
|
@@ -72,6 +72,12 @@ export function renderNavigationItemInput(
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
const TRIM_END_SLASH_RE = /\/$/;
|
|
76
|
+
|
|
77
|
+
function trimEndSlash<T extends string | undefined>(sorce: T) {
|
|
78
|
+
return sorce ? sorce.replace(TRIM_END_SLASH_RE, '') : sorce;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
export const VNavigationItem = defineComponent({
|
|
76
82
|
name: 'VNavigationItem',
|
|
77
83
|
inheritAttrs: false,
|
|
@@ -93,13 +99,16 @@ export const VNavigationItem = defineComponent({
|
|
|
93
99
|
|
|
94
100
|
const to = computed(() => ctx.attrs.to);
|
|
95
101
|
|
|
96
|
-
const match = computed(() => {
|
|
102
|
+
const match = computed<string[] | undefined>(() => {
|
|
97
103
|
const { match } = props;
|
|
98
104
|
const { to } = ctx.attrs;
|
|
99
|
-
if (match)
|
|
105
|
+
if (match) {
|
|
106
|
+
return (Array.isArray(match) ? match : [match]).map(trimEndSlash);
|
|
107
|
+
}
|
|
100
108
|
if (!to) return;
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
const toPath = typeof to === 'string' ? to : (to as any).path;
|
|
110
|
+
if (!toPath) return;
|
|
111
|
+
return [trimEndSlash(toPath)];
|
|
103
112
|
});
|
|
104
113
|
|
|
105
114
|
const classes = computed(() => [
|
|
@@ -123,18 +132,27 @@ export const VNavigationItem = defineComponent({
|
|
|
123
132
|
const c = children.value;
|
|
124
133
|
const m = match.value;
|
|
125
134
|
|
|
126
|
-
if (!c || !m) {
|
|
135
|
+
if (!c || !m || !m.length) {
|
|
127
136
|
// matched.value = false;
|
|
128
137
|
return;
|
|
129
138
|
}
|
|
130
139
|
|
|
131
|
-
|
|
140
|
+
const trimedNewPath = trimEndSlash(newPath);
|
|
141
|
+
if (m.some((_) => trimedNewPath.match(_))) {
|
|
132
142
|
open();
|
|
133
143
|
// matched.value = true;
|
|
134
144
|
} else {
|
|
135
145
|
close();
|
|
136
146
|
// matched.value = false;
|
|
137
147
|
}
|
|
148
|
+
|
|
149
|
+
// if (trimEndSlash(newPath).match(m)) {
|
|
150
|
+
// open();
|
|
151
|
+
// // matched.value = true;
|
|
152
|
+
// } else {
|
|
153
|
+
// close();
|
|
154
|
+
// // matched.value = false;
|
|
155
|
+
// }
|
|
138
156
|
},
|
|
139
157
|
{ immediate: true },
|
|
140
158
|
);
|