@infomaximum/widget-sdk 7.0.0-14 → 7.0.0-16

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.
Files changed (5) hide show
  1. package/CHANGELOG.md +256 -104
  2. package/dist/index.d.ts +14907 -12669
  3. package/dist/index.esm.js +1496 -792
  4. package/dist/index.js +1499 -791
  5. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var apiVersions = [
32
32
  "16.2", // Для версии системы 250709
33
33
  "17", // 2508
34
34
  "18", // 2601
35
+ "19", // 2602
35
36
  ];
36
37
  /**
37
38
  * Актуальная версия settings, с которой работает система.
@@ -102,46 +103,6 @@ exports.EActionButtonsTypes = void 0;
102
103
  EActionButtonsTypes["SECONDARY"] = "primary-outlined";
103
104
  })(exports.EActionButtonsTypes || (exports.EActionButtonsTypes = {}));
104
105
 
105
- /**
106
- * Глобальный счетчик для генерации ID.
107
- *
108
- * @todo
109
- * В будущем можно заменить единый счетчик на изолированные счетчики в разных контекстах.
110
- */
111
- var id = 1;
112
- var AutoIdentifiedArrayItemSchema = function (z) {
113
- return z.object({
114
- /**
115
- * Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
116
- * Гарантируется уникальность id в пределах settings виджета.
117
- */
118
- id: z
119
- .number()
120
- .default(-1)
121
- .transform(function (currentId) { return (currentId === -1 ? id++ : currentId); }),
122
- });
123
- };
124
- var BaseWidgetSettingsSchema = function (z) {
125
- return z.object({
126
- title: z.string().default(""),
127
- titleSize: themed(z.number().default(14), function (theme) { return theme.widgets.titleSize; }),
128
- titleColor: themed(ColorSchema(z), function (theme) { return theme.widgets.titleColor; }),
129
- titleWeight: themed(z.enum(exports.EFontWeight).default(exports.EFontWeight.NORMAL), function (theme) { return theme.widgets.titleWeight; }),
130
- stateName: z.string().nullable().default(null),
131
- showMarkdown: z.boolean().default(false),
132
- markdownMeasures: z.array(MarkdownMeasureSchema(z)).default([]),
133
- markdownText: z.string().default(""),
134
- markdownTextSize: z.number().default(14),
135
- filters: z.array(SettingsFilterSchema(z)).default([]),
136
- filterMode: z.enum(exports.EWidgetFilterMode).default(exports.EWidgetFilterMode.DEFAULT),
137
- ignoreFilters: z.boolean().default(false),
138
- sorting: z.array(WidgetSortingIndicatorSchema(z)).default([]),
139
- actionButtons: z.array(ActionButtonSchema(z)).default([]),
140
- paddings: themed(z.union([z.number(), z.string()]).default(8), function (theme) { return theme.widgets.paddings; }),
141
- viewTheme: z.boolean().default(false),
142
- });
143
- };
144
-
145
106
  /******************************************************************************
146
107
  Copyright (c) Microsoft Corporation.
147
108
 
@@ -158,6 +119,20 @@ PERFORMANCE OF THIS SOFTWARE.
158
119
  ***************************************************************************** */
159
120
  /* global Reflect, Promise, SuppressedError, Symbol */
160
121
 
122
+ var extendStatics = function(d, b) {
123
+ extendStatics = Object.setPrototypeOf ||
124
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
125
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
126
+ return extendStatics(d, b);
127
+ };
128
+
129
+ function __extends(d, b) {
130
+ if (typeof b !== "function" && b !== null)
131
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
132
+ extendStatics(d, b);
133
+ function __() { this.constructor = d; }
134
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
135
+ }
161
136
 
162
137
  var __assign = function() {
163
138
  __assign = Object.assign || function __assign(t) {
@@ -211,6 +186,16 @@ function __read(o, n) {
211
186
  return ar;
212
187
  }
213
188
 
189
+ function __spreadArray(to, from, pack) {
190
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
191
+ if (ar || !(i in from)) {
192
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
193
+ ar[i] = from[i];
194
+ }
195
+ }
196
+ return to.concat(ar || Array.prototype.slice.call(from));
197
+ }
198
+
214
199
  function __makeTemplateObject(cooked, raw) {
215
200
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
216
201
  return cooked;
@@ -220,6 +205,217 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
220
205
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
221
206
  };
222
207
 
208
+ var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
209
+ var compactMap = function (items, f) {
210
+ return compact(items === null || items === void 0 ? void 0 : items.map(f));
211
+ };
212
+ var isNil = function (value) {
213
+ return value === null || value === undefined;
214
+ };
215
+ function memoize(fn) {
216
+ var cache = new Map();
217
+ return function (arg) {
218
+ if (cache.has(arg)) {
219
+ return cache.get(arg);
220
+ }
221
+ var result = fn(arg);
222
+ cache.set(arg, result);
223
+ return result;
224
+ };
225
+ }
226
+ var clamp = function (value, min, max) {
227
+ if (value < min) {
228
+ return min;
229
+ }
230
+ if (value > max) {
231
+ return max;
232
+ }
233
+ return value;
234
+ };
235
+ /** Добавляет свойства к функции */
236
+ function assignPropsToFn(fn, props) {
237
+ return Object.assign(fn, props);
238
+ }
239
+
240
+ /** Фабрика версионированных схем. Не содержит состояния */
241
+ var VersionedSchemaFactory = /** @class */ (function () {
242
+ function VersionedSchemaFactory() {
243
+ }
244
+ VersionedSchemaFactory.compareVersions = function (a, b) {
245
+ var _a, _b;
246
+ var partsA = a.split(".").map(Number);
247
+ var partsB = b.split(".").map(Number);
248
+ var length = Math.max(partsA.length, partsB.length);
249
+ for (var i = 0; i < length; i++) {
250
+ var pa = (_a = partsA[i]) !== null && _a !== void 0 ? _a : 0;
251
+ var pb = (_b = partsB[i]) !== null && _b !== void 0 ? _b : 0;
252
+ var diff = Math.sign(pa - pb);
253
+ if (diff !== 0) {
254
+ return diff;
255
+ }
256
+ }
257
+ return 0;
258
+ };
259
+ VersionedSchemaFactory.findClosestVersion = function (versions, targetVersion, compare) {
260
+ return versions
261
+ .toSorted(function (a, b) { return compare(b, a); })
262
+ .find(function (version) { return compare(version, targetVersion) <= 0; });
263
+ };
264
+ /** Добавляет метаданные к схеме (curried) */
265
+ VersionedSchemaFactory.annotateSchema = function (meta) {
266
+ if (meta === undefined) {
267
+ return function (schemaFactory) { return schemaFactory; };
268
+ }
269
+ return function (schemaFactory) {
270
+ return (function (z) {
271
+ var restArgs = [];
272
+ for (var _i = 1; _i < arguments.length; _i++) {
273
+ restArgs[_i - 1] = arguments[_i];
274
+ }
275
+ return schemaFactory.apply(void 0, __spreadArray([z], __read(restArgs), false)).meta(meta);
276
+ });
277
+ };
278
+ };
279
+ /** Построить версионированную схему */
280
+ VersionedSchemaFactory.build = function (_a) {
281
+ var _this = this;
282
+ var history = _a.history, latestVersion = _a.latestVersion, meta = _a.meta;
283
+ var latestFactory = history[latestVersion];
284
+ if (!latestFactory) {
285
+ throw new Error("Не найдено записи в 'history' по 'latestVersion'");
286
+ }
287
+ var map = this.annotateSchema(meta);
288
+ var schema = assignPropsToFn(map(latestFactory), {
289
+ forVersion: function (targetVersion) {
290
+ if (targetVersion === null || targetVersion === undefined) {
291
+ return map(latestFactory);
292
+ }
293
+ if (targetVersion in history) {
294
+ return map(history[targetVersion]);
295
+ }
296
+ var closestVersion = _this.findClosestVersion(Object.keys(history), targetVersion, VersionedSchemaFactory.compareVersions);
297
+ if (closestVersion === undefined || !(closestVersion in history)) {
298
+ throw new Error("\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0449\u0435\u0439 \u0441\u0445\u0435\u043C\u044B \u0434\u043B\u044F \u0432\u0435\u0440\u0441\u0438\u0438 '".concat(targetVersion, "'"));
299
+ }
300
+ return map(history[closestVersion]);
301
+ },
302
+ });
303
+ return schema;
304
+ };
305
+ return VersionedSchemaFactory;
306
+ }());
307
+
308
+ /**
309
+ * Глобальный реестр версионированных схем (публичный слой, только чтение).
310
+ *
311
+ * Отвечает за:
312
+ *
313
+ * 1. Хранение зарегистрированных схем
314
+ * 2. Поиск схем по ключу
315
+ *
316
+ * Не предоставляет API для модификации registry.
317
+ */
318
+ var SchemaRegistryReader = /** @class */ (function () {
319
+ function SchemaRegistryReader() {
320
+ }
321
+ /** Получить версионированную схему из `registry` по ключу схемы */
322
+ SchemaRegistryReader.get = function (schemaKey) {
323
+ return this.registry.get(schemaKey);
324
+ };
325
+ /**
326
+ * Имя поля в метаданных схемы, в котором хранится идентификатор типа схемы.
327
+ *
328
+ * Это поле добавляется ко всем схемам, зарегистрированным через `SchemaRegistry`.
329
+ */
330
+ SchemaRegistryReader.typeKey = "type";
331
+ SchemaRegistryReader.registry = new Map();
332
+ return SchemaRegistryReader;
333
+ }());
334
+ /**
335
+ * Глобальный реестр версионированных схем (внутренний слой).
336
+ *
337
+ * Расширяет SchemaRegistryReader возможностью создать запись в registry.
338
+ *
339
+ * Отвечает за:
340
+ * 1. Декларацию схем (build + аннотация)
341
+ * 2. Регистрацию схем по ключу
342
+ */
343
+ var SchemaRegistry = /** @class */ (function (_super) {
344
+ __extends(SchemaRegistry, _super);
345
+ function SchemaRegistry() {
346
+ return _super !== null && _super.apply(this, arguments) || this;
347
+ }
348
+ /** Объявляет версионированную схему и регистрирует её во внутреннем `registry` */
349
+ SchemaRegistry.define = function (_a) {
350
+ var _b;
351
+ var key = _a.key, history = _a.history, latestVersion = _a.latestVersion;
352
+ var schema = VersionedSchemaFactory.build({
353
+ history: history,
354
+ latestVersion: latestVersion,
355
+ meta: (_b = {}, _b[this.typeKey] = key, _b),
356
+ });
357
+ this.registry.set(key, schema);
358
+ return schema;
359
+ };
360
+ return SchemaRegistry;
361
+ }(SchemaRegistryReader));
362
+
363
+ /**
364
+ * Глобальный счетчик для генерации ID.
365
+ *
366
+ * @todo
367
+ * В будущем можно заменить единый счетчик на изолированные счетчики в разных контекстах.
368
+ */
369
+ var id = 1;
370
+ var AutoIdentifiedArrayItemSchema = SchemaRegistry.define({
371
+ key: "AutoIdentifiedArrayItem",
372
+ latestVersion: "17",
373
+ history: {
374
+ "17": function (z) {
375
+ return z.object({
376
+ /**
377
+ * Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
378
+ * Гарантируется уникальность id в пределах settings виджета.
379
+ */
380
+ id: z
381
+ .number()
382
+ .default(-1)
383
+ .transform(function (currentId) { return (currentId === -1 ? id++ : currentId); }),
384
+ });
385
+ },
386
+ },
387
+ });
388
+ var BaseWidgetSettingsSchema = SchemaRegistry.define({
389
+ key: "BaseWidgetSettings",
390
+ latestVersion: "19",
391
+ get history() {
392
+ var v17 = function (z) {
393
+ return z.object({
394
+ title: z.string().default(""),
395
+ titleSize: themed(z.number().default(14), function (theme) { return theme.widgets.titleSize; }),
396
+ titleColor: themed(ColorSchema.forVersion("17")(z), function (theme) { return theme.widgets.titleColor; }),
397
+ titleWeight: themed(z.enum(exports.EFontWeight).default(exports.EFontWeight.NORMAL), function (theme) { return theme.widgets.titleWeight; }),
398
+ stateName: z.string().nullable().default(null),
399
+ showMarkdown: z.boolean().default(false),
400
+ markdownMeasures: z.array(MarkdownMeasureSchema.forVersion("17")(z)).default([]),
401
+ markdownText: z.string().default(""),
402
+ markdownTextSize: z.number().default(14),
403
+ filters: z.array(SettingsFilterSchema.forVersion("17")(z)).default([]),
404
+ filterMode: z.enum(exports.EWidgetFilterMode).default(exports.EWidgetFilterMode.DEFAULT),
405
+ ignoreFilters: z.boolean().default(false),
406
+ sorting: z.array(WidgetSortingIndicatorSchema.forVersion("17")(z)).default([]),
407
+ actionButtons: z.array(ActionButtonSchema.forVersion("17")(z)).default([]),
408
+ paddings: z.union([z.number(), z.string()]).default(8),
409
+ viewTheme: z.boolean().default(false),
410
+ });
411
+ };
412
+ return {
413
+ "17": v17,
414
+ "19": function (z) { return v17(z).omit({ paddings: true }); },
415
+ };
416
+ },
417
+ });
418
+
223
419
  exports.EWidgetIndicatorType = void 0;
224
420
  (function (EWidgetIndicatorType) {
225
421
  EWidgetIndicatorType["MEASURE"] = "MEASURE";
@@ -359,35 +555,53 @@ exports.EHeightMode = void 0;
359
555
  EHeightMode["PERCENT"] = "PERCENT";
360
556
  })(exports.EHeightMode || (exports.EHeightMode = {}));
361
557
 
362
- var SortDirectionSchema = function (z) {
363
- return z.union([z.literal(exports.ESortDirection.ascend), z.literal(exports.ESortDirection.descend)]);
364
- };
365
- var SortOrderSchema = function (z) {
366
- return z.object({
367
- /** Формула сортировки */
368
- formula: FormulaSchema(z),
369
- /** Тип данных формулы */
370
- dbDataType: z.string().optional(),
371
- /** Направление сортировки */
372
- direction: SortDirectionSchema(z),
373
- /** Условие применения сортировки */
374
- displayCondition: FormulaSchema(z).optional(),
375
- });
376
- };
377
- var WidgetSortingValueSchema = function (z) {
378
- return z.discriminatedUnion("mode", [
379
- z.object({
380
- mode: z.literal(exports.ESortingValueModes.FORMULA),
381
- formula: FormulaSchema(z),
382
- dbDataType: z.string().optional(),
383
- }),
384
- z.object({
385
- mode: z.literal(exports.ESortingValueModes.IN_WIDGET),
386
- group: z.string(),
387
- index: z.number(),
388
- }),
389
- ]);
390
- };
558
+ var SortDirectionSchema = SchemaRegistry.define({
559
+ key: "SortDirection",
560
+ latestVersion: "17",
561
+ history: {
562
+ "17": function (z) {
563
+ return z.union([z.literal(exports.ESortDirection.ascend), z.literal(exports.ESortDirection.descend)]);
564
+ },
565
+ },
566
+ });
567
+ var SortOrderSchema = SchemaRegistry.define({
568
+ key: "SortOrder",
569
+ latestVersion: "17",
570
+ history: {
571
+ "17": function (z) {
572
+ return z.object({
573
+ /** Формула сортировки */
574
+ formula: FormulaSchema.forVersion("17")(z),
575
+ /** Тип данных формулы */
576
+ dbDataType: z.string().optional(),
577
+ /** Направление сортировки */
578
+ direction: SortDirectionSchema.forVersion("17")(z),
579
+ /** Условие применения сортировки */
580
+ displayCondition: FormulaSchema.forVersion("17")(z).optional(),
581
+ });
582
+ },
583
+ },
584
+ });
585
+ var WidgetSortingValueSchema = SchemaRegistry.define({
586
+ key: "WidgetSortingValue",
587
+ latestVersion: "17",
588
+ history: {
589
+ "17": function (z) {
590
+ return z.discriminatedUnion("mode", [
591
+ z.object({
592
+ mode: z.literal(exports.ESortingValueModes.FORMULA),
593
+ formula: FormulaSchema.forVersion("17")(z),
594
+ dbDataType: z.string().optional(),
595
+ }),
596
+ z.object({
597
+ mode: z.literal(exports.ESortingValueModes.IN_WIDGET),
598
+ group: z.string(),
599
+ index: z.number(),
600
+ }),
601
+ ]);
602
+ },
603
+ },
604
+ });
391
605
 
392
606
  /** Ключи мета-данных внутри схем настроек */
393
607
  exports.ESettingsSchemaMetaKey = void 0;
@@ -399,35 +613,59 @@ exports.ESettingsSchemaMetaKey = void 0;
399
613
  })(exports.ESettingsSchemaMetaKey || (exports.ESettingsSchemaMetaKey = {}));
400
614
 
401
615
  var _a$7;
402
- var RangeSchema = function (z) {
403
- return z.object({
404
- unit: z.string().optional(),
405
- min: z.number().optional(),
406
- max: z.number().optional(),
407
- });
408
- };
409
- var DisplayConditionSchema = function (z) {
410
- return z
411
- .discriminatedUnion("mode", [
412
- z.object({
413
- mode: z.literal(exports.EDisplayConditionMode.DISABLED),
414
- }),
415
- z.object({
416
- mode: z.literal(exports.EDisplayConditionMode.FORMULA),
417
- formula: FormulaSchema(z),
418
- }),
419
- z.object({
420
- mode: z.literal(exports.EDisplayConditionMode.VARIABLE),
421
- variableName: NameNullableSchema(z),
422
- variableValue: z.string().nullable().default(null),
423
- }),
424
- ])
425
- .default({ mode: exports.EDisplayConditionMode.DISABLED });
426
- };
616
+ var RangeSchema = SchemaRegistry.define({
617
+ key: "Range",
618
+ latestVersion: "17",
619
+ history: {
620
+ "17": function (z) {
621
+ return z.object({
622
+ unit: z.string().optional(),
623
+ min: z.number().optional(),
624
+ max: z.number().optional(),
625
+ });
626
+ },
627
+ },
628
+ });
629
+ var DisplayConditionSchema = SchemaRegistry.define({
630
+ key: "DisplayCondition",
631
+ latestVersion: "17",
632
+ history: {
633
+ "17": function (z) {
634
+ return z
635
+ .discriminatedUnion("mode", [
636
+ z.object({
637
+ mode: z.literal(exports.EDisplayConditionMode.DISABLED),
638
+ }),
639
+ z.object({
640
+ mode: z.literal(exports.EDisplayConditionMode.FORMULA),
641
+ formula: FormulaSchema.forVersion("17")(z),
642
+ }),
643
+ z.object({
644
+ mode: z.literal(exports.EDisplayConditionMode.VARIABLE),
645
+ variableName: NameNullableSchema.forVersion("17")(z),
646
+ variableValue: z.string().nullable().default(null),
647
+ }),
648
+ ])
649
+ .default({ mode: exports.EDisplayConditionMode.DISABLED });
650
+ },
651
+ },
652
+ });
427
653
  /** Схема ключа сущности (с возможностью находиться в неинициализированном состоянии) */
428
- var KeyNullableSchema = function (z) { return z.string().nullable().default(null); };
654
+ var KeyNullableSchema = SchemaRegistry.define({
655
+ key: "KeyNullable",
656
+ latestVersion: "17",
657
+ history: {
658
+ "17": function (z) { return z.string().nullable().default(null); },
659
+ },
660
+ });
429
661
  /** Схема имени сущности (с возможностью находиться в неинициализированном состоянии) */
430
- var NameNullableSchema = function (z) { return z.string().nullable().default(null); };
662
+ var NameNullableSchema = SchemaRegistry.define({
663
+ key: "NameNullable",
664
+ latestVersion: "17",
665
+ history: {
666
+ "17": function (z) { return z.string().nullable().default(null); },
667
+ },
668
+ });
431
669
  /**
432
670
  * Перечисление системных типов сущностей в схеме настроек виджетов.
433
671
  * @note при расширении лучше положить на более общий уровень.
@@ -438,571 +676,929 @@ var EEntity;
438
676
  })(EEntity || (EEntity = {}));
439
677
  var formulaMeta = Object.freeze((_a$7 = {}, _a$7[exports.ESettingsSchemaMetaKey.entity] = EEntity.formula, _a$7));
440
678
  /** Схема формулы */
441
- var FormulaSchema = function (z) { return z.string().default("").meta(formulaMeta); };
679
+ var FormulaSchema = SchemaRegistry.define({
680
+ key: "Formula",
681
+ latestVersion: "17",
682
+ history: {
683
+ "17": function (z) { return z.string().default("").meta(formulaMeta); },
684
+ },
685
+ });
442
686
  /**
443
687
  * Схема формулы, которая не может быть пустой строкой, но может быть в
444
688
  * неинициализированном состоянии null (вместо пустой строки)
445
689
  *
446
690
  * @note для обратной совместимости без необходимости писать миграции
447
691
  */
448
- var FormulaNullableSchema = function (z) {
449
- return z.string().nullable().default(null).meta(formulaMeta);
450
- };
692
+ var FormulaNullableSchema = SchemaRegistry.define({
693
+ key: "FormulaNullable",
694
+ latestVersion: "17",
695
+ history: {
696
+ "17": function (z) { return z.string().nullable().default(null).meta(formulaMeta); },
697
+ },
698
+ });
451
699
 
452
- var WidgetIndicatorSchema = function (z) {
453
- return AutoIdentifiedArrayItemSchema(z).extend({
454
- name: z.string(),
455
- });
456
- };
457
- var FormatSchema = function (z) {
458
- return z
459
- .discriminatedUnion("mode", [
460
- z.object({
461
- mode: z.literal(exports.EFormatOrFormattingMode.BASE),
462
- value: z.enum(biFormatting.EFormatTypes).default(biFormatting.EFormatTypes.STRING).optional(),
463
- }),
464
- z.object({
465
- mode: z.literal(exports.EFormatOrFormattingMode.TEMPLATE),
466
- value: z.string().default("").optional(),
467
- }),
468
- ])
469
- .default({ mode: exports.EFormatOrFormattingMode.BASE, value: biFormatting.EFormatTypes.STRING });
470
- };
471
- var FormattingSchema = function (z) {
472
- return z
473
- .discriminatedUnion("mode", [
474
- z.object({
475
- mode: z.literal(exports.EFormatOrFormattingMode.BASE),
476
- value: z.enum(biFormatting.EFormattingPresets).default(biFormatting.EFormattingPresets.AUTO),
477
- }),
478
- z.object({
479
- mode: z.literal(exports.EFormatOrFormattingMode.TEMPLATE),
480
- value: z.string().default(""),
481
- }),
482
- ])
483
- .default({ mode: exports.EFormatOrFormattingMode.BASE, value: biFormatting.EFormattingPresets.AUTO });
484
- };
485
- var WidgetColumnIndicatorSchema = function (z) {
486
- return WidgetIndicatorSchema(z).extend({
487
- dbDataType: z.string().optional(),
488
- format: FormatSchema(z).optional(),
489
- formatting: FormattingSchema(z).optional(),
490
- displayCondition: DisplayConditionSchema(z),
491
- onClick: z.array(ActionsOnClickSchema(z)).optional(),
492
- });
493
- };
494
- var WidgetIndicatorFormulaValueSchema = function (z) {
495
- return z.object({
496
- mode: z.literal(exports.EWidgetIndicatorValueModes.FORMULA),
497
- formula: FormulaSchema(z).optional(),
498
- });
499
- };
500
- var WidgetIndicatorTemplateValueSchema = function (z) {
501
- return z.object({
502
- mode: z.literal(exports.EWidgetIndicatorValueModes.TEMPLATE),
503
- /** Имя шаблонной формулы, использующей колонку таблицы */
504
- templateName: z.string().optional(),
505
- /** Имя таблицы */
506
- tableName: z.string().optional(),
507
- /** Имя колонки */
508
- columnName: z.string().optional(),
509
- });
510
- };
511
- var ColumnIndicatorValueSchema = function (z) {
512
- return z.union([MeasureValueSchema(z), DimensionValueSchema(z)]);
513
- };
514
- var MeasureValueSchema = function (z) {
515
- return z.discriminatedUnion("mode", [
516
- WidgetIndicatorFormulaValueSchema(z),
517
- WidgetIndicatorTemplateValueSchema(z).extend({
518
- innerTemplateName: z.enum(exports.EMeasureInnerTemplateNames).optional(),
519
- }),
520
- ]);
521
- };
522
- var DimensionValueSchema = function (z) {
523
- return z.discriminatedUnion("mode", [
524
- WidgetIndicatorFormulaValueSchema(z),
525
- WidgetIndicatorTemplateValueSchema(z).extend({
526
- innerTemplateName: z.never().optional(),
527
- }),
528
- ]);
529
- };
530
- var WidgetIndicatorAggregationValueSchema = function (z) {
531
- return z.object({
532
- mode: z.literal(exports.EWidgetIndicatorValueModes.AGGREGATION),
533
- templateName: z.string(),
534
- processKey: KeyNullableSchema(z),
535
- eventName: NameNullableSchema(z),
536
- eventNameFormula: FormulaNullableSchema(z),
537
- anyEvent: z.literal(true).optional(),
538
- caseCaseIdFormula: FormulaNullableSchema(z),
539
- filters: z.array(ExtendedFormulaFilterValueSchema(z)).default([]),
540
- tableName: z.string().optional(),
541
- columnName: z.string().optional(),
542
- eventTimeFormula: FormulaNullableSchema(z).optional(),
543
- innerTemplateName: z.string().optional(),
544
- });
545
- };
546
- var WidgetMeasureAggregationValueSchema = function (z) {
547
- return WidgetIndicatorAggregationValueSchema(z).extend({ outerAggregation: z.enum(exports.EOuterAggregation) });
548
- };
549
- var WidgetIndicatorTimeValueSchema = function (z) {
550
- return z.object({
551
- templateName: z.string(),
552
- mode: z.union([
553
- z.literal(exports.EWidgetIndicatorValueModes.START_TIME),
554
- z.literal(exports.EWidgetIndicatorValueModes.END_TIME),
555
- ]),
556
- processKey: KeyNullableSchema(z),
557
- eventName: NameNullableSchema(z),
558
- eventTimeFormula: FormulaNullableSchema(z),
559
- caseCaseIdFormula: FormulaNullableSchema(z),
560
- eventNameFormula: FormulaNullableSchema(z),
561
- filters: z.array(ExtendedFormulaFilterValueSchema(z)).default([]),
562
- });
563
- };
564
- var WidgetDimensionSchema = function (z) {
565
- return WidgetColumnIndicatorSchema(z).extend({
566
- value: z
567
- .discriminatedUnion("mode", [
568
- DimensionValueSchema(z),
569
- WidgetIndicatorAggregationValueSchema(z).extend({
700
+ var WidgetIndicatorSchema = SchemaRegistry.define({
701
+ key: "WidgetIndicator",
702
+ latestVersion: "17",
703
+ history: {
704
+ "17": function (z) {
705
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
706
+ name: z.string(),
707
+ });
708
+ },
709
+ },
710
+ });
711
+ var FormatSchema = SchemaRegistry.define({
712
+ key: "Format",
713
+ latestVersion: "17",
714
+ history: {
715
+ "17": function (z) {
716
+ return z
717
+ .discriminatedUnion("mode", [
718
+ z.object({
719
+ mode: z.literal(exports.EFormatOrFormattingMode.BASE),
720
+ value: z.enum(biFormatting.EFormatTypes).default(biFormatting.EFormatTypes.STRING).optional(),
721
+ }),
722
+ z.object({
723
+ mode: z.literal(exports.EFormatOrFormattingMode.TEMPLATE),
724
+ value: z.string().default("").optional(),
725
+ }),
726
+ ])
727
+ .default({ mode: exports.EFormatOrFormattingMode.BASE, value: biFormatting.EFormatTypes.STRING });
728
+ },
729
+ },
730
+ });
731
+ var FormattingSchema = SchemaRegistry.define({
732
+ key: "Formatting",
733
+ latestVersion: "17",
734
+ history: {
735
+ "17": function (z) {
736
+ return z
737
+ .discriminatedUnion("mode", [
738
+ z.object({
739
+ mode: z.literal(exports.EFormatOrFormattingMode.BASE),
740
+ value: z.enum(biFormatting.EFormattingPresets).default(biFormatting.EFormattingPresets.AUTO),
741
+ }),
742
+ z.object({
743
+ mode: z.literal(exports.EFormatOrFormattingMode.TEMPLATE),
744
+ value: z.string().default(""),
745
+ }),
746
+ ])
747
+ .default({ mode: exports.EFormatOrFormattingMode.BASE, value: biFormatting.EFormattingPresets.AUTO });
748
+ },
749
+ },
750
+ });
751
+ var WidgetColumnIndicatorSchema = SchemaRegistry.define({
752
+ key: "WidgetColumnIndicator",
753
+ latestVersion: "17",
754
+ history: {
755
+ "17": function (z) {
756
+ return WidgetIndicatorSchema.forVersion("17")(z).extend({
757
+ dbDataType: z.string().optional(),
758
+ format: FormatSchema.forVersion("17")(z).optional(),
759
+ formatting: FormattingSchema.forVersion("17")(z).optional(),
760
+ displayCondition: DisplayConditionSchema.forVersion("17")(z),
761
+ onClick: z.array(ActionsOnClickSchema.forVersion("17")(z)).default([]).optional(),
762
+ });
763
+ },
764
+ },
765
+ });
766
+ var WidgetIndicatorFormulaValueSchema = SchemaRegistry.define({
767
+ key: "WidgetIndicatorFormulaValue",
768
+ latestVersion: "17",
769
+ history: {
770
+ "17": function (z) {
771
+ return z.object({
772
+ mode: z.literal(exports.EWidgetIndicatorValueModes.FORMULA),
773
+ formula: FormulaSchema.forVersion("17")(z).optional(),
774
+ });
775
+ },
776
+ },
777
+ });
778
+ var WidgetIndicatorTemplateValueSchema = SchemaRegistry.define({
779
+ key: "WidgetIndicatorTemplateValue",
780
+ latestVersion: "17",
781
+ history: {
782
+ "17": function (z) {
783
+ return z.object({
784
+ mode: z.literal(exports.EWidgetIndicatorValueModes.TEMPLATE),
785
+ /** Имя шаблонной формулы, использующей колонку таблицы */
786
+ templateName: z.string().optional(),
787
+ /** Имя таблицы */
788
+ tableName: z.string().optional(),
789
+ /** Имя колонки */
790
+ columnName: z.string().optional(),
791
+ });
792
+ },
793
+ },
794
+ });
795
+ var ColumnIndicatorValueSchema = SchemaRegistry.define({
796
+ key: "ColumnIndicatorValue",
797
+ latestVersion: "17",
798
+ history: {
799
+ "17": function (z) {
800
+ return z.union([MeasureValueSchema.forVersion("17")(z), DimensionValueSchema.forVersion("17")(z)]);
801
+ },
802
+ },
803
+ });
804
+ var MeasureValueSchema = SchemaRegistry.define({
805
+ key: "MeasureValue",
806
+ latestVersion: "17",
807
+ history: {
808
+ "17": function (z) {
809
+ return z.discriminatedUnion("mode", [
810
+ WidgetIndicatorFormulaValueSchema.forVersion("17")(z),
811
+ WidgetIndicatorTemplateValueSchema.forVersion("17")(z).extend({
812
+ innerTemplateName: z.enum(exports.EMeasureInnerTemplateNames).optional(),
813
+ }),
814
+ ]);
815
+ },
816
+ },
817
+ });
818
+ var DimensionValueSchema = SchemaRegistry.define({
819
+ key: "DimensionValue",
820
+ latestVersion: "17",
821
+ history: {
822
+ "17": function (z) {
823
+ return z.discriminatedUnion("mode", [
824
+ WidgetIndicatorFormulaValueSchema.forVersion("17")(z),
825
+ WidgetIndicatorTemplateValueSchema.forVersion("17")(z).extend({
826
+ innerTemplateName: z.never().optional(),
827
+ }),
828
+ ]);
829
+ },
830
+ },
831
+ });
832
+ var WidgetIndicatorAggregationValueSchema = SchemaRegistry.define({
833
+ key: "WidgetIndicatorAggregationValue",
834
+ latestVersion: "17",
835
+ history: {
836
+ "17": function (z) {
837
+ return z.object({
838
+ mode: z.literal(exports.EWidgetIndicatorValueModes.AGGREGATION),
839
+ templateName: z.string(),
840
+ processKey: KeyNullableSchema.forVersion("17")(z),
841
+ eventName: NameNullableSchema.forVersion("17")(z),
842
+ eventNameFormula: FormulaNullableSchema.forVersion("17")(z),
843
+ anyEvent: z.literal(true).optional(),
844
+ caseCaseIdFormula: FormulaNullableSchema.forVersion("17")(z),
845
+ filters: z.array(ExtendedFormulaFilterValueSchema.forVersion("17")(z)).default([]),
846
+ tableName: z.string().optional(),
847
+ columnName: z.string().optional(),
848
+ eventTimeFormula: FormulaNullableSchema.forVersion("17")(z).optional(),
570
849
  innerTemplateName: z.string().optional(),
571
- }),
572
- WidgetIndicatorTimeValueSchema(z),
573
- ])
574
- .optional(),
575
- hideEmptyValues: z.boolean().default(false),
576
- });
577
- };
578
- var WidgetDimensionInHierarchySchema = function (z) {
579
- return WidgetDimensionSchema(z).omit({ displayCondition: true });
580
- };
581
- var WidgetDimensionHierarchySchema = function (z, dimensionSchema) {
582
- return AutoIdentifiedArrayItemSchema(z).extend({
583
- name: z.string(),
584
- // Для иерархии является дискриминатором, для него нельзя задавать дефолтное значение.
585
- hierarchyDimensions: z.array(dimensionSchema),
586
- displayCondition: DisplayConditionSchema(z),
587
- });
588
- };
589
- var WidgetIndicatorConversionValueSchema = function (z) {
590
- return z.object({
591
- mode: z.literal(exports.EWidgetIndicatorValueModes.CONVERSION),
592
- startEventNameFormula: FormulaNullableSchema(z),
593
- startEventProcessKey: KeyNullableSchema(z),
594
- startEventName: NameNullableSchema(z),
595
- startEventFilters: z.array(ExtendedFormulaFilterValueSchema(z)).default([]),
596
- startEventTimeFormula: FormulaNullableSchema(z),
597
- endEventNameFormula: FormulaNullableSchema(z),
598
- endEventProcessKey: KeyNullableSchema(z),
599
- endEventName: NameNullableSchema(z),
600
- endEventFilters: z.array(ExtendedFormulaFilterValueSchema(z)).default([]),
601
- endCaseCaseIdFormula: FormulaNullableSchema(z),
602
- endEventTimeFormula: FormulaNullableSchema(z),
603
- });
604
- };
605
- var WidgetIndicatorDurationValueSchema = function (z) {
606
- return WidgetIndicatorConversionValueSchema(z).extend({
607
- mode: z.literal(exports.EWidgetIndicatorValueModes.DURATION),
608
- templateName: z.string(),
609
- startEventAppearances: z.enum(exports.EEventAppearances),
610
- endEventAppearances: z.enum(exports.EEventAppearances),
611
- });
612
- };
613
- var WidgetMeasureSchema = function (z) {
614
- return WidgetColumnIndicatorSchema(z).extend({
615
- value: z
616
- .discriminatedUnion("mode", [
617
- MeasureValueSchema(z),
618
- WidgetMeasureAggregationValueSchema(z),
619
- WidgetIndicatorConversionValueSchema(z),
620
- WidgetIndicatorDurationValueSchema(z),
621
- ])
622
- .optional(),
623
- });
624
- };
625
- var MarkdownMeasureSchema = function (z) {
626
- return WidgetMeasureSchema(z).extend({
627
- displaySign: z.enum(exports.EMarkdownDisplayMode).default(exports.EMarkdownDisplayMode.NONE),
628
- });
629
- };
630
- var WidgetSortingIndicatorSchema = function (z) {
631
- return WidgetIndicatorSchema(z).extend({
632
- direction: SortDirectionSchema(z),
633
- value: WidgetSortingValueSchema(z),
634
- });
635
- };
636
- var ProcessIndicatorValueSchema = function (z) {
637
- return z.discriminatedUnion("mode", [
638
- z.object({
639
- mode: z.literal(exports.EWidgetIndicatorValueModes.FORMULA),
640
- formula: FormulaSchema(z),
641
- }),
642
- z.object({
643
- mode: z.literal(exports.EWidgetIndicatorValueModes.TEMPLATE),
644
- /** Имя шаблонной формулы, использующей колонку таблицы */
645
- templateName: z.string(),
646
- }),
647
- ]);
648
- };
649
- var ProcessIndicatorSchema = function (z) {
650
- return WidgetIndicatorSchema(z).extend({
651
- value: ProcessIndicatorValueSchema(z).optional(),
652
- dbDataType: z.string().optional(),
653
- format: FormatSchema(z).optional(),
654
- formatting: FormattingSchema(z).optional(),
655
- displayCondition: DisplayConditionSchema(z),
656
- });
657
- };
658
-
659
- var FormulaFilterValueSchema = function (z) {
660
- var _a;
661
- return z.object({
662
- name: z.string().nullish(),
663
- formula: z.string(),
664
- sliceIndex: z.number().optional(),
665
- dbDataType: z.string(),
666
- format: z.union([z.enum(biFormatting.EFormatTypes), z.string()]).optional(),
667
- filteringMethod: z.enum(Object.values(formulaFilterMethods)),
668
- checkedValues: z.array(z.string().nullable()).optional(),
669
- formValues: z
670
- .object((_a = {},
671
- _a[exports.EFormulaFilterFieldKeys.date] = z.string().nullable(),
672
- _a[exports.EFormulaFilterFieldKeys.dateRange] = z.tuple([z.string(), z.string()]),
673
- _a[exports.EFormulaFilterFieldKeys.numberRange] = z.tuple([
674
- z.number().nullable(),
675
- z.number().nullable(),
676
- ]),
677
- _a[exports.EFormulaFilterFieldKeys.string] = z.string(),
678
- // todo: отказаться от использования z.string(), оставить только z.number() [BI-15912]
679
- _a[exports.EFormulaFilterFieldKeys.lastTimeValue] = z.number().or(z.string()),
680
- _a[exports.EFormulaFilterFieldKeys.lastTimeUnit] = z.enum(exports.ELastTimeUnit),
681
- _a[exports.EFormulaFilterFieldKeys.durationUnit] = z.enum(exports.EDurationUnit),
682
- _a))
683
- .partial()
684
- .optional(),
685
- });
686
- };
687
- var ExtendedFormulaFilterValueSchema = function (z) {
688
- return z.union([FormulaFilterValueSchema(z), z.object({ formula: z.string() })]);
689
- };
690
- var DimensionProcessFilterSchema = function (z) {
691
- return z.object({
692
- value: z.union([
693
- WidgetIndicatorAggregationValueSchema(z).extend({
850
+ });
851
+ },
852
+ },
853
+ });
854
+ var WidgetMeasureAggregationValueSchema = SchemaRegistry.define({
855
+ key: "WidgetMeasureAggregationValue",
856
+ latestVersion: "17",
857
+ history: {
858
+ "17": function (z) {
859
+ return WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
694
860
  outerAggregation: z.enum(exports.EOuterAggregation),
695
- }),
696
- WidgetIndicatorAggregationValueSchema(z).extend({
697
- innerTemplateName: z.string().optional(),
698
- }),
699
- WidgetIndicatorTimeValueSchema(z),
700
- z.object({
701
- mode: z.literal(exports.EWidgetIndicatorValueModes.FORMULA),
702
- formula: z.string().optional(),
703
- }),
704
- ]),
705
- dbDataType: z.string(),
706
- condition: z.object({
707
- filteringMethod: z.enum(Object.values(formulaFilterMethods)),
708
- timeUnit: z.enum(exports.EDimensionProcessFilterTimeUnit).optional(),
709
- values: z.array(z.string().nullable()),
710
- }),
711
- });
712
- };
713
- var SettingsFilterSchema = function (z) {
714
- return z.union([ExtendedFormulaFilterValueSchema(z), DimensionProcessFilterSchema(z)]);
715
- };
861
+ });
862
+ },
863
+ },
864
+ });
865
+ var WidgetIndicatorTimeValueSchema = SchemaRegistry.define({
866
+ key: "WidgetIndicatorTimeValue",
867
+ latestVersion: "17",
868
+ history: {
869
+ "17": function (z) {
870
+ return z.object({
871
+ templateName: z.string(),
872
+ mode: z.union([
873
+ z.literal(exports.EWidgetIndicatorValueModes.START_TIME),
874
+ z.literal(exports.EWidgetIndicatorValueModes.END_TIME),
875
+ ]),
876
+ processKey: KeyNullableSchema.forVersion("17")(z),
877
+ eventName: NameNullableSchema.forVersion("17")(z),
878
+ eventTimeFormula: FormulaNullableSchema.forVersion("17")(z),
879
+ caseCaseIdFormula: FormulaNullableSchema.forVersion("17")(z),
880
+ eventNameFormula: FormulaNullableSchema.forVersion("17")(z),
881
+ filters: z.array(ExtendedFormulaFilterValueSchema.forVersion("17")(z)).default([]),
882
+ });
883
+ },
884
+ },
885
+ });
886
+ var WidgetDimensionSchema = SchemaRegistry.define({
887
+ key: "WidgetDimension",
888
+ latestVersion: "17",
889
+ history: {
890
+ "17": function (z) {
891
+ return WidgetColumnIndicatorSchema.forVersion("17")(z).extend({
892
+ value: z
893
+ .discriminatedUnion("mode", [
894
+ DimensionValueSchema.forVersion("17")(z),
895
+ WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
896
+ innerTemplateName: z.string().optional(),
897
+ }),
898
+ WidgetIndicatorTimeValueSchema.forVersion("17")(z),
899
+ ])
900
+ .optional(),
901
+ hideEmptyValues: z.boolean().default(false),
902
+ });
903
+ },
904
+ },
905
+ });
906
+ var WidgetDimensionInHierarchySchema = SchemaRegistry.define({
907
+ key: "WidgetDimensionInHierarchy",
908
+ latestVersion: "17",
909
+ history: {
910
+ "17": function (z) { return WidgetDimensionSchema.forVersion("17")(z).omit({ displayCondition: true }); },
911
+ },
912
+ });
913
+ var WidgetDimensionHierarchySchema = SchemaRegistry.define({
914
+ key: "WidgetDimensionHierarchy",
915
+ latestVersion: "17",
916
+ history: {
917
+ "17": function (z, dimensionSchema) {
918
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
919
+ name: z.string(),
920
+ // Для иерархии является дискриминатором, для него нельзя задавать дефолтное значение.
921
+ hierarchyDimensions: z.array(dimensionSchema),
922
+ displayCondition: DisplayConditionSchema.forVersion("17")(z),
923
+ });
924
+ },
925
+ },
926
+ });
927
+ var WidgetIndicatorConversionValueSchema = SchemaRegistry.define({
928
+ key: "WidgetIndicatorConversionValue",
929
+ latestVersion: "17",
930
+ history: {
931
+ "17": function (z) {
932
+ return z.object({
933
+ mode: z.literal(exports.EWidgetIndicatorValueModes.CONVERSION),
934
+ startEventNameFormula: FormulaNullableSchema.forVersion("17")(z),
935
+ startEventProcessKey: KeyNullableSchema.forVersion("17")(z),
936
+ startEventName: NameNullableSchema.forVersion("17")(z),
937
+ startEventFilters: z
938
+ .array(ExtendedFormulaFilterValueSchema.forVersion("17")(z))
939
+ .default([]),
940
+ startEventTimeFormula: FormulaNullableSchema.forVersion("17")(z),
941
+ endEventNameFormula: FormulaNullableSchema.forVersion("17")(z),
942
+ endEventProcessKey: KeyNullableSchema.forVersion("17")(z),
943
+ endEventName: NameNullableSchema.forVersion("17")(z),
944
+ endEventFilters: z.array(ExtendedFormulaFilterValueSchema.forVersion("17")(z)).default([]),
945
+ endCaseCaseIdFormula: FormulaNullableSchema.forVersion("17")(z),
946
+ endEventTimeFormula: FormulaNullableSchema.forVersion("17")(z),
947
+ });
948
+ },
949
+ },
950
+ });
951
+ var WidgetIndicatorDurationValueSchema = SchemaRegistry.define({
952
+ key: "WidgetIndicatorDurationValue",
953
+ latestVersion: "17",
954
+ history: {
955
+ "17": function (z) {
956
+ return WidgetIndicatorConversionValueSchema.forVersion("17")(z).extend({
957
+ mode: z.literal(exports.EWidgetIndicatorValueModes.DURATION),
958
+ templateName: z.string(),
959
+ startEventAppearances: z.enum(exports.EEventAppearances),
960
+ endEventAppearances: z.enum(exports.EEventAppearances),
961
+ });
962
+ },
963
+ },
964
+ });
965
+ var WidgetMeasureSchema = SchemaRegistry.define({
966
+ key: "WidgetMeasure",
967
+ latestVersion: "17",
968
+ history: {
969
+ "17": function (z) {
970
+ return WidgetColumnIndicatorSchema.forVersion("17")(z).extend({
971
+ value: z
972
+ .discriminatedUnion("mode", [
973
+ MeasureValueSchema.forVersion("17")(z),
974
+ WidgetMeasureAggregationValueSchema.forVersion("17")(z),
975
+ WidgetIndicatorConversionValueSchema.forVersion("17")(z),
976
+ WidgetIndicatorDurationValueSchema.forVersion("17")(z),
977
+ ])
978
+ .optional(),
979
+ });
980
+ },
981
+ },
982
+ });
983
+ var MarkdownMeasureSchema = SchemaRegistry.define({
984
+ key: "MarkdownMeasure",
985
+ latestVersion: "17",
986
+ history: {
987
+ "17": function (z) {
988
+ return WidgetMeasureSchema.forVersion("17")(z).extend({
989
+ displaySign: z.enum(exports.EMarkdownDisplayMode).default(exports.EMarkdownDisplayMode.NONE),
990
+ });
991
+ },
992
+ },
993
+ });
994
+ var WidgetSortingIndicatorSchema = SchemaRegistry.define({
995
+ key: "WidgetSortingIndicator",
996
+ latestVersion: "17",
997
+ history: {
998
+ "17": function (z) {
999
+ return WidgetIndicatorSchema.forVersion("17")(z).extend({
1000
+ direction: SortDirectionSchema.forVersion("17")(z),
1001
+ value: WidgetSortingValueSchema.forVersion("17")(z),
1002
+ });
1003
+ },
1004
+ },
1005
+ });
1006
+ var ProcessIndicatorValueSchema = SchemaRegistry.define({
1007
+ key: "ProcessIndicatorValue",
1008
+ latestVersion: "17",
1009
+ history: {
1010
+ "17": function (z) {
1011
+ return z.discriminatedUnion("mode", [
1012
+ z.object({
1013
+ mode: z.literal(exports.EWidgetIndicatorValueModes.FORMULA),
1014
+ formula: FormulaSchema.forVersion("17")(z),
1015
+ }),
1016
+ z.object({
1017
+ mode: z.literal(exports.EWidgetIndicatorValueModes.TEMPLATE),
1018
+ /** Имя шаблонной формулы, использующей колонку таблицы */
1019
+ templateName: z.string(),
1020
+ }),
1021
+ ]);
1022
+ },
1023
+ },
1024
+ });
1025
+ var ProcessIndicatorSchema = SchemaRegistry.define({
1026
+ key: "ProcessIndicator",
1027
+ latestVersion: "17",
1028
+ history: {
1029
+ "17": function (z) {
1030
+ return WidgetIndicatorSchema.forVersion("17")(z).extend({
1031
+ value: ProcessIndicatorValueSchema.forVersion("17")(z).optional(),
1032
+ dbDataType: z.string().optional(),
1033
+ format: FormatSchema.forVersion("17")(z).optional(),
1034
+ formatting: FormattingSchema.forVersion("17")(z).optional(),
1035
+ displayCondition: DisplayConditionSchema.forVersion("17")(z),
1036
+ });
1037
+ },
1038
+ },
1039
+ });
716
1040
 
717
- var ActionOnClickParameterCommonSchema = function (z) {
718
- return AutoIdentifiedArrayItemSchema(z).extend({
719
- name: z.string(),
720
- });
721
- };
722
- var ParameterFromColumnSchema = function (z) {
723
- return z.object({
724
- inputMethod: z.literal(exports.EWidgetActionInputMethod.COLUMN),
725
- tableName: z.string().nullable().default(null),
726
- columnName: z.string().nullable().default(null),
727
- dbDataType: z.string().optional(),
728
- });
729
- };
730
- var ParameterFromVariableSchema = function (z) {
731
- return z.object({
732
- inputMethod: z.literal(exports.EWidgetActionInputMethod.VARIABLE),
733
- sourceVariable: z.string().nullable().default(null),
734
- });
735
- };
736
- var ParameterFromFormulaSchema = function (z) {
737
- return z.object({
738
- inputMethod: z.literal(exports.EWidgetActionInputMethod.FORMULA),
739
- formula: FormulaSchema(z),
740
- considerFilters: z.boolean().default(false),
741
- dbDataType: z.string().optional(),
742
- });
743
- };
744
- var ParameterFromEventSchema = function (z) {
745
- return z.object({
746
- inputMethod: z.literal(exports.EWidgetActionInputMethod.EVENT),
747
- });
748
- };
749
- var ParameterFromStartEventSchema = function (z) {
750
- return z.object({
751
- inputMethod: z.literal(exports.EWidgetActionInputMethod.START_EVENT),
752
- });
753
- };
754
- var ParameterFromEndEventSchema = function (z) {
755
- return z.object({
756
- inputMethod: z.literal(exports.EWidgetActionInputMethod.FINISH_EVENT),
757
- });
758
- };
759
- var ParameterFromAggregationSchema = function (z) {
760
- return z.object({
761
- inputMethod: z.literal(exports.EWidgetActionInputMethod.AGGREGATION),
762
- formula: FormulaSchema(z),
763
- considerFilters: z.boolean().default(false),
764
- dbDataType: z.string().optional(),
765
- });
766
- };
767
- var ParameterFromManualInputSchema = function (z) {
768
- return z.object({
769
- inputMethod: z.literal(exports.EWidgetActionInputMethod.MANUALLY),
770
- description: z.string().default(""),
771
- defaultValue: FormulaSchema(z),
772
- dbDataType: z.string().optional(),
773
- filterByRows: z.boolean().default(false),
774
- validation: FormulaSchema(z),
775
- acceptEmptyValue: z.boolean().default(false),
776
- });
777
- };
778
- var ParameterFromStaticListSchema = function (z) {
779
- return z.object({
780
- inputMethod: z.literal(exports.EWidgetActionInputMethod.STATIC_LIST),
781
- options: z.string().default(""),
782
- defaultValue: z
783
- .union([z.string(), z.array(z.string())])
784
- .nullable()
785
- .default(null),
786
- acceptEmptyValue: z.boolean().default(false),
787
- });
788
- };
789
- var ParameterFromDynamicListSchema = function (z) {
790
- return z.object({
791
- inputMethod: z.literal(exports.EWidgetActionInputMethod.DYNAMIC_LIST),
792
- options: FormulaSchema(z),
793
- defaultValue: FormulaSchema(z),
794
- dbDataType: z.string().optional(),
795
- displayOptions: FormulaSchema(z),
796
- filters: z.array(ExtendedFormulaFilterValueSchema(z)).default([]),
797
- filterByRows: z.boolean().default(false),
798
- considerFilters: z.boolean().default(false),
799
- insertAnyValues: z.boolean().default(false),
800
- validation: FormulaSchema(z),
801
- acceptEmptyValue: z.boolean().default(false),
802
- });
803
- };
804
- var ParameterFromDataModelSchema = function (z) {
805
- return z.object({
806
- inputMethod: z.literal(exports.EWidgetActionInputMethod.DATA_MODEL),
807
- option: z.enum(exports.EDataModelOption).default(exports.EDataModelOption.TABLE_LIST),
808
- /**
809
- * Используется только при COLUMN_LIST. Не делаем union по option, чтобы сохранить
810
- * одновременно default для option и работоспособность внешнего discriminated union.
811
- */
812
- parent: NameNullableSchema(z),
813
- });
814
- };
815
- var ActionOnClickParameterSchema = function (z) {
816
- return z.intersection(ActionOnClickParameterCommonSchema(z), z.discriminatedUnion("inputMethod", [
817
- ParameterFromColumnSchema(z),
818
- ParameterFromVariableSchema(z),
819
- ParameterFromFormulaSchema(z),
820
- ParameterFromEventSchema(z),
821
- ParameterFromStartEventSchema(z),
822
- ParameterFromEndEventSchema(z),
823
- ParameterFromAggregationSchema(z),
824
- ParameterFromManualInputSchema(z),
825
- ParameterFromStaticListSchema(z),
826
- ParameterFromDynamicListSchema(z),
827
- ParameterFromDataModelSchema(z),
828
- ]));
829
- };
830
- var ActionCommonSchema = function (z) {
831
- return AutoIdentifiedArrayItemSchema(z).extend({
832
- name: z.string(),
833
- });
834
- };
835
- var ActionDrillDownSchema = function (z) {
836
- return ActionCommonSchema(z).extend({
837
- type: z.literal(exports.EActionTypes.DRILL_DOWN),
838
- variables: z.array(ActionOnClickParameterSchema(z)).default([]),
839
- });
840
- };
841
- var ActionGoToURLSchema = function (z) {
842
- return ActionCommonSchema(z).extend({
843
- type: z.literal(exports.EActionTypes.OPEN_URL),
844
- url: z.string(),
845
- newWindow: z.boolean().default(true),
846
- variables: z.array(ActionOnClickParameterSchema(z)).default([]),
847
- });
848
- };
849
- var ActivateConditionSchema = function (z) {
850
- return z
851
- .discriminatedUnion("mode", [
852
- z.object({
853
- mode: z.literal(exports.EActivateConditionMode.FORMULA),
854
- formula: FormulaSchema(z),
855
- }),
856
- z.object({
857
- mode: z.literal(exports.EActivateConditionMode.VARIABLE),
858
- variableName: z.string().nullable().default(null),
859
- variableValue: z.string().nullable().default(null),
860
- }),
861
- ])
862
- .default({ mode: exports.EActivateConditionMode.FORMULA, formula: "" });
863
- };
864
- var ActionRunScriptSchema = function (z) {
865
- return ActionCommonSchema(z).extend({
866
- type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT),
867
- parameters: z.array(ActionOnClickParameterSchema(z)).default([]),
868
- scriptKey: z.string(),
869
- autoUpdate: z.enum(exports.EAutoUpdateMode).default(exports.EAutoUpdateMode.THIS_WIDGET),
870
- hideInactiveButton: z.boolean().default(false),
871
- activateCondition: ActivateConditionSchema(z),
872
- hint: z.string().default(""),
873
- variables: z.array(ActionOnClickParameterSchema(z)).default([]),
874
- runButtonText: z.string().default(""),
875
- });
876
- };
877
- var ActionUpdateVariableSchema = function (z) {
878
- return ActionCommonSchema(z).extend({
879
- type: z.literal(exports.EActionTypes.UPDATE_VARIABLE),
880
- variables: z.array(ActionOnClickParameterSchema(z)).default([]),
881
- });
882
- };
883
- var ActionOpenInSchema = function (z) {
884
- return z.discriminatedUnion("openIn", [
885
- z.object({
886
- openIn: z.literal(exports.EViewOpenIn.DRAWER_WINDOW),
887
- alignment: z.enum(exports.EDrawerPlacement).default(exports.EDrawerPlacement.RIGHT),
888
- inheritFilter: z.boolean().default(true),
889
- }),
890
- z.object({
891
- openIn: z.literal(exports.EViewOpenIn.PLACEHOLDER),
892
- placeholderName: z.string().optional(),
893
- }),
894
- z.object({
895
- openIn: z.literal(exports.EViewOpenIn.MODAL_WINDOW),
896
- positionByClick: z.boolean().default(false),
897
- inheritFilter: z.boolean().default(true),
898
- }),
899
- z.object({
900
- openIn: z.literal(exports.EViewOpenIn.WINDOW),
901
- newWindow: z.boolean().default(true),
902
- inheritFilter: z.boolean().default(true),
903
- }),
904
- ]);
905
- };
906
- var ActionOpenViewCommonSchema = function (z) {
907
- return ActionCommonSchema(z).extend({
908
- type: z.literal(exports.EActionTypes.OPEN_VIEW),
909
- variables: z.array(ActionOnClickParameterSchema(z)).default([]),
910
- });
911
- };
912
- var ActionOpenViewSchema = function (z) {
913
- return z.intersection(z.discriminatedUnion("mode", [
914
- ActionOpenViewCommonSchema(z).extend({
915
- mode: z.literal(exports.EViewMode.GENERATED_BY_SCRIPT),
916
- scriptKey: z.string().optional(),
917
- parameters: z.array(ActionOnClickParameterSchema(z)).default([]),
918
- displayName: z.string().default(""),
919
- }),
920
- ActionOpenViewCommonSchema(z).extend({
921
- mode: z.literal(exports.EViewMode.EXISTED_VIEW),
922
- viewKey: z.string().optional(),
923
- parameters: z.array(ActionOnClickParameterSchema(z)).default([]),
924
- }),
925
- ActionOpenViewCommonSchema(z).extend({
926
- mode: z.literal(exports.EViewMode.EMPTY),
927
- placeholderName: z.string().optional(),
928
- openIn: z.literal(exports.EViewOpenIn.PLACEHOLDER),
929
- }),
930
- ]), ActionOpenInSchema(z));
931
- };
932
- var ActionsOnClickSchema = function (z) {
933
- return z.union([
934
- ActionGoToURLSchema(z),
935
- ActionRunScriptSchema(z),
936
- ActionUpdateVariableSchema(z),
937
- ActionOpenViewSchema(z),
938
- ActionDrillDownSchema(z),
939
- ]);
940
- };
941
- var WidgetActionParameterCommonSchema = function (z) {
942
- return AutoIdentifiedArrayItemSchema(z).extend({
943
- name: z.string(),
944
- displayName: z.string().default(""),
945
- isHidden: z.boolean().default(false),
946
- });
947
- };
948
- var WidgetActionParameterSchema = function (z) {
949
- return z.intersection(WidgetActionParameterCommonSchema(z), z.discriminatedUnion("inputMethod", [
950
- ParameterFromColumnSchema(z),
951
- ParameterFromVariableSchema(z),
952
- ParameterFromFormulaSchema(z),
953
- ParameterFromManualInputSchema(z),
954
- ParameterFromStaticListSchema(z),
955
- ParameterFromDynamicListSchema(z),
956
- ParameterFromAggregationSchema(z),
957
- ParameterFromDataModelSchema(z),
958
- ]));
959
- };
960
- var WidgetActionSchema = function (z) {
961
- return ActionCommonSchema(z).extend({
962
- parameters: z.array(WidgetActionParameterSchema(z)).default([]),
963
- type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT),
964
- scriptKey: z.string(),
965
- autoUpdate: z.enum(exports.EAutoUpdateMode).default(exports.EAutoUpdateMode.THIS_WIDGET),
966
- description: z.string().default(""),
967
- hideInactiveButton: z.boolean().default(false),
968
- hint: z.string().default(""),
969
- activateCondition: ActivateConditionSchema(z),
970
- variables: z.array(WidgetActionParameterSchema(z)).default([]),
971
- runButtonText: z.string().default(""),
972
- });
973
- };
974
- var ViewActionParameterSchema = function (z) {
975
- return z.intersection(AutoIdentifiedArrayItemSchema(z).extend({ name: z.string() }), z.discriminatedUnion("inputMethod", [
976
- ParameterFromAggregationSchema(z),
977
- ParameterFromVariableSchema(z),
978
- ]));
979
- };
980
- var ViewActionSchema = function (z) {
981
- return AutoIdentifiedArrayItemSchema(z).extend({
982
- name: z.string(),
983
- buttonType: z.enum(exports.EActionButtonsTypes).default(exports.EActionButtonsTypes.BASE),
984
- type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT).default(exports.EActionTypes.EXECUTE_SCRIPT),
985
- parameters: z.array(ViewActionParameterSchema(z)).default([]),
986
- scriptKey: KeyNullableSchema(z),
987
- autoUpdate: z
988
- .union([z.literal(exports.EAutoUpdateMode.NONE), z.literal(exports.EAutoUpdateMode.ALL_VIEWS)])
989
- .default(exports.EAutoUpdateMode.NONE),
990
- });
991
- };
992
- var ActionSchema = function (z) {
993
- return z.union([ActionsOnClickSchema(z), WidgetActionSchema(z), ViewActionSchema(z)]);
994
- };
995
- var ActionButtonSchema = function (z) {
996
- return AutoIdentifiedArrayItemSchema(z).extend({
997
- name: z.string(),
998
- onClick: z.array(WidgetActionSchema(z)).default([]),
999
- buttonType: z.enum(exports.EActionButtonsTypes).default(exports.EActionButtonsTypes.BASE),
1000
- backgroundColor: ColorSchema(z),
1001
- borderColor: ColorSchema(z),
1002
- color: ColorSchema(z),
1003
- hint: z.string().default(""),
1004
- });
1005
- };
1041
+ var FormulaFilterValueSchema = SchemaRegistry.define({
1042
+ key: "FormulaFilterValue",
1043
+ latestVersion: "17",
1044
+ history: {
1045
+ "17": function (z) {
1046
+ var _a;
1047
+ return z.object({
1048
+ name: z.string().nullish(),
1049
+ formula: FormulaSchema.forVersion("17")(z),
1050
+ sliceIndex: z.number().optional(),
1051
+ dbDataType: z.string(),
1052
+ format: z.union([z.enum(biFormatting.EFormatTypes), z.string()]).optional(),
1053
+ filteringMethod: z.enum(Object.values(formulaFilterMethods)),
1054
+ checkedValues: z.array(z.string().nullable()).default([]).optional(),
1055
+ formValues: z
1056
+ .object((_a = {},
1057
+ _a[exports.EFormulaFilterFieldKeys.date] = z.string().nullable(),
1058
+ _a[exports.EFormulaFilterFieldKeys.dateRange] = z.tuple([z.string(), z.string()]),
1059
+ _a[exports.EFormulaFilterFieldKeys.numberRange] = z.tuple([
1060
+ z.number().nullable(),
1061
+ z.number().nullable(),
1062
+ ]),
1063
+ _a[exports.EFormulaFilterFieldKeys.string] = z.string(),
1064
+ // todo: отказаться от использования z.string(), оставить только z.number() [BI-15912]
1065
+ _a[exports.EFormulaFilterFieldKeys.lastTimeValue] = z.number().or(z.string()),
1066
+ _a[exports.EFormulaFilterFieldKeys.lastTimeUnit] = z.enum(exports.ELastTimeUnit),
1067
+ _a[exports.EFormulaFilterFieldKeys.durationUnit] = z.enum(exports.EDurationUnit),
1068
+ _a))
1069
+ .partial()
1070
+ .optional(),
1071
+ });
1072
+ },
1073
+ },
1074
+ });
1075
+ var ExtendedFormulaFilterValueSchema = SchemaRegistry.define({
1076
+ key: "ExtendedFormulaFilterValue",
1077
+ latestVersion: "17",
1078
+ history: {
1079
+ "17": function (z) {
1080
+ return z.union([
1081
+ FormulaFilterValueSchema.forVersion("17")(z),
1082
+ z.object({ formula: FormulaSchema.forVersion("17")(z) }),
1083
+ ]);
1084
+ },
1085
+ },
1086
+ });
1087
+ var DimensionProcessFilterSchema = SchemaRegistry.define({
1088
+ key: "DimensionProcessFilter",
1089
+ latestVersion: "17",
1090
+ history: {
1091
+ "17": function (z) {
1092
+ return z.object({
1093
+ value: z.union([
1094
+ WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1095
+ outerAggregation: z.enum(exports.EOuterAggregation),
1096
+ }),
1097
+ WidgetIndicatorAggregationValueSchema.forVersion("17")(z).extend({
1098
+ innerTemplateName: z.string().optional(),
1099
+ }),
1100
+ WidgetIndicatorTimeValueSchema.forVersion("17")(z),
1101
+ z.object({
1102
+ mode: z.literal(exports.EWidgetIndicatorValueModes.FORMULA),
1103
+ formula: FormulaSchema.forVersion("17")(z).optional(),
1104
+ }),
1105
+ ]),
1106
+ dbDataType: z.string(),
1107
+ condition: z.object({
1108
+ filteringMethod: z.enum(Object.values(formulaFilterMethods)),
1109
+ timeUnit: z.enum(exports.EDimensionProcessFilterTimeUnit).optional(),
1110
+ values: z.array(z.string().nullable()),
1111
+ }),
1112
+ });
1113
+ },
1114
+ },
1115
+ });
1116
+ var SettingsFilterSchema = SchemaRegistry.define({
1117
+ key: "SettingsFilter",
1118
+ latestVersion: "17",
1119
+ history: {
1120
+ "17": function (z) {
1121
+ return z.union([
1122
+ ExtendedFormulaFilterValueSchema.forVersion("17")(z),
1123
+ DimensionProcessFilterSchema.forVersion("17")(z),
1124
+ ]);
1125
+ },
1126
+ },
1127
+ });
1128
+
1129
+ var ActionOnClickParameterCommonSchema = SchemaRegistry.define({
1130
+ key: "ActionOnClickParameterCommon",
1131
+ latestVersion: "17",
1132
+ history: {
1133
+ "17": function (z) {
1134
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1135
+ name: z.string(),
1136
+ });
1137
+ },
1138
+ },
1139
+ });
1140
+ var ParameterFromColumnSchema = SchemaRegistry.define({
1141
+ key: "ParameterFromColumn",
1142
+ latestVersion: "17",
1143
+ history: {
1144
+ "17": function (z) {
1145
+ return z.object({
1146
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.COLUMN),
1147
+ tableName: z.string().nullable().default(null),
1148
+ columnName: z.string().nullable().default(null),
1149
+ dbDataType: z.string().optional(),
1150
+ });
1151
+ },
1152
+ },
1153
+ });
1154
+ var ParameterFromVariableSchema = SchemaRegistry.define({
1155
+ key: "ParameterFromVariable",
1156
+ latestVersion: "17",
1157
+ history: {
1158
+ "17": function (z) {
1159
+ return z.object({
1160
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.VARIABLE),
1161
+ sourceVariable: z.string().nullable().default(null),
1162
+ });
1163
+ },
1164
+ },
1165
+ });
1166
+ var ParameterFromFormulaSchema = SchemaRegistry.define({
1167
+ key: "ParameterFromFormula",
1168
+ latestVersion: "17",
1169
+ history: {
1170
+ "17": function (z) {
1171
+ return z.object({
1172
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.FORMULA),
1173
+ formula: FormulaSchema.forVersion("17")(z),
1174
+ considerFilters: z.boolean().default(false),
1175
+ dbDataType: z.string().optional(),
1176
+ });
1177
+ },
1178
+ },
1179
+ });
1180
+ var ParameterFromEventSchema = SchemaRegistry.define({
1181
+ key: "ParameterFromEvent",
1182
+ latestVersion: "17",
1183
+ history: {
1184
+ "17": function (z) {
1185
+ return z.object({
1186
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.EVENT),
1187
+ });
1188
+ },
1189
+ },
1190
+ });
1191
+ var ParameterFromStartEventSchema = SchemaRegistry.define({
1192
+ key: "ParameterFromStartEvent",
1193
+ latestVersion: "17",
1194
+ history: {
1195
+ "17": function (z) {
1196
+ return z.object({
1197
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.START_EVENT),
1198
+ });
1199
+ },
1200
+ },
1201
+ });
1202
+ var ParameterFromEndEventSchema = SchemaRegistry.define({
1203
+ key: "ParameterFromEndEvent",
1204
+ latestVersion: "17",
1205
+ history: {
1206
+ "17": function (z) {
1207
+ return z.object({
1208
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.FINISH_EVENT),
1209
+ });
1210
+ },
1211
+ },
1212
+ });
1213
+ var ParameterFromAggregationSchema = SchemaRegistry.define({
1214
+ key: "ParameterFromAggregation",
1215
+ latestVersion: "17",
1216
+ history: {
1217
+ "17": function (z) {
1218
+ return z.object({
1219
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.AGGREGATION),
1220
+ formula: FormulaSchema.forVersion("17")(z),
1221
+ considerFilters: z.boolean().default(false),
1222
+ dbDataType: z.string().optional(),
1223
+ });
1224
+ },
1225
+ },
1226
+ });
1227
+ var ParameterFromManualInputSchema = SchemaRegistry.define({
1228
+ key: "ParameterFromManualInput",
1229
+ latestVersion: "17",
1230
+ history: {
1231
+ "17": function (z) {
1232
+ return z.object({
1233
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.MANUALLY),
1234
+ description: z.string().default(""),
1235
+ defaultValue: FormulaSchema.forVersion("17")(z),
1236
+ dbDataType: z.string().optional(),
1237
+ filterByRows: z.boolean().default(false),
1238
+ validation: FormulaSchema.forVersion("17")(z),
1239
+ acceptEmptyValue: z.boolean().default(false),
1240
+ });
1241
+ },
1242
+ },
1243
+ });
1244
+ var ParameterFromStaticListSchema = SchemaRegistry.define({
1245
+ key: "ParameterFromStaticList",
1246
+ latestVersion: "17",
1247
+ history: {
1248
+ "17": function (z) {
1249
+ return z.object({
1250
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.STATIC_LIST),
1251
+ options: z.string().default(""),
1252
+ defaultValue: z
1253
+ .union([z.string(), z.array(z.string())])
1254
+ .nullable()
1255
+ .default(null),
1256
+ acceptEmptyValue: z.boolean().default(false),
1257
+ });
1258
+ },
1259
+ },
1260
+ });
1261
+ var ParameterFromDynamicListSchema = SchemaRegistry.define({
1262
+ key: "ParameterFromDynamicList",
1263
+ latestVersion: "17",
1264
+ history: {
1265
+ "17": function (z) {
1266
+ return z.object({
1267
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.DYNAMIC_LIST),
1268
+ options: FormulaSchema.forVersion("17")(z),
1269
+ defaultValue: FormulaSchema.forVersion("17")(z),
1270
+ dbDataType: z.string().optional(),
1271
+ displayOptions: FormulaSchema.forVersion("17")(z),
1272
+ filters: z.array(ExtendedFormulaFilterValueSchema.forVersion("17")(z)).default([]),
1273
+ filterByRows: z.boolean().default(false),
1274
+ considerFilters: z.boolean().default(false),
1275
+ insertAnyValues: z.boolean().default(false),
1276
+ validation: FormulaSchema.forVersion("17")(z),
1277
+ acceptEmptyValue: z.boolean().default(false),
1278
+ });
1279
+ },
1280
+ },
1281
+ });
1282
+ var ParameterFromDataModelSchema = SchemaRegistry.define({
1283
+ key: "ParameterFromDataModel",
1284
+ latestVersion: "17",
1285
+ history: {
1286
+ "17": function (z) {
1287
+ return z.object({
1288
+ inputMethod: z.literal(exports.EWidgetActionInputMethod.DATA_MODEL),
1289
+ option: z.enum(exports.EDataModelOption).default(exports.EDataModelOption.TABLE_LIST),
1290
+ /**
1291
+ * Используется только при COLUMN_LIST. Не делаем union по option, чтобы сохранить
1292
+ * одновременно default для option и работоспособность внешнего discriminated union.
1293
+ */
1294
+ parent: NameNullableSchema.forVersion("17")(z),
1295
+ });
1296
+ },
1297
+ },
1298
+ });
1299
+ var ActionOnClickParameterSchema = SchemaRegistry.define({
1300
+ key: "ActionOnClickParameter",
1301
+ latestVersion: "17",
1302
+ history: {
1303
+ "17": function (z) {
1304
+ return z.intersection(ActionOnClickParameterCommonSchema.forVersion("17")(z), z.discriminatedUnion("inputMethod", [
1305
+ ParameterFromColumnSchema.forVersion("17")(z),
1306
+ ParameterFromVariableSchema.forVersion("17")(z),
1307
+ ParameterFromFormulaSchema.forVersion("17")(z),
1308
+ ParameterFromEventSchema.forVersion("17")(z),
1309
+ ParameterFromStartEventSchema.forVersion("17")(z),
1310
+ ParameterFromEndEventSchema.forVersion("17")(z),
1311
+ ParameterFromAggregationSchema.forVersion("17")(z),
1312
+ ParameterFromManualInputSchema.forVersion("17")(z),
1313
+ ParameterFromStaticListSchema.forVersion("17")(z),
1314
+ ParameterFromDynamicListSchema.forVersion("17")(z),
1315
+ ParameterFromDataModelSchema.forVersion("17")(z),
1316
+ ]));
1317
+ },
1318
+ },
1319
+ });
1320
+ var ActionCommonSchema = SchemaRegistry.define({
1321
+ key: "ActionCommon",
1322
+ latestVersion: "17",
1323
+ history: {
1324
+ "17": function (z) {
1325
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1326
+ name: z.string(),
1327
+ });
1328
+ },
1329
+ },
1330
+ });
1331
+ var ActionDrillDownSchema = SchemaRegistry.define({
1332
+ key: "ActionDrillDown",
1333
+ latestVersion: "17",
1334
+ history: {
1335
+ "17": function (z) {
1336
+ return ActionCommonSchema.forVersion("17")(z).extend({
1337
+ type: z.literal(exports.EActionTypes.DRILL_DOWN),
1338
+ variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1339
+ });
1340
+ },
1341
+ },
1342
+ });
1343
+ var ActionGoToURLSchema = SchemaRegistry.define({
1344
+ key: "ActionGoToURL",
1345
+ latestVersion: "17",
1346
+ history: {
1347
+ "17": function (z) {
1348
+ return ActionCommonSchema.forVersion("17")(z).extend({
1349
+ type: z.literal(exports.EActionTypes.OPEN_URL),
1350
+ url: z.string(),
1351
+ newWindow: z.boolean().default(true),
1352
+ variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1353
+ });
1354
+ },
1355
+ },
1356
+ });
1357
+ var ActivateConditionSchema = SchemaRegistry.define({
1358
+ key: "ActivateCondition",
1359
+ latestVersion: "17",
1360
+ history: {
1361
+ "17": function (z) {
1362
+ return z
1363
+ .discriminatedUnion("mode", [
1364
+ z.object({
1365
+ mode: z.literal(exports.EActivateConditionMode.FORMULA),
1366
+ formula: FormulaSchema.forVersion("17")(z),
1367
+ }),
1368
+ z.object({
1369
+ mode: z.literal(exports.EActivateConditionMode.VARIABLE),
1370
+ variableName: z.string().nullable().default(null),
1371
+ variableValue: z.string().nullable().default(null),
1372
+ }),
1373
+ ])
1374
+ .default({ mode: exports.EActivateConditionMode.FORMULA, formula: "" });
1375
+ },
1376
+ },
1377
+ });
1378
+ var ActionRunScriptSchema = SchemaRegistry.define({
1379
+ key: "ActionRunScript",
1380
+ latestVersion: "17",
1381
+ history: {
1382
+ "17": function (z) {
1383
+ return ActionCommonSchema.forVersion("17")(z).extend({
1384
+ type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT),
1385
+ parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1386
+ scriptKey: z.string(),
1387
+ autoUpdate: z.enum(exports.EAutoUpdateMode).default(exports.EAutoUpdateMode.THIS_WIDGET),
1388
+ hideInactiveButton: z.boolean().default(false),
1389
+ activateCondition: ActivateConditionSchema.forVersion("17")(z),
1390
+ hint: z.string().default(""),
1391
+ variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1392
+ runButtonText: z.string().default(""),
1393
+ });
1394
+ },
1395
+ },
1396
+ });
1397
+ var ActionUpdateVariableSchema = SchemaRegistry.define({
1398
+ key: "ActionUpdateVariable",
1399
+ latestVersion: "17",
1400
+ history: {
1401
+ "17": function (z) {
1402
+ return ActionCommonSchema.forVersion("17")(z).extend({
1403
+ type: z.literal(exports.EActionTypes.UPDATE_VARIABLE),
1404
+ variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1405
+ });
1406
+ },
1407
+ },
1408
+ });
1409
+ var ActionOpenInSchema = SchemaRegistry.define({
1410
+ key: "ActionOpenIn",
1411
+ latestVersion: "17",
1412
+ history: {
1413
+ "17": function (z) {
1414
+ return z.discriminatedUnion("openIn", [
1415
+ z.object({
1416
+ openIn: z.literal(exports.EViewOpenIn.DRAWER_WINDOW),
1417
+ alignment: z.enum(exports.EDrawerPlacement).default(exports.EDrawerPlacement.RIGHT),
1418
+ inheritFilter: z.boolean().default(true),
1419
+ }),
1420
+ z.object({
1421
+ openIn: z.literal(exports.EViewOpenIn.PLACEHOLDER),
1422
+ placeholderName: z.string().optional(),
1423
+ }),
1424
+ z.object({
1425
+ openIn: z.literal(exports.EViewOpenIn.MODAL_WINDOW),
1426
+ positionByClick: z.boolean().default(false),
1427
+ inheritFilter: z.boolean().default(true),
1428
+ }),
1429
+ z.object({
1430
+ openIn: z.literal(exports.EViewOpenIn.WINDOW),
1431
+ newWindow: z.boolean().default(true),
1432
+ inheritFilter: z.boolean().default(true),
1433
+ }),
1434
+ ]);
1435
+ },
1436
+ },
1437
+ });
1438
+ var ActionOpenViewCommonSchema = SchemaRegistry.define({
1439
+ key: "ActionOpenViewCommon",
1440
+ latestVersion: "17",
1441
+ history: {
1442
+ "17": function (z) {
1443
+ return ActionCommonSchema.forVersion("17")(z).extend({
1444
+ type: z.literal(exports.EActionTypes.OPEN_VIEW),
1445
+ variables: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1446
+ });
1447
+ },
1448
+ },
1449
+ });
1450
+ var ActionOpenViewSchema = SchemaRegistry.define({
1451
+ key: "ActionOpenView",
1452
+ latestVersion: "17",
1453
+ history: {
1454
+ "17": function (z) {
1455
+ return z.intersection(z.discriminatedUnion("mode", [
1456
+ ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1457
+ mode: z.literal(exports.EViewMode.GENERATED_BY_SCRIPT),
1458
+ scriptKey: z.string().optional(),
1459
+ parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1460
+ displayName: z.string().default(""),
1461
+ }),
1462
+ ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1463
+ mode: z.literal(exports.EViewMode.EXISTED_VIEW),
1464
+ viewKey: z.string().optional(),
1465
+ parameters: z.array(ActionOnClickParameterSchema.forVersion("17")(z)).default([]),
1466
+ }),
1467
+ ActionOpenViewCommonSchema.forVersion("17")(z).extend({
1468
+ mode: z.literal(exports.EViewMode.EMPTY),
1469
+ placeholderName: z.string().optional(),
1470
+ openIn: z.literal(exports.EViewOpenIn.PLACEHOLDER),
1471
+ }),
1472
+ ]), ActionOpenInSchema.forVersion("17")(z));
1473
+ },
1474
+ },
1475
+ });
1476
+ var ActionsOnClickSchema = SchemaRegistry.define({
1477
+ key: "ActionsOnClick",
1478
+ latestVersion: "17",
1479
+ history: {
1480
+ "17": function (z) {
1481
+ return z.union([
1482
+ ActionGoToURLSchema.forVersion("17")(z),
1483
+ ActionRunScriptSchema.forVersion("17")(z),
1484
+ ActionUpdateVariableSchema.forVersion("17")(z),
1485
+ ActionOpenViewSchema.forVersion("17")(z),
1486
+ ActionDrillDownSchema.forVersion("17")(z),
1487
+ ]);
1488
+ },
1489
+ },
1490
+ });
1491
+ var WidgetActionParameterCommonSchema = SchemaRegistry.define({
1492
+ key: "WidgetActionParameterCommon",
1493
+ latestVersion: "17",
1494
+ history: {
1495
+ "17": function (z) {
1496
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1497
+ name: z.string(),
1498
+ displayName: z.string().default(""),
1499
+ isHidden: z.boolean().default(false),
1500
+ });
1501
+ },
1502
+ },
1503
+ });
1504
+ var WidgetActionParameterSchema = SchemaRegistry.define({
1505
+ key: "WidgetActionParameter",
1506
+ latestVersion: "17",
1507
+ history: {
1508
+ "17": function (z) {
1509
+ return z.intersection(WidgetActionParameterCommonSchema.forVersion("17")(z), z.discriminatedUnion("inputMethod", [
1510
+ ParameterFromColumnSchema.forVersion("17")(z),
1511
+ ParameterFromVariableSchema.forVersion("17")(z),
1512
+ ParameterFromFormulaSchema.forVersion("17")(z),
1513
+ ParameterFromManualInputSchema.forVersion("17")(z),
1514
+ ParameterFromStaticListSchema.forVersion("17")(z),
1515
+ ParameterFromDynamicListSchema.forVersion("17")(z),
1516
+ ParameterFromAggregationSchema.forVersion("17")(z),
1517
+ ParameterFromDataModelSchema.forVersion("17")(z),
1518
+ ]));
1519
+ },
1520
+ },
1521
+ });
1522
+ var WidgetActionSchema = SchemaRegistry.define({
1523
+ key: "WidgetAction",
1524
+ latestVersion: "17",
1525
+ history: {
1526
+ "17": function (z) {
1527
+ return ActionCommonSchema.forVersion("17")(z).extend({
1528
+ parameters: z.array(WidgetActionParameterSchema.forVersion("17")(z)).default([]),
1529
+ type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT),
1530
+ scriptKey: z.string(),
1531
+ autoUpdate: z.enum(exports.EAutoUpdateMode).default(exports.EAutoUpdateMode.THIS_WIDGET),
1532
+ description: z.string().default(""),
1533
+ hideInactiveButton: z.boolean().default(false),
1534
+ hint: z.string().default(""),
1535
+ activateCondition: ActivateConditionSchema.forVersion("17")(z),
1536
+ variables: z.array(WidgetActionParameterSchema.forVersion("17")(z)).default([]),
1537
+ runButtonText: z.string().default(""),
1538
+ });
1539
+ },
1540
+ },
1541
+ });
1542
+ var ViewActionParameterSchema = SchemaRegistry.define({
1543
+ key: "ViewActionParameter",
1544
+ latestVersion: "17",
1545
+ history: {
1546
+ "17": function (z) {
1547
+ return z.intersection(AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({ name: z.string() }), z.discriminatedUnion("inputMethod", [
1548
+ ParameterFromAggregationSchema.forVersion("17")(z),
1549
+ ParameterFromVariableSchema.forVersion("17")(z),
1550
+ ]));
1551
+ },
1552
+ },
1553
+ });
1554
+ var ViewActionSchema = SchemaRegistry.define({
1555
+ key: "ViewAction",
1556
+ latestVersion: "17",
1557
+ history: {
1558
+ "17": function (z) {
1559
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1560
+ name: z.string(),
1561
+ buttonType: z.enum(exports.EActionButtonsTypes).default(exports.EActionButtonsTypes.BASE),
1562
+ type: z.literal(exports.EActionTypes.EXECUTE_SCRIPT).default(exports.EActionTypes.EXECUTE_SCRIPT),
1563
+ parameters: z.array(ViewActionParameterSchema.forVersion("17")(z)).default([]),
1564
+ scriptKey: KeyNullableSchema.forVersion("17")(z),
1565
+ autoUpdate: z
1566
+ .union([z.literal(exports.EAutoUpdateMode.NONE), z.literal(exports.EAutoUpdateMode.ALL_VIEWS)])
1567
+ .default(exports.EAutoUpdateMode.NONE),
1568
+ });
1569
+ },
1570
+ },
1571
+ });
1572
+ var ActionSchema = SchemaRegistry.define({
1573
+ key: "Action",
1574
+ latestVersion: "17",
1575
+ history: {
1576
+ "17": function (z) {
1577
+ return z.union([
1578
+ ActionsOnClickSchema.forVersion("17")(z),
1579
+ WidgetActionSchema.forVersion("17")(z),
1580
+ ViewActionSchema.forVersion("17")(z),
1581
+ ]);
1582
+ },
1583
+ },
1584
+ });
1585
+ var ActionButtonSchema = SchemaRegistry.define({
1586
+ key: "ActionButton",
1587
+ latestVersion: "17",
1588
+ history: {
1589
+ "17": function (z) {
1590
+ return AutoIdentifiedArrayItemSchema.forVersion("17")(z).extend({
1591
+ name: z.string(),
1592
+ onClick: z.array(WidgetActionSchema.forVersion("17")(z)).default([]),
1593
+ buttonType: z.enum(exports.EActionButtonsTypes).default(exports.EActionButtonsTypes.BASE),
1594
+ backgroundColor: ColorSchema.forVersion("17")(z),
1595
+ borderColor: ColorSchema.forVersion("17")(z),
1596
+ color: ColorSchema.forVersion("17")(z),
1597
+ hint: z.string().default(""),
1598
+ });
1599
+ },
1600
+ },
1601
+ });
1006
1602
 
1007
1603
  exports.ESimpleDataType = void 0;
1008
1604
  (function (ESimpleDataType) {
@@ -1087,25 +1683,6 @@ var isFormulaFilterValue = function (value) {
1087
1683
  };
1088
1684
  var isDimensionProcessFilter = function (filter) { return "value" in filter && "condition" in filter; };
1089
1685
 
1090
- var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
1091
- var compactMap = function (items, f) {
1092
- return compact(items === null || items === void 0 ? void 0 : items.map(f));
1093
- };
1094
- var isNil = function (value) {
1095
- return value === null || value === undefined;
1096
- };
1097
- function memoize(fn) {
1098
- var cache = new Map();
1099
- return function (arg) {
1100
- if (cache.has(arg)) {
1101
- return cache.get(arg);
1102
- }
1103
- var result = fn(arg);
1104
- cache.set(arg, result);
1105
- return result;
1106
- };
1107
- }
1108
-
1109
1686
  exports.EClickHouseBaseTypes = void 0;
1110
1687
  (function (EClickHouseBaseTypes) {
1111
1688
  // DATE
@@ -2271,7 +2848,7 @@ exports.ESortDirection = void 0;
2271
2848
  * Если к разрезу иерархии применяется INCLUDE-фильтр с несколькими значениями - выбираем данный разрез
2272
2849
  */
2273
2850
  function selectDimensionFromHierarchy(hierarchy, filters) {
2274
- var hierarchyDimensions = hierarchy.hierarchyDimensions; hierarchy.displayCondition;
2851
+ var hierarchyDimensions = hierarchy.hierarchyDimensions;
2275
2852
  var _loop_1 = function (i) {
2276
2853
  var dimension = hierarchyDimensions[i];
2277
2854
  // todo: widgets - возможно, стоит использовать Map фильтров для быстрого поиска
@@ -2584,6 +3161,39 @@ var replaceFiltersBySelection = function (filters, selection) {
2584
3161
  }, []);
2585
3162
  };
2586
3163
 
3164
+ var colors = [
3165
+ "#222F3E",
3166
+ "#00D2D3",
3167
+ "#5F27CD",
3168
+ "#FECA57",
3169
+ "#078936",
3170
+ "#E51320",
3171
+ "#96AABF",
3172
+ "#1C55E7",
3173
+ "#341F97",
3174
+ "#FFDD59",
3175
+ "#D82C46",
3176
+ "#0BE881",
3177
+ "#0ABDE3",
3178
+ "#FF9F43",
3179
+ "#EC41D4",
3180
+ "#117F8E",
3181
+ "#B9B9B9",
3182
+ "#505BF1",
3183
+ "#64FFB6",
3184
+ "#485460",
3185
+ "#FFD32A",
3186
+ "#C74E1A",
3187
+ "#6E70A6",
3188
+ "#3C40C6",
3189
+ "#48DBFB",
3190
+ "#486179",
3191
+ "#FF9FF3",
3192
+ "#1DD1A1",
3193
+ "#BCC8D4",
3194
+ "#BA46AA",
3195
+ ];
3196
+
2587
3197
  exports.EColorMode = void 0;
2588
3198
  (function (EColorMode) {
2589
3199
  /** Окрашивание отключено */
@@ -2603,6 +3213,7 @@ exports.EColorMode = void 0;
2603
3213
  /** Задать цвет конкретным значениям общего разреза. Режим используется только для настроек правила отображения */
2604
3214
  EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
2605
3215
  })(exports.EColorMode || (exports.EColorMode = {}));
3216
+
2606
3217
  var getRuleColor = function (ruleFormula, globalContext) {
2607
3218
  var _a, _b;
2608
3219
  var link = parseIndicatorLink(ruleFormula);
@@ -2624,38 +3235,6 @@ var isValidColor = function (color, globalContext) {
2624
3235
  }
2625
3236
  return true;
2626
3237
  };
2627
- var colors = [
2628
- "#222F3E",
2629
- "#00D2D3",
2630
- "#5F27CD",
2631
- "#FECA57",
2632
- "#078936",
2633
- "#E51320",
2634
- "#96AABF",
2635
- "#1C55E7",
2636
- "#341F97",
2637
- "#FFDD59",
2638
- "#D82C46",
2639
- "#0BE881",
2640
- "#0ABDE3",
2641
- "#FF9F43",
2642
- "#EC41D4",
2643
- "#117F8E",
2644
- "#B9B9B9",
2645
- "#505BF1",
2646
- "#64FFB6",
2647
- "#485460",
2648
- "#FFD32A",
2649
- "#C74E1A",
2650
- "#6E70A6",
2651
- "#3C40C6",
2652
- "#48DBFB",
2653
- "#486179",
2654
- "#FF9FF3",
2655
- "#1DD1A1",
2656
- "#BCC8D4",
2657
- "#BA46AA",
2658
- ];
2659
3238
  /**
2660
3239
  * Получить цвет по индексу элемента
2661
3240
  * @param index - индекс элемента, которому требуется цвет
@@ -2670,22 +3249,222 @@ var getColorByIndex = function (index) {
2670
3249
  return color;
2671
3250
  };
2672
3251
 
2673
- var WidgetPresetSettingsSchema = function (z) {
2674
- return BaseWidgetSettingsSchema(z)
2675
- .pick({
2676
- filterMode: true,
2677
- ignoreFilters: true,
2678
- stateName: true,
2679
- titleColor: true,
2680
- titleSize: true,
2681
- titleWeight: true,
2682
- paddings: true,
2683
- })
2684
- .extend({
2685
- textSize: z.number().default(12),
3252
+ var ColorBaseSchema = SchemaRegistry.define({
3253
+ key: "ColorBase",
3254
+ latestVersion: "17",
3255
+ history: {
3256
+ "17": function (z) {
3257
+ return z.object({
3258
+ mode: z.literal(exports.EColorMode.BASE),
3259
+ value: z.string(),
3260
+ });
3261
+ },
3262
+ },
3263
+ });
3264
+ var ColorRuleSchema = SchemaRegistry.define({
3265
+ key: "ColorRule",
3266
+ latestVersion: "17",
3267
+ history: {
3268
+ "17": function (z) {
3269
+ return z.object({
3270
+ mode: z.literal(exports.EColorMode.RULE),
3271
+ formula: FormulaSchema.forVersion("17")(z),
3272
+ });
3273
+ },
3274
+ },
3275
+ });
3276
+ var ColorAutoSchema = SchemaRegistry.define({
3277
+ key: "ColorAuto",
3278
+ latestVersion: "17",
3279
+ history: {
3280
+ "17": function (z) {
3281
+ return z.object({
3282
+ mode: z.literal(exports.EColorMode.AUTO),
3283
+ });
3284
+ },
3285
+ },
3286
+ });
3287
+ var ColorDisabledSchema = SchemaRegistry.define({
3288
+ key: "ColorDisabled",
3289
+ latestVersion: "17",
3290
+ history: {
3291
+ "17": function (z) {
3292
+ return z.object({
3293
+ mode: z.literal(exports.EColorMode.DISABLED),
3294
+ });
3295
+ },
3296
+ },
3297
+ });
3298
+ var ColorGradientSchema = SchemaRegistry.define({
3299
+ key: "ColorGradient",
3300
+ latestVersion: "17",
3301
+ history: {
3302
+ "17": function (z) {
3303
+ return z.object({
3304
+ mode: z.literal(exports.EColorMode.GRADIENT),
3305
+ startValue: z.string(),
3306
+ endValue: z.string(),
3307
+ classCount: z.number().min(3).max(10).nullish(),
3308
+ });
3309
+ },
3310
+ },
3311
+ });
3312
+ var ColorFormulaSchema = SchemaRegistry.define({
3313
+ key: "ColorFormula",
3314
+ latestVersion: "17",
3315
+ history: {
3316
+ "17": function (z) {
3317
+ return z.object({
3318
+ mode: z.literal(exports.EColorMode.FORMULA),
3319
+ formula: FormulaSchema.forVersion("17")(z),
3320
+ });
3321
+ },
3322
+ },
3323
+ });
3324
+ var ColorValuesSchema = SchemaRegistry.define({
3325
+ key: "ColorValues",
3326
+ latestVersion: "17",
3327
+ history: {
3328
+ "17": function (z) {
3329
+ return z.object({
3330
+ mode: z.literal(exports.EColorMode.VALUES),
3331
+ items: z
3332
+ .array(z.object({
3333
+ value: z.string(),
3334
+ color: z.union([
3335
+ ColorBaseSchema.forVersion("17")(z),
3336
+ ColorRuleSchema.forVersion("17")(z),
3337
+ ]),
3338
+ }))
3339
+ .default([]),
3340
+ });
3341
+ },
3342
+ },
3343
+ });
3344
+ var ColorByDimensionSchema = SchemaRegistry.define({
3345
+ key: "ColorByDimension",
3346
+ latestVersion: "17",
3347
+ history: {
3348
+ "17": function (z) {
3349
+ return z.object({
3350
+ mode: z.literal(exports.EColorMode.BY_DIMENSION),
3351
+ /** Имя разреза из области видимости правила отображения */
3352
+ dimensionName: z.string(),
3353
+ items: z
3354
+ .array(z.object({
3355
+ value: z.string(),
3356
+ color: z.union([
3357
+ ColorBaseSchema.forVersion("17")(z),
3358
+ ColorRuleSchema.forVersion("17")(z),
3359
+ ]),
3360
+ }))
3361
+ .default([]),
3362
+ });
3363
+ },
3364
+ },
3365
+ });
3366
+ var ColoredValueSchema = SchemaRegistry.define({
3367
+ key: "ColoredValue",
3368
+ latestVersion: "17",
3369
+ history: {
3370
+ "17": function (z) {
3371
+ return z.object({
3372
+ value: z.string(),
3373
+ color: z.union([ColorBaseSchema.forVersion("17")(z), ColorRuleSchema.forVersion("17")(z)]),
3374
+ });
3375
+ },
3376
+ },
3377
+ });
3378
+ var ColorSchema = SchemaRegistry.define({
3379
+ key: "Color",
3380
+ latestVersion: "17",
3381
+ history: {
3382
+ "17": function (z) {
3383
+ return z
3384
+ .discriminatedUnion("mode", [
3385
+ ColorAutoSchema.forVersion("17")(z),
3386
+ ColorDisabledSchema.forVersion("17")(z),
3387
+ ColorBaseSchema.forVersion("17")(z),
3388
+ ColorRuleSchema.forVersion("17")(z),
3389
+ ColorGradientSchema.forVersion("17")(z),
3390
+ ColorFormulaSchema.forVersion("17")(z),
3391
+ ColorValuesSchema.forVersion("17")(z),
3392
+ ColorByDimensionSchema.forVersion("17")(z),
3393
+ ])
3394
+ .default({ mode: exports.EColorMode.AUTO });
3395
+ },
3396
+ },
3397
+ });
3398
+
3399
+ var hexToRgb = function (hex) {
3400
+ if (hex.length === 0) {
3401
+ return;
3402
+ }
3403
+ var rgbTuple = [0, 0, 0];
3404
+ var matchArray = hex
3405
+ .replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) { return "#".concat(r).concat(r).concat(g).concat(g).concat(b).concat(b); })
3406
+ .substring(1)
3407
+ .match(/.{2}/g);
3408
+ matchArray === null || matchArray === void 0 ? void 0 : matchArray.forEach(function (value, index) {
3409
+ if (index > 2) {
3410
+ return undefined;
3411
+ }
3412
+ rgbTuple[index] = parseInt(value, 16);
2686
3413
  });
3414
+ return rgbTuple;
2687
3415
  };
2688
3416
 
3417
+ var rgbToHex = function (rgb) {
3418
+ return "#".concat(rgb.map(function (x) { return x.toString(16).padStart(2, "0"); }).join(""));
3419
+ };
3420
+
3421
+ var lerp = function (a, b, t) { return a + (b - a) * t; };
3422
+ /**
3423
+ * Вычисляет промежуточный hex цвет между двумя цветами путем линейной интерполяции
3424
+ * в RGB пространстве
3425
+ *
3426
+ * @param startHex цвет начала
3427
+ * @param endHex цвет конца
3428
+ * @param position позиция на градиенте от 0 до 1
3429
+ */
3430
+ var interpolateHexColor = function (startHex, endHex, position) {
3431
+ var clampedPosition = clamp(position, 0, 1);
3432
+ var startRgb = hexToRgb(startHex);
3433
+ var endRgb = hexToRgb(endHex);
3434
+ if (!startRgb || !endRgb) {
3435
+ throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0435 \u0446\u0432\u0435\u0442\u0430: start: ".concat(startHex, ", end: ").concat(endHex));
3436
+ }
3437
+ var interpolated = [
3438
+ Math.round(lerp(startRgb[0], endRgb[0], clampedPosition)),
3439
+ Math.round(lerp(startRgb[1], endRgb[1], clampedPosition)),
3440
+ Math.round(lerp(startRgb[2], endRgb[2], clampedPosition)),
3441
+ ];
3442
+ return rgbToHex(interpolated);
3443
+ };
3444
+
3445
+ /** @deprecated временно используется для миграции */
3446
+ var WidgetPresetSettingsSchema = SchemaRegistry.define({
3447
+ key: "WidgetPresetSettings",
3448
+ latestVersion: "17",
3449
+ history: {
3450
+ "17": function (z) {
3451
+ return BaseWidgetSettingsSchema.forVersion("17")(z)
3452
+ .pick({
3453
+ filterMode: true,
3454
+ ignoreFilters: true,
3455
+ stateName: true,
3456
+ titleColor: true,
3457
+ titleSize: true,
3458
+ titleWeight: true,
3459
+ paddings: true,
3460
+ })
3461
+ .extend({
3462
+ textSize: z.number().default(12),
3463
+ });
3464
+ },
3465
+ },
3466
+ });
3467
+
2689
3468
  /**
2690
3469
  * Привязывает мета-информацию о теме к Zod-схеме
2691
3470
  *
@@ -2709,81 +3488,6 @@ var themed = function (scheme, selectThemeValue) {
2709
3488
  return scheme.meta((_a = {}, _a[exports.ESettingsSchemaMetaKey.themeValue] = selectThemeValue, _a));
2710
3489
  };
2711
3490
 
2712
- var ColorBaseSchema = function (z) {
2713
- return z.object({
2714
- mode: z.literal(exports.EColorMode.BASE),
2715
- value: z.string(),
2716
- });
2717
- };
2718
- var ColorRuleSchema = function (z) {
2719
- return z.object({
2720
- mode: z.literal(exports.EColorMode.RULE),
2721
- formula: FormulaSchema(z),
2722
- });
2723
- };
2724
- var ColorAutoSchema = function (z) {
2725
- return z.object({
2726
- mode: z.literal(exports.EColorMode.AUTO),
2727
- });
2728
- };
2729
- var ColorDisabledSchema = function (z) {
2730
- return z.object({
2731
- mode: z.literal(exports.EColorMode.DISABLED),
2732
- });
2733
- };
2734
- var ColorGradientSchema = function (z) {
2735
- return z.object({
2736
- mode: z.literal(exports.EColorMode.GRADIENT),
2737
- startValue: z.string(),
2738
- endValue: z.string(),
2739
- classCount: z.number().min(3).max(10).nullish(),
2740
- });
2741
- };
2742
- var ColorFormulaSchema = function (z) {
2743
- return z.object({
2744
- mode: z.literal(exports.EColorMode.FORMULA),
2745
- formula: FormulaSchema(z),
2746
- });
2747
- };
2748
- var ColorValuesSchema = function (z) {
2749
- return z.object({
2750
- mode: z.literal(exports.EColorMode.VALUES),
2751
- items: z
2752
- .array(z.object({ value: z.string(), color: z.union([ColorBaseSchema(z), ColorRuleSchema(z)]) }))
2753
- .default([]),
2754
- });
2755
- };
2756
- var ColorByDimensionSchema = function (z) {
2757
- return z.object({
2758
- mode: z.literal(exports.EColorMode.BY_DIMENSION),
2759
- /** Имя разреза из области видимости правила отображения */
2760
- dimensionName: z.string(),
2761
- items: z
2762
- .array(z.object({ value: z.string(), color: z.union([ColorBaseSchema(z), ColorRuleSchema(z)]) }))
2763
- .default([]),
2764
- });
2765
- };
2766
- var ColoredValueSchema = function (z) {
2767
- return z.object({
2768
- value: z.string(),
2769
- color: z.union([ColorBaseSchema(z), ColorRuleSchema(z)]),
2770
- });
2771
- };
2772
- var ColorSchema = function (z) {
2773
- return z
2774
- .discriminatedUnion("mode", [
2775
- ColorAutoSchema(z),
2776
- ColorDisabledSchema(z),
2777
- ColorBaseSchema(z),
2778
- ColorRuleSchema(z),
2779
- ColorGradientSchema(z),
2780
- ColorFormulaSchema(z),
2781
- ColorValuesSchema(z),
2782
- ColorByDimensionSchema(z),
2783
- ])
2784
- .default({ mode: exports.EColorMode.AUTO });
2785
- };
2786
-
2787
3491
  Object.defineProperty(exports, "ELanguages", {
2788
3492
  enumerable: true,
2789
3493
  get: function () { return localization.ELanguages; }
@@ -2854,9 +3558,11 @@ exports.ParameterFromVariableSchema = ParameterFromVariableSchema;
2854
3558
  exports.ProcessIndicatorSchema = ProcessIndicatorSchema;
2855
3559
  exports.ProcessIndicatorValueSchema = ProcessIndicatorValueSchema;
2856
3560
  exports.RangeSchema = RangeSchema;
3561
+ exports.SchemaRegistryReader = SchemaRegistryReader;
2857
3562
  exports.SettingsFilterSchema = SettingsFilterSchema;
2858
3563
  exports.SortDirectionSchema = SortDirectionSchema;
2859
3564
  exports.SortOrderSchema = SortOrderSchema;
3565
+ exports.VersionedSchemaFactory = VersionedSchemaFactory;
2860
3566
  exports.ViewActionParameterSchema = ViewActionParameterSchema;
2861
3567
  exports.ViewActionSchema = ViewActionSchema;
2862
3568
  exports.WidgetActionParameterSchema = WidgetActionParameterSchema;
@@ -2916,7 +3622,9 @@ exports.getMeasureFormula = getMeasureFormula;
2916
3622
  exports.getProcessDimensionValueFormula = getProcessDimensionValueFormula;
2917
3623
  exports.getRuleColor = getRuleColor;
2918
3624
  exports.getTransitionMeasureFormula = getTransitionMeasureFormula;
3625
+ exports.hexToRgb = hexToRgb;
2919
3626
  exports.inheritDisplayConditionFromHierarchy = inheritDisplayConditionFromHierarchy;
3627
+ exports.interpolateHexColor = interpolateHexColor;
2920
3628
  exports.isDimensionProcessFilter = isDimensionProcessFilter;
2921
3629
  exports.isDimensionsHierarchy = isDimensionsHierarchy;
2922
3630
  exports.isFormulaFilterValue = isFormulaFilterValue;