@dolusoft/vue3-datatable 1.8.28 → 1.8.30

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.
@@ -3165,6 +3165,31 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3165
3165
  },
3166
3166
  { immediate: true, deep: true }
3167
3167
  );
3168
+ vue.watch(
3169
+ () => {
3170
+ var _a, _b;
3171
+ return (_b = (_a = props.all) == null ? void 0 : _a.columns) == null ? void 0 : _b.map((col) => ({ field: col.field, value: col.value, condition: col.condition }));
3172
+ },
3173
+ (newValues) => {
3174
+ if (!newValues) return;
3175
+ newValues.forEach((colState) => {
3176
+ if (colState.field) {
3177
+ const currentInputValue = filterInputs.value[colState.field] ?? "";
3178
+ const newInputValue = colState.value ?? "";
3179
+ if (String(currentInputValue) !== String(newInputValue)) {
3180
+ filterInputs.value[colState.field] = newInputValue;
3181
+ }
3182
+ if (colState.condition) {
3183
+ const currentCondition = columnConditions.value[colState.field] ?? "";
3184
+ if (currentCondition !== colState.condition) {
3185
+ columnConditions.value[colState.field] = colState.condition;
3186
+ }
3187
+ }
3188
+ }
3189
+ });
3190
+ },
3191
+ { deep: true, immediate: true }
3192
+ );
3168
3193
  vue.onMounted(() => {
3169
3194
  setupColumnWatches();
3170
3195
  });
@@ -4111,15 +4136,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4111
4136
  * Set column filter value and optionally trigger filter
4112
4137
  * @param field - Column field name
4113
4138
  * @param value - Filter value
4114
- * @param condition - Filter condition (default: column's default condition)
4139
+ * @param condition - Filter condition (default: column type's default)
4115
4140
  * @param triggerFilter - Whether to trigger filterChange event (default: false)
4116
4141
  */
4117
4142
  setColumnFilter(field, value, condition, triggerFilter = false) {
4143
+ var _a2;
4118
4144
  const column = props.columns.find((col) => col.field === field);
4119
4145
  if (column) {
4120
4146
  column.value = value;
4121
4147
  if (condition) {
4122
4148
  column.condition = condition;
4149
+ } else {
4150
+ const type = ((_a2 = column.type) == null ? void 0 : _a2.toLowerCase()) || "string";
4151
+ column.condition = type === "string" ? "Contains" : "Equal";
4123
4152
  }
4124
4153
  updateHasAnyActiveFilter();
4125
4154
  if (triggerFilter) {
@@ -3164,6 +3164,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3164
3164
  },
3165
3165
  { immediate: true, deep: true }
3166
3166
  );
3167
+ watch(
3168
+ () => {
3169
+ var _a, _b;
3170
+ return (_b = (_a = props.all) == null ? void 0 : _a.columns) == null ? void 0 : _b.map((col) => ({ field: col.field, value: col.value, condition: col.condition }));
3171
+ },
3172
+ (newValues) => {
3173
+ if (!newValues) return;
3174
+ newValues.forEach((colState) => {
3175
+ if (colState.field) {
3176
+ const currentInputValue = filterInputs.value[colState.field] ?? "";
3177
+ const newInputValue = colState.value ?? "";
3178
+ if (String(currentInputValue) !== String(newInputValue)) {
3179
+ filterInputs.value[colState.field] = newInputValue;
3180
+ }
3181
+ if (colState.condition) {
3182
+ const currentCondition = columnConditions.value[colState.field] ?? "";
3183
+ if (currentCondition !== colState.condition) {
3184
+ columnConditions.value[colState.field] = colState.condition;
3185
+ }
3186
+ }
3187
+ }
3188
+ });
3189
+ },
3190
+ { deep: true, immediate: true }
3191
+ );
3167
3192
  onMounted(() => {
3168
3193
  setupColumnWatches();
3169
3194
  });
@@ -4110,15 +4135,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4110
4135
  * Set column filter value and optionally trigger filter
4111
4136
  * @param field - Column field name
4112
4137
  * @param value - Filter value
4113
- * @param condition - Filter condition (default: column's default condition)
4138
+ * @param condition - Filter condition (default: column type's default)
4114
4139
  * @param triggerFilter - Whether to trigger filterChange event (default: false)
4115
4140
  */
4116
4141
  setColumnFilter(field, value, condition, triggerFilter = false) {
4142
+ var _a2;
4117
4143
  const column = props.columns.find((col) => col.field === field);
4118
4144
  if (column) {
4119
4145
  column.value = value;
4120
4146
  if (condition) {
4121
4147
  column.condition = condition;
4148
+ } else {
4149
+ const type = ((_a2 = column.type) == null ? void 0 : _a2.toLowerCase()) || "string";
4150
+ column.condition = type === "string" ? "Contains" : "Equal";
4122
4151
  }
4123
4152
  updateHasAnyActiveFilter();
4124
4153
  if (triggerFilter) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/vue3-datatable",
3
- "version": "1.8.28",
3
+ "version": "1.8.30",
4
4
  "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
5
  "private": false,
6
6
  "type": "module",