@ishibashi0112/spreadsheet-grid-core 0.62.0 → 0.64.0
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/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.d.ts +1 -0
- package/dist/controllers/autoHeightMeasurer.js +59 -48
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +119 -115
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +2 -0
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +2 -0
- package/dist/controllers/detailTabOrder.cjs +1 -0
- package/dist/controllers/detailTabOrder.d.ts +4 -0
- package/dist/controllers/detailTabOrder.js +33 -0
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +2 -0
- package/dist/controllers/editController.js +2 -2
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +119 -117
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.d.ts +1 -0
- package/dist/controllers/filterPopoverController.js +4 -2
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +1 -1
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +2 -0
- package/dist/controllers/keyboardController.js +71 -68
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +22 -15
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +2 -0
- package/dist/controllers/popoverSupport.js +11 -3
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.js +120 -119
- package/dist/controllers/saveStatusController.cjs +1 -1
- package/dist/controllers/saveStatusController.d.ts +1 -1
- package/dist/controllers/saveStatusController.js +23 -22
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +2 -0
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +54 -53
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +3 -1
- package/dist/controllers/viewportSyncController.js +4 -4
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.d.ts +2 -0
- package/dist/engine/columnCommands.js +71 -31
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.js +15 -14
- package/dist/engine/createGridEngine.cjs +3 -1
- package/dist/engine/createGridEngine.d.ts +3 -1
- package/dist/engine/createGridEngine.js +79 -49
- package/dist/engine/exportCommands.cjs +2 -1
- package/dist/engine/exportCommands.d.ts +2 -1
- package/dist/engine/exportCommands.js +118 -92
- package/dist/engine/features.d.ts +3 -1
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +23 -21
- package/dist/engine/gridApi.cjs +6 -1
- package/dist/engine/gridApi.d.ts +8 -1
- package/dist/engine/gridApi.js +382 -333
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.d.ts +2 -0
- package/dist/engine/rowPipeline.js +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +13 -6
- package/dist/locales/en.cjs +1 -0
- package/dist/locales/en.d.ts +10 -0
- package/dist/locales/en.js +380 -0
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.js +84 -84
- package/dist/logic/columnWidthState.cjs +1 -1
- package/dist/logic/columnWidthState.js +25 -20
- package/dist/logic/dateFilterCondition.cjs +1 -1
- package/dist/logic/dateFilterCondition.d.ts +5 -4
- package/dist/logic/dateFilterCondition.js +34 -30
- package/dist/logic/dateFilterPresets.cjs +1 -1
- package/dist/logic/dateFilterPresets.d.ts +5 -3
- package/dist/logic/dateFilterPresets.js +16 -12
- package/dist/logic/dateFilterTree.cjs +1 -1
- package/dist/logic/dateFilterTree.d.ts +2 -1
- package/dist/logic/dateFilterTree.js +38 -37
- package/dist/logic/datePickerCalendar.cjs +1 -1
- package/dist/logic/datePickerCalendar.d.ts +0 -3
- package/dist/logic/datePickerCalendar.js +4 -25
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +11 -0
- package/dist/logic/detailRow.js +34 -1
- package/dist/logic/exportCsv.cjs +2 -2
- package/dist/logic/exportCsv.d.ts +3 -1
- package/dist/logic/exportCsv.js +15 -10
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -1
- package/dist/logic/exportData.js +23 -15
- package/dist/logic/featureWarnings.cjs +1 -1
- package/dist/logic/featureWarnings.d.ts +1 -1
- package/dist/logic/featureWarnings.js +8 -8
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.d.ts +3 -1
- package/dist/logic/filterSummary.js +30 -25
- package/dist/logic/gridAsk.cjs +3 -3
- package/dist/logic/gridAsk.d.ts +3 -1
- package/dist/logic/gridAsk.js +301 -300
- package/dist/logic/gridAskLocaleText.cjs +1 -0
- package/dist/logic/gridAskLocaleText.d.ts +206 -0
- package/dist/logic/gridAskLocaleText.js +102 -0
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +5 -0
- package/dist/logic/gridState.js +27 -22
- package/dist/logic/groupExport.cjs +1 -0
- package/dist/logic/groupExport.d.ts +17 -0
- package/dist/logic/groupExport.js +42 -0
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.d.ts +2 -2
- package/dist/logic/grouping.js +58 -40
- package/dist/logic/localeText.cjs +1 -0
- package/dist/logic/localeText.d.ts +92 -0
- package/dist/logic/localeText.js +83 -0
- package/dist/logic/localeTextFeatures.cjs +1 -0
- package/dist/logic/localeTextFeatures.d.ts +82 -0
- package/dist/logic/localeTextFeatures.js +77 -0
- package/dist/logic/localeTextFilters.cjs +1 -0
- package/dist/logic/localeTextFilters.d.ts +31 -0
- package/dist/logic/localeTextFilters.js +32 -0
- package/dist/logic/localeTextPopups.cjs +1 -0
- package/dist/logic/localeTextPopups.d.ts +106 -0
- package/dist/logic/localeTextPopups.js +130 -0
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +3 -2
- package/dist/logic/numberFilterCondition.js +44 -40
- package/dist/logic/rowReorder.cjs +1 -1
- package/dist/logic/rowReorder.d.ts +0 -2
- package/dist/logic/rowReorder.js +2 -2
- package/dist/logic/scrollHint.cjs +1 -1
- package/dist/logic/scrollHint.d.ts +10 -3
- package/dist/logic/scrollHint.js +16 -11
- package/dist/logic/scrollTargets.cjs +1 -1
- package/dist/logic/scrollTargets.d.ts +6 -1
- package/dist/logic/scrollTargets.js +8 -8
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +2 -2
- package/dist/logic/textFilterCondition.cjs +1 -1
- package/dist/logic/textFilterCondition.d.ts +3 -2
- package/dist/logic/textFilterCondition.js +22 -21
- package/dist/logic/theme.cjs +1 -1
- package/dist/logic/theme.d.ts +2 -0
- package/dist/logic/theme.js +2 -2
- package/dist/logic/totalRow.cjs +1 -1
- package/dist/logic/totalRow.d.ts +3 -2
- package/dist/logic/totalRow.js +33 -30
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +7 -5
- package/dist/logic/validation.js +33 -28
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +4 -2
- package/dist/model/gridActions.js +12 -4
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +2 -2
- package/dist/model/gridTypes.core.d.ts +764 -33
- package/dist/utils/clipboard.cjs +2 -1
- package/dist/utils/clipboard.js +1 -1
- package/dist/utils/permissions.cjs +2 -1
- package/dist/utils/permissions.js +2 -1
- package/dist/utils/portalTokens.cjs +1 -0
- package/dist/utils/portalTokens.d.ts +3 -0
- package/dist/utils/portalTokens.js +65 -0
- package/package.json +1 -1
package/dist/logic/gridAsk.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { parseNumberText as e } from "./editorValues.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { formatLocaleText as t } from "./localeTextFilters.js";
|
|
3
|
+
import { normalizeDateFilterPresets as n } from "./dateFilterPresets.js";
|
|
4
|
+
import { formatDateKey as r, toDateKey as i } from "./filtering.js";
|
|
5
|
+
import { formatParsedNumberFilter as a } from "./numberFilterCondition.js";
|
|
6
|
+
import { cloneColumnFilterValue as o, isSameColumnFilterValue as s, isSameFilterState as c, isSameSortState as l } from "./gridState.js";
|
|
7
|
+
import { createColumnFilterDescribeOptions as u, describeColumnFilterValue as d } from "./filterSummary.js";
|
|
8
|
+
import { resolveGridAskLocaleText as f } from "./gridAskLocaleText.js";
|
|
7
9
|
//#region src/logic/gridAsk.ts
|
|
8
|
-
var
|
|
10
|
+
var p = [
|
|
9
11
|
"=",
|
|
10
12
|
"!=",
|
|
11
13
|
">",
|
|
12
14
|
">=",
|
|
13
15
|
"<",
|
|
14
16
|
"<="
|
|
15
|
-
],
|
|
16
|
-
...
|
|
17
|
+
], m = [
|
|
18
|
+
...p,
|
|
17
19
|
"between",
|
|
18
20
|
"contains",
|
|
19
21
|
"equals",
|
|
@@ -28,7 +30,7 @@ var d = [
|
|
|
28
30
|
"in",
|
|
29
31
|
"notIn",
|
|
30
32
|
"clear"
|
|
31
|
-
],
|
|
33
|
+
], h = {
|
|
32
34
|
text: ["contains", "clear"],
|
|
33
35
|
date: ["contains", "clear"],
|
|
34
36
|
select: ["equals", "clear"],
|
|
@@ -38,14 +40,14 @@ var d = [
|
|
|
38
40
|
"clear"
|
|
39
41
|
],
|
|
40
42
|
number: [
|
|
41
|
-
...
|
|
43
|
+
...p,
|
|
42
44
|
"between",
|
|
43
45
|
"blank",
|
|
44
46
|
"notBlank",
|
|
45
47
|
"clear"
|
|
46
48
|
],
|
|
47
49
|
numberSet: [
|
|
48
|
-
...
|
|
50
|
+
...p,
|
|
49
51
|
"between",
|
|
50
52
|
"blank",
|
|
51
53
|
"notBlank",
|
|
@@ -77,7 +79,7 @@ var d = [
|
|
|
77
79
|
"notIn",
|
|
78
80
|
"clear"
|
|
79
81
|
]
|
|
80
|
-
},
|
|
82
|
+
}, g = {
|
|
81
83
|
text: "text",
|
|
82
84
|
textSet: "text",
|
|
83
85
|
number: "number",
|
|
@@ -86,100 +88,79 @@ var d = [
|
|
|
86
88
|
dateSet: "date",
|
|
87
89
|
select: "choice (one value)",
|
|
88
90
|
set: "choice"
|
|
89
|
-
},
|
|
90
|
-
"=": "に等しい",
|
|
91
|
-
"!=": "に等しくない",
|
|
92
|
-
">": "より大きい",
|
|
93
|
-
">=": "以上",
|
|
94
|
-
"<": "未満",
|
|
95
|
-
"<=": "以下",
|
|
96
|
-
between: "範囲",
|
|
97
|
-
contains: "を含む",
|
|
98
|
-
equals: "に等しい",
|
|
99
|
-
startsWith: "で始まる",
|
|
100
|
-
endsWith: "で終わる",
|
|
101
|
-
onOrAfter: "以降",
|
|
102
|
-
onOrBefore: "以前",
|
|
103
|
-
notEquals: "に等しくない",
|
|
104
|
-
preset: "今日・今月など",
|
|
105
|
-
blank: "空白",
|
|
106
|
-
notBlank: "空白でない",
|
|
107
|
-
in: "値を選ぶ",
|
|
108
|
-
notIn: "値を除く",
|
|
109
|
-
clear: "外す"
|
|
110
|
-
}, g = 50, _ = 200, v = 1e3, y = 1e3, ee = 300, b = 500, x = 100, S = 20, C = 40, w = (e, t) => t?.kind === "numberSet" || t?.kind === "textSet" || t?.kind === "dateSet" || t?.kind === "text" ? t.kind : e.editor?.type === "number" ? "numberSet" : e.editor?.type === "date" ? "dateSet" : "text", T = (e, t) => {
|
|
91
|
+
}, _ = 50, v = 200, y = 1e3, b = 1e3, ee = 300, x = 500, S = 100, C = 20, w = 40, T = (e, t) => t?.kind === "numberSet" || t?.kind === "textSet" || t?.kind === "dateSet" || t?.kind === "text" ? t.kind : e.editor?.type === "number" ? "numberSet" : e.editor?.type === "date" ? "dateSet" : "text", E = (e, t) => {
|
|
111
92
|
let n = e.filterType;
|
|
112
|
-
return n === void 0 || n === "custom" ? null : n === "auto" ?
|
|
113
|
-
},
|
|
93
|
+
return n === void 0 || n === "custom" ? null : n === "auto" ? T(e, t) : n;
|
|
94
|
+
}, D = (e) => {
|
|
114
95
|
let t = e.editor, n = e.filterOptions && e.filterOptions.length > 0 ? e.filterOptions : t?.type === "select" && Array.isArray(t.options) ? t.options : [];
|
|
115
96
|
return n.length > 0 ? n.map((e) => ({
|
|
116
97
|
value: e.value,
|
|
117
98
|
label: e.label
|
|
118
99
|
})) : null;
|
|
119
|
-
},
|
|
120
|
-
let r =
|
|
121
|
-
for (let
|
|
122
|
-
let
|
|
123
|
-
if (
|
|
124
|
-
let
|
|
125
|
-
|
|
126
|
-
column:
|
|
127
|
-
key:
|
|
128
|
-
title:
|
|
129
|
-
hint: typeof
|
|
130
|
-
filterType:
|
|
131
|
-
ops:
|
|
132
|
-
options:
|
|
133
|
-
presets:
|
|
100
|
+
}, O = (e, t) => e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, k = (e, t) => {
|
|
101
|
+
let r = A(e.allowFilter, !0), i = e.localeText ? f(e.localeText) : void 0, a = [];
|
|
102
|
+
for (let o of e.columns) {
|
|
103
|
+
let s = O(e.columnHints, o.key);
|
|
104
|
+
if (s === !1) continue;
|
|
105
|
+
let c = r ? E(o, O(t.filters.columnFilters, o.key)) : null, l = c === "dateSet" ? n(o.dateFilterPresets, i) : [], u = c === null ? [] : c === "dateSet" && l.length === 0 ? h.dateSet.filter((e) => e !== "preset") : h[c];
|
|
106
|
+
a.push({
|
|
107
|
+
column: o,
|
|
108
|
+
key: o.key,
|
|
109
|
+
title: o.title || o.key,
|
|
110
|
+
hint: typeof s == "string" && s.trim() !== "" ? s.trim() : null,
|
|
111
|
+
filterType: c,
|
|
112
|
+
ops: u,
|
|
113
|
+
options: c === null || c === "text" || c === "date" || c === "number" ? null : D(o),
|
|
114
|
+
presets: l
|
|
134
115
|
});
|
|
135
116
|
}
|
|
136
|
-
return
|
|
137
|
-
},
|
|
117
|
+
return a;
|
|
118
|
+
}, A = (e, t) => e ?? t, j = (e, t, n = {}) => ({
|
|
138
119
|
column: e,
|
|
139
120
|
op: t,
|
|
140
121
|
value: n.value ?? null,
|
|
141
122
|
values: n.values ?? null,
|
|
142
123
|
to: n.to ?? null
|
|
143
|
-
}),
|
|
124
|
+
}), M = (e, t) => {
|
|
144
125
|
switch (t.mode) {
|
|
145
|
-
case "comparison": return [
|
|
146
|
-
case "range": return [
|
|
126
|
+
case "comparison": return [j(e, t.operator, { value: String(t.value) })];
|
|
127
|
+
case "range": return [j(e, "between", {
|
|
147
128
|
value: String(t.min),
|
|
148
129
|
to: String(t.max)
|
|
149
130
|
})];
|
|
150
|
-
default: return [
|
|
131
|
+
default: return [j(e, t.mode)];
|
|
151
132
|
}
|
|
152
|
-
},
|
|
133
|
+
}, N = (e, t) => t.mode === "blank" || t.mode === "notBlank" ? [j(e, t.mode)] : [j(e, t.mode, { value: t.value })], P = (e, t) => {
|
|
153
134
|
switch (t.mode) {
|
|
154
|
-
case "range": return [
|
|
135
|
+
case "range": return [j(e, "between", {
|
|
155
136
|
value: t.from,
|
|
156
137
|
to: t.to
|
|
157
138
|
})];
|
|
158
|
-
case "preset": return [
|
|
139
|
+
case "preset": return [j(e, "preset", { value: t.preset })];
|
|
159
140
|
case "blank":
|
|
160
|
-
case "notBlank": return [
|
|
161
|
-
default: return [
|
|
141
|
+
case "notBlank": return [j(e, t.mode)];
|
|
142
|
+
default: return [j(e, t.mode, { value: t.value })];
|
|
162
143
|
}
|
|
163
|
-
},
|
|
144
|
+
}, F = (e, t) => {
|
|
164
145
|
if (!t) return [];
|
|
165
|
-
let n =
|
|
166
|
-
return t.values.length >
|
|
146
|
+
let n = j(e, t.mode === "exclude" ? "notIn" : "in", { values: t.values.slice(0, x) });
|
|
147
|
+
return t.values.length > x && (n.more = t.values.length - x), [n];
|
|
167
148
|
}, te = (e, t) => {
|
|
168
149
|
switch (t.kind) {
|
|
169
150
|
case "text":
|
|
170
|
-
case "date": return [
|
|
171
|
-
case "select": return [
|
|
172
|
-
case "set": return
|
|
173
|
-
case "number": return t.parsed ?
|
|
174
|
-
case "numberSet": return [...t.condition ?
|
|
175
|
-
case "textSet": return [...t.condition ?
|
|
176
|
-
case "dateSet": return [...t.condition ?
|
|
151
|
+
case "date": return [j(e, "contains", { value: t.value })];
|
|
152
|
+
case "select": return [j(e, "equals", { value: t.value })];
|
|
153
|
+
case "set": return F(e, t);
|
|
154
|
+
case "number": return t.parsed ? M(e, t.parsed) : [];
|
|
155
|
+
case "numberSet": return [...t.condition ? M(e, t.condition) : [], ...F(e, t.set)];
|
|
156
|
+
case "textSet": return [...t.condition ? N(e, t.condition) : [], ...F(e, t.set)];
|
|
157
|
+
case "dateSet": return [...t.condition ? P(e, t.condition) : [], ...F(e, t.set)];
|
|
177
158
|
case "custom": return [];
|
|
178
159
|
}
|
|
179
|
-
},
|
|
160
|
+
}, I = (e) => {
|
|
180
161
|
let t = { ...e };
|
|
181
162
|
return delete t.visible, t;
|
|
182
|
-
},
|
|
163
|
+
}, L = (e) => (e ?? []).filter((e) => e.visible === !1).map((e) => e.key), R = [
|
|
183
164
|
"You set how a data table is viewed, from one request by its user. You choose filters (which rows to show), the sort order, a quick text search and hidden columns. You never see or change the data.",
|
|
184
165
|
"- Use only the listed columns (by key) and, for each column, only its listed ops. A column without ops cannot be filtered.",
|
|
185
166
|
"- A filter is {column, op, value, values, to}. Comparison ops (=, !=, >, >=, <, <=) and contains, equals, startsWith, endsWith, onOrAfter, onOrBefore, notEquals use \"value\". \"between\" uses \"value\" (from) and \"to\"; both ends are included. \"in\" (show only these values) and \"notIn\" (hide these values) use \"values\"; pick from the column's listed values when it has them (a list ending in \"more (not listed)\" is cut short). \"\" in values stands for blank cells. \"preset\" puts one of the column's preset ids in \"value\". blank, notBlank and clear use none of them. Unused fields are null.",
|
|
@@ -200,17 +181,17 @@ var d = [
|
|
|
200
181
|
"Fri",
|
|
201
182
|
"Sat"
|
|
202
183
|
], re = (e) => {
|
|
203
|
-
let t = e.slice(0,
|
|
184
|
+
let t = e.slice(0, _).map((e) => e.label && e.label !== e.value ? `${JSON.stringify(e.value)} (${e.label})` : JSON.stringify(e.value)), n = e.length - t.length;
|
|
204
185
|
return n > 0 ? `${t.join(", ")} and ${n} more (not listed)` : t.join(", ");
|
|
205
186
|
}, ie = (e) => {
|
|
206
187
|
let t = `- ${e.key} ${JSON.stringify(e.title)}${e.hint ? ` (${e.hint})` : ""}`;
|
|
207
188
|
if (e.filterType === null) return `${t}: no ops.`;
|
|
208
|
-
let n = `${t}: ${
|
|
189
|
+
let n = `${t}: ${g[e.filterType]}.`, r = e.filterType === "select" ? e.options?.filter((e) => e.value !== "") : e.options;
|
|
209
190
|
r && r.length > 0 && (n += ` values: ${re(r)}.`);
|
|
210
191
|
let i = e.ops.map((t) => t === "preset" ? `preset (${e.presets.map((e) => `${e.id} = ${e.label}`).join(", ")})` : t);
|
|
211
192
|
return `${n} ops: ${i.join(", ")}`;
|
|
212
193
|
}, ae = (e) => {
|
|
213
|
-
let t = e.length > 0 && e.length <=
|
|
194
|
+
let t = e.length > 0 && e.length <= S ? {
|
|
214
195
|
type: "string",
|
|
215
196
|
enum: e
|
|
216
197
|
} : { type: "string" }, n = { anyOf: [{ type: "string" }, { type: "null" }] };
|
|
@@ -247,7 +228,7 @@ var d = [
|
|
|
247
228
|
column: t,
|
|
248
229
|
op: {
|
|
249
230
|
type: "string",
|
|
250
|
-
enum: [...
|
|
231
|
+
enum: [...m]
|
|
251
232
|
},
|
|
252
233
|
value: n,
|
|
253
234
|
values: { anyOf: [{
|
|
@@ -285,15 +266,15 @@ var d = [
|
|
|
285
266
|
unsupported: n
|
|
286
267
|
}
|
|
287
268
|
};
|
|
288
|
-
}, oe = (e, t,
|
|
289
|
-
let i =
|
|
269
|
+
}, oe = (e, t, n) => {
|
|
270
|
+
let i = k(n, t), a = A(n.allowFilter, !0), o = A(n.allowSort, !0), s = A(n.allowSearch, !0), c = A(n.allowColumnVisibility, !1), l = n.now ?? /* @__PURE__ */ new Date(), u = new Set(i.map((e) => e.key)), d = new Set(i.filter((e) => e.filterType !== null).map((e) => e.key)), f = {};
|
|
290
271
|
return a && (f.filters = Object.entries(t.filters.columnFilters).filter(([e]) => d.has(e)).flatMap(([e, t]) => te(e, t))), o && (f.sort = t.sort.filter((e) => u.has(e.columnKey)).map((e) => ({
|
|
291
272
|
column: e.columnKey,
|
|
292
273
|
direction: e.direction
|
|
293
|
-
}))), s && (f.search = t.filters.globalText === "" ? null : t.filters.globalText), c && (f.hidden =
|
|
294
|
-
system:
|
|
274
|
+
}))), s && (f.search = t.filters.globalText === "" ? null : t.filters.globalText), c && (f.hidden = L(t.columns).filter((e) => u.has(e))), {
|
|
275
|
+
system: R,
|
|
295
276
|
prompt: [
|
|
296
|
-
`Today: ${
|
|
277
|
+
`Today: ${r(l)} (${ne[l.getDay()]})`,
|
|
297
278
|
"Columns:",
|
|
298
279
|
...i.map(ie),
|
|
299
280
|
`Filters: ${a ? "allowed (by each column's ops)" : "not allowed"}.`,
|
|
@@ -306,47 +287,53 @@ var d = [
|
|
|
306
287
|
schema: ae(i.map((e) => e.key)),
|
|
307
288
|
text: e.trim()
|
|
308
289
|
};
|
|
309
|
-
},
|
|
310
|
-
let
|
|
311
|
-
return
|
|
312
|
-
}, se = (e) => {
|
|
313
|
-
let
|
|
314
|
-
return e.length > 5 ?
|
|
315
|
-
|
|
316
|
-
|
|
290
|
+
}, z = (e) => ({ value: e }), B = (e) => ({ error: e }), V = (e) => typeof e == "string" ? e : typeof e == "number" && Number.isFinite(e) ? String(e) : "", H = (e) => V(e).trim(), U = (t) => typeof t == "number" ? Number.isFinite(t) ? t : null : typeof t == "string" && t.length <= v ? e(t) : null, W = (e, t) => {
|
|
291
|
+
let n = H(e);
|
|
292
|
+
return n === "" ? t.emptyText : n.length > w ? `${n.slice(0, w)}…` : n;
|
|
293
|
+
}, G = (e, n) => t(n.quote, { text: W(e, n) }), se = (e, n) => {
|
|
294
|
+
let r = e.slice(0, 5).map((e) => G(e, n)).join(n.quoteSeparator);
|
|
295
|
+
return e.length > 5 ? t(n.andMore, {
|
|
296
|
+
items: r,
|
|
297
|
+
count: e.length - 5
|
|
298
|
+
}) : r;
|
|
299
|
+
}, K = (e, n) => t(n.quote, { text: H(e) === "" ? n.unnamed : W(e, n) }), q = (e) => t(e.textTooLong, { limit: v }), J = (e, n, r) => t(r.columnReason, {
|
|
300
|
+
column: e,
|
|
301
|
+
reason: n
|
|
302
|
+
}), Y = (e, n, r) => {
|
|
303
|
+
if (e === "blank" || e === "notBlank") return z({ mode: e });
|
|
317
304
|
if (e === "between") {
|
|
318
|
-
let e =
|
|
319
|
-
return e === null ||
|
|
305
|
+
let e = U(n.value), t = U(n.to);
|
|
306
|
+
return e === null || t === null ? B(r.noNumberRange) : z({
|
|
320
307
|
mode: "range",
|
|
321
|
-
min: Math.min(e,
|
|
322
|
-
max: Math.max(e,
|
|
308
|
+
min: Math.min(e, t),
|
|
309
|
+
max: Math.max(e, t)
|
|
323
310
|
});
|
|
324
311
|
}
|
|
325
|
-
let
|
|
326
|
-
return
|
|
312
|
+
let i = U(n.value);
|
|
313
|
+
return i === null ? B(t(r.notNumber, { value: G(n.value, r) })) : z({
|
|
327
314
|
mode: "comparison",
|
|
328
315
|
operator: e,
|
|
329
|
-
value:
|
|
316
|
+
value: i
|
|
330
317
|
});
|
|
331
|
-
}, ce = (e, t) => {
|
|
332
|
-
if (e === "blank" || e === "notBlank") return
|
|
333
|
-
let
|
|
334
|
-
return
|
|
318
|
+
}, ce = (e, t, n) => {
|
|
319
|
+
if (e === "blank" || e === "notBlank") return z({ mode: e });
|
|
320
|
+
let r = H(t.value);
|
|
321
|
+
return r === "" ? B(n.noText) : r.length > v ? B(q(n)) : z({
|
|
335
322
|
mode: e,
|
|
336
|
-
value:
|
|
323
|
+
value: r
|
|
337
324
|
});
|
|
338
|
-
}, le = (e,
|
|
339
|
-
if (
|
|
340
|
-
if (
|
|
341
|
-
let
|
|
342
|
-
return
|
|
325
|
+
}, le = (e, n, r, a) => {
|
|
326
|
+
if (n === "blank" || n === "notBlank") return z({ mode: n });
|
|
327
|
+
if (n === "preset") {
|
|
328
|
+
let n = H(r.value), i = e.presets.find((e) => e.id === n || e.label === n);
|
|
329
|
+
return i ? z({
|
|
343
330
|
mode: "preset",
|
|
344
|
-
preset:
|
|
345
|
-
}) :
|
|
331
|
+
preset: i.id
|
|
332
|
+
}) : B(t(a.unknownPeriod, { value: G(r.value, a) }));
|
|
346
333
|
}
|
|
347
|
-
if (
|
|
348
|
-
let e =
|
|
349
|
-
return e === null || t === null ?
|
|
334
|
+
if (n === "between") {
|
|
335
|
+
let e = i(H(r.value)), t = i(H(r.to));
|
|
336
|
+
return e === null || t === null ? B(a.noDateRange) : z(e <= t ? {
|
|
350
337
|
mode: "range",
|
|
351
338
|
from: e,
|
|
352
339
|
to: t
|
|
@@ -356,12 +343,12 @@ var d = [
|
|
|
356
343
|
to: e
|
|
357
344
|
});
|
|
358
345
|
}
|
|
359
|
-
let
|
|
360
|
-
return
|
|
361
|
-
mode:
|
|
362
|
-
value:
|
|
346
|
+
let o = i(H(r.value));
|
|
347
|
+
return o === null ? B(t(a.notDate, { value: G(r.value, a) })) : z({
|
|
348
|
+
mode: n,
|
|
349
|
+
value: o
|
|
363
350
|
});
|
|
364
|
-
},
|
|
351
|
+
}, X = (e, t) => {
|
|
365
352
|
let n = e.find((e) => e.value === t);
|
|
366
353
|
if (n) return n.value;
|
|
367
354
|
let r = e.find((e) => e.label === t);
|
|
@@ -374,122 +361,129 @@ var d = [
|
|
|
374
361
|
} : (e.kind === "numberSet" || e.kind === "textSet" || e.kind === "dateSet") && e.set ? {
|
|
375
362
|
mode: e.set.mode === "exclude" ? "exclude" : "include",
|
|
376
363
|
values: e.set.values
|
|
377
|
-
} : null,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
364
|
+
} : null, Z = (n, r, a, o) => {
|
|
365
|
+
let { t: s } = o;
|
|
366
|
+
if (!Array.isArray(r)) return B(s.noValues);
|
|
367
|
+
let c = ue(o.original), l = new Set(c?.values ?? []);
|
|
368
|
+
r.length > b && o.dropped.push(J(n.title, t(s.tooManyValues, {
|
|
369
|
+
limit: b,
|
|
370
|
+
count: r.length - b
|
|
371
|
+
}), s));
|
|
372
|
+
let u = /* @__PURE__ */ new Set(), d = [], f = 0, p = 0;
|
|
373
|
+
for (let t of r.slice(0, b)) {
|
|
374
|
+
if (typeof t != "string" && !(typeof t == "number" && Number.isFinite(t))) {
|
|
375
|
+
f += 1;
|
|
385
376
|
continue;
|
|
386
377
|
}
|
|
387
|
-
let
|
|
388
|
-
if (
|
|
389
|
-
|
|
378
|
+
let r = V(t);
|
|
379
|
+
if (l.has(r)) {
|
|
380
|
+
u.add(r);
|
|
390
381
|
continue;
|
|
391
382
|
}
|
|
392
|
-
let a =
|
|
393
|
-
if (a.length >
|
|
394
|
-
|
|
383
|
+
let a = r.trim();
|
|
384
|
+
if (a.length > y) {
|
|
385
|
+
p += 1;
|
|
395
386
|
continue;
|
|
396
387
|
}
|
|
397
388
|
let o = a;
|
|
398
|
-
if (a === "" ||
|
|
399
|
-
else if (
|
|
400
|
-
else if (
|
|
401
|
-
else if (
|
|
389
|
+
if (a === "" || l.has(a)) o = a;
|
|
390
|
+
else if (n.options) o = X(n.options, r);
|
|
391
|
+
else if (n.filterType === "dateSet") o = i(a) ?? a;
|
|
392
|
+
else if (n.filterType === "numberSet") {
|
|
402
393
|
let t = e(a);
|
|
403
394
|
o = t === null ? a : String(t);
|
|
404
395
|
}
|
|
405
|
-
o === null ?
|
|
396
|
+
o === null ? d.push(r) : u.add(o);
|
|
406
397
|
}
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
398
|
+
if (d.length > 0 && o.dropped.push(J(n.title, t(s.notInOptions, { values: se(d, s) }), s)), p > 0 && o.dropped.push(J(n.title, t(s.valuesTooLong, {
|
|
399
|
+
limit: y,
|
|
400
|
+
count: p
|
|
401
|
+
}), s)), f > 0 && o.dropped.push(J(n.title, t(s.unreadableValues, { count: f }), s)), u.size === 0) return B(s.noSelectableValues);
|
|
402
|
+
if (c === null || c.mode !== a) return z([...u]);
|
|
403
|
+
if (c.values.length > x && !o.cleared) {
|
|
404
|
+
let e = c.values.slice(0, x);
|
|
405
|
+
if (o.refine || e.every((e) => u.has(e))) for (let e of c.values.slice(x)) u.add(e);
|
|
412
406
|
}
|
|
413
|
-
return
|
|
414
|
-
}, de = (e,
|
|
415
|
-
let
|
|
416
|
-
switch (
|
|
407
|
+
return u.size === c.values.length && c.values.every((e) => u.has(e)) ? z([...c.values]) : z([...u]);
|
|
408
|
+
}, de = (e, n, r, i) => {
|
|
409
|
+
let c = e.filterType, { original: l, t: u } = i;
|
|
410
|
+
switch (c) {
|
|
417
411
|
case "text":
|
|
418
412
|
case "date": {
|
|
419
|
-
let e =
|
|
420
|
-
return e === "" ?
|
|
421
|
-
kind:
|
|
422
|
-
value:
|
|
423
|
-
}) : e.length >
|
|
424
|
-
kind:
|
|
413
|
+
let e = H(r.value);
|
|
414
|
+
return e === "" ? B(u.noText) : (l?.kind === "text" || l?.kind === "date") && l.kind === c && l.value.trim() === e ? z({
|
|
415
|
+
kind: c,
|
|
416
|
+
value: l.value
|
|
417
|
+
}) : e.length > v ? B(q(u)) : z({
|
|
418
|
+
kind: c,
|
|
425
419
|
value: e
|
|
426
420
|
});
|
|
427
421
|
}
|
|
428
422
|
case "select": {
|
|
429
|
-
let
|
|
430
|
-
if (
|
|
431
|
-
if (
|
|
423
|
+
let n = V(r.value);
|
|
424
|
+
if (n.trim() === "") return B(u.noValues);
|
|
425
|
+
if (l?.kind === "select" && (l.value === n || l.value === n.trim())) return z({
|
|
432
426
|
kind: "select",
|
|
433
|
-
value:
|
|
427
|
+
value: l.value
|
|
434
428
|
});
|
|
435
|
-
let
|
|
436
|
-
return
|
|
429
|
+
let i = e.options ? X(e.options, n) : n.trim();
|
|
430
|
+
return i === null ? B(t(u.notAnOption, { value: G(n, u) })) : i === "" ? B(t(u.cannotFilterBy, { value: G(n, u) })) : i.length > y ? B(t(u.valueTooLong, { limit: y })) : z({
|
|
437
431
|
kind: "select",
|
|
438
|
-
value:
|
|
432
|
+
value: i
|
|
439
433
|
});
|
|
440
434
|
}
|
|
441
435
|
case "set": {
|
|
442
|
-
let
|
|
443
|
-
return "error" in a ? a :
|
|
436
|
+
let t = n === "notIn" ? "exclude" : "include", a = Z(e, r.values, t, i);
|
|
437
|
+
return "error" in a ? a : z({
|
|
444
438
|
kind: "set",
|
|
445
|
-
mode:
|
|
439
|
+
mode: t,
|
|
446
440
|
values: a.value
|
|
447
441
|
});
|
|
448
442
|
}
|
|
449
443
|
case "number": {
|
|
450
|
-
let e =
|
|
451
|
-
return "error" in e ? e :
|
|
444
|
+
let e = Y(n, r, u);
|
|
445
|
+
return "error" in e ? e : l?.kind === "number" && s({
|
|
452
446
|
kind: "number",
|
|
453
|
-
raw:
|
|
447
|
+
raw: l.raw,
|
|
454
448
|
parsed: e.value
|
|
455
|
-
},
|
|
449
|
+
}, l) ? z(o(l)) : z({
|
|
456
450
|
kind: "number",
|
|
457
|
-
raw:
|
|
451
|
+
raw: a(e.value),
|
|
458
452
|
parsed: e.value
|
|
459
453
|
});
|
|
460
454
|
}
|
|
461
455
|
default: {
|
|
462
|
-
let
|
|
463
|
-
kind:
|
|
456
|
+
let t = i.base, a = t && t.kind === c ? o(t) : {
|
|
457
|
+
kind: c,
|
|
464
458
|
condition: null,
|
|
465
459
|
set: null
|
|
466
460
|
};
|
|
467
|
-
if (
|
|
468
|
-
if (
|
|
469
|
-
let
|
|
470
|
-
return "error" in
|
|
471
|
-
mode:
|
|
472
|
-
values:
|
|
473
|
-
},
|
|
461
|
+
if (n === "in" || n === "notIn") {
|
|
462
|
+
if (i.fixed.has("set")) return B(u.oneSelection);
|
|
463
|
+
let t = n === "notIn" ? "exclude" : "include", o = Z(e, r.values, t, i);
|
|
464
|
+
return "error" in o ? o : (a.set = {
|
|
465
|
+
mode: t,
|
|
466
|
+
values: o.value
|
|
467
|
+
}, z(a));
|
|
474
468
|
}
|
|
475
|
-
if (
|
|
476
|
-
if (
|
|
477
|
-
let e =
|
|
469
|
+
if (i.fixed.has("condition")) return B(u.oneCondition);
|
|
470
|
+
if (a.kind === "numberSet") {
|
|
471
|
+
let e = Y(n, r, u);
|
|
478
472
|
if ("error" in e) return e;
|
|
479
|
-
|
|
480
|
-
} else if (
|
|
481
|
-
let e = ce(
|
|
473
|
+
a.condition = e.value;
|
|
474
|
+
} else if (a.kind === "textSet") {
|
|
475
|
+
let e = ce(n, r, u);
|
|
482
476
|
if ("error" in e) return e;
|
|
483
|
-
|
|
477
|
+
a.condition = e.value;
|
|
484
478
|
} else {
|
|
485
|
-
let
|
|
486
|
-
if ("error" in
|
|
487
|
-
|
|
479
|
+
let t = le(e, n, r, u);
|
|
480
|
+
if ("error" in t) return t;
|
|
481
|
+
a.condition = t.value;
|
|
488
482
|
}
|
|
489
|
-
return
|
|
483
|
+
return z(a);
|
|
490
484
|
}
|
|
491
485
|
}
|
|
492
|
-
}, fe =
|
|
486
|
+
}, fe = (e) => {
|
|
493
487
|
if (typeof e != "string") return e;
|
|
494
488
|
let t = e.trim().replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/, "");
|
|
495
489
|
try {
|
|
@@ -503,178 +497,185 @@ var d = [
|
|
|
503
497
|
return;
|
|
504
498
|
}
|
|
505
499
|
}
|
|
506
|
-
},
|
|
507
|
-
let t =
|
|
500
|
+
}, Q = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : null, pe = (e) => {
|
|
501
|
+
let t = H(e).toLowerCase();
|
|
508
502
|
return t === "asc" || t === "ascending" ? "asc" : t === "desc" || t === "descending" ? "desc" : null;
|
|
509
|
-
},
|
|
510
|
-
let r =
|
|
511
|
-
if (
|
|
503
|
+
}, $ = (e, t, n) => l(e, t.filter((e) => n(e.columnKey))) ? t.map((e) => ({ ...e })) : [...e, ...t.filter((e) => !n(e.columnKey)).map((e) => ({ ...e }))], me = (e, n) => e.length > C ? [...e.slice(0, C - 1), t(n.moreReasons, { count: e.length - C + 1 })] : e, he = (e, n, r) => {
|
|
504
|
+
let i = f(r.localeText), a = fe(e);
|
|
505
|
+
if (a === void 0) return {
|
|
512
506
|
ok: !1,
|
|
513
|
-
message:
|
|
507
|
+
message: i.readError
|
|
514
508
|
};
|
|
515
|
-
let
|
|
516
|
-
if (!
|
|
509
|
+
let s = Q(a), c = s?.mode, l = s?.filters;
|
|
510
|
+
if (!s || c !== void 0 && c !== "replace" && c !== "refine" || l !== void 0 && !Array.isArray(l) || l === void 0 && c === void 0) return {
|
|
517
511
|
ok: !1,
|
|
518
|
-
message:
|
|
512
|
+
message: i.shapeError
|
|
519
513
|
};
|
|
520
|
-
let
|
|
521
|
-
for (let e of
|
|
522
|
-
let
|
|
523
|
-
let t =
|
|
524
|
-
return
|
|
525
|
-
},
|
|
526
|
-
for (let [e,
|
|
527
|
-
let
|
|
528
|
-
(
|
|
514
|
+
let u = Array.isArray(l) ? l : [], d = k(r, n), p = new Map(d.map((e) => [e.key, e])), m = /* @__PURE__ */ new Map();
|
|
515
|
+
for (let e of d) m.set(e.title, m.has(e.title) ? null : e);
|
|
516
|
+
let h = (e) => {
|
|
517
|
+
let t = H(e);
|
|
518
|
+
return p.get(t) ?? m.get(t) ?? void 0;
|
|
519
|
+
}, g = A(r.allowFilter, !0), _ = A(r.allowSort, !0), y = A(r.allowSearch, !0), b = A(r.allowColumnVisibility, !1), x = c === "refine", S = [], C = /* @__PURE__ */ new Map();
|
|
520
|
+
for (let [e, t] of Object.entries(n.filters.columnFilters)) {
|
|
521
|
+
let n = p.get(e);
|
|
522
|
+
(x || !n || n.filterType === null) && C.set(e, o(t));
|
|
529
523
|
}
|
|
530
|
-
let
|
|
531
|
-
if (!
|
|
524
|
+
let w = (e) => p.has(e), T = x || !_ ? n.sort.map((e) => ({ ...e })) : $([], n.sort, w), E = x || !y ? n.filters.globalText : "";
|
|
525
|
+
if (!g) u.length > 0 && S.push(i.filtersLocked);
|
|
532
526
|
else {
|
|
533
|
-
let e = /* @__PURE__ */ new Set(),
|
|
534
|
-
for (let
|
|
535
|
-
let
|
|
536
|
-
if (!
|
|
537
|
-
|
|
527
|
+
let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = 0;
|
|
528
|
+
for (let s of u) {
|
|
529
|
+
let c = Q(s);
|
|
530
|
+
if (!c) {
|
|
531
|
+
o += 1;
|
|
538
532
|
continue;
|
|
539
533
|
}
|
|
540
|
-
let
|
|
541
|
-
if (!
|
|
542
|
-
|
|
534
|
+
let l = h(c.column);
|
|
535
|
+
if (!l) {
|
|
536
|
+
S.push(t(i.noSuchColumn, { column: K(c.column, i) }));
|
|
543
537
|
continue;
|
|
544
538
|
}
|
|
545
|
-
let
|
|
546
|
-
if (
|
|
547
|
-
|
|
539
|
+
let u = typeof c.op == "string" ? c.op.trim() : "";
|
|
540
|
+
if (l.filterType === null) {
|
|
541
|
+
S.push(J(l.title, i.notFilterable, i));
|
|
548
542
|
continue;
|
|
549
543
|
}
|
|
550
|
-
if (
|
|
551
|
-
|
|
544
|
+
if (u === "") {
|
|
545
|
+
S.push(J(l.title, i.noOperator, i));
|
|
552
546
|
continue;
|
|
553
547
|
}
|
|
554
|
-
let
|
|
555
|
-
if (!
|
|
556
|
-
let e = Object.prototype.hasOwnProperty.call(
|
|
557
|
-
|
|
548
|
+
let d = u;
|
|
549
|
+
if (!l.ops.includes(d)) {
|
|
550
|
+
let e = Object.prototype.hasOwnProperty.call(i.operatorLabels, d) ? i.operatorLabels[d] : W(c.op, i);
|
|
551
|
+
S.push(J(l.title, t(i.operatorUnavailable, { operator: t(i.quote, { text: e }) }), i));
|
|
558
552
|
continue;
|
|
559
553
|
}
|
|
560
|
-
if (
|
|
561
|
-
|
|
554
|
+
if (d === "clear") {
|
|
555
|
+
C.delete(l.key), e.delete(l.key), a.delete(l.key), r.add(l.key);
|
|
562
556
|
continue;
|
|
563
557
|
}
|
|
564
|
-
let
|
|
565
|
-
if (e.has(
|
|
566
|
-
|
|
558
|
+
let f = l.filterType === "numberSet" || l.filterType === "textSet" || l.filterType === "dateSet";
|
|
559
|
+
if (e.has(l.key) && !f) {
|
|
560
|
+
S.push(J(l.title, i.oneCondition, i));
|
|
567
561
|
continue;
|
|
568
562
|
}
|
|
569
|
-
let
|
|
570
|
-
original:
|
|
571
|
-
base:
|
|
572
|
-
fixed:
|
|
573
|
-
refine:
|
|
574
|
-
cleared:
|
|
575
|
-
dropped:
|
|
563
|
+
let p = a.get(l.key) ?? /* @__PURE__ */ new Set(), m = de(l, d, c, {
|
|
564
|
+
original: O(n.filters.columnFilters, l.key),
|
|
565
|
+
base: C.get(l.key),
|
|
566
|
+
fixed: p,
|
|
567
|
+
refine: x,
|
|
568
|
+
cleared: r.has(l.key),
|
|
569
|
+
dropped: S,
|
|
570
|
+
t: i
|
|
576
571
|
});
|
|
577
|
-
if ("error" in
|
|
578
|
-
|
|
572
|
+
if ("error" in m) {
|
|
573
|
+
S.push(J(l.title, m.error, i));
|
|
579
574
|
continue;
|
|
580
575
|
}
|
|
581
|
-
|
|
576
|
+
C.set(l.key, m.value), e.add(l.key), f && (p.add(d === "in" || d === "notIn" ? "set" : "condition"), a.set(l.key, p));
|
|
582
577
|
}
|
|
583
|
-
|
|
578
|
+
o > 0 && S.push(t(i.unreadableFilters, { count: o }));
|
|
584
579
|
}
|
|
585
|
-
if (Array.isArray(
|
|
580
|
+
if (Array.isArray(s.sort)) if (!_) s.sort.length > 0 && S.push(i.sortLocked);
|
|
586
581
|
else {
|
|
587
582
|
let e = [];
|
|
588
|
-
for (let
|
|
589
|
-
let
|
|
590
|
-
if (!
|
|
591
|
-
|
|
583
|
+
for (let n of s.sort) {
|
|
584
|
+
let r = Q(n), a = r ? h(r.column) : void 0;
|
|
585
|
+
if (!r || !a) {
|
|
586
|
+
S.push(t(i.sortNoSuchColumn, { column: K(r?.column, i) }));
|
|
592
587
|
continue;
|
|
593
588
|
}
|
|
594
|
-
let
|
|
595
|
-
if (
|
|
596
|
-
|
|
589
|
+
let o = pe(r.direction);
|
|
590
|
+
if (o === null) {
|
|
591
|
+
S.push(t(i.sortBadDirection, {
|
|
592
|
+
column: a.title,
|
|
593
|
+
direction: G(r.direction, i)
|
|
594
|
+
}));
|
|
597
595
|
continue;
|
|
598
596
|
}
|
|
599
|
-
e.some((e) => e.columnKey ===
|
|
600
|
-
columnKey:
|
|
601
|
-
direction:
|
|
597
|
+
e.some((e) => e.columnKey === a.key) || e.push({
|
|
598
|
+
columnKey: a.key,
|
|
599
|
+
direction: o
|
|
602
600
|
});
|
|
603
601
|
}
|
|
604
|
-
|
|
602
|
+
x && s.sort.length > 0 && e.length === 0 || (T = $(e, n.sort, w));
|
|
605
603
|
}
|
|
606
|
-
if (
|
|
607
|
-
else if (typeof
|
|
608
|
-
let e =
|
|
609
|
-
|
|
604
|
+
if (s.search !== void 0 && s.search !== null && typeof s.search != "string") S.push(i.searchUnreadable);
|
|
605
|
+
else if (typeof s.search == "string") {
|
|
606
|
+
let e = s.search.trim(), r = n.filters.globalText;
|
|
607
|
+
y ? e !== "" && e === r.trim() ? E = r : e.length > v ? S.push(t(i.searchTooLong, { limit: v })) : E = e : e !== "" && e !== r.trim() && S.push(i.searchLocked);
|
|
610
608
|
}
|
|
611
|
-
let
|
|
612
|
-
if (
|
|
609
|
+
let D = n.columns?.map((e) => ({ ...e })), j = Array.isArray(s.hide) ? s.hide.filter((e) => H(e) !== "") : [], M = Array.isArray(s.show) ? s.show.filter((e) => H(e) !== "") : [], N = (Array.isArray(s.hide) ? s.hide.length - j.length : 0) + (Array.isArray(s.show) ? s.show.length - M.length : 0);
|
|
610
|
+
if (N > 0 && S.push(t(i.unreadableColumns, { count: N })), j.length > 0 || M.length > 0) if (!b || !D) S.push(i.columnsLocked);
|
|
613
611
|
else {
|
|
614
|
-
let e = new Set(
|
|
615
|
-
for (let [
|
|
616
|
-
let
|
|
617
|
-
|
|
612
|
+
let e = new Set(D.map((e) => e.key)), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
613
|
+
for (let [a, o] of [[M, n], [j, r]]) for (let n of a) {
|
|
614
|
+
let r = h(n);
|
|
615
|
+
r && e.has(r.key) ? o.add(r.key) : S.push(t(i.noSuchColumn, { column: K(n, i) }));
|
|
618
616
|
}
|
|
619
|
-
let
|
|
617
|
+
let a = D.map((e) => r.has(e.key) ? {
|
|
620
618
|
...e,
|
|
621
619
|
visible: !1
|
|
622
|
-
} :
|
|
623
|
-
|
|
620
|
+
} : n.has(e.key) && e.visible === !1 ? I(e) : e);
|
|
621
|
+
a.length > 0 && a.every((e) => e.visible === !1) ? S.push(i.cannotHideAll) : D = a;
|
|
624
622
|
}
|
|
625
|
-
let
|
|
626
|
-
version:
|
|
627
|
-
columnWidths: { ...
|
|
623
|
+
let P = typeof s.unsupported == "string" && s.unsupported.trim() !== "" ? s.unsupported.trim().slice(0, ee) : null, F = {
|
|
624
|
+
version: n.version,
|
|
625
|
+
columnWidths: { ...n.columnWidths },
|
|
628
626
|
filters: {
|
|
629
|
-
globalText:
|
|
630
|
-
columnFilters: Object.fromEntries(
|
|
627
|
+
globalText: E,
|
|
628
|
+
columnFilters: Object.fromEntries(C)
|
|
631
629
|
},
|
|
632
|
-
sort:
|
|
633
|
-
columns:
|
|
630
|
+
sort: T,
|
|
631
|
+
columns: D
|
|
634
632
|
};
|
|
635
633
|
return {
|
|
636
634
|
ok: !0,
|
|
637
|
-
state:
|
|
638
|
-
changed:
|
|
639
|
-
dropped:
|
|
640
|
-
unsupported:
|
|
635
|
+
state: F,
|
|
636
|
+
changed: !_e(F, n),
|
|
637
|
+
dropped: me(S, i),
|
|
638
|
+
unsupported: P
|
|
641
639
|
};
|
|
642
|
-
},
|
|
643
|
-
let n =
|
|
640
|
+
}, ge = (e, t) => {
|
|
641
|
+
let n = L(e).sort(), r = L(t).sort();
|
|
644
642
|
return n.length === r.length && n.every((e, t) => e === r[t]);
|
|
645
|
-
},
|
|
646
|
-
let n = new Map(
|
|
647
|
-
for (let [t,
|
|
648
|
-
let e =
|
|
649
|
-
|
|
643
|
+
}, _e = (e, t) => c(e.filters, t.filters) && l(e.sort, t.sort) && ge(e.columns, t.columns), ve = (e, t) => !ge(e.columns, t.columns), ye = (e, n) => {
|
|
644
|
+
let r = f(n.localeText), i = new Map(n.columns.map((e) => [e.key, e])), a = (e) => i.get(e)?.title || e, o = [];
|
|
645
|
+
for (let [t, n] of Object.entries(e.filters.columnFilters)) {
|
|
646
|
+
let e = i.get(t);
|
|
647
|
+
o.push({
|
|
650
648
|
id: `f:${t}`,
|
|
651
|
-
label:
|
|
652
|
-
text:
|
|
649
|
+
label: a(t),
|
|
650
|
+
text: d(n, e ? u(e, r) : { texts: r })
|
|
653
651
|
});
|
|
654
652
|
}
|
|
655
|
-
for (let
|
|
656
|
-
id: `s:${
|
|
657
|
-
label:
|
|
658
|
-
text:
|
|
653
|
+
for (let n of e.sort) o.push({
|
|
654
|
+
id: `s:${n.columnKey}`,
|
|
655
|
+
label: r.itemSort,
|
|
656
|
+
text: t(r.itemSortEntry, {
|
|
657
|
+
column: a(n.columnKey),
|
|
658
|
+
direction: n.direction === "desc" ? r.descending : r.ascending
|
|
659
|
+
})
|
|
659
660
|
});
|
|
660
|
-
if (e.filters.globalText !== "" &&
|
|
661
|
+
if (e.filters.globalText !== "" && o.push({
|
|
661
662
|
id: "q",
|
|
662
|
-
label:
|
|
663
|
-
text:
|
|
664
|
-
}),
|
|
663
|
+
label: r.itemSearch,
|
|
664
|
+
text: t(r.quote, { text: e.filters.globalText })
|
|
665
|
+
}), A(n.allowColumnVisibility, !1)) for (let t of L(e.columns)) o.push({
|
|
665
666
|
id: `h:${t}`,
|
|
666
|
-
label:
|
|
667
|
-
text:
|
|
667
|
+
label: r.itemHidden,
|
|
668
|
+
text: a(t)
|
|
668
669
|
});
|
|
669
|
-
return
|
|
670
|
-
},
|
|
670
|
+
return o;
|
|
671
|
+
}, be = (e, t) => {
|
|
671
672
|
let n = { ...e.filters.columnFilters }, { globalText: r } = e.filters, i = e.sort, a = e.columns;
|
|
672
673
|
if (t.startsWith("f:")) delete n[t.slice(2)];
|
|
673
674
|
else if (t.startsWith("s:")) i = i.filter((e) => e.columnKey !== t.slice(2));
|
|
674
675
|
else if (t === "q") r = "";
|
|
675
676
|
else if (t.startsWith("h:")) {
|
|
676
677
|
let e = t.slice(2);
|
|
677
|
-
a = a?.map((t) => t.key === e ?
|
|
678
|
+
a = a?.map((t) => t.key === e ? I(t) : t);
|
|
678
679
|
}
|
|
679
680
|
return {
|
|
680
681
|
...e,
|
|
@@ -687,4 +688,4 @@ var d = [
|
|
|
687
688
|
};
|
|
688
689
|
};
|
|
689
690
|
//#endregion
|
|
690
|
-
export { oe as createGridAskRequest,
|
|
691
|
+
export { oe as createGridAskRequest, ye as describeGridAskView, R as gridAskSystemPrompt, ve as isGridAskColumnsChanged, _e as isSameGridAskView, he as readGridAskAnswer, be as removeGridAskItem };
|