@fastkit/vui 0.7.54 → 0.7.57

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,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,CAyJrB"}
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,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);
2655
+ }
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);
2587
2667
  }
2588
- }, null) || vue.createVNode(VIcon, {
2589
- "key": "icon",
2590
- "name": this.iconName,
2591
- "rotate": this.menuOpened ? 180 : 0
2592
- }, null)
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'
@@ -2770,6 +2853,7 @@ const VTextarea = vue.defineComponent({
2770
2853
  }, { ...this.$slots,
2771
2854
  default: () => vue.createVNode(VControlField, {
2772
2855
  "class": "v-textarea__input",
2856
+ "size": this.size,
2773
2857
  "autoHeight": true,
2774
2858
  "startAdornment": this.startAdornment,
2775
2859
  "endAdornment": this.endAdornment
@@ -2865,8 +2949,8 @@ const VWysiwygEditor = vue.defineComponent({
2865
2949
  vue.watch(() => inputControl.canOperation, updateEditable);
2866
2950
  vue.watch(() => props.modelValue, modelValue => {
2867
2951
  const $editor = editor.value;
2868
- if (!$editor) return;
2869
- $editor.commands.setContent(modelValue == null ? '' : modelValue);
2952
+ if (!$editor || $editor.getHTML() === modelValue) return;
2953
+ $editor.commands.setContent(modelValue == null ? '' : modelValue, false);
2870
2954
  textRef.value = $editor.getText();
2871
2955
  });
2872
2956
  const editor = vue3.useEditor({
@@ -3009,7 +3093,8 @@ const VWysiwygEditor = vue.defineComponent({
3009
3093
  "class": "v-wysiwyg-editor__input",
3010
3094
  "autoHeight": true,
3011
3095
  "startAdornment": this.startAdornment,
3012
- "endAdornment": this.endAdornment
3096
+ "endAdornment": this.endAdornment,
3097
+ "size": this.size
3013
3098
  }, { ...this.$slots,
3014
3099
  default: () => {
3015
3100
  let _slot2;
@@ -4056,7 +4141,7 @@ const VDataTable = vue.defineComponent({
4056
4141
  message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
4057
4142
  }
4058
4143
 
4059
- return typeof message === 'function' ? message() : message;
4144
+ return typeof message === 'function' ? message(vui) : message;
4060
4145
  });
4061
4146
  const classesRef = vue.computed(() => [{
4062
4147
  'v-data-table--fixed-header': props.fixedHeader
@@ -4969,6 +5054,7 @@ exports.ICON_NAMES = iconFont.ICON_NAMES;
4969
5054
  exports.AVATAR_SIZES = AVATAR_SIZES;
4970
5055
  exports.CHIP_SIZES = CHIP_SIZES;
4971
5056
  exports.CONTROL_FIELD_VARIANTS = CONTROL_FIELD_VARIANTS;
5057
+ exports.CONTROL_LOADING_SPINNER_SIZES = CONTROL_LOADING_SPINNER_SIZES;
4972
5058
  exports.CONTROL_SIZES = CONTROL_SIZES;
4973
5059
  exports.PAGINATION_ALIGNS = PAGINATION_ALIGNS;
4974
5060
  exports.VApp = VApp;
@@ -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);
2655
+ }
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);
2587
2667
  }
2588
- }, null) || vue.createVNode(VIcon, {
2589
- "key": "icon",
2590
- "name": this.iconName,
2591
- "rotate": this.menuOpened ? 180 : 0
2592
- }, null)
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'
@@ -2770,6 +2853,7 @@ const VTextarea = vue.defineComponent({
2770
2853
  }, { ...this.$slots,
2771
2854
  default: () => vue.createVNode(VControlField, {
2772
2855
  "class": "v-textarea__input",
2856
+ "size": this.size,
2773
2857
  "autoHeight": true,
2774
2858
  "startAdornment": this.startAdornment,
2775
2859
  "endAdornment": this.endAdornment
@@ -2865,8 +2949,8 @@ const VWysiwygEditor = vue.defineComponent({
2865
2949
  vue.watch(() => inputControl.canOperation, updateEditable);
2866
2950
  vue.watch(() => props.modelValue, modelValue => {
2867
2951
  const $editor = editor.value;
2868
- if (!$editor) return;
2869
- $editor.commands.setContent(modelValue == null ? '' : modelValue);
2952
+ if (!$editor || $editor.getHTML() === modelValue) return;
2953
+ $editor.commands.setContent(modelValue == null ? '' : modelValue, false);
2870
2954
  textRef.value = $editor.getText();
2871
2955
  });
2872
2956
  const editor = vue3.useEditor({
@@ -3009,7 +3093,8 @@ const VWysiwygEditor = vue.defineComponent({
3009
3093
  "class": "v-wysiwyg-editor__input",
3010
3094
  "autoHeight": true,
3011
3095
  "startAdornment": this.startAdornment,
3012
- "endAdornment": this.endAdornment
3096
+ "endAdornment": this.endAdornment,
3097
+ "size": this.size
3013
3098
  }, { ...this.$slots,
3014
3099
  default: () => {
3015
3100
  let _slot2;
@@ -4056,7 +4141,7 @@ const VDataTable = vue.defineComponent({
4056
4141
  message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
4057
4142
  }
4058
4143
 
4059
- return typeof message === 'function' ? message() : message;
4144
+ return typeof message === 'function' ? message(vui) : message;
4060
4145
  });
4061
4146
  const classesRef = vue.computed(() => [{
4062
4147
  'v-data-table--fixed-header': props.fixedHeader
@@ -4969,6 +5054,7 @@ exports.ICON_NAMES = iconFont.ICON_NAMES;
4969
5054
  exports.AVATAR_SIZES = AVATAR_SIZES;
4970
5055
  exports.CHIP_SIZES = CHIP_SIZES;
4971
5056
  exports.CONTROL_FIELD_VARIANTS = CONTROL_FIELD_VARIANTS;
5057
+ exports.CONTROL_LOADING_SPINNER_SIZES = CONTROL_LOADING_SPINNER_SIZES;
4972
5058
  exports.CONTROL_SIZES = CONTROL_SIZES;
4973
5059
  exports.PAGINATION_ALIGNS = PAGINATION_ALIGNS;
4974
5060
  exports.VApp = VApp;
package/dist/vui.css CHANGED
@@ -857,6 +857,17 @@ thead th {
857
857
  .v-form-selector__body {
858
858
  display: block;
859
859
  }
860
+ .v-form-selector__placeholder {
861
+ display: flex;
862
+ align-items: center;
863
+ margin-top: 8px;
864
+ font-style: italic;
865
+ opacity: 0.5;
866
+ }
867
+ .v-form-selector__placeholder--error {
868
+ color: var(--main-color);
869
+ opacity: 1;
870
+ }
860
871
  .v-form-selector--stacked .v-form-selector__body {
861
872
  display: flex;
862
873
  flex-direction: column;