@fastkit/vui 0.7.50 → 0.7.55
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 +160 -32
- package/dist/vui.cjs.prod.js +160 -32
- package/dist/vui.css +11 -0
- package/dist/vui.d.ts +376 -88
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/dist/vui.mjs +160 -34
- package/package.json +7 -7
- package/src/components/.DS_Store +0 -0
- package/src/components/VButton/VButton.tsx +0 -1
- package/src/components/VControlField/VControlField.tsx +23 -6
- package/src/components/VDataTable/VDataTable.tsx +5 -5
- package/src/components/VFormControl/VFormControl.tsx +6 -1
- package/src/components/VNumberField/VNumberField.tsx +55 -0
- package/src/components/VNumberField/index.ts +1 -0
- package/src/components/VSelect/VSelect.tsx +67 -15
- package/src/components/VTextField/.DS_Store +0 -0
- package/src/components/VTextField/VTextField.tsx +6 -0
- package/src/components/VTextarea/VTextarea.tsx +1 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/composables/control.ts +1 -0
- package/src/composables/form-selector.scss +13 -0
- package/src/composables/form-selector.tsx +48 -1
- package/src/schemes/control.ts +6 -0
- package/src/service.tsx +6 -2
- package/src/tool/vite-plugin.ts +1 -0
package/dist/vui.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl,
|
|
1
|
+
import { createPropsOptions, createFormControlSettings, defineSlotsProps, useFormControl, VTooltip, renderSlotOrEmpty, createFormSelectorSettings, createFormControlProps, useFormSelectorControl, resolveVNodeChildOrSlots, createFormSelectorItemSettings, useFormSelectorItemControl, createFormSelectorItemGroupProps, useFormSelectorItemGroupControl, 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
3
|
export { VDialog, VMenu, VSnackbar, VTooltip } from '@fastkit/vue-kit';
|
|
4
4
|
import { inject, computed, provide, createVNode, mergeProps, defineComponent, isVNode, ref, watch, onMounted, onBeforeUnmount, cloneVNode, withDirectives, createTextVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, Transition, reactive } from 'vue';
|
|
5
5
|
import { useRouter, RouterLink, useLink, useRoute } 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
|
-
import { useScopeColorClass, colorSchemeProps, useColorClasses, toScopeColorClass } from '@fastkit/vue-color-scheme';
|
|
9
8
|
import { VProgressCircular } from '@fastkit/vue-loading';
|
|
10
9
|
export * from '@fastkit/vue-loading';
|
|
10
|
+
import { useScopeColorClass, colorSchemeProps, useColorClasses, toScopeColorClass } from '@fastkit/vue-color-scheme';
|
|
11
11
|
import { loadImage, IN_WINDOW, isPromise } from '@fastkit/helpers';
|
|
12
12
|
export { ICON_NAMES } from '@fastkit/icon-font';
|
|
13
13
|
import { VAppContainer, VAppLayoutControl } from '@fastkit/vue-app-layout';
|
|
@@ -24,7 +24,12 @@ import { validateIf, url } from '@fastkit/rules';
|
|
|
24
24
|
import { OrderedList } from '@tiptap/extension-ordered-list';
|
|
25
25
|
|
|
26
26
|
const CONTROL_SIZES = ['sm', 'md', 'lg'];
|
|
27
|
-
const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
|
|
27
|
+
const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
|
|
28
|
+
const CONTROL_LOADING_SPINNER_SIZES = {
|
|
29
|
+
sm: 16,
|
|
30
|
+
md: 20,
|
|
31
|
+
lg: 24,
|
|
32
|
+
};
|
|
28
33
|
|
|
29
34
|
const VuiInjectionKey = Symbol();
|
|
30
35
|
const VuiControlInjectionKey = Symbol();
|
|
@@ -79,6 +84,7 @@ function createControlProps() {
|
|
|
79
84
|
return CONTROL_SIZES.includes(value);
|
|
80
85
|
},
|
|
81
86
|
},
|
|
87
|
+
loading: Boolean,
|
|
82
88
|
});
|
|
83
89
|
}
|
|
84
90
|
function useControl(props, opts = {}) {
|
|
@@ -230,7 +236,8 @@ function createRequiredChipRenderer(required, props, vui = useVui()) {
|
|
|
230
236
|
const VFormControl = defineComponent({
|
|
231
237
|
name: 'VFormControl',
|
|
232
238
|
props: { ...props$8,
|
|
233
|
-
...defineSlotsProps()
|
|
239
|
+
...defineSlotsProps(),
|
|
240
|
+
error: Boolean
|
|
234
241
|
},
|
|
235
242
|
emits: emits$8,
|
|
236
243
|
|
|
@@ -271,7 +278,7 @@ const VFormControl = defineComponent({
|
|
|
271
278
|
'v-form-control--untouched': control.untouched,
|
|
272
279
|
'v-form-control--invalid': control.invalid,
|
|
273
280
|
'v-form-control--valid': control.valid
|
|
274
|
-
}, colorProvider.className(control.invalid && !control.readonly ? 'error' : 'primary')]);
|
|
281
|
+
}, colorProvider.className(props.error ? 'error' : control.invalid && !control.readonly ? 'error' : 'primary')]);
|
|
275
282
|
const getRequiredChip = createRequiredChipRenderer(() => control.required, props, vui);
|
|
276
283
|
return () => {
|
|
277
284
|
const label = control.renderLabel();
|
|
@@ -334,6 +341,10 @@ function defineFormSelectorComponent(opts) {
|
|
|
334
341
|
type: Boolean,
|
|
335
342
|
default: true
|
|
336
343
|
},
|
|
344
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
345
|
+
loadingMessage: {},
|
|
346
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
347
|
+
failedToLoadItemsMessage: {},
|
|
337
348
|
...defineSlotsProps()
|
|
338
349
|
},
|
|
339
350
|
emits,
|
|
@@ -344,8 +355,19 @@ function defineFormSelectorComponent(opts) {
|
|
|
344
355
|
defaultMultiple
|
|
345
356
|
});
|
|
346
357
|
const control = useControl(props);
|
|
358
|
+
const vui = useVui();
|
|
359
|
+
const loadingMessageRef = computed(() => {
|
|
360
|
+
const slot = resolveVNodeChildOrSlots(props.loadingMessage, vui.setting('loadingMessage'), 'Loading...');
|
|
361
|
+
return slot && slot(vui);
|
|
362
|
+
});
|
|
363
|
+
const failedToLoadItemsMessageRef = computed(() => {
|
|
364
|
+
const slot = resolveVNodeChildOrSlots(props.failedToLoadItemsMessage, vui.setting('failedToLoadDataMessage'), 'Failed to load data.');
|
|
365
|
+
return slot && slot(vui);
|
|
366
|
+
});
|
|
347
367
|
return { ...selectorControl.expose(),
|
|
348
|
-
...control
|
|
368
|
+
...control,
|
|
369
|
+
loadingMessageRef,
|
|
370
|
+
failedToLoadItemsMessageRef
|
|
349
371
|
};
|
|
350
372
|
},
|
|
351
373
|
|
|
@@ -363,11 +385,22 @@ function defineFormSelectorComponent(opts) {
|
|
|
363
385
|
"label": this.label,
|
|
364
386
|
"hint": this.hint,
|
|
365
387
|
"hinttip": this.hinttip,
|
|
366
|
-
"requiredChip": this.requiredChip
|
|
388
|
+
"requiredChip": this.requiredChip,
|
|
389
|
+
"error": selectorControl.itemsLoadFailed
|
|
367
390
|
}, { ...this.$slots,
|
|
368
391
|
default: () => createVNode("div", {
|
|
369
392
|
"class": "v-form-selector__body"
|
|
370
|
-
}, [
|
|
393
|
+
}, [selectorControl.itemsLoadFailed && createVNode("div", {
|
|
394
|
+
"key": "failed",
|
|
395
|
+
"class": "v-form-selector__placeholder v-form-selector__placeholder--error"
|
|
396
|
+
}, [this.failedToLoadItemsMessageRef]), selectorControl.itemsLoading && createVNode("div", {
|
|
397
|
+
"key": "loading",
|
|
398
|
+
"class": "v-form-selector__placeholder"
|
|
399
|
+
}, [createVNode(VProgressCircular, {
|
|
400
|
+
"indeterminate": true,
|
|
401
|
+
"class": "mr-1",
|
|
402
|
+
"size": CONTROL_LOADING_SPINNER_SIZES[this.size || 'md']
|
|
403
|
+
}, null), this.loadingMessageRef]), this.propItems.map(attrs => {
|
|
371
404
|
const selected = selectorControl.isSelected(attrs.value);
|
|
372
405
|
return itemRenderer({
|
|
373
406
|
selected,
|
|
@@ -1107,7 +1140,6 @@ const vueButtonProps = createPropsOptions$1({ ...htmlAttributesPropOptions,
|
|
|
1107
1140
|
...colorSchemeProps(),
|
|
1108
1141
|
...navigationableInheritProps,
|
|
1109
1142
|
spacer: [Boolean, String],
|
|
1110
|
-
loading: Boolean,
|
|
1111
1143
|
rounded: Boolean,
|
|
1112
1144
|
icon: [String, Function],
|
|
1113
1145
|
startIcon: [String, Function],
|
|
@@ -2333,7 +2365,8 @@ const VControlField = defineComponent({
|
|
|
2333
2365
|
props: { ...createControlFieldProps(),
|
|
2334
2366
|
focused: Boolean,
|
|
2335
2367
|
autoHeight: Boolean,
|
|
2336
|
-
...defineSlotsProps()
|
|
2368
|
+
...defineSlotsProps(),
|
|
2369
|
+
error: Boolean
|
|
2337
2370
|
},
|
|
2338
2371
|
// _slots: inputBoxSlots,
|
|
2339
2372
|
emits: {
|
|
@@ -2357,11 +2390,11 @@ const VControlField = defineComponent({
|
|
|
2357
2390
|
const classes = computed(() => {
|
|
2358
2391
|
const classes = ['v-control-field', `v-control-field--${inputBox.variant.value}`, {
|
|
2359
2392
|
'v-control-field--disabled': disabled.value,
|
|
2360
|
-
'v-control-field--invalid': invalid.value,
|
|
2393
|
+
'v-control-field--invalid': invalid.value || props.error,
|
|
2361
2394
|
'v-control-field--readonly': readonly.value,
|
|
2362
2395
|
'v-control-field--focused': props.focused,
|
|
2363
2396
|
'v-control-field--auto-height': autoHeight.value
|
|
2364
|
-
}, control.classes.value, colorProvider.className(invalid.value && !readonly.value ? 'error' : 'primary')];
|
|
2397
|
+
}, control.classes.value, colorProvider.className(props.error ? 'error' : invalid.value && !readonly.value ? 'error' : 'primary')];
|
|
2365
2398
|
return classes;
|
|
2366
2399
|
});
|
|
2367
2400
|
const resolvedSlots = computed(() => {
|
|
@@ -2374,11 +2407,21 @@ const VControlField = defineComponent({
|
|
|
2374
2407
|
});
|
|
2375
2408
|
|
|
2376
2409
|
const renderAdornment = position => {
|
|
2377
|
-
|
|
2378
|
-
|
|
2410
|
+
let child;
|
|
2411
|
+
|
|
2412
|
+
if (position === 'end' && props.loading) {
|
|
2413
|
+
child = createVNode(VProgressCircular, {
|
|
2414
|
+
"indeterminate": true,
|
|
2415
|
+
"size": CONTROL_LOADING_SPINNER_SIZES[props.size || 'md']
|
|
2416
|
+
}, null);
|
|
2417
|
+
} else {
|
|
2418
|
+
child = renderSlotOrEmpty(resolvedSlots.value, position);
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
if (!child) return;
|
|
2379
2422
|
return createVNode("div", {
|
|
2380
2423
|
"class": ['v-control-field__adornment', `v-control-field__adornment--${position}`]
|
|
2381
|
-
}, [
|
|
2424
|
+
}, [child]);
|
|
2382
2425
|
};
|
|
2383
2426
|
|
|
2384
2427
|
const handleClick = ev => {
|
|
@@ -2421,7 +2464,9 @@ const VSelect = defineComponent({
|
|
|
2421
2464
|
...createControlProps(),
|
|
2422
2465
|
...defineSlotsProps(),
|
|
2423
2466
|
...createPropsOptions({
|
|
2424
|
-
placeholder: String
|
|
2467
|
+
placeholder: String,
|
|
2468
|
+
loadingMessage: {},
|
|
2469
|
+
failedToLoadItemsMessage: {}
|
|
2425
2470
|
})
|
|
2426
2471
|
},
|
|
2427
2472
|
emits: emits$3,
|
|
@@ -2448,6 +2493,14 @@ const VSelect = defineComponent({
|
|
|
2448
2493
|
const vui = useVui();
|
|
2449
2494
|
const iconName = vui.icon('menuDown');
|
|
2450
2495
|
const fieldRef = ref(null);
|
|
2496
|
+
const loadingMessageRef = computed(() => {
|
|
2497
|
+
const slot = resolveVNodeChildOrSlots(props.loadingMessage, vui.setting('loadingMessage'), 'Loading...');
|
|
2498
|
+
return slot && slot(vui);
|
|
2499
|
+
});
|
|
2500
|
+
const failedToLoadItemsMessageRef = computed(() => {
|
|
2501
|
+
const slot = resolveVNodeChildOrSlots(props.failedToLoadItemsMessage, vui.setting('failedToLoadDataMessage'), 'Failed to load data.');
|
|
2502
|
+
return slot && slot(vui);
|
|
2503
|
+
});
|
|
2451
2504
|
|
|
2452
2505
|
const focus = opts => {
|
|
2453
2506
|
fieldRef.value && fieldRef.value.focus(opts);
|
|
@@ -2456,7 +2509,15 @@ const VSelect = defineComponent({
|
|
|
2456
2509
|
const renderSelections = selectedItems => {
|
|
2457
2510
|
const children = [];
|
|
2458
2511
|
|
|
2459
|
-
if (
|
|
2512
|
+
if (inputControl.itemsLoadFailed) {
|
|
2513
|
+
children.push(createVNode("span", {
|
|
2514
|
+
"class": "v-select__placeholder"
|
|
2515
|
+
}, [failedToLoadItemsMessageRef.value]));
|
|
2516
|
+
} else if (inputControl.itemsLoading) {
|
|
2517
|
+
children.push(createVNode("span", {
|
|
2518
|
+
"class": "v-select__placeholder"
|
|
2519
|
+
}, [loadingMessageRef.value]));
|
|
2520
|
+
} else if (selectedItems.length) {
|
|
2460
2521
|
selectedItems.forEach((item, index) => {
|
|
2461
2522
|
if (index > 0) {
|
|
2462
2523
|
children.push(vui.selectionSeparator());
|
|
@@ -2531,8 +2592,11 @@ const VSelect = defineComponent({
|
|
|
2531
2592
|
}) => [createVNode(VControlField, {
|
|
2532
2593
|
"class": "v-select__input",
|
|
2533
2594
|
"ref": this.fieldRef(),
|
|
2595
|
+
"loading": selectorControl.itemsLoading,
|
|
2596
|
+
"error": selectorControl.itemsLoadFailed,
|
|
2534
2597
|
"startAdornment": this.startAdornment,
|
|
2535
2598
|
"endAdornment": this.endAdornment,
|
|
2599
|
+
"size": this.size,
|
|
2536
2600
|
"focused": this.menuOpened,
|
|
2537
2601
|
"onClick": ev => {
|
|
2538
2602
|
if (this.canOperation && !control.isActive) {
|
|
@@ -2572,19 +2636,37 @@ const VSelect = defineComponent({
|
|
|
2572
2636
|
}, [createVNode("div", {
|
|
2573
2637
|
"class": "v-select__selections__inner"
|
|
2574
2638
|
}, [this.renderSelections(selectedItems)])])],
|
|
2575
|
-
endAdornment: () =>
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2639
|
+
endAdornment: () => {
|
|
2640
|
+
if (selectorControl.itemsLoadFailed) {
|
|
2641
|
+
return createVNode(VButton, {
|
|
2642
|
+
"key": "reload",
|
|
2643
|
+
"icon": this.$vui.icon('reload'),
|
|
2644
|
+
"rounded": true,
|
|
2645
|
+
"onClick": ev => {
|
|
2646
|
+
ev.stopPropagation();
|
|
2647
|
+
selectorControl.loadItems();
|
|
2648
|
+
}
|
|
2649
|
+
}, null);
|
|
2582
2650
|
}
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2651
|
+
|
|
2652
|
+
if (this.clearable && this.nodeControl.value != null) {
|
|
2653
|
+
return createVNode(VButton, {
|
|
2654
|
+
"key": "clear",
|
|
2655
|
+
"icon": this.$vui.icon('clear'),
|
|
2656
|
+
"rounded": true,
|
|
2657
|
+
"onClick": ev => {
|
|
2658
|
+
ev.stopPropagation();
|
|
2659
|
+
this.nodeControl.clear();
|
|
2660
|
+
}
|
|
2661
|
+
}, null);
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
return createVNode(VIcon, {
|
|
2665
|
+
"key": "icon",
|
|
2666
|
+
"name": this.iconName,
|
|
2667
|
+
"rotate": this.menuOpened ? 180 : 0
|
|
2668
|
+
}, null);
|
|
2669
|
+
}
|
|
2588
2670
|
})]
|
|
2589
2671
|
})
|
|
2590
2672
|
});
|
|
@@ -2661,7 +2743,8 @@ const VTextField = defineComponent({
|
|
|
2661
2743
|
default: () => createVNode(VControlField, {
|
|
2662
2744
|
"class": "v-text-field__input",
|
|
2663
2745
|
"startAdornment": this.startAdornment,
|
|
2664
|
-
"endAdornment": this.endAdornment
|
|
2746
|
+
"endAdornment": this.endAdornment,
|
|
2747
|
+
"size": this.size
|
|
2665
2748
|
}, { ...this.$slots,
|
|
2666
2749
|
default: () => this.textInputControl.createInputElement({
|
|
2667
2750
|
class: 'v-text-field__input__element'
|
|
@@ -2679,6 +2762,48 @@ const VTextField = defineComponent({
|
|
|
2679
2762
|
|
|
2680
2763
|
});
|
|
2681
2764
|
|
|
2765
|
+
const VNumberField = defineComponent({
|
|
2766
|
+
name: 'VNumberField',
|
|
2767
|
+
props: { ...undefined,
|
|
2768
|
+
modelValue: {
|
|
2769
|
+
type: Number,
|
|
2770
|
+
default: null
|
|
2771
|
+
}
|
|
2772
|
+
},
|
|
2773
|
+
emits: { ...undefined,
|
|
2774
|
+
'update:modelValue': value => true,
|
|
2775
|
+
change: value => true
|
|
2776
|
+
},
|
|
2777
|
+
|
|
2778
|
+
setup(props, ctx) {
|
|
2779
|
+
const toString = value => {
|
|
2780
|
+
if (value == null) return '';
|
|
2781
|
+
return String(value);
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
const toNumber = value => {
|
|
2785
|
+
if (value == null) return null;
|
|
2786
|
+
if (typeof value === 'number') return value;
|
|
2787
|
+
if (value.trim() === '') return null;
|
|
2788
|
+
return Number(value);
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
return () => {
|
|
2792
|
+
return createVNode(VTextField, mergeProps(ctx.attrs, {
|
|
2793
|
+
"type": "number",
|
|
2794
|
+
"modelValue": toString(props.modelValue),
|
|
2795
|
+
"onUpdate:modelValue": value => {
|
|
2796
|
+
ctx.emit('update:modelValue', toNumber(value));
|
|
2797
|
+
},
|
|
2798
|
+
"onChange": value => {
|
|
2799
|
+
ctx.emit('change', toNumber(value));
|
|
2800
|
+
}
|
|
2801
|
+
}), ctx.slots);
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
});
|
|
2806
|
+
|
|
2682
2807
|
const {
|
|
2683
2808
|
props: props$1,
|
|
2684
2809
|
emits: emits$1
|
|
@@ -2723,6 +2848,7 @@ const VTextarea = defineComponent({
|
|
|
2723
2848
|
}, { ...this.$slots,
|
|
2724
2849
|
default: () => createVNode(VControlField, {
|
|
2725
2850
|
"class": "v-textarea__input",
|
|
2851
|
+
"size": this.size,
|
|
2726
2852
|
"autoHeight": true,
|
|
2727
2853
|
"startAdornment": this.startAdornment,
|
|
2728
2854
|
"endAdornment": this.endAdornment
|
|
@@ -2838,7 +2964,6 @@ const VWysiwygEditor = defineComponent({
|
|
|
2838
2964
|
onUpdate: ev => {
|
|
2839
2965
|
inputControl.value = ev.editor.getHTML();
|
|
2840
2966
|
textRef.value = ev.editor.getText();
|
|
2841
|
-
console.log(textRef.value);
|
|
2842
2967
|
},
|
|
2843
2968
|
autofocus: props.autofocus,
|
|
2844
2969
|
content: props.modelValue,
|
|
@@ -2963,7 +3088,8 @@ const VWysiwygEditor = defineComponent({
|
|
|
2963
3088
|
"class": "v-wysiwyg-editor__input",
|
|
2964
3089
|
"autoHeight": true,
|
|
2965
3090
|
"startAdornment": this.startAdornment,
|
|
2966
|
-
"endAdornment": this.endAdornment
|
|
3091
|
+
"endAdornment": this.endAdornment,
|
|
3092
|
+
"size": this.size
|
|
2967
3093
|
}, { ...this.$slots,
|
|
2968
3094
|
default: () => {
|
|
2969
3095
|
let _slot2;
|
|
@@ -4010,7 +4136,7 @@ const VDataTable = defineComponent({
|
|
|
4010
4136
|
message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
|
|
4011
4137
|
}
|
|
4012
4138
|
|
|
4013
|
-
return typeof message === 'function' ? message() : message;
|
|
4139
|
+
return typeof message === 'function' ? message(vui) : message;
|
|
4014
4140
|
});
|
|
4015
4141
|
const classesRef = computed(() => [{
|
|
4016
4142
|
'v-data-table--fixed-header': props.fixedHeader
|
|
@@ -4915,4 +5041,4 @@ function installVuiPlugin(app, opts) {
|
|
|
4915
5041
|
return app.use(VuiPlugin, opts);
|
|
4916
5042
|
}
|
|
4917
5043
|
|
|
4918
|
-
export { AVATAR_SIZES, CHIP_SIZES, CONTROL_FIELD_VARIANTS, CONTROL_SIZES, 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, 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, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, splitAttrs, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
|
|
5044
|
+
export { AVATAR_SIZES, CHIP_SIZES, CONTROL_FIELD_VARIANTS, CONTROL_LOADING_SPINNER_SIZES, CONTROL_SIZES, 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, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygOrderedListTool, WysiwygTextColorTool, configureDataTableDefaults, createAvatarProps, createCardProps, createChipProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, createVFormProps, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, resolveRawWysiwygEditorTools, splitAttrs, 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.55",
|
|
4
4
|
"description": "@fastkit/vui",
|
|
5
5
|
"buildOptions": {
|
|
6
6
|
"name": "Vui",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/dadajam4/fastkit/tree/dev/packages/vui#readme",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"vite": "^2.
|
|
31
|
+
"vite": "^2.9.1",
|
|
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.55",
|
|
36
|
+
"@fastkit/icon-font": "0.7.55",
|
|
37
|
+
"@fastkit/tiny-logger": "0.7.55",
|
|
38
|
+
"@fastkit/vite-kit": "0.7.55",
|
|
39
|
+
"@fastkit/vue-kit": "0.7.55",
|
|
40
40
|
"@tiptap/extension-link": "^2.0.0-beta.36",
|
|
41
41
|
"@tiptap/extension-underline": "^2.0.0-beta.23",
|
|
42
42
|
"@tiptap/starter-kit": "^2.0.0-beta.183",
|
package/src/components/.DS_Store
CHANGED
|
Binary file
|
|
@@ -50,7 +50,6 @@ export const vueButtonProps = createPropsOptions({
|
|
|
50
50
|
...colorSchemeProps(),
|
|
51
51
|
...navigationableInheritProps,
|
|
52
52
|
spacer: [Boolean, String] as PropType<RawVButtonSpacer>,
|
|
53
|
-
loading: Boolean,
|
|
54
53
|
rounded: Boolean,
|
|
55
54
|
icon: [String, Function] as PropType<RawVButtonIcon>,
|
|
56
55
|
startIcon: [String, Function] as PropType<RawVButtonIcon>,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './VControlField.scss';
|
|
2
|
-
import { computed, PropType, ref, defineComponent } from 'vue';
|
|
2
|
+
import { computed, PropType, ref, defineComponent, VNodeChild } from 'vue';
|
|
3
3
|
import {
|
|
4
4
|
useParentFormNode,
|
|
5
5
|
VNodeChildOrSlot,
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
useControlField,
|
|
17
17
|
} from '../../composables';
|
|
18
18
|
import { useVuiColorProvider } from '../../injections';
|
|
19
|
+
import { VProgressCircular } from '../loading';
|
|
20
|
+
import { CONTROL_LOADING_SPINNER_SIZES } from '../../schemes';
|
|
19
21
|
|
|
20
22
|
const ADORNMENT_POSITIONS = ['start', 'end'] as const;
|
|
21
23
|
|
|
@@ -56,6 +58,7 @@ export const VControlField = defineComponent({
|
|
|
56
58
|
focused: Boolean,
|
|
57
59
|
autoHeight: Boolean,
|
|
58
60
|
...defineSlotsProps<InputBoxSlots>(),
|
|
61
|
+
error: Boolean,
|
|
59
62
|
},
|
|
60
63
|
// _slots: inputBoxSlots,
|
|
61
64
|
emits: {
|
|
@@ -83,14 +86,18 @@ export const VControlField = defineComponent({
|
|
|
83
86
|
`v-control-field--${inputBox.variant.value}`,
|
|
84
87
|
{
|
|
85
88
|
'v-control-field--disabled': disabled.value,
|
|
86
|
-
'v-control-field--invalid': invalid.value,
|
|
89
|
+
'v-control-field--invalid': invalid.value || props.error,
|
|
87
90
|
'v-control-field--readonly': readonly.value,
|
|
88
91
|
'v-control-field--focused': props.focused,
|
|
89
92
|
'v-control-field--auto-height': autoHeight.value,
|
|
90
93
|
},
|
|
91
94
|
control.classes.value,
|
|
92
95
|
colorProvider.className(
|
|
93
|
-
|
|
96
|
+
props.error
|
|
97
|
+
? 'error'
|
|
98
|
+
: invalid.value && !readonly.value
|
|
99
|
+
? 'error'
|
|
100
|
+
: 'primary',
|
|
94
101
|
),
|
|
95
102
|
];
|
|
96
103
|
return classes;
|
|
@@ -106,15 +113,25 @@ export const VControlField = defineComponent({
|
|
|
106
113
|
});
|
|
107
114
|
|
|
108
115
|
const renderAdornment = (position: AdornmentPosition) => {
|
|
109
|
-
|
|
110
|
-
if (
|
|
116
|
+
let child: VNodeChild | undefined;
|
|
117
|
+
if (position === 'end' && props.loading) {
|
|
118
|
+
child = (
|
|
119
|
+
<VProgressCircular
|
|
120
|
+
indeterminate
|
|
121
|
+
size={CONTROL_LOADING_SPINNER_SIZES[props.size || 'md']}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
} else {
|
|
125
|
+
child = renderSlotOrEmpty(resolvedSlots.value, position);
|
|
126
|
+
}
|
|
127
|
+
if (!child) return;
|
|
111
128
|
return (
|
|
112
129
|
<div
|
|
113
130
|
class={[
|
|
114
131
|
'v-control-field__adornment',
|
|
115
132
|
`v-control-field__adornment--${position}`,
|
|
116
133
|
]}>
|
|
117
|
-
{
|
|
134
|
+
{child}
|
|
118
135
|
</div>
|
|
119
136
|
);
|
|
120
137
|
};
|
|
@@ -20,7 +20,7 @@ import { VPagination } from '../VPagination';
|
|
|
20
20
|
import { VCheckbox } from '../VCheckbox';
|
|
21
21
|
import { VIcon, resolveRawIconProp } from '../VIcon';
|
|
22
22
|
import { VProgressCircular } from '../loading';
|
|
23
|
-
import { resizeDirectiveArgument } from '@fastkit/vue-utils';
|
|
23
|
+
import { resizeDirectiveArgument, VNodeChildOrSlot } from '@fastkit/vue-utils';
|
|
24
24
|
import { VAppLayoutControl } from '@fastkit/vue-app-layout';
|
|
25
25
|
import { VPaper } from '../VPaper';
|
|
26
26
|
|
|
@@ -182,9 +182,9 @@ export const VDataTable = defineComponent({
|
|
|
182
182
|
fixedHeader: Boolean,
|
|
183
183
|
maxHeight: [Number, String],
|
|
184
184
|
// eslint-disable-next-line vue/require-prop-types
|
|
185
|
-
noDataMessage: {} as PropType<
|
|
185
|
+
noDataMessage: {} as PropType<VNodeChildOrSlot>,
|
|
186
186
|
// eslint-disable-next-line vue/require-prop-types
|
|
187
|
-
noResultsMessage: {} as PropType<
|
|
187
|
+
noResultsMessage: {} as PropType<VNodeChildOrSlot>,
|
|
188
188
|
},
|
|
189
189
|
emits: {
|
|
190
190
|
input: (selecteds: string[]) => true,
|
|
@@ -233,7 +233,7 @@ export const VDataTable = defineComponent({
|
|
|
233
233
|
});
|
|
234
234
|
|
|
235
235
|
const emptyMessage = computed(() => {
|
|
236
|
-
let message:
|
|
236
|
+
let message: VNodeChildOrSlot;
|
|
237
237
|
if (searchQueryValues.value.length) {
|
|
238
238
|
message =
|
|
239
239
|
props.noResultsMessage ||
|
|
@@ -245,7 +245,7 @@ export const VDataTable = defineComponent({
|
|
|
245
245
|
vui.setting('noDataMessage') ||
|
|
246
246
|
'No data was available.'; // データはありませんでした。
|
|
247
247
|
}
|
|
248
|
-
return typeof message === 'function' ? message() : message;
|
|
248
|
+
return typeof message === 'function' ? message(vui) : message;
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
const classesRef = computed(() => [
|
|
@@ -51,6 +51,7 @@ export const VFormControl = defineComponent({
|
|
|
51
51
|
default: FormControl;
|
|
52
52
|
}
|
|
53
53
|
>(),
|
|
54
|
+
error: Boolean,
|
|
54
55
|
},
|
|
55
56
|
emits,
|
|
56
57
|
setup(props, ctx) {
|
|
@@ -94,7 +95,11 @@ export const VFormControl = defineComponent({
|
|
|
94
95
|
'v-form-control--valid': control.valid,
|
|
95
96
|
},
|
|
96
97
|
colorProvider.className(
|
|
97
|
-
|
|
98
|
+
props.error
|
|
99
|
+
? 'error'
|
|
100
|
+
: control.invalid && !control.readonly
|
|
101
|
+
? 'error'
|
|
102
|
+
: 'primary',
|
|
98
103
|
),
|
|
99
104
|
]);
|
|
100
105
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent, PropType } from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
VTextField,
|
|
4
|
+
TextFieldPropsOptions,
|
|
5
|
+
TextFieldEmits,
|
|
6
|
+
} from '../VTextField/VTextField';
|
|
7
|
+
|
|
8
|
+
export const VNumberField = defineComponent({
|
|
9
|
+
name: 'VNumberField',
|
|
10
|
+
props: {
|
|
11
|
+
...(undefined as unknown as Omit<TextFieldPropsOptions, 'type'>),
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: Number as PropType<number | null>,
|
|
14
|
+
default: null,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
emits: {
|
|
18
|
+
...(undefined as unknown as Omit<
|
|
19
|
+
TextFieldEmits,
|
|
20
|
+
'update:modelValue' | 'change'
|
|
21
|
+
>),
|
|
22
|
+
'update:modelValue': (value: number | null) => true,
|
|
23
|
+
change: (value: number | null) => true,
|
|
24
|
+
},
|
|
25
|
+
setup(props, ctx) {
|
|
26
|
+
const toString = (value?: string | number | null): string => {
|
|
27
|
+
if (value == null) return '';
|
|
28
|
+
return String(value);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const toNumber = (value?: string | number | null): number | null => {
|
|
32
|
+
if (value == null) return null;
|
|
33
|
+
if (typeof value === 'number') return value;
|
|
34
|
+
if (value.trim() === '') return null;
|
|
35
|
+
return Number(value);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
return (
|
|
40
|
+
<VTextField
|
|
41
|
+
{...ctx.attrs}
|
|
42
|
+
type="number"
|
|
43
|
+
modelValue={toString(props.modelValue)}
|
|
44
|
+
onUpdate:modelValue={(value) => {
|
|
45
|
+
ctx.emit('update:modelValue', toNumber(value));
|
|
46
|
+
}}
|
|
47
|
+
onChange={(value) => {
|
|
48
|
+
ctx.emit('change', toNumber(value));
|
|
49
|
+
}}
|
|
50
|
+
v-slots={ctx.slots}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VNumberField';
|