@fastkit/vui 0.6.31 → 0.6.32

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/vui.cjs.js CHANGED
@@ -841,9 +841,9 @@ const VListTile = vue.defineComponent({
841
841
  return icon;
842
842
  });
843
843
  const endIcon = vue.computed(() => resolveRawIconProp(false, props.endIcon));
844
- const hasTo = vue.computed(() => !!props.to);
844
+ const hasTo = vue.computed(() => !!ctx.attrs.to);
845
845
  const link = vueRouter.useLink({
846
- to: props.to || ''
846
+ to: ctx.attrs.to || ''
847
847
  });
848
848
  const isActive = vue.computed(() => {
849
849
  if (!hasTo.value) return false;
@@ -965,7 +965,11 @@ function _isSlot$a(s) {
965
965
 
966
966
  function createNavigationItemProps() {
967
967
  return { ...createListTileProps(),
968
- match: String
968
+ match: String // key: {
969
+ // type: [String, Number],
970
+ // required: true,
971
+ // },
972
+
969
973
  };
970
974
  }
971
975
  function resolveNavigationItemInput(input) {
@@ -1010,7 +1014,7 @@ const VNavigationItem = vue.defineComponent({
1010
1014
  const c = props.children;
1011
1015
  return c && c.length ? c : undefined;
1012
1016
  });
1013
- const to = vue.computed(() => props.to);
1017
+ const to = vue.computed(() => ctx.attrs.to);
1014
1018
  const match = vue.computed(() => {
1015
1019
  const {
1016
1020
  match,
@@ -1085,6 +1089,7 @@ const VNavigationItem = vue.defineComponent({
1085
1089
  });
1086
1090
 
1087
1091
  function open() {
1092
+ if (!children.value) return;
1088
1093
  opened.value = true;
1089
1094
  }
1090
1095
 
@@ -1098,9 +1103,13 @@ const VNavigationItem = vue.defineComponent({
1098
1103
 
1099
1104
  const onClick = ev => {
1100
1105
  if (!to.value) {
1101
- toggle();
1102
- } // ctx.emit('click', ev);
1106
+ return toggle();
1107
+ }
1103
1108
 
1109
+ open(); // if (!to.value) {
1110
+ // toggle();
1111
+ // }
1112
+ // ctx.emit('click', ev);
1104
1113
  };
1105
1114
 
1106
1115
  const onChangeActive = isActive => {
@@ -1122,6 +1131,9 @@ const VNavigationItem = vue.defineComponent({
1122
1131
  ctx.emit('changeActive', isActive);
1123
1132
  };
1124
1133
 
1134
+ ctx.expose({
1135
+ close
1136
+ });
1125
1137
  return () => {
1126
1138
  let _slot;
1127
1139
 
@@ -1173,6 +1185,28 @@ const VNavigation = vue.defineComponent({
1173
1185
  const c = props.caption;
1174
1186
  return typeof c === 'function' ? c() : c;
1175
1187
  });
1188
+ const itemsRef = vue.ref([]);
1189
+ vue.onBeforeUpdate(() => {
1190
+ itemsRef.value = [];
1191
+ });
1192
+
1193
+ function setItemRef(item, itemRef) {
1194
+ itemsRef.value.push({
1195
+ key: item.key,
1196
+ ref: itemRef
1197
+ });
1198
+ }
1199
+
1200
+ function onItemActivated(item) {
1201
+ itemsRef.value.forEach(({
1202
+ key,
1203
+ ref
1204
+ }) => {
1205
+ if (key === item.key) return;
1206
+ ref.close();
1207
+ });
1208
+ }
1209
+
1176
1210
  return () => {
1177
1211
  const $caption = caption.value;
1178
1212
  return vue.createVNode("nav", {
@@ -1181,7 +1215,17 @@ const VNavigation = vue.defineComponent({
1181
1215
  "class": "v-navigation__caption"
1182
1216
  }, [$caption]), items.value.map(item => renderNavigationItemInput(item, {
1183
1217
  class: 'v-navigation__item',
1184
- startIconEmptySpace: startIconEmptySpace.value
1218
+ startIconEmptySpace: startIconEmptySpace.value,
1219
+ ref: ref => {
1220
+ setItemRef(item, ref);
1221
+ },
1222
+ onChangeActive: isActive => {
1223
+ if (isActive
1224
+ /* && item.children && item.children.length*/
1225
+ ) {
1226
+ onItemActivated(item);
1227
+ }
1228
+ }
1185
1229
  }))]);
1186
1230
  };
1187
1231
  }
@@ -841,9 +841,9 @@ const VListTile = vue.defineComponent({
841
841
  return icon;
842
842
  });
843
843
  const endIcon = vue.computed(() => resolveRawIconProp(false, props.endIcon));
844
- const hasTo = vue.computed(() => !!props.to);
844
+ const hasTo = vue.computed(() => !!ctx.attrs.to);
845
845
  const link = vueRouter.useLink({
846
- to: props.to || ''
846
+ to: ctx.attrs.to || ''
847
847
  });
848
848
  const isActive = vue.computed(() => {
849
849
  if (!hasTo.value) return false;
@@ -965,7 +965,11 @@ function _isSlot$a(s) {
965
965
 
966
966
  function createNavigationItemProps() {
967
967
  return { ...createListTileProps(),
968
- match: String
968
+ match: String // key: {
969
+ // type: [String, Number],
970
+ // required: true,
971
+ // },
972
+
969
973
  };
970
974
  }
971
975
  function resolveNavigationItemInput(input) {
@@ -1010,7 +1014,7 @@ const VNavigationItem = vue.defineComponent({
1010
1014
  const c = props.children;
1011
1015
  return c && c.length ? c : undefined;
1012
1016
  });
1013
- const to = vue.computed(() => props.to);
1017
+ const to = vue.computed(() => ctx.attrs.to);
1014
1018
  const match = vue.computed(() => {
1015
1019
  const {
1016
1020
  match,
@@ -1085,6 +1089,7 @@ const VNavigationItem = vue.defineComponent({
1085
1089
  });
1086
1090
 
1087
1091
  function open() {
1092
+ if (!children.value) return;
1088
1093
  opened.value = true;
1089
1094
  }
1090
1095
 
@@ -1098,9 +1103,13 @@ const VNavigationItem = vue.defineComponent({
1098
1103
 
1099
1104
  const onClick = ev => {
1100
1105
  if (!to.value) {
1101
- toggle();
1102
- } // ctx.emit('click', ev);
1106
+ return toggle();
1107
+ }
1103
1108
 
1109
+ open(); // if (!to.value) {
1110
+ // toggle();
1111
+ // }
1112
+ // ctx.emit('click', ev);
1104
1113
  };
1105
1114
 
1106
1115
  const onChangeActive = isActive => {
@@ -1122,6 +1131,9 @@ const VNavigationItem = vue.defineComponent({
1122
1131
  ctx.emit('changeActive', isActive);
1123
1132
  };
1124
1133
 
1134
+ ctx.expose({
1135
+ close
1136
+ });
1125
1137
  return () => {
1126
1138
  let _slot;
1127
1139
 
@@ -1173,6 +1185,28 @@ const VNavigation = vue.defineComponent({
1173
1185
  const c = props.caption;
1174
1186
  return typeof c === 'function' ? c() : c;
1175
1187
  });
1188
+ const itemsRef = vue.ref([]);
1189
+ vue.onBeforeUpdate(() => {
1190
+ itemsRef.value = [];
1191
+ });
1192
+
1193
+ function setItemRef(item, itemRef) {
1194
+ itemsRef.value.push({
1195
+ key: item.key,
1196
+ ref: itemRef
1197
+ });
1198
+ }
1199
+
1200
+ function onItemActivated(item) {
1201
+ itemsRef.value.forEach(({
1202
+ key,
1203
+ ref
1204
+ }) => {
1205
+ if (key === item.key) return;
1206
+ ref.close();
1207
+ });
1208
+ }
1209
+
1176
1210
  return () => {
1177
1211
  const $caption = caption.value;
1178
1212
  return vue.createVNode("nav", {
@@ -1181,7 +1215,17 @@ const VNavigation = vue.defineComponent({
1181
1215
  "class": "v-navigation__caption"
1182
1216
  }, [$caption]), items.value.map(item => renderNavigationItemInput(item, {
1183
1217
  class: 'v-navigation__item',
1184
- startIconEmptySpace: startIconEmptySpace.value
1218
+ startIconEmptySpace: startIconEmptySpace.value,
1219
+ ref: ref => {
1220
+ setItemRef(item, ref);
1221
+ },
1222
+ onChangeActive: isActive => {
1223
+ if (isActive
1224
+ /* && item.children && item.children.length*/
1225
+ ) {
1226
+ onItemActivated(item);
1227
+ }
1228
+ }
1185
1229
  }))]);
1186
1230
  };
1187
1231
  }
@@ -3,7 +3,7 @@ export * from '@fastkit/vue-kit';
3
3
  export { VDialog, VMenu, VSnackbar } from '@fastkit/vue-kit';
4
4
  import { useRouter, RouterLink, useLink, useRoute } from 'vue-router';
5
5
  import { createPropsOptions as createPropsOptions$1, defineSlotsProps as defineSlotsProps$1, renderSlotOrEmpty as renderSlotOrEmpty$1, navigationableInheritProps, VLink, rawNumberPropType, resolveNumberish, resizeDirectiveArgument, VExpandTransition, LocationService, setDefaultRouterLink } from '@fastkit/vue-utils';
6
- import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, vModelSelect, onMounted, onBeforeUnmount, onBeforeUpdate, Transition } from 'vue';
6
+ import { inject, computed, provide, defineComponent, createVNode, mergeProps, ref, watch, withDirectives, createTextVNode, isVNode, Fragment, vShow, onBeforeUpdate, vModelSelect, onMounted, onBeforeUnmount, Transition } from 'vue';
7
7
  import { useScopeColorClass, colorSchemeProps, useColorClasses, toScopeColorClass } from '@fastkit/vue-color-scheme';
8
8
  import { VProgressCircular } from '@fastkit/vue-loading';
9
9
  export * from '@fastkit/vue-loading';
@@ -840,9 +840,9 @@ const VListTile = defineComponent({
840
840
  return icon;
841
841
  });
842
842
  const endIcon = computed(() => resolveRawIconProp(false, props.endIcon));
843
- const hasTo = computed(() => !!props.to);
843
+ const hasTo = computed(() => !!ctx.attrs.to);
844
844
  const link = useLink({
845
- to: props.to || ''
845
+ to: ctx.attrs.to || ''
846
846
  });
847
847
  const isActive = computed(() => {
848
848
  if (!hasTo.value) return false;
@@ -964,7 +964,11 @@ function _isSlot$a(s) {
964
964
 
965
965
  function createNavigationItemProps() {
966
966
  return { ...createListTileProps(),
967
- match: String
967
+ match: String // key: {
968
+ // type: [String, Number],
969
+ // required: true,
970
+ // },
971
+
968
972
  };
969
973
  }
970
974
  function resolveNavigationItemInput(input) {
@@ -1009,7 +1013,7 @@ const VNavigationItem = defineComponent({
1009
1013
  const c = props.children;
1010
1014
  return c && c.length ? c : undefined;
1011
1015
  });
1012
- const to = computed(() => props.to);
1016
+ const to = computed(() => ctx.attrs.to);
1013
1017
  const match = computed(() => {
1014
1018
  const {
1015
1019
  match,
@@ -1084,6 +1088,7 @@ const VNavigationItem = defineComponent({
1084
1088
  });
1085
1089
 
1086
1090
  function open() {
1091
+ if (!children.value) return;
1087
1092
  opened.value = true;
1088
1093
  }
1089
1094
 
@@ -1097,9 +1102,13 @@ const VNavigationItem = defineComponent({
1097
1102
 
1098
1103
  const onClick = ev => {
1099
1104
  if (!to.value) {
1100
- toggle();
1101
- } // ctx.emit('click', ev);
1105
+ return toggle();
1106
+ }
1102
1107
 
1108
+ open(); // if (!to.value) {
1109
+ // toggle();
1110
+ // }
1111
+ // ctx.emit('click', ev);
1103
1112
  };
1104
1113
 
1105
1114
  const onChangeActive = isActive => {
@@ -1121,6 +1130,9 @@ const VNavigationItem = defineComponent({
1121
1130
  ctx.emit('changeActive', isActive);
1122
1131
  };
1123
1132
 
1133
+ ctx.expose({
1134
+ close
1135
+ });
1124
1136
  return () => {
1125
1137
  let _slot;
1126
1138
 
@@ -1172,6 +1184,28 @@ const VNavigation = defineComponent({
1172
1184
  const c = props.caption;
1173
1185
  return typeof c === 'function' ? c() : c;
1174
1186
  });
1187
+ const itemsRef = ref([]);
1188
+ onBeforeUpdate(() => {
1189
+ itemsRef.value = [];
1190
+ });
1191
+
1192
+ function setItemRef(item, itemRef) {
1193
+ itemsRef.value.push({
1194
+ key: item.key,
1195
+ ref: itemRef
1196
+ });
1197
+ }
1198
+
1199
+ function onItemActivated(item) {
1200
+ itemsRef.value.forEach(({
1201
+ key,
1202
+ ref
1203
+ }) => {
1204
+ if (key === item.key) return;
1205
+ ref.close();
1206
+ });
1207
+ }
1208
+
1175
1209
  return () => {
1176
1210
  const $caption = caption.value;
1177
1211
  return createVNode("nav", {
@@ -1180,7 +1214,17 @@ const VNavigation = defineComponent({
1180
1214
  "class": "v-navigation__caption"
1181
1215
  }, [$caption]), items.value.map(item => renderNavigationItemInput(item, {
1182
1216
  class: 'v-navigation__item',
1183
- startIconEmptySpace: startIconEmptySpace.value
1217
+ startIconEmptySpace: startIconEmptySpace.value,
1218
+ ref: ref => {
1219
+ setItemRef(item, ref);
1220
+ },
1221
+ onChangeActive: isActive => {
1222
+ if (isActive
1223
+ /* && item.children && item.children.length*/
1224
+ ) {
1225
+ onItemActivated(item);
1226
+ }
1227
+ }
1184
1228
  }))]);
1185
1229
  };
1186
1230
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastkit/vui",
3
- "version": "0.6.31",
3
+ "version": "0.6.32",
4
4
  "description": "@fastkit/vui",
5
5
  "buildOptions": {
6
6
  "name": "Vui",
@@ -31,11 +31,11 @@
31
31
  "vue": "^3.2.23"
32
32
  },
33
33
  "dependencies": {
34
- "@fastkit/color-scheme": "0.6.31",
35
- "@fastkit/icon-font": "0.6.31",
36
- "@fastkit/tiny-logger": "0.6.31",
37
- "@fastkit/vite-kit": "0.6.31",
38
- "@fastkit/vue-kit": "0.6.31",
34
+ "@fastkit/color-scheme": "0.6.32",
35
+ "@fastkit/icon-font": "0.6.32",
36
+ "@fastkit/tiny-logger": "0.6.32",
37
+ "@fastkit/vite-kit": "0.6.32",
38
+ "@fastkit/vue-kit": "0.6.32",
39
39
  "eta": "^1.12.3",
40
40
  "fs-extra": "^9.1.0"
41
41
  }