@dolusoft/vue3-datatable 1.8.17 → 1.8.19
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 +33 -45
- package/dist/vue3-datatable.js +34 -46
- package/package.json +1 -1
package/dist/vue3-datatable.cjs
CHANGED
|
@@ -29,9 +29,6 @@ function createFilterWrapper(filter, fn) {
|
|
|
29
29
|
}
|
|
30
30
|
return wrapper;
|
|
31
31
|
}
|
|
32
|
-
const bypassFilter = (invoke) => {
|
|
33
|
-
return invoke();
|
|
34
|
-
};
|
|
35
32
|
function debounceFilter(ms, options = {}) {
|
|
36
33
|
let timer;
|
|
37
34
|
let maxTimer;
|
|
@@ -142,20 +139,6 @@ function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnC
|
|
|
142
139
|
fn
|
|
143
140
|
);
|
|
144
141
|
}
|
|
145
|
-
function watchWithFilter(source, cb, options = {}) {
|
|
146
|
-
const {
|
|
147
|
-
eventFilter = bypassFilter,
|
|
148
|
-
...watchOptions
|
|
149
|
-
} = options;
|
|
150
|
-
return vue.watch(
|
|
151
|
-
source,
|
|
152
|
-
createFilterWrapper(
|
|
153
|
-
eventFilter,
|
|
154
|
-
cb
|
|
155
|
-
),
|
|
156
|
-
watchOptions
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
142
|
function tryOnMounted(fn, sync = true, target) {
|
|
160
143
|
const instance = getLifeCycleTarget();
|
|
161
144
|
if (instance)
|
|
@@ -165,21 +148,6 @@ function tryOnMounted(fn, sync = true, target) {
|
|
|
165
148
|
else
|
|
166
149
|
vue.nextTick(fn);
|
|
167
150
|
}
|
|
168
|
-
function watchDebounced(source, cb, options = {}) {
|
|
169
|
-
const {
|
|
170
|
-
debounce = 0,
|
|
171
|
-
maxWait = void 0,
|
|
172
|
-
...watchOptions
|
|
173
|
-
} = options;
|
|
174
|
-
return watchWithFilter(
|
|
175
|
-
source,
|
|
176
|
-
cb,
|
|
177
|
-
{
|
|
178
|
-
...watchOptions,
|
|
179
|
-
eventFilter: debounceFilter(debounce, { maxWait })
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
151
|
function unrefElement(elRef) {
|
|
184
152
|
var _a;
|
|
185
153
|
const plain = toValue(elRef);
|
|
@@ -3120,27 +3088,42 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3120
3088
|
filterInputs.value[col.field] = col.value || "";
|
|
3121
3089
|
}
|
|
3122
3090
|
watchedFields.value.add(col.field);
|
|
3123
|
-
|
|
3091
|
+
let debounceTimer = null;
|
|
3092
|
+
vue.watch(
|
|
3124
3093
|
() => filterInputs.value[col.field],
|
|
3125
3094
|
(newValue) => {
|
|
3126
3095
|
const column = columnsMap.value.get(col.field);
|
|
3127
3096
|
if (!column) return;
|
|
3128
3097
|
const isEmpty = newValue === "" || newValue === null || newValue === void 0;
|
|
3129
|
-
if (
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
column.value = isEmpty ? "" : newValue;
|
|
3098
|
+
if (debounceTimer) {
|
|
3099
|
+
clearTimeout(debounceTimer);
|
|
3100
|
+
debounceTimer = null;
|
|
3133
3101
|
}
|
|
3102
|
+
const processChange = () => {
|
|
3103
|
+
if (column.type === "string" || column.type === "String") {
|
|
3104
|
+
column.value = isEmpty ? "" : typeof newValue === "string" ? newValue.trim() : newValue;
|
|
3105
|
+
} else {
|
|
3106
|
+
column.value = isEmpty ? "" : newValue;
|
|
3107
|
+
}
|
|
3108
|
+
if (isEmpty) {
|
|
3109
|
+
column.condition = "";
|
|
3110
|
+
columnConditions.value[col.field] = "";
|
|
3111
|
+
console.log("🔴 [COLUMN-HEADER] CLEARED:", col.field, { value: column.value, condition: column.condition });
|
|
3112
|
+
} else if (!columnConditions.value[col.field]) {
|
|
3113
|
+
column.condition = "Equal";
|
|
3114
|
+
columnConditions.value[col.field] = "Equal";
|
|
3115
|
+
console.log("🟢 [COLUMN-HEADER] SET DEFAULT:", col.field, { value: column.value, condition: column.condition });
|
|
3116
|
+
} else {
|
|
3117
|
+
console.log("🟡 [COLUMN-HEADER] KEEP EXISTING:", col.field, { value: column.value, condition: column.condition });
|
|
3118
|
+
}
|
|
3119
|
+
emit("filterChange");
|
|
3120
|
+
};
|
|
3134
3121
|
if (isEmpty) {
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
column.condition = "Equal";
|
|
3139
|
-
columnConditions.value[col.field] = "Equal";
|
|
3122
|
+
processChange();
|
|
3123
|
+
} else {
|
|
3124
|
+
debounceTimer = setTimeout(processChange, 300);
|
|
3140
3125
|
}
|
|
3141
|
-
|
|
3142
|
-
},
|
|
3143
|
-
{ debounce: 300 }
|
|
3126
|
+
}
|
|
3144
3127
|
);
|
|
3145
3128
|
}
|
|
3146
3129
|
});
|
|
@@ -4351,6 +4334,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
4351
4334
|
const changeForServer = (changeType, isResetPage = false) => {
|
|
4352
4335
|
if (props.isServerMode) {
|
|
4353
4336
|
setDefaultCondition();
|
|
4337
|
+
const activeFilters = props.columns.filter((c) => c.value || c.condition);
|
|
4338
|
+
console.log("🔵 [CUSTOM-TABLE] changeForServer:", changeType, {
|
|
4339
|
+
activeFilters: activeFilters.map((c) => ({ field: c.field, value: c.value, condition: c.condition })),
|
|
4340
|
+
allColumns: props.columns.map((c) => ({ field: c.field, value: c.value, condition: c.condition }))
|
|
4341
|
+
});
|
|
4354
4342
|
const res = {
|
|
4355
4343
|
current_page: isResetPage ? 1 : currentPage.value,
|
|
4356
4344
|
pagesize: currentPageSize.value,
|
package/dist/vue3-datatable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRef, onMounted, nextTick, getCurrentScope, onScopeDispose, unref, getCurrentInstance,
|
|
1
|
+
import { isRef, onMounted, nextTick, getCurrentScope, onScopeDispose, unref, getCurrentInstance, computed, ref, watch, useSlots, onBeforeUnmount, provide, openBlock, createBlock, resolveDynamicComponent, inject, createElementBlock, normalizeStyle, renderSlot, h, defineComponent, toRef, Fragment, withModifiers, createVNode, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, withDirectives, renderList, vModelSelect, resolveComponent, createTextVNode, vModelText, vShow, withCtx, onUnmounted, createSlots, normalizeProps, guardReactiveProps, vModelCheckbox } from "vue";
|
|
2
2
|
function tryOnScopeDispose(fn) {
|
|
3
3
|
if (getCurrentScope()) {
|
|
4
4
|
onScopeDispose(fn);
|
|
@@ -28,9 +28,6 @@ function createFilterWrapper(filter, fn) {
|
|
|
28
28
|
}
|
|
29
29
|
return wrapper;
|
|
30
30
|
}
|
|
31
|
-
const bypassFilter = (invoke) => {
|
|
32
|
-
return invoke();
|
|
33
|
-
};
|
|
34
31
|
function debounceFilter(ms, options = {}) {
|
|
35
32
|
let timer;
|
|
36
33
|
let maxTimer;
|
|
@@ -141,20 +138,6 @@ function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnC
|
|
|
141
138
|
fn
|
|
142
139
|
);
|
|
143
140
|
}
|
|
144
|
-
function watchWithFilter(source, cb, options = {}) {
|
|
145
|
-
const {
|
|
146
|
-
eventFilter = bypassFilter,
|
|
147
|
-
...watchOptions
|
|
148
|
-
} = options;
|
|
149
|
-
return watch(
|
|
150
|
-
source,
|
|
151
|
-
createFilterWrapper(
|
|
152
|
-
eventFilter,
|
|
153
|
-
cb
|
|
154
|
-
),
|
|
155
|
-
watchOptions
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
141
|
function tryOnMounted(fn, sync = true, target) {
|
|
159
142
|
const instance = getLifeCycleTarget();
|
|
160
143
|
if (instance)
|
|
@@ -164,21 +147,6 @@ function tryOnMounted(fn, sync = true, target) {
|
|
|
164
147
|
else
|
|
165
148
|
nextTick(fn);
|
|
166
149
|
}
|
|
167
|
-
function watchDebounced(source, cb, options = {}) {
|
|
168
|
-
const {
|
|
169
|
-
debounce = 0,
|
|
170
|
-
maxWait = void 0,
|
|
171
|
-
...watchOptions
|
|
172
|
-
} = options;
|
|
173
|
-
return watchWithFilter(
|
|
174
|
-
source,
|
|
175
|
-
cb,
|
|
176
|
-
{
|
|
177
|
-
...watchOptions,
|
|
178
|
-
eventFilter: debounceFilter(debounce, { maxWait })
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
150
|
function unrefElement(elRef) {
|
|
183
151
|
var _a;
|
|
184
152
|
const plain = toValue(elRef);
|
|
@@ -3119,27 +3087,42 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3119
3087
|
filterInputs.value[col.field] = col.value || "";
|
|
3120
3088
|
}
|
|
3121
3089
|
watchedFields.value.add(col.field);
|
|
3122
|
-
|
|
3090
|
+
let debounceTimer = null;
|
|
3091
|
+
watch(
|
|
3123
3092
|
() => filterInputs.value[col.field],
|
|
3124
3093
|
(newValue) => {
|
|
3125
3094
|
const column = columnsMap.value.get(col.field);
|
|
3126
3095
|
if (!column) return;
|
|
3127
3096
|
const isEmpty = newValue === "" || newValue === null || newValue === void 0;
|
|
3128
|
-
if (
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
column.value = isEmpty ? "" : newValue;
|
|
3097
|
+
if (debounceTimer) {
|
|
3098
|
+
clearTimeout(debounceTimer);
|
|
3099
|
+
debounceTimer = null;
|
|
3132
3100
|
}
|
|
3101
|
+
const processChange = () => {
|
|
3102
|
+
if (column.type === "string" || column.type === "String") {
|
|
3103
|
+
column.value = isEmpty ? "" : typeof newValue === "string" ? newValue.trim() : newValue;
|
|
3104
|
+
} else {
|
|
3105
|
+
column.value = isEmpty ? "" : newValue;
|
|
3106
|
+
}
|
|
3107
|
+
if (isEmpty) {
|
|
3108
|
+
column.condition = "";
|
|
3109
|
+
columnConditions.value[col.field] = "";
|
|
3110
|
+
console.log("🔴 [COLUMN-HEADER] CLEARED:", col.field, { value: column.value, condition: column.condition });
|
|
3111
|
+
} else if (!columnConditions.value[col.field]) {
|
|
3112
|
+
column.condition = "Equal";
|
|
3113
|
+
columnConditions.value[col.field] = "Equal";
|
|
3114
|
+
console.log("🟢 [COLUMN-HEADER] SET DEFAULT:", col.field, { value: column.value, condition: column.condition });
|
|
3115
|
+
} else {
|
|
3116
|
+
console.log("🟡 [COLUMN-HEADER] KEEP EXISTING:", col.field, { value: column.value, condition: column.condition });
|
|
3117
|
+
}
|
|
3118
|
+
emit("filterChange");
|
|
3119
|
+
};
|
|
3133
3120
|
if (isEmpty) {
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
column.condition = "Equal";
|
|
3138
|
-
columnConditions.value[col.field] = "Equal";
|
|
3121
|
+
processChange();
|
|
3122
|
+
} else {
|
|
3123
|
+
debounceTimer = setTimeout(processChange, 300);
|
|
3139
3124
|
}
|
|
3140
|
-
|
|
3141
|
-
},
|
|
3142
|
-
{ debounce: 300 }
|
|
3125
|
+
}
|
|
3143
3126
|
);
|
|
3144
3127
|
}
|
|
3145
3128
|
});
|
|
@@ -4350,6 +4333,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4350
4333
|
const changeForServer = (changeType, isResetPage = false) => {
|
|
4351
4334
|
if (props.isServerMode) {
|
|
4352
4335
|
setDefaultCondition();
|
|
4336
|
+
const activeFilters = props.columns.filter((c) => c.value || c.condition);
|
|
4337
|
+
console.log("🔵 [CUSTOM-TABLE] changeForServer:", changeType, {
|
|
4338
|
+
activeFilters: activeFilters.map((c) => ({ field: c.field, value: c.value, condition: c.condition })),
|
|
4339
|
+
allColumns: props.columns.map((c) => ({ field: c.field, value: c.value, condition: c.condition }))
|
|
4340
|
+
});
|
|
4353
4341
|
const res = {
|
|
4354
4342
|
current_page: isResetPage ? 1 : currentPage.value,
|
|
4355
4343
|
pagesize: currentPageSize.value,
|