@dolusoft/vue3-datatable 1.8.30 → 1.8.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/vue3-datatable.cjs +36 -13
- package/dist/vue3-datatable.js +36 -13
- package/package.json +1 -1
package/dist/vue3-datatable.cjs
CHANGED
|
@@ -3043,7 +3043,8 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3043
3043
|
"columnFilterLang",
|
|
3044
3044
|
"hasFilterDatetimeSlot",
|
|
3045
3045
|
"showClearAllButton",
|
|
3046
|
-
"hasAnyActiveFilter"
|
|
3046
|
+
"hasAnyActiveFilter",
|
|
3047
|
+
"filterUpdateTrigger"
|
|
3047
3048
|
],
|
|
3048
3049
|
emits: [
|
|
3049
3050
|
"selectAll",
|
|
@@ -3176,20 +3177,40 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3176
3177
|
if (colState.field) {
|
|
3177
3178
|
const currentInputValue = filterInputs.value[colState.field] ?? "";
|
|
3178
3179
|
const newInputValue = colState.value ?? "";
|
|
3180
|
+
const hasValue = newInputValue !== "" && newInputValue !== null && newInputValue !== void 0;
|
|
3179
3181
|
if (String(currentInputValue) !== String(newInputValue)) {
|
|
3180
3182
|
filterInputs.value[colState.field] = newInputValue;
|
|
3181
3183
|
}
|
|
3182
|
-
if (colState.condition) {
|
|
3184
|
+
if (hasValue && colState.condition) {
|
|
3183
3185
|
const currentCondition = columnConditions.value[colState.field] ?? "";
|
|
3184
3186
|
if (currentCondition !== colState.condition) {
|
|
3185
3187
|
columnConditions.value[colState.field] = colState.condition;
|
|
3186
3188
|
}
|
|
3189
|
+
} else if (!hasValue) {
|
|
3190
|
+
columnConditions.value[colState.field] = "";
|
|
3187
3191
|
}
|
|
3188
3192
|
}
|
|
3189
3193
|
});
|
|
3190
3194
|
},
|
|
3191
3195
|
{ deep: true, immediate: true }
|
|
3192
3196
|
);
|
|
3197
|
+
vue.watch(
|
|
3198
|
+
() => props.filterUpdateTrigger,
|
|
3199
|
+
() => {
|
|
3200
|
+
var _a;
|
|
3201
|
+
if (!((_a = props.all) == null ? void 0 : _a.columns)) return;
|
|
3202
|
+
props.all.columns.forEach((col) => {
|
|
3203
|
+
if (col.field) {
|
|
3204
|
+
const colValue = col.value ?? "";
|
|
3205
|
+
const hasValue = colValue !== "" && colValue !== null && colValue !== void 0;
|
|
3206
|
+
filterInputs.value[col.field] = colValue;
|
|
3207
|
+
if (hasValue && col.condition) {
|
|
3208
|
+
columnConditions.value[col.field] = col.condition;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
});
|
|
3212
|
+
}
|
|
3213
|
+
);
|
|
3193
3214
|
vue.onMounted(() => {
|
|
3194
3215
|
setupColumnWatches();
|
|
3195
3216
|
});
|
|
@@ -3800,7 +3821,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3800
3821
|
item.search = item.search !== void 0 ? item.search : true;
|
|
3801
3822
|
item.sort = item.sort !== void 0 ? item.sort : true;
|
|
3802
3823
|
item.html = item.html !== void 0 ? item.html : false;
|
|
3803
|
-
item.
|
|
3824
|
+
if (item.value !== void 0 && item.value !== null && item.value !== "") {
|
|
3825
|
+
item.condition = item.condition || "Equal";
|
|
3826
|
+
} else {
|
|
3827
|
+
item.condition = "";
|
|
3828
|
+
}
|
|
3804
3829
|
}
|
|
3805
3830
|
const filterItems = vue.ref([]);
|
|
3806
3831
|
const currentPage = vue.ref(props.page);
|
|
@@ -3819,6 +3844,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3819
3844
|
const currentSearch = vue.ref(props.search);
|
|
3820
3845
|
JSON.parse(JSON.stringify(props.columns));
|
|
3821
3846
|
const isOpenFilter = vue.ref(null);
|
|
3847
|
+
const filterUpdateTrigger = vue.ref(0);
|
|
3822
3848
|
const timer = vue.ref(null);
|
|
3823
3849
|
let clickCount = vue.ref(0);
|
|
3824
3850
|
const delay = vue.ref(230);
|
|
@@ -4136,20 +4162,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4136
4162
|
* Set column filter value and optionally trigger filter
|
|
4137
4163
|
* @param field - Column field name
|
|
4138
4164
|
* @param value - Filter value
|
|
4139
|
-
* @param condition - Filter condition (default:
|
|
4165
|
+
* @param condition - Filter condition (default: Equal)
|
|
4140
4166
|
* @param triggerFilter - Whether to trigger filterChange event (default: false)
|
|
4141
4167
|
*/
|
|
4142
4168
|
setColumnFilter(field, value, condition, triggerFilter = false) {
|
|
4143
|
-
var _a2;
|
|
4144
4169
|
const column = props.columns.find((col) => col.field === field);
|
|
4145
4170
|
if (column) {
|
|
4146
4171
|
column.value = value;
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
} else {
|
|
4150
|
-
const type = ((_a2 = column.type) == null ? void 0 : _a2.toLowerCase()) || "string";
|
|
4151
|
-
column.condition = type === "string" ? "Contains" : "Equal";
|
|
4152
|
-
}
|
|
4172
|
+
column.condition = condition || "Equal";
|
|
4173
|
+
filterUpdateTrigger.value++;
|
|
4153
4174
|
updateHasAnyActiveFilter();
|
|
4154
4175
|
if (triggerFilter) {
|
|
4155
4176
|
filterChange();
|
|
@@ -4659,6 +4680,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4659
4680
|
hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
|
|
4660
4681
|
showClearAllButton: props.showClearAllButton,
|
|
4661
4682
|
hasAnyActiveFilter: hasAnyActiveFilter.value,
|
|
4683
|
+
filterUpdateTrigger: filterUpdateTrigger.value,
|
|
4662
4684
|
onSelectAll: selectAll,
|
|
4663
4685
|
onSortChange: sortChange,
|
|
4664
4686
|
onFilterChange: filterChange,
|
|
@@ -4673,7 +4695,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4673
4695
|
]),
|
|
4674
4696
|
key: "0"
|
|
4675
4697
|
} : void 0
|
|
4676
|
-
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
|
|
4698
|
+
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter", "filterUpdateTrigger"])
|
|
4677
4699
|
], 2),
|
|
4678
4700
|
vue.createElementVNode("tbody", null, [
|
|
4679
4701
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filterItems.value, (item, i) => {
|
|
@@ -4932,6 +4954,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4932
4954
|
hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
|
|
4933
4955
|
showClearAllButton: props.showClearAllButton,
|
|
4934
4956
|
hasAnyActiveFilter: hasAnyActiveFilter.value,
|
|
4957
|
+
filterUpdateTrigger: filterUpdateTrigger.value,
|
|
4935
4958
|
onSelectAll: selectAll,
|
|
4936
4959
|
onSortChange: sortChange,
|
|
4937
4960
|
onFilterChange: filterChange,
|
|
@@ -4946,7 +4969,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4946
4969
|
]),
|
|
4947
4970
|
key: "0"
|
|
4948
4971
|
} : void 0
|
|
4949
|
-
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
|
|
4972
|
+
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter", "filterUpdateTrigger"])
|
|
4950
4973
|
], 2),
|
|
4951
4974
|
vue.createElementVNode("tbody", null, [
|
|
4952
4975
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filterItems.value, (item, i) => {
|
package/dist/vue3-datatable.js
CHANGED
|
@@ -3042,7 +3042,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3042
3042
|
"columnFilterLang",
|
|
3043
3043
|
"hasFilterDatetimeSlot",
|
|
3044
3044
|
"showClearAllButton",
|
|
3045
|
-
"hasAnyActiveFilter"
|
|
3045
|
+
"hasAnyActiveFilter",
|
|
3046
|
+
"filterUpdateTrigger"
|
|
3046
3047
|
],
|
|
3047
3048
|
emits: [
|
|
3048
3049
|
"selectAll",
|
|
@@ -3175,20 +3176,40 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3175
3176
|
if (colState.field) {
|
|
3176
3177
|
const currentInputValue = filterInputs.value[colState.field] ?? "";
|
|
3177
3178
|
const newInputValue = colState.value ?? "";
|
|
3179
|
+
const hasValue = newInputValue !== "" && newInputValue !== null && newInputValue !== void 0;
|
|
3178
3180
|
if (String(currentInputValue) !== String(newInputValue)) {
|
|
3179
3181
|
filterInputs.value[colState.field] = newInputValue;
|
|
3180
3182
|
}
|
|
3181
|
-
if (colState.condition) {
|
|
3183
|
+
if (hasValue && colState.condition) {
|
|
3182
3184
|
const currentCondition = columnConditions.value[colState.field] ?? "";
|
|
3183
3185
|
if (currentCondition !== colState.condition) {
|
|
3184
3186
|
columnConditions.value[colState.field] = colState.condition;
|
|
3185
3187
|
}
|
|
3188
|
+
} else if (!hasValue) {
|
|
3189
|
+
columnConditions.value[colState.field] = "";
|
|
3186
3190
|
}
|
|
3187
3191
|
}
|
|
3188
3192
|
});
|
|
3189
3193
|
},
|
|
3190
3194
|
{ deep: true, immediate: true }
|
|
3191
3195
|
);
|
|
3196
|
+
watch(
|
|
3197
|
+
() => props.filterUpdateTrigger,
|
|
3198
|
+
() => {
|
|
3199
|
+
var _a;
|
|
3200
|
+
if (!((_a = props.all) == null ? void 0 : _a.columns)) return;
|
|
3201
|
+
props.all.columns.forEach((col) => {
|
|
3202
|
+
if (col.field) {
|
|
3203
|
+
const colValue = col.value ?? "";
|
|
3204
|
+
const hasValue = colValue !== "" && colValue !== null && colValue !== void 0;
|
|
3205
|
+
filterInputs.value[col.field] = colValue;
|
|
3206
|
+
if (hasValue && col.condition) {
|
|
3207
|
+
columnConditions.value[col.field] = col.condition;
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
);
|
|
3192
3213
|
onMounted(() => {
|
|
3193
3214
|
setupColumnWatches();
|
|
3194
3215
|
});
|
|
@@ -3799,7 +3820,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3799
3820
|
item.search = item.search !== void 0 ? item.search : true;
|
|
3800
3821
|
item.sort = item.sort !== void 0 ? item.sort : true;
|
|
3801
3822
|
item.html = item.html !== void 0 ? item.html : false;
|
|
3802
|
-
item.
|
|
3823
|
+
if (item.value !== void 0 && item.value !== null && item.value !== "") {
|
|
3824
|
+
item.condition = item.condition || "Equal";
|
|
3825
|
+
} else {
|
|
3826
|
+
item.condition = "";
|
|
3827
|
+
}
|
|
3803
3828
|
}
|
|
3804
3829
|
const filterItems = ref([]);
|
|
3805
3830
|
const currentPage = ref(props.page);
|
|
@@ -3818,6 +3843,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3818
3843
|
const currentSearch = ref(props.search);
|
|
3819
3844
|
JSON.parse(JSON.stringify(props.columns));
|
|
3820
3845
|
const isOpenFilter = ref(null);
|
|
3846
|
+
const filterUpdateTrigger = ref(0);
|
|
3821
3847
|
const timer = ref(null);
|
|
3822
3848
|
let clickCount = ref(0);
|
|
3823
3849
|
const delay = ref(230);
|
|
@@ -4135,20 +4161,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4135
4161
|
* Set column filter value and optionally trigger filter
|
|
4136
4162
|
* @param field - Column field name
|
|
4137
4163
|
* @param value - Filter value
|
|
4138
|
-
* @param condition - Filter condition (default:
|
|
4164
|
+
* @param condition - Filter condition (default: Equal)
|
|
4139
4165
|
* @param triggerFilter - Whether to trigger filterChange event (default: false)
|
|
4140
4166
|
*/
|
|
4141
4167
|
setColumnFilter(field, value, condition, triggerFilter = false) {
|
|
4142
|
-
var _a2;
|
|
4143
4168
|
const column = props.columns.find((col) => col.field === field);
|
|
4144
4169
|
if (column) {
|
|
4145
4170
|
column.value = value;
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
} else {
|
|
4149
|
-
const type = ((_a2 = column.type) == null ? void 0 : _a2.toLowerCase()) || "string";
|
|
4150
|
-
column.condition = type === "string" ? "Contains" : "Equal";
|
|
4151
|
-
}
|
|
4171
|
+
column.condition = condition || "Equal";
|
|
4172
|
+
filterUpdateTrigger.value++;
|
|
4152
4173
|
updateHasAnyActiveFilter();
|
|
4153
4174
|
if (triggerFilter) {
|
|
4154
4175
|
filterChange();
|
|
@@ -4658,6 +4679,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4658
4679
|
hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
|
|
4659
4680
|
showClearAllButton: props.showClearAllButton,
|
|
4660
4681
|
hasAnyActiveFilter: hasAnyActiveFilter.value,
|
|
4682
|
+
filterUpdateTrigger: filterUpdateTrigger.value,
|
|
4661
4683
|
onSelectAll: selectAll,
|
|
4662
4684
|
onSortChange: sortChange,
|
|
4663
4685
|
onFilterChange: filterChange,
|
|
@@ -4672,7 +4694,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4672
4694
|
]),
|
|
4673
4695
|
key: "0"
|
|
4674
4696
|
} : void 0
|
|
4675
|
-
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
|
|
4697
|
+
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter", "filterUpdateTrigger"])
|
|
4676
4698
|
], 2),
|
|
4677
4699
|
createElementVNode("tbody", null, [
|
|
4678
4700
|
(openBlock(true), createElementBlock(Fragment, null, renderList(filterItems.value, (item, i) => {
|
|
@@ -4931,6 +4953,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4931
4953
|
hasFilterDatetimeSlot: hasFilterDatetimeSlot.value,
|
|
4932
4954
|
showClearAllButton: props.showClearAllButton,
|
|
4933
4955
|
hasAnyActiveFilter: hasAnyActiveFilter.value,
|
|
4956
|
+
filterUpdateTrigger: filterUpdateTrigger.value,
|
|
4934
4957
|
onSelectAll: selectAll,
|
|
4935
4958
|
onSortChange: sortChange,
|
|
4936
4959
|
onFilterChange: filterChange,
|
|
@@ -4945,7 +4968,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4945
4968
|
]),
|
|
4946
4969
|
key: "0"
|
|
4947
4970
|
} : void 0
|
|
4948
|
-
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter"])
|
|
4971
|
+
]), 1032, ["expandedrows", "currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang", "hasFilterDatetimeSlot", "showClearAllButton", "hasAnyActiveFilter", "filterUpdateTrigger"])
|
|
4949
4972
|
], 2),
|
|
4950
4973
|
createElementVNode("tbody", null, [
|
|
4951
4974
|
(openBlock(true), createElementBlock(Fragment, null, renderList(filterItems.value, (item, i) => {
|