@fastkit/vui 0.7.22 → 0.7.23

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.
@@ -35,20 +35,21 @@ import './setup.scss';
35
35
  import type { App } from 'vue';
36
36
  import type { Router } from 'vue-router';
37
37
  import { VPageLink } from '@fastkit/vue-page';
38
- import { installVuiPlugin as _installVuiPlugin, VuiPluginOptions } from '@fastkit/vui';
38
+ import { installVuiPlugin as _installVuiPlugin, RawVuiPluginOptions, mergeVuiPluginOptions } from '@fastkit/vui';
39
39
  import { colorScheme } from '<%~ it.colorScheme %>';
40
40
  import '<%~ it.mediaMatch %>';
41
41
  import './icon-font';
42
42
  import '${STYLE_AFTER_EFFECTS_PATH}';
43
43
 
44
- export function installVui(settings: { app: App, router: Router }) {
45
- _installVuiPlugin(settings.app, {
44
+ export function installVui(settings: { app: App, router: Router }, options?: RawVuiPluginOptions) {
45
+ const merged = mergeVuiPluginOptions({
46
46
  RouterLink: VPageLink,
47
47
  colorScheme,
48
48
  uiSettings: <%~ it.uiSettings %>,
49
49
  icons: <%~ it.icons %>,
50
50
  ...settings,
51
- });
51
+ }, options);
52
+ _installVuiPlugin(settings.app, merged);
52
53
  }
53
54
 
54
55
  export default installVui;
@@ -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;AA+F/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,CAyJrB"}
package/dist/vui.cjs.js CHANGED
@@ -3432,6 +3432,11 @@ const VDataTable = vue.defineComponent({
3432
3432
  default: () => DATA_TABLE_DEFAULTS.orderQuery
3433
3433
  },
3434
3434
 
3435
+ /**
3436
+ * 検索クエリ名
3437
+ */
3438
+ searchQuery: [String, Array],
3439
+
3435
3440
  /**
3436
3441
  * リミット件数クエリ名
3437
3442
  */
@@ -3477,7 +3482,11 @@ const VDataTable = vue.defineComponent({
3477
3482
  },
3478
3483
  selectable: Boolean,
3479
3484
  fixedHeader: Boolean,
3480
- maxHeight: [Number, String]
3485
+ maxHeight: [Number, String],
3486
+ // eslint-disable-next-line vue/require-prop-types
3487
+ noDataMessage: {},
3488
+ // eslint-disable-next-line vue/require-prop-types
3489
+ noResultsMessage: {}
3481
3490
  },
3482
3491
  emits: {
3483
3492
  input: selecteds => true
@@ -3506,6 +3515,46 @@ const VDataTable = vue.defineComponent({
3506
3515
  ret.push(...headers.filter(h => !h.hidden));
3507
3516
  return ret;
3508
3517
  });
3518
+ const searchQueryValues = vue.computed(() => {
3519
+ let {
3520
+ searchQuery
3521
+ } = props;
3522
+
3523
+ if (!searchQuery) {
3524
+ return [];
3525
+ }
3526
+
3527
+ if (!Array.isArray(searchQuery)) {
3528
+ searchQuery = [searchQuery];
3529
+ }
3530
+
3531
+ const values = [];
3532
+ searchQuery.forEach(query => {
3533
+ const value = vui.location.getQuery(query);
3534
+
3535
+ if (value == null || value === '') {
3536
+ return;
3537
+ }
3538
+
3539
+ if (typeof value === 'object' && !Object.keys(value).length) {
3540
+ return;
3541
+ }
3542
+
3543
+ values.push(value);
3544
+ });
3545
+ return values;
3546
+ });
3547
+ const emptyMessage = vue.computed(() => {
3548
+ let message;
3549
+
3550
+ if (searchQueryValues.value.length) {
3551
+ message = props.noResultsMessage || vui.setting('noResultsMessage') || 'No search results found.'; // 検索結果が見つかりませんでした。
3552
+ } else {
3553
+ message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
3554
+ }
3555
+
3556
+ return typeof message === 'function' ? message() : message;
3557
+ });
3509
3558
  const classesRef = vue.computed(() => [{
3510
3559
  'v-data-table--fixed-header': props.fixedHeader
3511
3560
  }]);
@@ -3972,7 +4021,7 @@ const VDataTable = vue.defineComponent({
3972
4021
  "class": "v-data-table__body container-pull"
3973
4022
  }, [isEmpty ? vue.createVNode("div", {
3974
4023
  "class": "v-data-table__empty--message"
3975
- }, null) : vue.createVNode(VPaper, {
4024
+ }, [emptyMessage.value]) : vue.createVNode(VPaper, {
3976
4025
  "class": "v-data-table__body__inner",
3977
4026
  "style": bodyInnerStylesRef.value
3978
4027
  }, {
@@ -4136,6 +4185,51 @@ const VToolbarTitle = vue.defineComponent({
4136
4185
 
4137
4186
  const DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP = -20;
4138
4187
  const DEFAULT_TEXTAREA_ROWS = 3;
4188
+ function mergeVuiServiceUISettings(base, overrides) {
4189
+ if (!overrides) {
4190
+ return base;
4191
+ }
4192
+
4193
+ const merged = { ...base
4194
+ };
4195
+ Object.entries(overrides).forEach(([key, value]) => {
4196
+ if (value) {
4197
+ merged[key] = value;
4198
+ }
4199
+ });
4200
+ return merged;
4201
+ }
4202
+ function mergeVuiServiceIconSettings(base, overrides) {
4203
+ if (!overrides) {
4204
+ return base;
4205
+ }
4206
+
4207
+ const merged = { ...base
4208
+ };
4209
+ Object.entries(overrides).forEach(([key, value]) => {
4210
+ if (value) {
4211
+ merged[key] = value;
4212
+ }
4213
+ });
4214
+ return merged;
4215
+ }
4216
+ function mergeVuiServiceOptions(base, overrides) {
4217
+ if (!overrides) {
4218
+ return base;
4219
+ }
4220
+
4221
+ const merged = { ...base,
4222
+ uiSettings: mergeVuiServiceUISettings(base.uiSettings, overrides.uiSettings),
4223
+ icons: mergeVuiServiceIconSettings(base.icons, overrides.icons)
4224
+ };
4225
+ const excludes = ['uiSettings', 'icons'];
4226
+ Object.entries(overrides).forEach(([key, value]) => {
4227
+ if (value && !excludes.includes(key)) {
4228
+ merged[key] = value;
4229
+ }
4230
+ });
4231
+ return merged;
4232
+ }
4139
4233
  class VuiService {
4140
4234
  get scroller() {
4141
4235
  return vueScroller.getDocumentScroller();
@@ -4272,6 +4366,18 @@ class VuiService {
4272
4366
 
4273
4367
  }
4274
4368
 
4369
+ function mergeVuiPluginOptions(base, override) {
4370
+ if (!override) return base;
4371
+ const merged = mergeVuiServiceOptions(base, override);
4372
+
4373
+ if (override.stack) {
4374
+ merged.stack = { ...merged.stack,
4375
+ ...override.stack
4376
+ };
4377
+ }
4378
+
4379
+ return merged;
4380
+ }
4275
4381
  class VuiPlugin {
4276
4382
  static installedApps = new Set();
4277
4383
 
@@ -4415,6 +4521,10 @@ exports.defineFormSelectorComponent = defineFormSelectorComponent;
4415
4521
  exports.iconProps = iconProps;
4416
4522
  exports.installVuiPlugin = installVuiPlugin;
4417
4523
  exports.listTileEmits = listTileEmits;
4524
+ exports.mergeVuiPluginOptions = mergeVuiPluginOptions;
4525
+ exports.mergeVuiServiceIconSettings = mergeVuiServiceIconSettings;
4526
+ exports.mergeVuiServiceOptions = mergeVuiServiceOptions;
4527
+ exports.mergeVuiServiceUISettings = mergeVuiServiceUISettings;
4418
4528
  exports.paginationProps = paginationProps;
4419
4529
  exports.rawIconProp = rawIconProp;
4420
4530
  exports.renderNavigationItemInput = renderNavigationItemInput;
@@ -3432,6 +3432,11 @@ const VDataTable = vue.defineComponent({
3432
3432
  default: () => DATA_TABLE_DEFAULTS.orderQuery
3433
3433
  },
3434
3434
 
3435
+ /**
3436
+ * 検索クエリ名
3437
+ */
3438
+ searchQuery: [String, Array],
3439
+
3435
3440
  /**
3436
3441
  * リミット件数クエリ名
3437
3442
  */
@@ -3477,7 +3482,11 @@ const VDataTable = vue.defineComponent({
3477
3482
  },
3478
3483
  selectable: Boolean,
3479
3484
  fixedHeader: Boolean,
3480
- maxHeight: [Number, String]
3485
+ maxHeight: [Number, String],
3486
+ // eslint-disable-next-line vue/require-prop-types
3487
+ noDataMessage: {},
3488
+ // eslint-disable-next-line vue/require-prop-types
3489
+ noResultsMessage: {}
3481
3490
  },
3482
3491
  emits: {
3483
3492
  input: selecteds => true
@@ -3506,6 +3515,46 @@ const VDataTable = vue.defineComponent({
3506
3515
  ret.push(...headers.filter(h => !h.hidden));
3507
3516
  return ret;
3508
3517
  });
3518
+ const searchQueryValues = vue.computed(() => {
3519
+ let {
3520
+ searchQuery
3521
+ } = props;
3522
+
3523
+ if (!searchQuery) {
3524
+ return [];
3525
+ }
3526
+
3527
+ if (!Array.isArray(searchQuery)) {
3528
+ searchQuery = [searchQuery];
3529
+ }
3530
+
3531
+ const values = [];
3532
+ searchQuery.forEach(query => {
3533
+ const value = vui.location.getQuery(query);
3534
+
3535
+ if (value == null || value === '') {
3536
+ return;
3537
+ }
3538
+
3539
+ if (typeof value === 'object' && !Object.keys(value).length) {
3540
+ return;
3541
+ }
3542
+
3543
+ values.push(value);
3544
+ });
3545
+ return values;
3546
+ });
3547
+ const emptyMessage = vue.computed(() => {
3548
+ let message;
3549
+
3550
+ if (searchQueryValues.value.length) {
3551
+ message = props.noResultsMessage || vui.setting('noResultsMessage') || 'No search results found.'; // 検索結果が見つかりませんでした。
3552
+ } else {
3553
+ message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
3554
+ }
3555
+
3556
+ return typeof message === 'function' ? message() : message;
3557
+ });
3509
3558
  const classesRef = vue.computed(() => [{
3510
3559
  'v-data-table--fixed-header': props.fixedHeader
3511
3560
  }]);
@@ -3972,7 +4021,7 @@ const VDataTable = vue.defineComponent({
3972
4021
  "class": "v-data-table__body container-pull"
3973
4022
  }, [isEmpty ? vue.createVNode("div", {
3974
4023
  "class": "v-data-table__empty--message"
3975
- }, null) : vue.createVNode(VPaper, {
4024
+ }, [emptyMessage.value]) : vue.createVNode(VPaper, {
3976
4025
  "class": "v-data-table__body__inner",
3977
4026
  "style": bodyInnerStylesRef.value
3978
4027
  }, {
@@ -4136,6 +4185,51 @@ const VToolbarTitle = vue.defineComponent({
4136
4185
 
4137
4186
  const DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP = -20;
4138
4187
  const DEFAULT_TEXTAREA_ROWS = 3;
4188
+ function mergeVuiServiceUISettings(base, overrides) {
4189
+ if (!overrides) {
4190
+ return base;
4191
+ }
4192
+
4193
+ const merged = { ...base
4194
+ };
4195
+ Object.entries(overrides).forEach(([key, value]) => {
4196
+ if (value) {
4197
+ merged[key] = value;
4198
+ }
4199
+ });
4200
+ return merged;
4201
+ }
4202
+ function mergeVuiServiceIconSettings(base, overrides) {
4203
+ if (!overrides) {
4204
+ return base;
4205
+ }
4206
+
4207
+ const merged = { ...base
4208
+ };
4209
+ Object.entries(overrides).forEach(([key, value]) => {
4210
+ if (value) {
4211
+ merged[key] = value;
4212
+ }
4213
+ });
4214
+ return merged;
4215
+ }
4216
+ function mergeVuiServiceOptions(base, overrides) {
4217
+ if (!overrides) {
4218
+ return base;
4219
+ }
4220
+
4221
+ const merged = { ...base,
4222
+ uiSettings: mergeVuiServiceUISettings(base.uiSettings, overrides.uiSettings),
4223
+ icons: mergeVuiServiceIconSettings(base.icons, overrides.icons)
4224
+ };
4225
+ const excludes = ['uiSettings', 'icons'];
4226
+ Object.entries(overrides).forEach(([key, value]) => {
4227
+ if (value && !excludes.includes(key)) {
4228
+ merged[key] = value;
4229
+ }
4230
+ });
4231
+ return merged;
4232
+ }
4139
4233
  class VuiService {
4140
4234
  get scroller() {
4141
4235
  return vueScroller.getDocumentScroller();
@@ -4272,6 +4366,18 @@ class VuiService {
4272
4366
 
4273
4367
  }
4274
4368
 
4369
+ function mergeVuiPluginOptions(base, override) {
4370
+ if (!override) return base;
4371
+ const merged = mergeVuiServiceOptions(base, override);
4372
+
4373
+ if (override.stack) {
4374
+ merged.stack = { ...merged.stack,
4375
+ ...override.stack
4376
+ };
4377
+ }
4378
+
4379
+ return merged;
4380
+ }
4275
4381
  class VuiPlugin {
4276
4382
  static installedApps = new Set();
4277
4383
 
@@ -4415,6 +4521,10 @@ exports.defineFormSelectorComponent = defineFormSelectorComponent;
4415
4521
  exports.iconProps = iconProps;
4416
4522
  exports.installVuiPlugin = installVuiPlugin;
4417
4523
  exports.listTileEmits = listTileEmits;
4524
+ exports.mergeVuiPluginOptions = mergeVuiPluginOptions;
4525
+ exports.mergeVuiServiceIconSettings = mergeVuiServiceIconSettings;
4526
+ exports.mergeVuiServiceOptions = mergeVuiServiceOptions;
4527
+ exports.mergeVuiServiceUISettings = mergeVuiServiceUISettings;
4418
4528
  exports.paginationProps = paginationProps;
4419
4529
  exports.rawIconProp = rawIconProp;
4420
4530
  exports.renderNavigationItemInput = renderNavigationItemInput;
package/dist/vui.d.ts CHANGED
@@ -1241,6 +1241,14 @@ export declare const listTileEmits: {
1241
1241
  changeActive: (isActive: boolean) => boolean;
1242
1242
  };
1243
1243
 
1244
+ export declare function mergeVuiPluginOptions(base: VuiPluginOptions, override?: RawVuiPluginOptions): VuiPluginOptions;
1245
+
1246
+ export declare function mergeVuiServiceIconSettings(base: VuiServiceIconSettings, overrides?: RawVuiServiceIconSettings): VuiServiceIconSettings;
1247
+
1248
+ export declare function mergeVuiServiceOptions(base: VuiServiceOptions, overrides?: RawVuiServiceOptions): VuiServiceOptions;
1249
+
1250
+ export declare function mergeVuiServiceUISettings(base: VuiServiceUISettings, overrides?: RawVuiServiceUISettings): VuiServiceUISettings;
1251
+
1244
1252
  export declare interface NavigationItemInput extends ExtractPropInput<ReturnType<typeof createNavigationItemProps>> {
1245
1253
  key: string | number;
1246
1254
  label: VNodeChild | (() => VNodeChild);
@@ -1299,8 +1307,21 @@ export declare type RawVButtonIcon = IconName | VButtonIcon;
1299
1307
 
1300
1308
  export declare type RawVButtonSpacer = boolean | VButtonSpacer;
1301
1309
 
1310
+ export declare interface RawVuiPluginOptions extends RawVuiServiceOptions {
1311
+ stack?: VuiPluginStackOptions;
1312
+ }
1313
+
1302
1314
  export declare type RawVuiPromptOptions = string | VuiPromptOptions;
1303
1315
 
1316
+ export declare type RawVuiServiceIconSettings = Partial<VuiServiceIconSettings>;
1317
+
1318
+ export declare interface RawVuiServiceOptions extends Omit<Partial<VuiServiceOptions>, 'uiSettings' | 'icons'> {
1319
+ uiSettings?: RawVuiServiceUISettings;
1320
+ icons?: RawVuiServiceIconSettings;
1321
+ }
1322
+
1323
+ export declare type RawVuiServiceUISettings = Partial<VuiServiceUISettings>;
1324
+
1304
1325
  declare type RawWysiwygEditorTool = WysiwygEditorTool | WysiwygEditorToolFactory<any>;
1305
1326
 
1306
1327
  declare type RecursiveArray<T> = T | RecursiveArray<T>[];
@@ -3864,6 +3885,10 @@ export declare const VDataTable: DefineComponent<{
3864
3885
  type: StringConstructor;
3865
3886
  default: () => string;
3866
3887
  };
3888
+ /**
3889
+ * 検索クエリ名
3890
+ */
3891
+ searchQuery: PropType<string | string[]>;
3867
3892
  /**
3868
3893
  * リミット件数クエリ名
3869
3894
  */
@@ -3910,6 +3935,8 @@ export declare const VDataTable: DefineComponent<{
3910
3935
  selectable: BooleanConstructor;
3911
3936
  fixedHeader: BooleanConstructor;
3912
3937
  maxHeight: (StringConstructor | NumberConstructor)[];
3938
+ noDataMessage: PropType<VNodeChild | (() => VNodeChild)>;
3939
+ noResultsMessage: PropType<VNodeChild | (() => VNodeChild)>;
3913
3940
  }, () => JSX.Element, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
3914
3941
  input: (selecteds: string[]) => true;
3915
3942
  }, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{
@@ -3918,6 +3945,7 @@ export declare const VDataTable: DefineComponent<{
3918
3945
  pageQuery?: unknown;
3919
3946
  sortQuery?: unknown;
3920
3947
  orderQuery?: unknown;
3948
+ searchQuery?: unknown;
3921
3949
  limitQuery?: unknown;
3922
3950
  defaultOrder?: unknown;
3923
3951
  ascQueryValue?: unknown;
@@ -3931,6 +3959,8 @@ export declare const VDataTable: DefineComponent<{
3931
3959
  selectable?: unknown;
3932
3960
  fixedHeader?: unknown;
3933
3961
  maxHeight?: unknown;
3962
+ noDataMessage?: unknown;
3963
+ noResultsMessage?: unknown;
3934
3964
  } & {
3935
3965
  itemKey: string;
3936
3966
  pageQuery: string;
@@ -3951,6 +3981,9 @@ export declare const VDataTable: DefineComponent<{
3951
3981
  fixedHeader: boolean;
3952
3982
  } & {
3953
3983
  maxHeight?: string | number | undefined;
3984
+ searchQuery?: string | string[] | undefined;
3985
+ noDataMessage?: VNodeChild | (() => VNodeChild);
3986
+ noResultsMessage?: VNodeChild | (() => VNodeChild);
3954
3987
  }> & {
3955
3988
  onInput?: ((selecteds: string[]) => any) | undefined;
3956
3989
  }, {
@@ -10138,6 +10171,8 @@ export declare interface VuiServiceUISettings {
10138
10171
  color?: ScopeName;
10139
10172
  variant?: ColorVariant;
10140
10173
  };
10174
+ noDataMessage?: VNodeChild | (() => VNodeChild);
10175
+ noResultsMessage?: VNodeChild | (() => VNodeChild);
10141
10176
  }
10142
10177
 
10143
10178
  export declare type VuiVNodeResolver = () => VNodeChild;
package/dist/vui.mjs CHANGED
@@ -3427,6 +3427,11 @@ const VDataTable = defineComponent({
3427
3427
  default: () => DATA_TABLE_DEFAULTS.orderQuery
3428
3428
  },
3429
3429
 
3430
+ /**
3431
+ * 検索クエリ名
3432
+ */
3433
+ searchQuery: [String, Array],
3434
+
3430
3435
  /**
3431
3436
  * リミット件数クエリ名
3432
3437
  */
@@ -3472,7 +3477,11 @@ const VDataTable = defineComponent({
3472
3477
  },
3473
3478
  selectable: Boolean,
3474
3479
  fixedHeader: Boolean,
3475
- maxHeight: [Number, String]
3480
+ maxHeight: [Number, String],
3481
+ // eslint-disable-next-line vue/require-prop-types
3482
+ noDataMessage: {},
3483
+ // eslint-disable-next-line vue/require-prop-types
3484
+ noResultsMessage: {}
3476
3485
  },
3477
3486
  emits: {
3478
3487
  input: selecteds => true
@@ -3501,6 +3510,46 @@ const VDataTable = defineComponent({
3501
3510
  ret.push(...headers.filter(h => !h.hidden));
3502
3511
  return ret;
3503
3512
  });
3513
+ const searchQueryValues = computed(() => {
3514
+ let {
3515
+ searchQuery
3516
+ } = props;
3517
+
3518
+ if (!searchQuery) {
3519
+ return [];
3520
+ }
3521
+
3522
+ if (!Array.isArray(searchQuery)) {
3523
+ searchQuery = [searchQuery];
3524
+ }
3525
+
3526
+ const values = [];
3527
+ searchQuery.forEach(query => {
3528
+ const value = vui.location.getQuery(query);
3529
+
3530
+ if (value == null || value === '') {
3531
+ return;
3532
+ }
3533
+
3534
+ if (typeof value === 'object' && !Object.keys(value).length) {
3535
+ return;
3536
+ }
3537
+
3538
+ values.push(value);
3539
+ });
3540
+ return values;
3541
+ });
3542
+ const emptyMessage = computed(() => {
3543
+ let message;
3544
+
3545
+ if (searchQueryValues.value.length) {
3546
+ message = props.noResultsMessage || vui.setting('noResultsMessage') || 'No search results found.'; // 検索結果が見つかりませんでした。
3547
+ } else {
3548
+ message = props.noDataMessage || vui.setting('noDataMessage') || 'No data was available.'; // データはありませんでした。
3549
+ }
3550
+
3551
+ return typeof message === 'function' ? message() : message;
3552
+ });
3504
3553
  const classesRef = computed(() => [{
3505
3554
  'v-data-table--fixed-header': props.fixedHeader
3506
3555
  }]);
@@ -3967,7 +4016,7 @@ const VDataTable = defineComponent({
3967
4016
  "class": "v-data-table__body container-pull"
3968
4017
  }, [isEmpty ? createVNode("div", {
3969
4018
  "class": "v-data-table__empty--message"
3970
- }, null) : createVNode(VPaper, {
4019
+ }, [emptyMessage.value]) : createVNode(VPaper, {
3971
4020
  "class": "v-data-table__body__inner",
3972
4021
  "style": bodyInnerStylesRef.value
3973
4022
  }, {
@@ -4131,6 +4180,51 @@ const VToolbarTitle = defineComponent({
4131
4180
 
4132
4181
  const DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP = -20;
4133
4182
  const DEFAULT_TEXTAREA_ROWS = 3;
4183
+ function mergeVuiServiceUISettings(base, overrides) {
4184
+ if (!overrides) {
4185
+ return base;
4186
+ }
4187
+
4188
+ const merged = { ...base
4189
+ };
4190
+ Object.entries(overrides).forEach(([key, value]) => {
4191
+ if (value) {
4192
+ merged[key] = value;
4193
+ }
4194
+ });
4195
+ return merged;
4196
+ }
4197
+ function mergeVuiServiceIconSettings(base, overrides) {
4198
+ if (!overrides) {
4199
+ return base;
4200
+ }
4201
+
4202
+ const merged = { ...base
4203
+ };
4204
+ Object.entries(overrides).forEach(([key, value]) => {
4205
+ if (value) {
4206
+ merged[key] = value;
4207
+ }
4208
+ });
4209
+ return merged;
4210
+ }
4211
+ function mergeVuiServiceOptions(base, overrides) {
4212
+ if (!overrides) {
4213
+ return base;
4214
+ }
4215
+
4216
+ const merged = { ...base,
4217
+ uiSettings: mergeVuiServiceUISettings(base.uiSettings, overrides.uiSettings),
4218
+ icons: mergeVuiServiceIconSettings(base.icons, overrides.icons)
4219
+ };
4220
+ const excludes = ['uiSettings', 'icons'];
4221
+ Object.entries(overrides).forEach(([key, value]) => {
4222
+ if (value && !excludes.includes(key)) {
4223
+ merged[key] = value;
4224
+ }
4225
+ });
4226
+ return merged;
4227
+ }
4134
4228
  class VuiService {
4135
4229
  get scroller() {
4136
4230
  return getDocumentScroller$1();
@@ -4267,6 +4361,18 @@ class VuiService {
4267
4361
 
4268
4362
  }
4269
4363
 
4364
+ function mergeVuiPluginOptions(base, override) {
4365
+ if (!override) return base;
4366
+ const merged = mergeVuiServiceOptions(base, override);
4367
+
4368
+ if (override.stack) {
4369
+ merged.stack = { ...merged.stack,
4370
+ ...override.stack
4371
+ };
4372
+ }
4373
+
4374
+ return merged;
4375
+ }
4270
4376
  class VuiPlugin {
4271
4377
  static installedApps = new Set();
4272
4378
 
@@ -4324,4 +4430,4 @@ function installVuiPlugin(app, opts) {
4324
4430
  return app.use(VuiPlugin, opts);
4325
4431
  }
4326
4432
 
4327
- export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, 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, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, useControl, useControlField, useElevation, useVui, useVuiColorProvider, vueButtonProps };
4433
+ export { CONTROL_FIELD_VARIANTS, CONTROL_SIZES, PAGINATION_ALIGNS, VApp, VBreadcrumbs, VButton, VButtonGroup, VCard, VCardActions, VCardContent, VCheckbox, VCheckboxGroup, VContentSwitcher, VDataTable, VDrawerLayout, VForm, VFormControl, VGridContainer, VGridItem, VHero, VIcon, VListTile, VNavigation, VNavigationItem, VOption, VOptionGroup, VPagination, VPaper, VRadio, VRadioGroup, VSelect, 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, createCardProps, createControlFieldProviderProps, createControlProps, createElevationProps, createListTileProps, createNavigationItemProps, createPaperBaseProps, createPaperProps, createRequiredChipRenderer, defineFormSelectorComponent, iconProps, installVuiPlugin, listTileEmits, mergeVuiPluginOptions, mergeVuiServiceIconSettings, mergeVuiServiceOptions, mergeVuiServiceUISettings, paginationProps, rawIconProp, renderNavigationItemInput, resolveNavigationItemInput, resolveRawIconProp, 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.22",
3
+ "version": "0.7.23",
4
4
  "description": "@fastkit/vui",
5
5
  "buildOptions": {
6
6
  "name": "Vui",
@@ -32,11 +32,11 @@
32
32
  "vue": "^3.2.26"
33
33
  },
34
34
  "dependencies": {
35
- "@fastkit/color-scheme": "0.7.22",
36
- "@fastkit/icon-font": "0.7.22",
37
- "@fastkit/tiny-logger": "0.7.22",
38
- "@fastkit/vite-kit": "0.7.22",
39
- "@fastkit/vue-kit": "0.7.22",
35
+ "@fastkit/color-scheme": "0.7.23",
36
+ "@fastkit/icon-font": "0.7.23",
37
+ "@fastkit/tiny-logger": "0.7.23",
38
+ "@fastkit/vite-kit": "0.7.23",
39
+ "@fastkit/vue-kit": "0.7.23",
40
40
  "@tiptap/extension-link": "^2.0.0-beta.35",
41
41
  "@tiptap/extension-underline": "^2.0.0-beta.22",
42
42
  "@tiptap/starter-kit": "^2.0.0-beta.168",
@@ -126,6 +126,11 @@ export const VDataTable = defineComponent({
126
126
  default: () => DATA_TABLE_DEFAULTS.orderQuery,
127
127
  },
128
128
 
129
+ /**
130
+ * 検索クエリ名
131
+ */
132
+ searchQuery: [String, Array] as PropType<string | string[]>,
133
+
129
134
  /**
130
135
  * リミット件数クエリ名
131
136
  */
@@ -172,6 +177,10 @@ export const VDataTable = defineComponent({
172
177
  selectable: Boolean,
173
178
  fixedHeader: Boolean,
174
179
  maxHeight: [Number, String],
180
+ // eslint-disable-next-line vue/require-prop-types
181
+ noDataMessage: {} as PropType<VNodeChild | (() => VNodeChild)>,
182
+ // eslint-disable-next-line vue/require-prop-types
183
+ noResultsMessage: {} as PropType<VNodeChild | (() => VNodeChild)>,
175
184
  },
176
185
  emits: {
177
186
  input: (selecteds: string[]) => true,
@@ -196,6 +205,45 @@ export const VDataTable = defineComponent({
196
205
  ret.push(...headers.filter((h) => !h.hidden));
197
206
  return ret;
198
207
  });
208
+
209
+ const searchQueryValues = computed<string[]>(() => {
210
+ let { searchQuery } = props;
211
+ if (!searchQuery) {
212
+ return [];
213
+ }
214
+ if (!Array.isArray(searchQuery)) {
215
+ searchQuery = [searchQuery];
216
+ }
217
+ const values: string[] = [];
218
+ searchQuery.forEach((query) => {
219
+ const value = vui.location.getQuery(query);
220
+ if (value == null || value === '') {
221
+ return;
222
+ }
223
+ if (typeof value === 'object' && !Object.keys(value).length) {
224
+ return;
225
+ }
226
+ values.push(value);
227
+ });
228
+ return values;
229
+ });
230
+
231
+ const emptyMessage = computed(() => {
232
+ let message: VNodeChild | (() => VNodeChild);
233
+ if (searchQueryValues.value.length) {
234
+ message =
235
+ props.noResultsMessage ||
236
+ vui.setting('noResultsMessage') ||
237
+ 'No search results found.'; // 検索結果が見つかりませんでした。
238
+ } else {
239
+ message =
240
+ props.noDataMessage ||
241
+ vui.setting('noDataMessage') ||
242
+ 'No data was available.'; // データはありませんでした。
243
+ }
244
+ return typeof message === 'function' ? message() : message;
245
+ });
246
+
199
247
  const classesRef = computed(() => [
200
248
  {
201
249
  'v-data-table--fixed-header': props.fixedHeader,
@@ -724,7 +772,7 @@ export const VDataTable = defineComponent({
724
772
  <div class="v-data-table__body container-pull">
725
773
  {isEmpty ? (
726
774
  <div class="v-data-table__empty--message">
727
- {/* {this.computedEmptyMessage} */}
775
+ {emptyMessage.value}
728
776
  </div>
729
777
  ) : (
730
778
  <VPaper
package/src/plugin.tsx CHANGED
@@ -1,5 +1,11 @@
1
1
  import { App } from 'vue';
2
- import { VuiService, VuiServiceOptions, VuiInjectionKey } from './service';
2
+ import {
3
+ VuiService,
4
+ VuiServiceOptions,
5
+ RawVuiServiceOptions,
6
+ mergeVuiServiceOptions,
7
+ VuiInjectionKey,
8
+ } from './service';
3
9
  import {
4
10
  installVueStackPlugin,
5
11
  VueStackServiceOptions,
@@ -14,6 +20,25 @@ export interface VuiPluginOptions extends VuiServiceOptions {
14
20
  stack?: VuiPluginStackOptions;
15
21
  }
16
22
 
23
+ export interface RawVuiPluginOptions extends RawVuiServiceOptions {
24
+ stack?: VuiPluginStackOptions;
25
+ }
26
+
27
+ export function mergeVuiPluginOptions(
28
+ base: VuiPluginOptions,
29
+ override?: RawVuiPluginOptions,
30
+ ): VuiPluginOptions {
31
+ if (!override) return base;
32
+ const merged: VuiPluginOptions = mergeVuiServiceOptions(base, override);
33
+ if (override.stack) {
34
+ merged.stack = {
35
+ ...merged.stack,
36
+ ...override.stack,
37
+ };
38
+ }
39
+ return merged;
40
+ }
41
+
17
42
  declare module '@vue/runtime-core' {
18
43
  export interface ComponentCustomProperties {
19
44
  $vui: VuiService;
package/src/service.tsx CHANGED
@@ -50,6 +50,28 @@ export interface VuiServiceUISettings {
50
50
  color?: ScopeName;
51
51
  variant?: ColorVariant;
52
52
  };
53
+ noDataMessage?: VNodeChild | (() => VNodeChild);
54
+ noResultsMessage?: VNodeChild | (() => VNodeChild);
55
+ }
56
+
57
+ export type RawVuiServiceUISettings = Partial<VuiServiceUISettings>;
58
+
59
+ export function mergeVuiServiceUISettings(
60
+ base: VuiServiceUISettings,
61
+ overrides?: RawVuiServiceUISettings,
62
+ ): VuiServiceUISettings {
63
+ if (!overrides) {
64
+ return base;
65
+ }
66
+ const merged: VuiServiceUISettings = {
67
+ ...base,
68
+ };
69
+ Object.entries(overrides).forEach(([key, value]) => {
70
+ if (value) {
71
+ (merged as any)[key] = value;
72
+ }
73
+ });
74
+ return merged;
53
75
  }
54
76
 
55
77
  export interface VuiServiceIconSettings {
@@ -72,6 +94,26 @@ export interface VuiServiceIconSettings {
72
94
  clear: IconName;
73
95
  }
74
96
 
97
+ export type RawVuiServiceIconSettings = Partial<VuiServiceIconSettings>;
98
+
99
+ export function mergeVuiServiceIconSettings(
100
+ base: VuiServiceIconSettings,
101
+ overrides?: RawVuiServiceIconSettings,
102
+ ): VuiServiceIconSettings {
103
+ if (!overrides) {
104
+ return base;
105
+ }
106
+ const merged: VuiServiceIconSettings = {
107
+ ...base,
108
+ };
109
+ Object.entries(overrides).forEach(([key, value]) => {
110
+ if (value) {
111
+ (merged as any)[key] = value;
112
+ }
113
+ });
114
+ return merged;
115
+ }
116
+
75
117
  export type VuiVNodeResolver = () => VNodeChild;
76
118
 
77
119
  export interface VuiServiceOptions {
@@ -86,6 +128,36 @@ export interface VuiServiceOptions {
86
128
  requiredChip?: VuiVNodeResolver;
87
129
  }
88
130
 
131
+ export interface RawVuiServiceOptions
132
+ extends Omit<Partial<VuiServiceOptions>, 'uiSettings' | 'icons'> {
133
+ uiSettings?: RawVuiServiceUISettings;
134
+ icons?: RawVuiServiceIconSettings;
135
+ }
136
+
137
+ export function mergeVuiServiceOptions(
138
+ base: VuiServiceOptions,
139
+ overrides?: RawVuiServiceOptions,
140
+ ): VuiServiceOptions {
141
+ if (!overrides) {
142
+ return base;
143
+ }
144
+ const merged: VuiServiceOptions = {
145
+ ...base,
146
+ uiSettings: mergeVuiServiceUISettings(
147
+ base.uiSettings,
148
+ overrides.uiSettings,
149
+ ),
150
+ icons: mergeVuiServiceIconSettings(base.icons, overrides.icons),
151
+ };
152
+ const excludes = ['uiSettings', 'icons'];
153
+ Object.entries(overrides).forEach(([key, value]) => {
154
+ if (value && !excludes.includes(key)) {
155
+ (merged as any)[key] = value;
156
+ }
157
+ });
158
+ return merged;
159
+ }
160
+
89
161
  export class VuiService {
90
162
  readonly options: VuiServiceOptions;
91
163
 
@@ -30,20 +30,21 @@ import './setup.scss';
30
30
  import type { App } from 'vue';
31
31
  import type { Router } from 'vue-router';
32
32
  import { VPageLink } from '@fastkit/vue-page';
33
- import { installVuiPlugin as _installVuiPlugin, VuiPluginOptions } from '@fastkit/vui';
33
+ import { installVuiPlugin as _installVuiPlugin, RawVuiPluginOptions, mergeVuiPluginOptions } from '@fastkit/vui';
34
34
  import { colorScheme } from '<%~ it.colorScheme %>';
35
35
  import '<%~ it.mediaMatch %>';
36
36
  import './icon-font';
37
37
  import '${STYLE_AFTER_EFFECTS_PATH}';
38
38
 
39
- export function installVui(settings: { app: App, router: Router }) {
40
- _installVuiPlugin(settings.app, {
39
+ export function installVui(settings: { app: App, router: Router }, options?: RawVuiPluginOptions) {
40
+ const merged = mergeVuiPluginOptions({
41
41
  RouterLink: VPageLink,
42
42
  colorScheme,
43
43
  uiSettings: <%~ it.uiSettings %>,
44
44
  icons: <%~ it.icons %>,
45
45
  ...settings,
46
- });
46
+ }, options);
47
+ _installVuiPlugin(settings.app, merged);
47
48
  }
48
49
 
49
50
  export default installVui;