@dao-style/core 0.1.5 → 0.1.6

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.
@@ -6695,8 +6695,11 @@ function isEmpty(value) {
6695
6695
  }
6696
6696
  return true;
6697
6697
  }
6698
+ function isNil(value) {
6699
+ return value == null;
6700
+ }
6698
6701
  function withDefaultValue(val) {
6699
- return isEmpty(val) ? "-" : val;
6702
+ return isNil(val) || isObject(val) && isEmpty(val) ? "-" : val;
6700
6703
  }
6701
6704
  const tableProps = {
6702
6705
  id: {
@@ -7740,7 +7743,10 @@ const _sfc_main$4 = defineComponent({
7740
7743
  emits: ["update:search", "search"],
7741
7744
  setup(props, { emit }) {
7742
7745
  const { t } = useI18n();
7743
- const searchModel = useVModel(props, "search", emit);
7746
+ const searchModel = useVModel(props, "search", emit, {
7747
+ passive: true,
7748
+ deep: true
7749
+ });
7744
7750
  const visible = ref(false);
7745
7751
  const searchText = ref("");
7746
7752
  const dropdownRef = ref();
@@ -7756,6 +7762,7 @@ const _sfc_main$4 = defineComponent({
7756
7762
  return props.searchOptions.find((i) => i.label === searchKey.value || i.key === searchKey.value);
7757
7763
  });
7758
7764
  const resetSearch = () => {
7765
+ emit("search");
7759
7766
  searchText.value = "";
7760
7767
  visible.value = false;
7761
7768
  daoInputSearchRef.value.input.focus();
@@ -7768,29 +7775,31 @@ const _sfc_main$4 = defineComponent({
7768
7775
  }
7769
7776
  return false;
7770
7777
  };
7771
- const hasFuzzyOption = () => {
7772
- var _a2;
7778
+ const hasFuzzyOption = (value) => {
7779
+ var _a2, _b2;
7773
7780
  const { fuzzy } = props;
7774
- if (!fuzzy || ((_a2 = searchModel.value[fuzzy.key]) == null ? void 0 : _a2.length)) {
7781
+ if (!fuzzy) {
7782
+ return true;
7783
+ }
7784
+ if ((fuzzy == null ? void 0 : fuzzy.single) && ((_a2 = searchModel.value[fuzzy.key]) == null ? void 0 : _a2.length)) {
7785
+ return true;
7786
+ }
7787
+ if ((_b2 = searchModel.value[fuzzy.key]) == null ? void 0 : _b2.includes(value)) {
7775
7788
  return true;
7776
7789
  }
7777
7790
  return false;
7778
7791
  };
7779
7792
  const addFuzzyOption = (value) => {
7780
- var _a2;
7781
7793
  const { fuzzy } = props;
7782
- if (!fuzzy || !hasFuzzyOption()) {
7794
+ if (!fuzzy || hasFuzzyOption(value)) {
7783
7795
  return;
7784
7796
  }
7785
- if ((_a2 = searchModel.value[fuzzy.key]) == null ? void 0 : _a2.length) {
7786
- if (!searchModel.value[fuzzy.key].includes(value) && !fuzzy.single) {
7787
- searchModel.value[fuzzy.key].push(value);
7788
- resetSearch();
7789
- }
7790
- } else {
7797
+ if (!searchModel.value[fuzzy.key]) {
7791
7798
  searchModel.value[fuzzy.key] = [value];
7792
- resetSearch();
7799
+ } else {
7800
+ searchModel.value[fuzzy.key].push(value);
7793
7801
  }
7802
+ resetSearch();
7794
7803
  };
7795
7804
  const filteredKeys = computed(() => {
7796
7805
  if (type.value === "value") {
@@ -7839,7 +7848,6 @@ const _sfc_main$4 = defineComponent({
7839
7848
  searchModel.value[key] = [item.value];
7840
7849
  }
7841
7850
  resetSearch();
7842
- emit("search");
7843
7851
  };
7844
7852
  const handleEnter = () => {
7845
7853
  var _a2, _b2, _c, _d, _e, _f, _g, _h;
@@ -8018,9 +8026,12 @@ const _sfc_main$3 = defineComponent({
8018
8026
  if (searchModel.value[key].length === 0) {
8019
8027
  delete searchModel.value[key];
8020
8028
  }
8029
+ emit("search");
8021
8030
  };
8022
8031
  const clearFilter = () => {
8023
- searchModel.value = {};
8032
+ Object.keys(searchModel.value).forEach((key) => {
8033
+ delete searchModel.value[key];
8034
+ });
8024
8035
  emit("search");
8025
8036
  };
8026
8037
  return {