@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.
@@ -125,6 +125,7 @@ function viteVuiPlugin(options = {}) {
125
125
  editorRedo: 'mdi-redo-variant',
126
126
  hinttip: 'mdi-help-circle-outline',
127
127
  clear: 'mdi-close',
128
+ reload: 'mdi-reload',
128
129
  // navigationExpand: (gen, active) => {
129
130
  // return gen({
130
131
  // name: 'mdi-menu-down' as any,
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/vui/src/tool/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAK9B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAgG/C,MAAM,WAAW,oBACf,SAAQ,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAGD,MAAM,WAAW,2BACf,SAAQ,IAAI,CAA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jB;AAGD,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,OAAO,CAAC;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,aAAa,CAC3B,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CA0JrB"}
package/dist/vui.cjs.js CHANGED
@@ -7,8 +7,8 @@ var vue = require('vue');
7
7
  var vueRouter = require('vue-router');
8
8
  var vueUtils = require('@fastkit/vue-utils');
9
9
  var vueScroller = require('@fastkit/vue-scroller');
10
- var vueColorScheme = require('@fastkit/vue-color-scheme');
11
10
  var vueLoading = require('@fastkit/vue-loading');
11
+ var vueColorScheme = require('@fastkit/vue-color-scheme');
12
12
  var helpers = require('@fastkit/helpers');
13
13
  var iconFont = require('@fastkit/icon-font');
14
14
  var vueAppLayout = require('@fastkit/vue-app-layout');
@@ -29,7 +29,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
29
29
  var StarterKit__default = /*#__PURE__*/_interopDefaultLegacy(StarterKit);
30
30
 
31
31
  const CONTROL_SIZES = ['sm', 'md', 'lg'];
32
- const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
32
+ const CONTROL_FIELD_VARIANTS = ['outlined', 'filled', 'flat'];
33
+ const CONTROL_LOADING_SPINNER_SIZES = {
34
+ sm: 16,
35
+ md: 20,
36
+ lg: 24,
37
+ };
33
38
 
34
39
  const VuiInjectionKey = Symbol();
35
40
  const VuiControlInjectionKey = Symbol();
@@ -84,6 +89,7 @@ function createControlProps() {
84
89
  return CONTROL_SIZES.includes(value);
85
90
  },
86
91
  },
92
+ loading: Boolean,
87
93
  });
88
94
  }
89
95
  function useControl(props, opts = {}) {
@@ -235,7 +241,8 @@ function createRequiredChipRenderer(required, props, vui = useVui()) {
235
241
  const VFormControl = vue.defineComponent({
236
242
  name: 'VFormControl',
237
243
  props: { ...props$8,
238
- ...vueKit.defineSlotsProps()
244
+ ...vueKit.defineSlotsProps(),
245
+ error: Boolean
239
246
  },
240
247
  emits: emits$8,
241
248
 
@@ -276,7 +283,7 @@ const VFormControl = vue.defineComponent({
276
283
  'v-form-control--untouched': control.untouched,
277
284
  'v-form-control--invalid': control.invalid,
278
285
  'v-form-control--valid': control.valid
279
- }, colorProvider.className(control.invalid && !control.readonly ? 'error' : 'primary')]);
286
+ }, colorProvider.className(props.error ? 'error' : control.invalid && !control.readonly ? 'error' : 'primary')]);
280
287
  const getRequiredChip = createRequiredChipRenderer(() => control.required, props, vui);
281
288
  return () => {
282
289
  const label = control.renderLabel();
@@ -339,6 +346,10 @@ function defineFormSelectorComponent(opts) {
339
346
  type: Boolean,
340
347
  default: true
341
348
  },
349
+ // eslint-disable-next-line vue/require-prop-types
350
+ loadingMessage: {},
351
+ // eslint-disable-next-line vue/require-prop-types
352
+ failedToLoadItemsMessage: {},
342
353
  ...vueKit.defineSlotsProps()
343
354
  },
344
355
  emits,
@@ -349,8 +360,19 @@ function defineFormSelectorComponent(opts) {
349
360
  defaultMultiple
350
361
  });
351
362
  const control = useControl(props);
363
+ const vui = useVui();
364
+ const loadingMessageRef = vue.computed(() => {
365
+ const slot = vueKit.resolveVNodeChildOrSlots(props.loadingMessage, vui.setting('loadingMessage'), 'Loading...');
366
+ return slot && slot(vui);
367
+ });
368
+ const failedToLoadItemsMessageRef = vue.computed(() => {
369
+ const slot = vueKit.resolveVNodeChildOrSlots(props.failedToLoadItemsMessage, vui.setting('failedToLoadDataMessage'), 'Failed to load data.');
370
+ return slot && slot(vui);
371
+ });
352
372
  return { ...selectorControl.expose(),
353
- ...control
373
+ ...control,
374
+ loadingMessageRef,
375
+ failedToLoadItemsMessageRef
354
376
  };
355
377
  },
356
378
 
@@ -368,11 +390,22 @@ function defineFormSelectorComponent(opts) {
368
390
  "label": this.label,
369
391
  "hint": this.hint,
370
392
  "hinttip": this.hinttip,
371
- "requiredChip": this.requiredChip
393
+ "requiredChip": this.requiredChip,
394
+ "error": selectorControl.itemsLoadFailed
372
395
  }, { ...this.$slots,
373
396
  default: () => vue.createVNode("div", {
374
397
  "class": "v-form-selector__body"
375
- }, [this.propItems.map(attrs => {
398
+ }, [selectorControl.itemsLoadFailed && vue.createVNode("div", {
399
+ "key": "failed",
400
+ "class": "v-form-selector__placeholder v-form-selector__placeholder--error"
401
+ }, [this.failedToLoadItemsMessageRef]), selectorControl.itemsLoading && vue.createVNode("div", {
402
+ "key": "loading",
403
+ "class": "v-form-selector__placeholder"
404
+ }, [vue.createVNode(vueLoading.VProgressCircular, {
405
+ "indeterminate": true,
406
+ "class": "mr-1",
407
+ "size": CONTROL_LOADING_SPINNER_SIZES[this.size || 'md']
408
+ }, null), this.loadingMessageRef]), this.propItems.map(attrs => {
376
409
  const selected = selectorControl.isSelected(attrs.value);
377
410
  return itemRenderer({
378
411
  selected,
@@ -1112,7 +1145,6 @@ const vueButtonProps = vueUtils.createPropsOptions({ ...vueUtils.htmlAttributesP
1112
1145
  ...vueColorScheme.colorSchemeProps(),
1113
1146
  ...vueUtils.navigationableInheritProps,
1114
1147
  spacer: [Boolean, String],
1115
- loading: Boolean,
1116
1148
  rounded: Boolean,
1117
1149
  icon: [String, Function],
1118
1150
  startIcon: [String, Function],
@@ -2338,7 +2370,8 @@ const VControlField = vue.defineComponent({
2338
2370
  props: { ...createControlFieldProps(),
2339
2371
  focused: Boolean,
2340
2372
  autoHeight: Boolean,
2341
- ...vueKit.defineSlotsProps()
2373
+ ...vueKit.defineSlotsProps(),
2374
+ error: Boolean
2342
2375
  },
2343
2376
  // _slots: inputBoxSlots,
2344
2377
  emits: {
@@ -2362,11 +2395,11 @@ const VControlField = vue.defineComponent({
2362
2395
  const classes = vue.computed(() => {
2363
2396
  const classes = ['v-control-field', `v-control-field--${inputBox.variant.value}`, {
2364
2397
  'v-control-field--disabled': disabled.value,
2365
- 'v-control-field--invalid': invalid.value,
2398
+ 'v-control-field--invalid': invalid.value || props.error,
2366
2399
  'v-control-field--readonly': readonly.value,
2367
2400
  'v-control-field--focused': props.focused,
2368
2401
  'v-control-field--auto-height': autoHeight.value
2369
- }, control.classes.value, colorProvider.className(invalid.value && !readonly.value ? 'error' : 'primary')];
2402
+ }, control.classes.value, colorProvider.className(props.error ? 'error' : invalid.value && !readonly.value ? 'error' : 'primary')];
2370
2403
  return classes;
2371
2404
  });
2372
2405
  const resolvedSlots = vue.computed(() => {
@@ -2379,11 +2412,21 @@ const VControlField = vue.defineComponent({
2379
2412
  });
2380
2413
 
2381
2414
  const renderAdornment = position => {
2382
- const result = vueKit.renderSlotOrEmpty(resolvedSlots.value, position);
2383
- if (!result) return;
2415
+ let child;
2416
+
2417
+ if (position === 'end' && props.loading) {
2418
+ child = vue.createVNode(vueLoading.VProgressCircular, {
2419
+ "indeterminate": true,
2420
+ "size": CONTROL_LOADING_SPINNER_SIZES[props.size || 'md']
2421
+ }, null);
2422
+ } else {
2423
+ child = vueKit.renderSlotOrEmpty(resolvedSlots.value, position);
2424
+ }
2425
+
2426
+ if (!child) return;
2384
2427
  return vue.createVNode("div", {
2385
2428
  "class": ['v-control-field__adornment', `v-control-field__adornment--${position}`]
2386
- }, [result]);
2429
+ }, [child]);
2387
2430
  };
2388
2431
 
2389
2432
  const handleClick = ev => {
@@ -2426,7 +2469,9 @@ const VSelect = vue.defineComponent({
2426
2469
  ...createControlProps(),
2427
2470
  ...vueKit.defineSlotsProps(),
2428
2471
  ...vueKit.createPropsOptions({
2429
- placeholder: String
2472
+ placeholder: String,
2473
+ loadingMessage: {},
2474
+ failedToLoadItemsMessage: {}
2430
2475
  })
2431
2476
  },
2432
2477
  emits: emits$3,
@@ -2453,6 +2498,14 @@ const VSelect = vue.defineComponent({
2453
2498
  const vui = useVui();
2454
2499
  const iconName = vui.icon('menuDown');
2455
2500
  const fieldRef = vue.ref(null);
2501
+ const loadingMessageRef = vue.computed(() => {
2502
+ const slot = vueKit.resolveVNodeChildOrSlots(props.loadingMessage, vui.setting('loadingMessage'), 'Loading...');
2503
+ return slot && slot(vui);
2504
+ });
2505
+ const failedToLoadItemsMessageRef = vue.computed(() => {
2506
+ const slot = vueKit.resolveVNodeChildOrSlots(props.failedToLoadItemsMessage, vui.setting('failedToLoadDataMessage'), 'Failed to load data.');
2507
+ return slot && slot(vui);
2508
+ });
2456
2509
 
2457
2510
  const focus = opts => {
2458
2511
  fieldRef.value && fieldRef.value.focus(opts);
@@ -2461,7 +2514,15 @@ const VSelect = vue.defineComponent({
2461
2514
  const renderSelections = selectedItems => {
2462
2515
  const children = [];
2463
2516
 
2464
- if (selectedItems.length) {
2517
+ if (inputControl.itemsLoadFailed) {
2518
+ children.push(vue.createVNode("span", {
2519
+ "class": "v-select__placeholder"
2520
+ }, [failedToLoadItemsMessageRef.value]));
2521
+ } else if (inputControl.itemsLoading) {
2522
+ children.push(vue.createVNode("span", {
2523
+ "class": "v-select__placeholder"
2524
+ }, [loadingMessageRef.value]));
2525
+ } else if (selectedItems.length) {
2465
2526
  selectedItems.forEach((item, index) => {
2466
2527
  if (index > 0) {
2467
2528
  children.push(vui.selectionSeparator());
@@ -2536,8 +2597,11 @@ const VSelect = vue.defineComponent({
2536
2597
  }) => [vue.createVNode(VControlField, {
2537
2598
  "class": "v-select__input",
2538
2599
  "ref": this.fieldRef(),
2600
+ "loading": selectorControl.itemsLoading,
2601
+ "error": selectorControl.itemsLoadFailed,
2539
2602
  "startAdornment": this.startAdornment,
2540
2603
  "endAdornment": this.endAdornment,
2604
+ "size": this.size,
2541
2605
  "focused": this.menuOpened,
2542
2606
  "onClick": ev => {
2543
2607
  if (this.canOperation && !control.isActive) {
@@ -2577,19 +2641,37 @@ const VSelect = vue.defineComponent({
2577
2641
  }, [vue.createVNode("div", {
2578
2642
  "class": "v-select__selections__inner"
2579
2643
  }, [this.renderSelections(selectedItems)])])],
2580
- endAdornment: () => this.clearable && this.nodeControl.value != null && vue.createVNode(VButton, {
2581
- "key": "clear",
2582
- "icon": this.$vui.icon('clear'),
2583
- "rounded": true,
2584
- "onClick": ev => {
2585
- ev.stopPropagation();
2586
- this.nodeControl.clear();
2644
+ endAdornment: () => {
2645
+ if (selectorControl.itemsLoadFailed) {
2646
+ return vue.createVNode(VButton, {
2647
+ "key": "reload",
2648
+ "icon": this.$vui.icon('reload'),
2649
+ "rounded": true,
2650
+ "onClick": ev => {
2651
+ ev.stopPropagation();
2652
+ selectorControl.loadItems();
2653
+ }
2654
+ }, null);
2587
2655
  }
2588
- }, null) || vue.createVNode(VIcon, {
2589
- "key": "icon",
2590
- "name": this.iconName,
2591
- "rotate": this.menuOpened ? 180 : 0
2592
- }, null)
2656
+
2657
+ if (this.clearable && this.nodeControl.value != null) {
2658
+ return vue.createVNode(VButton, {
2659
+ "key": "clear",
2660
+ "icon": this.$vui.icon('clear'),
2661
+ "rounded": true,
2662
+ "onClick": ev => {
2663
+ ev.stopPropagation();
2664
+ this.nodeControl.clear();
2665
+ }
2666
+ }, null);
2667
+ }
2668
+
2669
+ return vue.createVNode(VIcon, {
2670
+ "key": "icon",
2671
+ "name": this.iconName,
2672
+ "rotate": this.menuOpened ? 180 : 0
2673
+ }, null);
2674
+ }
2593
2675
  })]
2594
2676
  })
2595
2677
  });
@@ -2666,7 +2748,8 @@ const VTextField = vue.defineComponent({
2666
2748
  default: () => vue.createVNode(VControlField, {
2667
2749
  "class": "v-text-field__input",
2668
2750
  "startAdornment": this.startAdornment,
2669
- "endAdornment": this.endAdornment
2751
+ "endAdornment": this.endAdornment,
2752
+ "size": this.size
2670
2753
  }, { ...this.$slots,
2671
2754
  default: () => this.textInputControl.createInputElement({
2672
2755
  class: 'v-text-field__input__element'
@@ -2684,6 +2767,48 @@ const VTextField = vue.defineComponent({
2684
2767
 
2685
2768
  });
2686
2769
 
2770
+ const VNumberField = vue.defineComponent({
2771
+ name: 'VNumberField',
2772
+ props: { ...undefined,
2773
+ modelValue: {
2774
+ type: Number,
2775
+ default: null
2776
+ }
2777
+ },
2778
+ emits: { ...undefined,
2779
+ 'update:modelValue': value => true,
2780
+ change: value => true
2781
+ },
2782
+
2783
+ setup(props, ctx) {
2784
+ const toString = value => {
2785
+ if (value == null) return '';
2786
+ return String(value);
2787
+ };
2788
+
2789
+ const toNumber = value => {
2790
+ if (value == null) return null;
2791
+ if (typeof value === 'number') return value;
2792
+ if (value.trim() === '') return null;
2793
+ return Number(value);
2794
+ };
2795
+
2796
+ return () => {
2797
+ return vue.createVNode(VTextField, vue.mergeProps(ctx.attrs, {
2798
+ "type": "number",
2799
+ "modelValue": toString(props.modelValue),
2800
+ "onUpdate:modelValue": value => {
2801
+ ctx.emit('update:modelValue', toNumber(value));
2802
+ },
2803
+ "onChange": value => {
2804
+ ctx.emit('change', toNumber(value));
2805
+ }
2806
+ }), ctx.slots);
2807
+ };
2808
+ }
2809
+
2810
+ });
2811
+
2687
2812
  const {
2688
2813
  props: props$1,
2689
2814
  emits: emits$1
@@ -2728,6 +2853,7 @@ const VTextarea = vue.defineComponent({
2728
2853
  }, { ...this.$slots,
2729
2854
  default: () => vue.createVNode(VControlField, {
2730
2855
  "class": "v-textarea__input",
2856
+ "size": this.size,
2731
2857
  "autoHeight": true,
2732
2858
  "startAdornment": this.startAdornment,
2733
2859
  "endAdornment": this.endAdornment
@@ -2843,7 +2969,6 @@ const VWysiwygEditor = vue.defineComponent({
2843
2969
  onUpdate: ev => {
2844
2970
  inputControl.value = ev.editor.getHTML();
2845
2971
  textRef.value = ev.editor.getText();
2846
- console.log(textRef.value);
2847
2972
  },
2848
2973
  autofocus: props.autofocus,
2849
2974
  content: props.modelValue,
@@ -2968,7 +3093,8 @@ const VWysiwygEditor = vue.defineComponent({
2968
3093
  "class": "v-wysiwyg-editor__input",
2969
3094
  "autoHeight": true,
2970
3095
  "startAdornment": this.startAdornment,
2971
- "endAdornment": this.endAdornment
3096
+ "endAdornment": this.endAdornment,
3097
+ "size": this.size
2972
3098
  }, { ...this.$slots,
2973
3099
  default: () => {
2974
3100
  let _slot2;
@@ -4015,7 +4141,7 @@ const VDataTable = vue.defineComponent({
4015
4141
  message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
4016
4142
  }
4017
4143
 
4018
- return typeof message === 'function' ? message() : message;
4144
+ return typeof message === 'function' ? message(vui) : message;
4019
4145
  });
4020
4146
  const classesRef = vue.computed(() => [{
4021
4147
  'v-data-table--fixed-header': props.fixedHeader
@@ -4928,6 +5054,7 @@ exports.ICON_NAMES = iconFont.ICON_NAMES;
4928
5054
  exports.AVATAR_SIZES = AVATAR_SIZES;
4929
5055
  exports.CHIP_SIZES = CHIP_SIZES;
4930
5056
  exports.CONTROL_FIELD_VARIANTS = CONTROL_FIELD_VARIANTS;
5057
+ exports.CONTROL_LOADING_SPINNER_SIZES = CONTROL_LOADING_SPINNER_SIZES;
4931
5058
  exports.CONTROL_SIZES = CONTROL_SIZES;
4932
5059
  exports.PAGINATION_ALIGNS = PAGINATION_ALIGNS;
4933
5060
  exports.VApp = VApp;
@@ -4954,6 +5081,7 @@ exports.VIcon = VIcon;
4954
5081
  exports.VListTile = VListTile;
4955
5082
  exports.VNavigation = VNavigation;
4956
5083
  exports.VNavigationItem = VNavigationItem;
5084
+ exports.VNumberField = VNumberField;
4957
5085
  exports.VOption = VOption;
4958
5086
  exports.VOptionGroup = VOptionGroup;
4959
5087
  exports.VPagination = VPagination;