@ishibashi0112/spreadsheet-grid-core 1.13.0 → 1.14.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/debouncedValueStore.cjs +1 -1
- package/dist/controllers/debouncedValueStore.d.ts +2 -1
- package/dist/controllers/debouncedValueStore.js +10 -9
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.js +1 -0
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.d.ts +2 -1
- package/dist/controllers/serverSideRowModel.js +37 -36
- package/dist/engine/createGridEngine.cjs +1 -1
- package/dist/engine/createGridEngine.js +44 -37
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +75 -54
- package/dist/engine/gridApi.cjs +10 -10
- package/dist/engine/gridApi.d.ts +5 -1
- package/dist/engine/gridApi.js +433 -236
- package/dist/engine/newRowController.cjs +1 -1
- package/dist/engine/newRowController.d.ts +4 -1
- package/dist/engine/newRowController.js +23 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -4
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +1 -0
- package/dist/logic/cellValueWrites.cjs +1 -0
- package/dist/logic/cellValueWrites.d.ts +21 -0
- package/dist/logic/cellValueWrites.js +70 -0
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +8 -2
- package/dist/logic/exportData.js +45 -27
- package/dist/logic/gridAgentTools.cjs +2 -0
- package/dist/logic/gridAgentTools.d.ts +125 -0
- package/dist/logic/gridAgentTools.js +673 -0
- package/dist/logic/gridAsk.cjs +3 -3
- package/dist/logic/gridAsk.d.ts +10 -0
- package/dist/logic/gridAsk.js +169 -156
- package/dist/logic/gridAskLocaleText.cjs +1 -1
- package/dist/logic/gridAskLocaleText.d.ts +5 -0
- package/dist/logic/gridAskLocaleText.js +1 -0
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.d.ts +1 -0
- package/dist/logic/grouping.js +16 -2
- package/dist/model/gridTypes.core.d.ts +120 -2
- package/package.json +1 -1
package/dist/logic/gridAsk.js
CHANGED
|
@@ -102,8 +102,8 @@ var m = [
|
|
|
102
102
|
value: e.value,
|
|
103
103
|
label: e.label
|
|
104
104
|
})) : null;
|
|
105
|
-
}, k = (e, t) => e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0,
|
|
106
|
-
let n =
|
|
105
|
+
}, k = (e, t) => e !== void 0 && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, te = (e, t) => {
|
|
106
|
+
let n = A(e.allowFilter, !0), i = e.localeText ? p(e.localeText) : void 0, a = [];
|
|
107
107
|
for (let o of e.columns) {
|
|
108
108
|
let s = k(e.columnHints, o.key);
|
|
109
109
|
if (s === !1) continue;
|
|
@@ -120,53 +120,52 @@ var m = [
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
return a;
|
|
123
|
-
},
|
|
123
|
+
}, A = (e, t) => e ?? t, j = (e, t, n = {}) => ({
|
|
124
124
|
column: e,
|
|
125
125
|
op: t,
|
|
126
126
|
value: n.value ?? null,
|
|
127
127
|
values: n.values ?? null,
|
|
128
128
|
to: n.to ?? null
|
|
129
|
-
}),
|
|
129
|
+
}), M = (e, t) => {
|
|
130
130
|
switch (t.mode) {
|
|
131
|
-
case "comparison": return [
|
|
132
|
-
case "range": return [
|
|
131
|
+
case "comparison": return [j(e, t.operator, { value: String(t.value) })];
|
|
132
|
+
case "range": return [j(e, "between", {
|
|
133
133
|
value: String(t.min),
|
|
134
134
|
to: String(t.max)
|
|
135
135
|
})];
|
|
136
|
-
default: return [
|
|
136
|
+
default: return [j(e, t.mode)];
|
|
137
137
|
}
|
|
138
|
-
},
|
|
138
|
+
}, N = (e, t) => t.mode === "blank" || t.mode === "notBlank" ? [j(e, t.mode)] : [j(e, t.mode, { value: t.value })], P = (e, t) => {
|
|
139
139
|
switch (t.mode) {
|
|
140
|
-
case "range": return [
|
|
140
|
+
case "range": return [j(e, "between", {
|
|
141
141
|
value: t.from,
|
|
142
142
|
to: t.to
|
|
143
143
|
})];
|
|
144
|
-
case "preset": return [
|
|
144
|
+
case "preset": return [j(e, "preset", { value: t.preset })];
|
|
145
145
|
case "blank":
|
|
146
|
-
case "notBlank": return [
|
|
147
|
-
default: return [
|
|
146
|
+
case "notBlank": return [j(e, t.mode)];
|
|
147
|
+
default: return [j(e, t.mode, { value: t.value })];
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, F = (e, t) => {
|
|
150
150
|
if (!t) return [];
|
|
151
|
-
let n =
|
|
151
|
+
let n = j(e, t.mode === "exclude" ? "notIn" : "in", { values: t.values.slice(0, S) });
|
|
152
152
|
return t.values.length > S && (n.more = t.values.length - S), [n];
|
|
153
|
-
},
|
|
153
|
+
}, I = (e, t) => {
|
|
154
154
|
switch (t.kind) {
|
|
155
155
|
case "text":
|
|
156
|
-
case "date": return [
|
|
157
|
-
case "select": return [
|
|
158
|
-
case "set": return
|
|
159
|
-
case "number": return t.parsed ?
|
|
160
|
-
case "numberSet": return [...t.condition ?
|
|
161
|
-
case "textSet": return [...t.condition ?
|
|
162
|
-
case "dateSet": return [...t.condition ?
|
|
156
|
+
case "date": return [j(e, "contains", { value: t.value })];
|
|
157
|
+
case "select": return [j(e, "equals", { value: t.value })];
|
|
158
|
+
case "set": return F(e, t);
|
|
159
|
+
case "number": return t.parsed ? M(e, t.parsed) : [];
|
|
160
|
+
case "numberSet": return [...t.condition ? M(e, t.condition) : [], ...F(e, t.set)];
|
|
161
|
+
case "textSet": return [...t.condition ? N(e, t.condition) : [], ...F(e, t.set)];
|
|
162
|
+
case "dateSet": return [...t.condition ? P(e, t.condition) : [], ...F(e, t.set)];
|
|
163
163
|
case "custom": return [];
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, L = (e) => {
|
|
166
166
|
let t = { ...e };
|
|
167
167
|
return delete t.visible, t;
|
|
168
|
-
},
|
|
169
|
-
"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.",
|
|
168
|
+
}, R = (e) => (e ?? []).filter((e) => e.visible === !1).map((e) => e.key), z = [
|
|
170
169
|
"- Use only the listed columns (by key) and, for each column, only its listed ops. A column without ops cannot be filtered.",
|
|
171
170
|
"- 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.",
|
|
172
171
|
"- \"values\" is always the whole list after the change: in refine mode, repeat the current values you keep. A current list with \"more\": N shows only part of its values; in refine mode the rest stay while the column keeps the same op (in or notIn). To replace such a list, put op \"clear\" for the column before the new in or notIn.",
|
|
@@ -174,10 +173,13 @@ var m = [
|
|
|
174
173
|
"- Read amounts by their meaning: 「X しない」「X 未満」「X を切る」「under X」 are < X; 「X 以下」 is <= X; 「X 以上」 is >= X; 「X を超える」「X より多い」「over X」 are > X. Use != only for \"not equal to\" (〜ではない, 〜以外).",
|
|
175
174
|
"- Use at most one filter per column, except that a column whose ops include in/notIn may have one in/notIn and one other op.",
|
|
176
175
|
"- mode \"replace\" starts from an empty view (no filters, sort or search; hidden columns stay). mode \"refine\" keeps the current view and changes only what the request mentions; op \"clear\" removes a column's filter. Use refine only when the request clearly builds on what is shown now (for example: also, too, さらに, それと, そのうえで, その中で, 〜も). A request that describes on its own the rows it wants uses replace, even when it is short.",
|
|
177
|
-
"- sort lists columns in priority order; null keeps the current sort in refine mode. search is a word to find in any column; use it only when no column fits. In refine mode null keeps the current search; \"\" clears it."
|
|
176
|
+
"- sort lists columns in priority order; null keeps the current sort in refine mode. search is a word to find in any column; use it only when no column fits. In refine mode null keeps the current search; \"\" clears it."
|
|
177
|
+
], B = [
|
|
178
|
+
"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.",
|
|
179
|
+
...z,
|
|
178
180
|
"- Change filters, the sort, the search and hidden columns only when the prompt says it is allowed. hide and show list column keys.",
|
|
179
181
|
"- If any part of the request cannot be done with these columns and ops, do the rest and say briefly what you could not do in \"unsupported\", in the language of the request. Otherwise unsupported is null. Never invent a column."
|
|
180
|
-
].join("\n"),
|
|
182
|
+
].join("\n"), ne = [
|
|
181
183
|
"Sun",
|
|
182
184
|
"Mon",
|
|
183
185
|
"Tue",
|
|
@@ -185,21 +187,21 @@ var m = [
|
|
|
185
187
|
"Thu",
|
|
186
188
|
"Fri",
|
|
187
189
|
"Sat"
|
|
188
|
-
],
|
|
190
|
+
], re = (e) => {
|
|
189
191
|
let t = e.slice(0, v).map((e) => e.label && e.label !== e.value ? `${JSON.stringify(e.value)} (${e.label})` : JSON.stringify(e.value)), n = e.length - t.length;
|
|
190
192
|
return n > 0 ? `${t.join(", ")} and ${n} more (not listed)` : t.join(", ");
|
|
191
|
-
},
|
|
193
|
+
}, ie = (e) => {
|
|
192
194
|
let t = `- ${e.key} ${JSON.stringify(e.title)}${e.hint ? ` (${e.hint})` : ""}`;
|
|
193
195
|
if (e.filterType === null) return `${t}: no ops.`;
|
|
194
196
|
let n = `${t}: ${_[e.filterType]}.`, r = e.filterType === "select" ? e.options?.filter((e) => e.value !== "") : e.options;
|
|
195
|
-
r && r.length > 0 && (n += ` values: ${
|
|
197
|
+
r && r.length > 0 && (n += ` values: ${re(r)}.`);
|
|
196
198
|
let i = e.ops.map((t) => t === "preset" ? `preset (${e.presets.map((e) => `${e.id} = ${e.label}`).join(", ")})` : t);
|
|
197
199
|
return `${n} ops: ${i.join(", ")}`;
|
|
198
|
-
},
|
|
199
|
-
let
|
|
200
|
+
}, V = (e, t = !0) => {
|
|
201
|
+
let n = e.length > 0 && e.length <= C ? {
|
|
200
202
|
type: "string",
|
|
201
203
|
enum: e
|
|
202
|
-
} : { type: "string" },
|
|
204
|
+
} : { type: "string" }, r = { anyOf: [{ type: "string" }, { type: "null" }] };
|
|
203
205
|
return {
|
|
204
206
|
type: "object",
|
|
205
207
|
additionalProperties: !1,
|
|
@@ -210,7 +212,7 @@ var m = [
|
|
|
210
212
|
"search",
|
|
211
213
|
"hide",
|
|
212
214
|
"show",
|
|
213
|
-
"unsupported"
|
|
215
|
+
...t ? ["unsupported"] : []
|
|
214
216
|
],
|
|
215
217
|
properties: {
|
|
216
218
|
mode: {
|
|
@@ -230,17 +232,17 @@ var m = [
|
|
|
230
232
|
"to"
|
|
231
233
|
],
|
|
232
234
|
properties: {
|
|
233
|
-
column:
|
|
235
|
+
column: n,
|
|
234
236
|
op: {
|
|
235
237
|
type: "string",
|
|
236
238
|
enum: [...h]
|
|
237
239
|
},
|
|
238
|
-
value:
|
|
240
|
+
value: r,
|
|
239
241
|
values: { anyOf: [{
|
|
240
242
|
type: "array",
|
|
241
243
|
items: { type: "string" }
|
|
242
244
|
}, { type: "null" }] },
|
|
243
|
-
to:
|
|
245
|
+
to: r
|
|
244
246
|
}
|
|
245
247
|
}
|
|
246
248
|
},
|
|
@@ -251,7 +253,7 @@ var m = [
|
|
|
251
253
|
additionalProperties: !1,
|
|
252
254
|
required: ["column", "direction"],
|
|
253
255
|
properties: {
|
|
254
|
-
column:
|
|
256
|
+
column: n,
|
|
255
257
|
direction: {
|
|
256
258
|
type: "string",
|
|
257
259
|
enum: ["asc", "desc"]
|
|
@@ -259,86 +261,97 @@ var m = [
|
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
}, { type: "null" }] },
|
|
262
|
-
search:
|
|
264
|
+
search: r,
|
|
263
265
|
hide: {
|
|
264
266
|
type: "array",
|
|
265
|
-
items:
|
|
267
|
+
items: n
|
|
266
268
|
},
|
|
267
269
|
show: {
|
|
268
270
|
type: "array",
|
|
269
|
-
items:
|
|
271
|
+
items: n
|
|
270
272
|
},
|
|
271
|
-
unsupported:
|
|
273
|
+
...t ? { unsupported: r } : {}
|
|
272
274
|
}
|
|
273
275
|
};
|
|
274
|
-
},
|
|
275
|
-
let
|
|
276
|
-
return
|
|
276
|
+
}, H = (e, t) => {
|
|
277
|
+
let n = te(t, e), r = A(t.allowFilter, !0), a = A(t.allowSort, !0), o = A(t.allowSearch, !0), s = A(t.allowColumnVisibility, !1), c = t.now ?? /* @__PURE__ */ new Date(), l = new Set(n.map((e) => e.key)), u = new Set(n.filter((e) => e.filterType !== null).map((e) => e.key)), d = {};
|
|
278
|
+
return r && (d.filters = Object.entries(e.filters.columnFilters).filter(([e]) => u.has(e)).flatMap(([e, t]) => I(e, t))), a && (d.sort = e.sort.filter((e) => l.has(e.columnKey)).map((e) => ({
|
|
277
279
|
column: e.columnKey,
|
|
278
280
|
direction: e.direction
|
|
279
|
-
}))),
|
|
281
|
+
}))), o && (d.search = e.filters.globalText === "" ? null : e.filters.globalText), s && (d.hidden = R(e.columns).filter((e) => l.has(e))), {
|
|
282
|
+
today: `${i(c)} (${ne[c.getDay()]})`,
|
|
283
|
+
columnKeys: n.map((e) => e.key),
|
|
284
|
+
columnLines: n.map(ie),
|
|
285
|
+
permissions: [
|
|
286
|
+
`Filters: ${r ? "allowed (by each column's ops)" : "not allowed"}.`,
|
|
287
|
+
`Sort: ${a ? "allowed (any column above)" : "not allowed"}.`,
|
|
288
|
+
`Search: ${o ? "allowed" : "not allowed"}.`,
|
|
289
|
+
`Hide or show columns: ${s ? "allowed" : "not allowed"}.`
|
|
290
|
+
],
|
|
291
|
+
current: d
|
|
292
|
+
};
|
|
293
|
+
}, ae = (e, t, n) => {
|
|
294
|
+
let r = H(t, n);
|
|
295
|
+
return {
|
|
280
296
|
system: B,
|
|
281
297
|
prompt: [
|
|
282
|
-
`Today: ${
|
|
298
|
+
`Today: ${r.today}`,
|
|
283
299
|
"Columns:",
|
|
284
|
-
...r.
|
|
285
|
-
|
|
286
|
-
`
|
|
287
|
-
`Search: ${s ? "allowed" : "not allowed"}.`,
|
|
288
|
-
`Hide or show columns: ${c ? "allowed" : "not allowed"}.`,
|
|
289
|
-
`Current view: ${JSON.stringify(f)}`,
|
|
300
|
+
...r.columnLines,
|
|
301
|
+
...r.permissions,
|
|
302
|
+
`Current view: ${JSON.stringify(r.current)}`,
|
|
290
303
|
`Request: ${e.trim()}`
|
|
291
304
|
].join("\n"),
|
|
292
|
-
schema:
|
|
305
|
+
schema: V(r.columnKeys),
|
|
293
306
|
text: e.trim()
|
|
294
307
|
};
|
|
295
|
-
},
|
|
296
|
-
let n =
|
|
308
|
+
}, U = (e) => ({ value: e }), W = (e) => ({ error: e }), G = (e) => typeof e == "string" ? e : typeof e == "number" && Number.isFinite(e) ? String(e) : "", K = (e) => G(e).trim(), q = (e) => typeof e == "number" ? Number.isFinite(e) ? e : null : typeof e == "string" && e.length <= y ? n(e) : null, J = (e, t) => {
|
|
309
|
+
let n = K(e);
|
|
297
310
|
return n === "" ? t.emptyText : n.length > T ? `${n.slice(0, T)}…` : n;
|
|
298
|
-
},
|
|
299
|
-
let r = e.slice(0, 5).map((e) =>
|
|
311
|
+
}, Y = (e, n) => t(n.quote, { text: J(e, n) }), oe = (e, n) => {
|
|
312
|
+
let r = e.slice(0, 5).map((e) => Y(e, n)).join(n.quoteSeparator);
|
|
300
313
|
return e.length > 5 ? t(n.andMore, {
|
|
301
314
|
items: r,
|
|
302
315
|
count: e.length - 5
|
|
303
316
|
}) : r;
|
|
304
|
-
},
|
|
317
|
+
}, X = (e, n) => t(n.quote, { text: K(e) === "" ? n.unnamed : J(e, n) }), se = (e) => t(e.textTooLong, { limit: y }), Z = (e, n, r) => t(r.columnReason, {
|
|
305
318
|
column: e,
|
|
306
319
|
reason: n
|
|
307
|
-
}),
|
|
308
|
-
if (e === "blank" || e === "notBlank") return
|
|
320
|
+
}), ce = (e, n, r) => {
|
|
321
|
+
if (e === "blank" || e === "notBlank") return U({ mode: e });
|
|
309
322
|
if (e === "between") {
|
|
310
|
-
let e =
|
|
311
|
-
return e === null || t === null ?
|
|
323
|
+
let e = q(n.value), t = q(n.to);
|
|
324
|
+
return e === null || t === null ? W(r.noNumberRange) : U({
|
|
312
325
|
mode: "range",
|
|
313
326
|
min: Math.min(e, t),
|
|
314
327
|
max: Math.max(e, t)
|
|
315
328
|
});
|
|
316
329
|
}
|
|
317
|
-
let i =
|
|
318
|
-
return i === null ?
|
|
330
|
+
let i = q(n.value);
|
|
331
|
+
return i === null ? W(t(r.notNumber, { value: Y(n.value, r) })) : U({
|
|
319
332
|
mode: "comparison",
|
|
320
333
|
operator: e,
|
|
321
334
|
value: i
|
|
322
335
|
});
|
|
323
|
-
},
|
|
324
|
-
if (e === "blank" || e === "notBlank") return
|
|
325
|
-
let r =
|
|
326
|
-
return r === "" ?
|
|
336
|
+
}, le = (e, t, n) => {
|
|
337
|
+
if (e === "blank" || e === "notBlank") return U({ mode: e });
|
|
338
|
+
let r = K(t.value);
|
|
339
|
+
return r === "" ? W(n.noText) : r.length > y ? W(se(n)) : U({
|
|
327
340
|
mode: e,
|
|
328
341
|
value: r
|
|
329
342
|
});
|
|
330
|
-
},
|
|
331
|
-
if (n === "blank" || n === "notBlank") return
|
|
343
|
+
}, ue = (e, n, r, i) => {
|
|
344
|
+
if (n === "blank" || n === "notBlank") return U({ mode: n });
|
|
332
345
|
if (n === "preset") {
|
|
333
|
-
let n =
|
|
334
|
-
return a ?
|
|
346
|
+
let n = K(r.value), a = e.presets.find((e) => e.id === n || e.label === n);
|
|
347
|
+
return a ? U({
|
|
335
348
|
mode: "preset",
|
|
336
349
|
preset: a.id
|
|
337
|
-
}) :
|
|
350
|
+
}) : W(t(i.unknownPeriod, { value: Y(r.value, i) }));
|
|
338
351
|
}
|
|
339
352
|
if (n === "between") {
|
|
340
|
-
let e = a(
|
|
341
|
-
return e === null || t === null ?
|
|
353
|
+
let e = a(K(r.value)), t = a(K(r.to));
|
|
354
|
+
return e === null || t === null ? W(i.noDateRange) : U(e <= t ? {
|
|
342
355
|
mode: "range",
|
|
343
356
|
from: e,
|
|
344
357
|
to: t
|
|
@@ -348,29 +361,29 @@ var m = [
|
|
|
348
361
|
to: e
|
|
349
362
|
});
|
|
350
363
|
}
|
|
351
|
-
let o = a(
|
|
352
|
-
return o === null ?
|
|
364
|
+
let o = a(K(r.value));
|
|
365
|
+
return o === null ? W(t(i.notDate, { value: Y(r.value, i) })) : U({
|
|
353
366
|
mode: n,
|
|
354
367
|
value: o
|
|
355
368
|
});
|
|
356
|
-
},
|
|
369
|
+
}, de = (e, t) => {
|
|
357
370
|
let n = e.find((e) => e.value === t);
|
|
358
371
|
if (n) return n.value;
|
|
359
372
|
let r = e.find((e) => e.label === t);
|
|
360
373
|
if (r) return r.value;
|
|
361
374
|
let i = t.trim().toLowerCase(), a = e.find((e) => e.value.trim().toLowerCase() === i || e.label.trim().toLowerCase() === i);
|
|
362
375
|
return a ? a.value : null;
|
|
363
|
-
},
|
|
376
|
+
}, fe = (e) => e === void 0 ? null : e.kind === "set" ? {
|
|
364
377
|
mode: e.mode === "exclude" ? "exclude" : "include",
|
|
365
378
|
values: e.values
|
|
366
379
|
} : (e.kind === "numberSet" || e.kind === "textSet" || e.kind === "dateSet") && e.set ? {
|
|
367
380
|
mode: e.set.mode === "exclude" ? "exclude" : "include",
|
|
368
381
|
values: e.set.values
|
|
369
|
-
} : null,
|
|
382
|
+
} : null, pe = (e, r, i, o) => {
|
|
370
383
|
let { t: s } = o;
|
|
371
|
-
if (!Array.isArray(r)) return
|
|
372
|
-
let c =
|
|
373
|
-
r.length > x && o.dropped.push(
|
|
384
|
+
if (!Array.isArray(r)) return W(s.noValues);
|
|
385
|
+
let c = fe(o.original), l = new Set(c?.values ?? []);
|
|
386
|
+
r.length > x && o.dropped.push(Z(e.title, t(s.tooManyValues, {
|
|
374
387
|
limit: x,
|
|
375
388
|
count: r.length - x
|
|
376
389
|
}), s));
|
|
@@ -380,7 +393,7 @@ var m = [
|
|
|
380
393
|
f += 1;
|
|
381
394
|
continue;
|
|
382
395
|
}
|
|
383
|
-
let r =
|
|
396
|
+
let r = G(t);
|
|
384
397
|
if (l.has(r)) {
|
|
385
398
|
u.add(r);
|
|
386
399
|
continue;
|
|
@@ -392,7 +405,7 @@ var m = [
|
|
|
392
405
|
}
|
|
393
406
|
let o = i;
|
|
394
407
|
if (i === "" || l.has(i)) o = i;
|
|
395
|
-
else if (e.options) o =
|
|
408
|
+
else if (e.options) o = de(e.options, r);
|
|
396
409
|
else if (e.filterType === "dateSet") o = a(i) ?? i;
|
|
397
410
|
else if (e.filterType === "numberSet") {
|
|
398
411
|
let e = n(i);
|
|
@@ -400,58 +413,58 @@ var m = [
|
|
|
400
413
|
}
|
|
401
414
|
o === null ? d.push(r) : u.add(o);
|
|
402
415
|
}
|
|
403
|
-
if (d.length > 0 && o.dropped.push(
|
|
416
|
+
if (d.length > 0 && o.dropped.push(Z(e.title, t(s.notInOptions, { values: oe(d, s) }), s)), p > 0 && o.dropped.push(Z(e.title, t(s.valuesTooLong, {
|
|
404
417
|
limit: b,
|
|
405
418
|
count: p
|
|
406
|
-
}), s)), f > 0 && o.dropped.push(
|
|
407
|
-
if (c === null || c.mode !== i) return
|
|
419
|
+
}), s)), f > 0 && o.dropped.push(Z(e.title, t(s.unreadableValues, { count: f }), s)), u.size === 0) return W(s.noSelectableValues);
|
|
420
|
+
if (c === null || c.mode !== i) return U([...u]);
|
|
408
421
|
if (c.values.length > S && !o.cleared) {
|
|
409
422
|
let e = c.values.slice(0, S);
|
|
410
423
|
if (o.refine || e.every((e) => u.has(e))) for (let e of c.values.slice(S)) u.add(e);
|
|
411
424
|
}
|
|
412
|
-
return u.size === c.values.length && c.values.every((e) => u.has(e)) ?
|
|
413
|
-
},
|
|
425
|
+
return u.size === c.values.length && c.values.every((e) => u.has(e)) ? U([...c.values]) : U([...u]);
|
|
426
|
+
}, me = (e, n, r, i) => {
|
|
414
427
|
let a = e.filterType, { original: l, t: u } = i;
|
|
415
428
|
switch (a) {
|
|
416
429
|
case "text":
|
|
417
430
|
case "date": {
|
|
418
|
-
let e =
|
|
419
|
-
return e === "" ?
|
|
431
|
+
let e = K(r.value);
|
|
432
|
+
return e === "" ? W(u.noText) : (l?.kind === "text" || l?.kind === "date") && l.kind === a && l.value.trim() === e ? U({
|
|
420
433
|
kind: a,
|
|
421
434
|
value: l.value
|
|
422
|
-
}) : e.length > y ?
|
|
435
|
+
}) : e.length > y ? W(se(u)) : U({
|
|
423
436
|
kind: a,
|
|
424
437
|
value: e
|
|
425
438
|
});
|
|
426
439
|
}
|
|
427
440
|
case "select": {
|
|
428
|
-
let n =
|
|
429
|
-
if (n.trim() === "") return
|
|
430
|
-
if (l?.kind === "select" && (l.value === n || l.value === n.trim())) return
|
|
441
|
+
let n = G(r.value);
|
|
442
|
+
if (n.trim() === "") return W(u.noValues);
|
|
443
|
+
if (l?.kind === "select" && (l.value === n || l.value === n.trim())) return U({
|
|
431
444
|
kind: "select",
|
|
432
445
|
value: l.value
|
|
433
446
|
});
|
|
434
|
-
let i = e.options ?
|
|
435
|
-
return i === null ?
|
|
447
|
+
let i = e.options ? de(e.options, n) : n.trim();
|
|
448
|
+
return i === null ? W(t(u.notAnOption, { value: Y(n, u) })) : i === "" ? W(t(u.cannotFilterBy, { value: Y(n, u) })) : i.length > b ? W(t(u.valueTooLong, { limit: b })) : U({
|
|
436
449
|
kind: "select",
|
|
437
450
|
value: i
|
|
438
451
|
});
|
|
439
452
|
}
|
|
440
453
|
case "set": {
|
|
441
|
-
let t = n === "notIn" ? "exclude" : "include", a =
|
|
442
|
-
return "error" in a ? a :
|
|
454
|
+
let t = n === "notIn" ? "exclude" : "include", a = pe(e, r.values, t, i);
|
|
455
|
+
return "error" in a ? a : U({
|
|
443
456
|
kind: "set",
|
|
444
457
|
mode: t,
|
|
445
458
|
values: a.value
|
|
446
459
|
});
|
|
447
460
|
}
|
|
448
461
|
case "number": {
|
|
449
|
-
let e =
|
|
462
|
+
let e = ce(n, r, u);
|
|
450
463
|
return "error" in e ? e : l?.kind === "number" && c({
|
|
451
464
|
kind: "number",
|
|
452
465
|
raw: l.raw,
|
|
453
466
|
parsed: e.value
|
|
454
|
-
}, l) ?
|
|
467
|
+
}, l) ? U(s(l)) : U({
|
|
455
468
|
kind: "number",
|
|
456
469
|
raw: o(e.value, String, u),
|
|
457
470
|
parsed: e.value
|
|
@@ -464,31 +477,31 @@ var m = [
|
|
|
464
477
|
set: null
|
|
465
478
|
};
|
|
466
479
|
if (n === "in" || n === "notIn") {
|
|
467
|
-
if (i.fixed.has("set")) return
|
|
468
|
-
let t = n === "notIn" ? "exclude" : "include", a =
|
|
480
|
+
if (i.fixed.has("set")) return W(u.oneSelection);
|
|
481
|
+
let t = n === "notIn" ? "exclude" : "include", a = pe(e, r.values, t, i);
|
|
469
482
|
return "error" in a ? a : (o.set = {
|
|
470
483
|
mode: t,
|
|
471
484
|
values: a.value
|
|
472
|
-
},
|
|
485
|
+
}, U(o));
|
|
473
486
|
}
|
|
474
|
-
if (i.fixed.has("condition")) return
|
|
487
|
+
if (i.fixed.has("condition")) return W(u.oneCondition);
|
|
475
488
|
if (o.kind === "numberSet") {
|
|
476
|
-
let e =
|
|
489
|
+
let e = ce(n, r, u);
|
|
477
490
|
if ("error" in e) return e;
|
|
478
491
|
o.condition = e.value;
|
|
479
492
|
} else if (o.kind === "textSet") {
|
|
480
|
-
let e =
|
|
493
|
+
let e = le(n, r, u);
|
|
481
494
|
if ("error" in e) return e;
|
|
482
495
|
o.condition = e.value;
|
|
483
496
|
} else {
|
|
484
|
-
let t =
|
|
497
|
+
let t = ue(e, n, r, u);
|
|
485
498
|
if ("error" in t) return t;
|
|
486
499
|
o.condition = t.value;
|
|
487
500
|
}
|
|
488
|
-
return
|
|
501
|
+
return U(o);
|
|
489
502
|
}
|
|
490
503
|
}
|
|
491
|
-
},
|
|
504
|
+
}, he = (e) => {
|
|
492
505
|
if (typeof e != "string") return e;
|
|
493
506
|
let t = e.trim().replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/, "");
|
|
494
507
|
try {
|
|
@@ -502,58 +515,58 @@ var m = [
|
|
|
502
515
|
return;
|
|
503
516
|
}
|
|
504
517
|
}
|
|
505
|
-
},
|
|
506
|
-
let t =
|
|
518
|
+
}, Q = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : null, ge = (e) => {
|
|
519
|
+
let t = K(e).toLowerCase();
|
|
507
520
|
return t === "asc" || t === "ascending" ? "asc" : t === "desc" || t === "descending" ? "desc" : null;
|
|
508
|
-
},
|
|
509
|
-
let i = p(r.localeText), a =
|
|
521
|
+
}, _e = (e, t, n) => u(e, t.filter((e) => n(e.columnKey))) ? t.map((e) => ({ ...e })) : [...e, ...t.filter((e) => !n(e.columnKey)).map((e) => ({ ...e }))], ve = (e, n) => e.length > w ? [...e.slice(0, w - 1), t(n.moreReasons, { count: e.length - w + 1 })] : e, ye = (e, n, r) => {
|
|
522
|
+
let i = p(r.localeText), a = he(e);
|
|
510
523
|
if (a === void 0) return {
|
|
511
524
|
ok: !1,
|
|
512
525
|
message: i.readError
|
|
513
526
|
};
|
|
514
|
-
let o =
|
|
527
|
+
let o = Q(a), c = o?.mode, l = o?.filters;
|
|
515
528
|
if (!o || c !== void 0 && c !== "replace" && c !== "refine" || l !== void 0 && !Array.isArray(l) || l === void 0 && c === void 0) return {
|
|
516
529
|
ok: !1,
|
|
517
530
|
message: i.shapeError
|
|
518
531
|
};
|
|
519
|
-
let u = Array.isArray(l) ? l : [], d =
|
|
532
|
+
let u = Array.isArray(l) ? l : [], d = te(r, n), f = new Map(d.map((e) => [e.key, e])), m = /* @__PURE__ */ new Map();
|
|
520
533
|
for (let e of d) m.set(e.title, m.has(e.title) ? null : e);
|
|
521
534
|
let h = (e) => {
|
|
522
|
-
let t =
|
|
535
|
+
let t = K(e);
|
|
523
536
|
return f.get(t) ?? m.get(t) ?? void 0;
|
|
524
|
-
}, g =
|
|
537
|
+
}, g = A(r.allowFilter, !0), _ = A(r.allowSort, !0), v = A(r.allowSearch, !0), b = A(r.allowColumnVisibility, !1), x = c === "refine", S = [], C = !1, w = /* @__PURE__ */ new Map();
|
|
525
538
|
for (let [e, t] of Object.entries(n.filters.columnFilters)) {
|
|
526
539
|
let n = f.get(e);
|
|
527
540
|
(x || !n || n.filterType === null) && w.set(e, s(t));
|
|
528
541
|
}
|
|
529
|
-
let T = (e) => f.has(e), E = x || !_ ? n.sort.map((e) => ({ ...e })) :
|
|
542
|
+
let T = (e) => f.has(e), E = x || !_ ? n.sort.map((e) => ({ ...e })) : _e([], n.sort, T), D = x || !v ? n.filters.globalText : "";
|
|
530
543
|
if (!g) u.length > 0 && S.push(i.filtersLocked);
|
|
531
544
|
else {
|
|
532
545
|
let e = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = 0;
|
|
533
546
|
for (let s of u) {
|
|
534
|
-
let c =
|
|
547
|
+
let c = Q(s);
|
|
535
548
|
if (!c) {
|
|
536
549
|
o += 1;
|
|
537
550
|
continue;
|
|
538
551
|
}
|
|
539
552
|
let l = h(c.column);
|
|
540
553
|
if (!l) {
|
|
541
|
-
S.push(t(i.noSuchColumn, { column:
|
|
554
|
+
S.push(t(i.noSuchColumn, { column: X(c.column, i) }));
|
|
542
555
|
continue;
|
|
543
556
|
}
|
|
544
557
|
let u = typeof c.op == "string" ? c.op.trim() : "";
|
|
545
558
|
if (l.filterType === null) {
|
|
546
|
-
S.push(
|
|
559
|
+
S.push(Z(l.title, i.notFilterable, i));
|
|
547
560
|
continue;
|
|
548
561
|
}
|
|
549
562
|
if (u === "") {
|
|
550
|
-
S.push(
|
|
563
|
+
S.push(Z(l.title, i.noOperator, i));
|
|
551
564
|
continue;
|
|
552
565
|
}
|
|
553
566
|
let d = u;
|
|
554
567
|
if (!l.ops.includes(d)) {
|
|
555
|
-
let e = Object.prototype.hasOwnProperty.call(i.operatorLabels, d) ? i.operatorLabels[d] :
|
|
556
|
-
S.push(
|
|
568
|
+
let e = Object.prototype.hasOwnProperty.call(i.operatorLabels, d) ? i.operatorLabels[d] : J(c.op, i);
|
|
569
|
+
S.push(Z(l.title, t(i.operatorUnavailable, { operator: t(i.quote, { text: e }) }), i));
|
|
557
570
|
continue;
|
|
558
571
|
}
|
|
559
572
|
if (d === "clear") {
|
|
@@ -562,10 +575,10 @@ var m = [
|
|
|
562
575
|
}
|
|
563
576
|
let f = l.filterType === "numberSet" || l.filterType === "textSet" || l.filterType === "dateSet";
|
|
564
577
|
if (e.has(l.key) && !f) {
|
|
565
|
-
S.push(
|
|
578
|
+
S.push(Z(l.title, i.oneCondition, i));
|
|
566
579
|
continue;
|
|
567
580
|
}
|
|
568
|
-
let p = a.get(l.key) ?? /* @__PURE__ */ new Set(), m =
|
|
581
|
+
let p = a.get(l.key) ?? /* @__PURE__ */ new Set(), m = me(l, d, c, {
|
|
569
582
|
original: k(n.filters.columnFilters, l.key),
|
|
570
583
|
base: w.get(l.key),
|
|
571
584
|
fixed: p,
|
|
@@ -575,7 +588,7 @@ var m = [
|
|
|
575
588
|
t: i
|
|
576
589
|
});
|
|
577
590
|
if ("error" in m) {
|
|
578
|
-
S.push(
|
|
591
|
+
S.push(Z(l.title, m.error, i));
|
|
579
592
|
continue;
|
|
580
593
|
}
|
|
581
594
|
w.set(l.key, m.value), e.add(l.key), C = !0, f && (p.add(d === "in" || d === "notIn" ? "set" : "condition"), a.set(l.key, p));
|
|
@@ -587,16 +600,16 @@ var m = [
|
|
|
587
600
|
else {
|
|
588
601
|
let e = [];
|
|
589
602
|
for (let n of o.sort) {
|
|
590
|
-
let r =
|
|
603
|
+
let r = Q(n), a = r ? h(r.column) : void 0;
|
|
591
604
|
if (!r || !a) {
|
|
592
|
-
S.push(t(i.sortNoSuchColumn, { column:
|
|
605
|
+
S.push(t(i.sortNoSuchColumn, { column: X(r?.column, i) }));
|
|
593
606
|
continue;
|
|
594
607
|
}
|
|
595
|
-
let o =
|
|
608
|
+
let o = ge(r.direction);
|
|
596
609
|
if (o === null) {
|
|
597
610
|
S.push(t(i.sortBadDirection, {
|
|
598
611
|
column: a.title,
|
|
599
|
-
direction:
|
|
612
|
+
direction: Y(r.direction, i)
|
|
600
613
|
}));
|
|
601
614
|
continue;
|
|
602
615
|
}
|
|
@@ -605,29 +618,29 @@ var m = [
|
|
|
605
618
|
direction: o
|
|
606
619
|
});
|
|
607
620
|
}
|
|
608
|
-
x && o.sort.length > 0 && e.length === 0 || (E =
|
|
621
|
+
x && o.sort.length > 0 && e.length === 0 || (E = _e(e, n.sort, T)), e.length > 0 && (C = !0);
|
|
609
622
|
}
|
|
610
623
|
if (o.search !== void 0 && o.search !== null && typeof o.search != "string") S.push(i.searchUnreadable);
|
|
611
624
|
else if (typeof o.search == "string") {
|
|
612
625
|
let e = o.search.trim(), r = n.filters.globalText;
|
|
613
626
|
v ? e !== "" && e === r.trim() ? (D = r, C = !0) : e.length > y ? S.push(t(i.searchTooLong, { limit: y })) : (D = e, C ||= e !== "") : e !== "" && e !== r.trim() && S.push(i.searchLocked);
|
|
614
627
|
}
|
|
615
|
-
let O = n.columns?.map((e) => ({ ...e })),
|
|
616
|
-
if (
|
|
628
|
+
let O = n.columns?.map((e) => ({ ...e })), j = Array.isArray(o.hide) ? o.hide.filter((e) => K(e) !== "") : [], M = Array.isArray(o.show) ? o.show.filter((e) => K(e) !== "") : [], N = (e, t) => Array.isArray(e) ? e.length - t.length : e == null ? 0 : 1, P = N(o.hide, j) + N(o.show, M);
|
|
629
|
+
if (P > 0 && S.push(t(i.unreadableColumns, { count: P })), j.length > 0 || M.length > 0) if (!b || !O) S.push(i.columnsLocked);
|
|
617
630
|
else {
|
|
618
631
|
let e = new Set(O.map((e) => e.key)), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
619
|
-
for (let [a, o] of [[
|
|
632
|
+
for (let [a, o] of [[M, n], [j, r]]) for (let n of a) {
|
|
620
633
|
let r = h(n);
|
|
621
|
-
r && e.has(r.key) ? o.add(r.key) : S.push(t(i.noSuchColumn, { column:
|
|
634
|
+
r && e.has(r.key) ? o.add(r.key) : S.push(t(i.noSuchColumn, { column: X(n, i) }));
|
|
622
635
|
}
|
|
623
636
|
let a = O.map((e) => r.has(e.key) ? {
|
|
624
637
|
...e,
|
|
625
638
|
visible: !1
|
|
626
|
-
} : n.has(e.key) && e.visible === !1 ?
|
|
639
|
+
} : n.has(e.key) && e.visible === !1 ? L(e) : e);
|
|
627
640
|
a.length > 0 && a.every((e) => e.visible === !1) ? S.push(i.cannotHideAll) : (O = a, C = C || r.size > 0 || n.size > 0);
|
|
628
641
|
}
|
|
629
|
-
let
|
|
630
|
-
if (!x && !C && (
|
|
642
|
+
let F = typeof o.unsupported == "string" && o.unsupported.trim() !== "" ? o.unsupported.trim().slice(0, ee) : null, I = (e) => e != null && !(Array.isArray(e) && e.length === 0) && !(typeof e == "string" && e.trim() === ""), R = u.length > 0 || I(o.sort) || I(o.search) || I(o.hide) || I(o.show);
|
|
643
|
+
if (!x && !C && (R ? S.length > 0 : F !== null)) return {
|
|
631
644
|
ok: !0,
|
|
632
645
|
state: {
|
|
633
646
|
version: n.version,
|
|
@@ -640,10 +653,10 @@ var m = [
|
|
|
640
653
|
columns: n.columns?.map((e) => ({ ...e }))
|
|
641
654
|
},
|
|
642
655
|
changed: !1,
|
|
643
|
-
dropped:
|
|
644
|
-
unsupported:
|
|
656
|
+
dropped: ve(S, i),
|
|
657
|
+
unsupported: F
|
|
645
658
|
};
|
|
646
|
-
let
|
|
659
|
+
let z = {
|
|
647
660
|
version: n.version,
|
|
648
661
|
columnWidths: { ...n.columnWidths },
|
|
649
662
|
filters: {
|
|
@@ -655,15 +668,15 @@ var m = [
|
|
|
655
668
|
};
|
|
656
669
|
return {
|
|
657
670
|
ok: !0,
|
|
658
|
-
state:
|
|
659
|
-
changed: !
|
|
660
|
-
dropped:
|
|
661
|
-
unsupported:
|
|
671
|
+
state: z,
|
|
672
|
+
changed: !be(z, n),
|
|
673
|
+
dropped: ve(S, i),
|
|
674
|
+
unsupported: F
|
|
662
675
|
};
|
|
663
|
-
},
|
|
664
|
-
let n =
|
|
676
|
+
}, $ = (e, t) => {
|
|
677
|
+
let n = R(e).sort(), r = R(t).sort();
|
|
665
678
|
return n.length === r.length && n.every((e, t) => e === r[t]);
|
|
666
|
-
},
|
|
679
|
+
}, be = (e, t) => l(e.filters, t.filters) && u(e.sort, t.sort) && $(e.columns, t.columns), xe = (e, t) => !$(e.columns, t.columns), Se = (e, n) => {
|
|
667
680
|
let r = p(n.localeText), i = new Map(n.columns.map((e) => [e.key, e])), a = (e) => i.get(e)?.title || e, o = [];
|
|
668
681
|
for (let [t, n] of Object.entries(e.filters.columnFilters)) {
|
|
669
682
|
let e = i.get(t);
|
|
@@ -685,20 +698,20 @@ var m = [
|
|
|
685
698
|
id: "q",
|
|
686
699
|
label: r.itemSearch,
|
|
687
700
|
text: t(r.quote, { text: e.filters.globalText })
|
|
688
|
-
}),
|
|
701
|
+
}), A(n.allowColumnVisibility, !1)) for (let t of R(e.columns)) o.push({
|
|
689
702
|
id: `h:${t}`,
|
|
690
703
|
label: r.itemHidden,
|
|
691
704
|
text: a(t)
|
|
692
705
|
});
|
|
693
706
|
return o;
|
|
694
|
-
},
|
|
707
|
+
}, Ce = (e, t) => {
|
|
695
708
|
let n = { ...e.filters.columnFilters }, { globalText: r } = e.filters, i = e.sort, a = e.columns;
|
|
696
709
|
if (t.startsWith("f:")) delete n[t.slice(2)];
|
|
697
710
|
else if (t.startsWith("s:")) i = i.filter((e) => e.columnKey !== t.slice(2));
|
|
698
711
|
else if (t === "q") r = "";
|
|
699
712
|
else if (t.startsWith("h:")) {
|
|
700
713
|
let e = t.slice(2);
|
|
701
|
-
a = a?.map((t) => t.key === e ?
|
|
714
|
+
a = a?.map((t) => t.key === e ? L(t) : t);
|
|
702
715
|
}
|
|
703
716
|
return {
|
|
704
717
|
...e,
|
|
@@ -711,4 +724,4 @@ var m = [
|
|
|
711
724
|
};
|
|
712
725
|
};
|
|
713
726
|
//#endregion
|
|
714
|
-
export { ae as createGridAskRequest,
|
|
727
|
+
export { V as buildGridAskSchema, ae as createGridAskRequest, H as describeGridAskPromptParts, Se as describeGridAskView, B as gridAskSystemPrompt, z as gridAskViewRules, xe as isGridAskColumnsChanged, be as isSameGridAskView, ye as readGridAskAnswer, Ce as removeGridAskItem };
|