@vc-shell/framework 1.0.166 → 1.0.168

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.0.166",
3
+ "version": "1.0.168",
4
4
  "type": "module",
5
5
  "main": "./dist/framework.js",
6
6
  "types": "./dist/index.d.ts",
@@ -53,9 +53,9 @@
53
53
  "whatwg-fetch": "^3.6.19"
54
54
  },
55
55
  "devDependencies": {
56
- "@vc-shell/api-client-generator": "^1.0.166",
57
- "@vc-shell/config-generator": "^1.0.166",
58
- "@vc-shell/ts-config": "^1.0.166",
56
+ "@vc-shell/api-client-generator": "^1.0.168",
57
+ "@vc-shell/config-generator": "^1.0.168",
58
+ "@vc-shell/ts-config": "^1.0.168",
59
59
  "@vitejs/plugin-vue": "^5.0.3",
60
60
  "sass": "^1.69.6",
61
61
  "typescript": "^5.3.3",
@@ -13,7 +13,6 @@ import { CardCollection } from "../factories";
13
13
  import componentProps from "./props";
14
14
  import { CardSchema } from "../../types";
15
15
  import { nodeBuilder } from "../../helpers/nodeBuilder";
16
- import * as _ from "lodash-es";
17
16
  import { unrefNested } from "../../helpers/unrefNested";
18
17
 
19
18
  export default {
@@ -32,24 +31,31 @@ export default {
32
31
 
33
32
  const hasNoCommentNodes = (components: (VNodeChild | VNodeNormalizedChildren)[]): boolean => {
34
33
  const vnodeIterable = Array.isArray(components) ? components : [components];
35
- return _.every(vnodeIterable, (component) => {
36
- if (Array.isArray(component) && component.length > 0) {
37
- return hasNoCommentNodes(component);
38
- }
34
+ const commentCounter = ref(0);
39
35
 
40
- if (component && typeof component === "object" && !Array.isArray(component)) {
36
+ for (const component of vnodeIterable) {
37
+ if (Array.isArray(component) && component.length > 0) {
38
+ if (!hasNoCommentNodes(component)) {
39
+ commentCounter.value++;
40
+ break;
41
+ }
42
+ } else if (component && typeof component === "object" && !Array.isArray(component)) {
41
43
  if (Array.isArray(component.children) && component.children.length > 0) {
42
44
  // Recursive check for nested components
43
- return hasNoCommentNodes(component.children);
45
+ if (!hasNoCommentNodes(component.children)) {
46
+ commentCounter.value++;
47
+ break;
48
+ }
44
49
  }
45
50
 
46
51
  if (component.el && (component.el as HTMLElement).nodeType === 8) {
47
- return false;
52
+ commentCounter.value++;
53
+ break;
48
54
  }
49
55
  }
56
+ }
50
57
 
51
- return true;
52
- });
58
+ return commentCounter.value !== vnodeIterable.length;
53
59
  };
54
60
 
55
61
  return () => {
@@ -514,7 +514,7 @@ const defaultValue = ref<Option[]>([]) as Ref<Option[]>;
514
514
 
515
515
  const optionsList = ref<Option[]>([]) as Ref<Option[]>;
516
516
 
517
- // const optionsList = ref<Option[]>([]) as Ref<Option[]>;
517
+ const optionsTemp = ref<Option[]>([]) as Ref<Option[]>;
518
518
 
519
519
  const totalItems = ref();
520
520
 
@@ -600,16 +600,10 @@ watch(
600
600
  } else if (props.options && Array.isArray(props.options)) {
601
601
  optionsList.value = props.options as Option[];
602
602
  }
603
- },
604
- { immediate: true },
605
- );
606
603
 
607
- watch(
608
- () => optionsList.value,
609
- (newVal) => {
610
- optionsList.value = newVal;
604
+ optionsTemp.value = optionsList.value;
611
605
  },
612
- { immediate: true, deep: true },
606
+ { immediate: true },
613
607
  );
614
608
 
615
609
  watch(
@@ -626,8 +620,10 @@ async function onLoadMore() {
626
620
  try {
627
621
  listLoading.value = true;
628
622
  const data = await props.options(filterString.value, optionsList.value.length);
629
- optionsList.value.push(...(data.results as Option[]));
623
+ optionsList.value = _.unionBy<Option>(optionsList.value, data.results as Option[], "id");
624
+
630
625
  totalItems.value = data.totalCount;
626
+ optionsTemp.value = optionsList.value;
631
627
  } finally {
632
628
  listLoading.value = false;
633
629
  }
@@ -766,6 +762,7 @@ const onDropdownClose = async () => {
766
762
  } else {
767
763
  optionsList.value = props.options as Option[];
768
764
  }
765
+ optionsTemp.value = optionsList.value;
769
766
 
770
767
  filterString.value = undefined;
771
768
  };
@@ -828,7 +825,8 @@ function toggleOption(opt: Option) {
828
825
  if (innerValue.value.length === 0 || _.isEqual(getOptionValue.value(innerValue.value[0]), optValue) !== true) {
829
826
  emit("update:modelValue", props.emitValue === true ? optValue : opt);
830
827
  }
831
- isOpened.value = false;
828
+
829
+ closeDropdown();
832
830
  return;
833
831
  }
834
832
 
@@ -860,14 +858,16 @@ async function onSearch(value: string) {
860
858
  if (props.options && typeof props.options === "function") {
861
859
  try {
862
860
  listLoading.value = true;
861
+
863
862
  const data = await props.options(filterString.value);
863
+
864
864
  optionsList.value = data.results as Option[];
865
865
  totalItems.value = data.totalCount;
866
866
  } finally {
867
867
  listLoading.value = false;
868
868
  }
869
869
  } else {
870
- optionsList.value = optionsList.value.filter((x: Option) => {
870
+ optionsList.value = optionsTemp.value.filter((x: Option) => {
871
871
  return (x[props.optionLabel as keyof Option] as string).toLowerCase().includes(filterString.value.toLowerCase());
872
872
  });
873
873
  }