@dolusoft/vue3-datatable 1.8.50 → 1.8.51
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 +105 -8
- package/dist/vue3-datatable.js +105 -8
- package/package.json +1 -1
package/dist/vue3-datatable.cjs
CHANGED
|
@@ -5259,6 +5259,75 @@ function _sfc_render(_ctx, _cache) {
|
|
|
5259
5259
|
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$2);
|
|
5260
5260
|
}
|
|
5261
5261
|
const iconFilter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
|
|
5262
|
+
function parseSingleSegment(input) {
|
|
5263
|
+
let value = input.trim();
|
|
5264
|
+
if (value === "") return null;
|
|
5265
|
+
const negated = value.startsWith("!");
|
|
5266
|
+
if (negated) {
|
|
5267
|
+
value = value.substring(1);
|
|
5268
|
+
}
|
|
5269
|
+
if (value === "" || value === "*" || /^\*+$/.test(value)) {
|
|
5270
|
+
return null;
|
|
5271
|
+
}
|
|
5272
|
+
const startsWithStar = value.startsWith("*");
|
|
5273
|
+
const endsWithStar = value.endsWith("*");
|
|
5274
|
+
let condition;
|
|
5275
|
+
let operatorDetected = negated;
|
|
5276
|
+
if (startsWithStar && endsWithStar && value.length > 1) {
|
|
5277
|
+
value = value.substring(1, value.length - 1);
|
|
5278
|
+
condition = negated ? "NotContains" : "Contains";
|
|
5279
|
+
operatorDetected = true;
|
|
5280
|
+
} else if (endsWithStar) {
|
|
5281
|
+
value = value.substring(0, value.length - 1);
|
|
5282
|
+
condition = negated ? "NotContains" : "StartsWith";
|
|
5283
|
+
operatorDetected = true;
|
|
5284
|
+
} else if (startsWithStar) {
|
|
5285
|
+
value = value.substring(1);
|
|
5286
|
+
condition = negated ? "NotContains" : "EndsWith";
|
|
5287
|
+
operatorDetected = true;
|
|
5288
|
+
} else if (negated) {
|
|
5289
|
+
condition = "NotEqual";
|
|
5290
|
+
} else {
|
|
5291
|
+
condition = "Equal";
|
|
5292
|
+
}
|
|
5293
|
+
if (value.trim() === "") {
|
|
5294
|
+
return null;
|
|
5295
|
+
}
|
|
5296
|
+
return {
|
|
5297
|
+
rule: { value: value.trim(), condition },
|
|
5298
|
+
operatorDetected
|
|
5299
|
+
};
|
|
5300
|
+
}
|
|
5301
|
+
function parseFilterInput(rawInput) {
|
|
5302
|
+
const empty = { rules: [], displayCondition: "", isOperatorDetected: false };
|
|
5303
|
+
if (!rawInput || typeof rawInput !== "string") {
|
|
5304
|
+
return empty;
|
|
5305
|
+
}
|
|
5306
|
+
const trimmed = rawInput.trim();
|
|
5307
|
+
if (trimmed === "") {
|
|
5308
|
+
return empty;
|
|
5309
|
+
}
|
|
5310
|
+
const segments = trimmed.split(",");
|
|
5311
|
+
const rules = [];
|
|
5312
|
+
let anyOperatorDetected = false;
|
|
5313
|
+
for (const segment of segments) {
|
|
5314
|
+
const result = parseSingleSegment(segment);
|
|
5315
|
+
if (result) {
|
|
5316
|
+
rules.push(result.rule);
|
|
5317
|
+
if (result.operatorDetected) {
|
|
5318
|
+
anyOperatorDetected = true;
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
if (rules.length === 0) {
|
|
5323
|
+
return empty;
|
|
5324
|
+
}
|
|
5325
|
+
return {
|
|
5326
|
+
rules,
|
|
5327
|
+
displayCondition: rules[0].condition,
|
|
5328
|
+
isOperatorDetected: anyOperatorDetected
|
|
5329
|
+
};
|
|
5330
|
+
}
|
|
5262
5331
|
const _hoisted_1$2 = { key: "hdrrow" };
|
|
5263
5332
|
const _hoisted_2$2 = { class: "bh-checkbox" };
|
|
5264
5333
|
const _hoisted_3$1 = {
|
|
@@ -5474,13 +5543,29 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5474
5543
|
}
|
|
5475
5544
|
const processChange = () => {
|
|
5476
5545
|
debounceTimers.set(col.field, null);
|
|
5477
|
-
if (
|
|
5478
|
-
column.value =
|
|
5546
|
+
if (isEmpty) {
|
|
5547
|
+
column.value = "";
|
|
5548
|
+
column.parsedFilterRules = void 0;
|
|
5549
|
+
emit("filterChange");
|
|
5550
|
+
return;
|
|
5551
|
+
}
|
|
5552
|
+
if ((column.type === "string" || column.type === "String") && typeof newValue === "string") {
|
|
5553
|
+
const parsed = parseFilterInput(newValue);
|
|
5554
|
+
if (parsed.isOperatorDetected && parsed.rules.length > 0) {
|
|
5555
|
+
column.value = parsed.rules[0].value;
|
|
5556
|
+
column.condition = parsed.rules[0].condition;
|
|
5557
|
+
columnConditions.value[col.field] = parsed.rules[0].condition;
|
|
5558
|
+
column.parsedFilterRules = parsed.rules.length > 1 ? parsed.rules : void 0;
|
|
5559
|
+
emit("filterChange");
|
|
5560
|
+
return;
|
|
5561
|
+
}
|
|
5562
|
+
column.value = newValue.trim();
|
|
5563
|
+
column.parsedFilterRules = void 0;
|
|
5479
5564
|
} else {
|
|
5480
|
-
column.value =
|
|
5565
|
+
column.value = newValue;
|
|
5566
|
+
column.parsedFilterRules = void 0;
|
|
5481
5567
|
}
|
|
5482
|
-
if (
|
|
5483
|
-
else if (!columnConditions.value[col.field]) {
|
|
5568
|
+
if (!columnConditions.value[col.field]) {
|
|
5484
5569
|
column.condition = "Equal";
|
|
5485
5570
|
columnConditions.value[col.field] = "Equal";
|
|
5486
5571
|
} else {
|
|
@@ -5539,6 +5624,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5539
5624
|
if (col.filter) {
|
|
5540
5625
|
col.value = "";
|
|
5541
5626
|
col.condition = "";
|
|
5627
|
+
col.parsedFilterRules = void 0;
|
|
5542
5628
|
}
|
|
5543
5629
|
});
|
|
5544
5630
|
}
|
|
@@ -5637,13 +5723,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5637
5723
|
const type = ((_a = col.type) == null ? void 0 : _a.toLowerCase()) || "string";
|
|
5638
5724
|
const conditions = FILTER_CONDITIONS[type] || FILTER_CONDITIONS.string;
|
|
5639
5725
|
const found = conditions.find((c2) => c2.value === condition);
|
|
5726
|
+
let label = "";
|
|
5640
5727
|
if (found) {
|
|
5641
5728
|
if (props.columnFilterLang && props.columnFilterLang[condition]) {
|
|
5642
|
-
|
|
5729
|
+
label = props.columnFilterLang[condition];
|
|
5730
|
+
} else {
|
|
5731
|
+
label = found.label;
|
|
5643
5732
|
}
|
|
5644
|
-
|
|
5733
|
+
} else {
|
|
5734
|
+
label = condition;
|
|
5735
|
+
}
|
|
5736
|
+
if (col.parsedFilterRules && col.parsedFilterRules.length > 1) {
|
|
5737
|
+
label += ` (${col.parsedFilterRules.length})`;
|
|
5645
5738
|
}
|
|
5646
|
-
return
|
|
5739
|
+
return label;
|
|
5647
5740
|
};
|
|
5648
5741
|
const handleConditionChange = (field, condition) => {
|
|
5649
5742
|
const column = columnsMap.value.get(field);
|
|
@@ -5657,6 +5750,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
5657
5750
|
filterInputs.value[col.field] = "";
|
|
5658
5751
|
col.value = "";
|
|
5659
5752
|
col.condition = "";
|
|
5753
|
+
col.parsedFilterRules = void 0;
|
|
5660
5754
|
columnConditions.value[col.field] = "";
|
|
5661
5755
|
if (props.currentSortColumn === col.field) {
|
|
5662
5756
|
emit("sortChange", props.all.sortColumn || col.field, "asc");
|
|
@@ -6661,6 +6755,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
6661
6755
|
if (column) {
|
|
6662
6756
|
column.value = value;
|
|
6663
6757
|
column.condition = condition || "Equal";
|
|
6758
|
+
column.parsedFilterRules = void 0;
|
|
6664
6759
|
filterUpdateTrigger.value++;
|
|
6665
6760
|
updateHasAnyActiveFilter();
|
|
6666
6761
|
if (triggerFilter) {
|
|
@@ -6951,6 +7046,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
6951
7046
|
selectAll(false);
|
|
6952
7047
|
for (let i2 = 0; i2 < props.columns.length; i2++) {
|
|
6953
7048
|
props.columns[i2].value = "";
|
|
7049
|
+
props.columns[i2].parsedFilterRules = void 0;
|
|
6954
7050
|
}
|
|
6955
7051
|
currentSearch.value = "";
|
|
6956
7052
|
currentPageSize.value = oldPageSize;
|
|
@@ -7011,6 +7107,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
7011
7107
|
if (col.filter) {
|
|
7012
7108
|
col.value = "";
|
|
7013
7109
|
col.condition = "";
|
|
7110
|
+
col.parsedFilterRules = void 0;
|
|
7014
7111
|
}
|
|
7015
7112
|
}
|
|
7016
7113
|
updateHasAnyActiveFilter();
|
package/dist/vue3-datatable.js
CHANGED
|
@@ -5258,6 +5258,75 @@ function _sfc_render(_ctx, _cache) {
|
|
|
5258
5258
|
return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$2);
|
|
5259
5259
|
}
|
|
5260
5260
|
const iconFilter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
|
|
5261
|
+
function parseSingleSegment(input) {
|
|
5262
|
+
let value = input.trim();
|
|
5263
|
+
if (value === "") return null;
|
|
5264
|
+
const negated = value.startsWith("!");
|
|
5265
|
+
if (negated) {
|
|
5266
|
+
value = value.substring(1);
|
|
5267
|
+
}
|
|
5268
|
+
if (value === "" || value === "*" || /^\*+$/.test(value)) {
|
|
5269
|
+
return null;
|
|
5270
|
+
}
|
|
5271
|
+
const startsWithStar = value.startsWith("*");
|
|
5272
|
+
const endsWithStar = value.endsWith("*");
|
|
5273
|
+
let condition;
|
|
5274
|
+
let operatorDetected = negated;
|
|
5275
|
+
if (startsWithStar && endsWithStar && value.length > 1) {
|
|
5276
|
+
value = value.substring(1, value.length - 1);
|
|
5277
|
+
condition = negated ? "NotContains" : "Contains";
|
|
5278
|
+
operatorDetected = true;
|
|
5279
|
+
} else if (endsWithStar) {
|
|
5280
|
+
value = value.substring(0, value.length - 1);
|
|
5281
|
+
condition = negated ? "NotContains" : "StartsWith";
|
|
5282
|
+
operatorDetected = true;
|
|
5283
|
+
} else if (startsWithStar) {
|
|
5284
|
+
value = value.substring(1);
|
|
5285
|
+
condition = negated ? "NotContains" : "EndsWith";
|
|
5286
|
+
operatorDetected = true;
|
|
5287
|
+
} else if (negated) {
|
|
5288
|
+
condition = "NotEqual";
|
|
5289
|
+
} else {
|
|
5290
|
+
condition = "Equal";
|
|
5291
|
+
}
|
|
5292
|
+
if (value.trim() === "") {
|
|
5293
|
+
return null;
|
|
5294
|
+
}
|
|
5295
|
+
return {
|
|
5296
|
+
rule: { value: value.trim(), condition },
|
|
5297
|
+
operatorDetected
|
|
5298
|
+
};
|
|
5299
|
+
}
|
|
5300
|
+
function parseFilterInput(rawInput) {
|
|
5301
|
+
const empty = { rules: [], displayCondition: "", isOperatorDetected: false };
|
|
5302
|
+
if (!rawInput || typeof rawInput !== "string") {
|
|
5303
|
+
return empty;
|
|
5304
|
+
}
|
|
5305
|
+
const trimmed = rawInput.trim();
|
|
5306
|
+
if (trimmed === "") {
|
|
5307
|
+
return empty;
|
|
5308
|
+
}
|
|
5309
|
+
const segments = trimmed.split(",");
|
|
5310
|
+
const rules = [];
|
|
5311
|
+
let anyOperatorDetected = false;
|
|
5312
|
+
for (const segment of segments) {
|
|
5313
|
+
const result = parseSingleSegment(segment);
|
|
5314
|
+
if (result) {
|
|
5315
|
+
rules.push(result.rule);
|
|
5316
|
+
if (result.operatorDetected) {
|
|
5317
|
+
anyOperatorDetected = true;
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
if (rules.length === 0) {
|
|
5322
|
+
return empty;
|
|
5323
|
+
}
|
|
5324
|
+
return {
|
|
5325
|
+
rules,
|
|
5326
|
+
displayCondition: rules[0].condition,
|
|
5327
|
+
isOperatorDetected: anyOperatorDetected
|
|
5328
|
+
};
|
|
5329
|
+
}
|
|
5261
5330
|
const _hoisted_1$2 = { key: "hdrrow" };
|
|
5262
5331
|
const _hoisted_2$2 = { class: "bh-checkbox" };
|
|
5263
5332
|
const _hoisted_3$1 = {
|
|
@@ -5473,13 +5542,29 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5473
5542
|
}
|
|
5474
5543
|
const processChange = () => {
|
|
5475
5544
|
debounceTimers.set(col.field, null);
|
|
5476
|
-
if (
|
|
5477
|
-
column.value =
|
|
5545
|
+
if (isEmpty) {
|
|
5546
|
+
column.value = "";
|
|
5547
|
+
column.parsedFilterRules = void 0;
|
|
5548
|
+
emit("filterChange");
|
|
5549
|
+
return;
|
|
5550
|
+
}
|
|
5551
|
+
if ((column.type === "string" || column.type === "String") && typeof newValue === "string") {
|
|
5552
|
+
const parsed = parseFilterInput(newValue);
|
|
5553
|
+
if (parsed.isOperatorDetected && parsed.rules.length > 0) {
|
|
5554
|
+
column.value = parsed.rules[0].value;
|
|
5555
|
+
column.condition = parsed.rules[0].condition;
|
|
5556
|
+
columnConditions.value[col.field] = parsed.rules[0].condition;
|
|
5557
|
+
column.parsedFilterRules = parsed.rules.length > 1 ? parsed.rules : void 0;
|
|
5558
|
+
emit("filterChange");
|
|
5559
|
+
return;
|
|
5560
|
+
}
|
|
5561
|
+
column.value = newValue.trim();
|
|
5562
|
+
column.parsedFilterRules = void 0;
|
|
5478
5563
|
} else {
|
|
5479
|
-
column.value =
|
|
5564
|
+
column.value = newValue;
|
|
5565
|
+
column.parsedFilterRules = void 0;
|
|
5480
5566
|
}
|
|
5481
|
-
if (
|
|
5482
|
-
else if (!columnConditions.value[col.field]) {
|
|
5567
|
+
if (!columnConditions.value[col.field]) {
|
|
5483
5568
|
column.condition = "Equal";
|
|
5484
5569
|
columnConditions.value[col.field] = "Equal";
|
|
5485
5570
|
} else {
|
|
@@ -5538,6 +5623,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5538
5623
|
if (col.filter) {
|
|
5539
5624
|
col.value = "";
|
|
5540
5625
|
col.condition = "";
|
|
5626
|
+
col.parsedFilterRules = void 0;
|
|
5541
5627
|
}
|
|
5542
5628
|
});
|
|
5543
5629
|
}
|
|
@@ -5636,13 +5722,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5636
5722
|
const type = ((_a = col.type) == null ? void 0 : _a.toLowerCase()) || "string";
|
|
5637
5723
|
const conditions = FILTER_CONDITIONS[type] || FILTER_CONDITIONS.string;
|
|
5638
5724
|
const found = conditions.find((c2) => c2.value === condition);
|
|
5725
|
+
let label = "";
|
|
5639
5726
|
if (found) {
|
|
5640
5727
|
if (props.columnFilterLang && props.columnFilterLang[condition]) {
|
|
5641
|
-
|
|
5728
|
+
label = props.columnFilterLang[condition];
|
|
5729
|
+
} else {
|
|
5730
|
+
label = found.label;
|
|
5642
5731
|
}
|
|
5643
|
-
|
|
5732
|
+
} else {
|
|
5733
|
+
label = condition;
|
|
5734
|
+
}
|
|
5735
|
+
if (col.parsedFilterRules && col.parsedFilterRules.length > 1) {
|
|
5736
|
+
label += ` (${col.parsedFilterRules.length})`;
|
|
5644
5737
|
}
|
|
5645
|
-
return
|
|
5738
|
+
return label;
|
|
5646
5739
|
};
|
|
5647
5740
|
const handleConditionChange = (field, condition) => {
|
|
5648
5741
|
const column = columnsMap.value.get(field);
|
|
@@ -5656,6 +5749,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5656
5749
|
filterInputs.value[col.field] = "";
|
|
5657
5750
|
col.value = "";
|
|
5658
5751
|
col.condition = "";
|
|
5752
|
+
col.parsedFilterRules = void 0;
|
|
5659
5753
|
columnConditions.value[col.field] = "";
|
|
5660
5754
|
if (props.currentSortColumn === col.field) {
|
|
5661
5755
|
emit("sortChange", props.all.sortColumn || col.field, "asc");
|
|
@@ -6660,6 +6754,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
6660
6754
|
if (column) {
|
|
6661
6755
|
column.value = value;
|
|
6662
6756
|
column.condition = condition || "Equal";
|
|
6757
|
+
column.parsedFilterRules = void 0;
|
|
6663
6758
|
filterUpdateTrigger.value++;
|
|
6664
6759
|
updateHasAnyActiveFilter();
|
|
6665
6760
|
if (triggerFilter) {
|
|
@@ -6950,6 +7045,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
6950
7045
|
selectAll(false);
|
|
6951
7046
|
for (let i2 = 0; i2 < props.columns.length; i2++) {
|
|
6952
7047
|
props.columns[i2].value = "";
|
|
7048
|
+
props.columns[i2].parsedFilterRules = void 0;
|
|
6953
7049
|
}
|
|
6954
7050
|
currentSearch.value = "";
|
|
6955
7051
|
currentPageSize.value = oldPageSize;
|
|
@@ -7010,6 +7106,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
7010
7106
|
if (col.filter) {
|
|
7011
7107
|
col.value = "";
|
|
7012
7108
|
col.condition = "";
|
|
7109
|
+
col.parsedFilterRules = void 0;
|
|
7013
7110
|
}
|
|
7014
7111
|
}
|
|
7015
7112
|
updateHasAnyActiveFilter();
|