plmt-constructor-sdk 0.13.23 → 0.13.25

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.
@@ -1,5 +1,5 @@
1
1
  import { Locale } from '../config';
2
- import { Filter, Sort, Target } from '../data';
2
+ import { DataOptionFilter, Filter, Sort, Target } from '../data';
3
3
  import { WidgetRenderEnv } from '../widget';
4
4
  import { ThemeProvide } from './theme';
5
5
  import { WidgetDataOptionColumn_Server, WidgetRepresent } from './widget';
@@ -26,20 +26,26 @@ export interface InputParameter extends Record<Input, any> {
26
26
  [Input.ChangeOtherFilters]: WidgetDataOptionColumn_Server[];
27
27
  [Input.ChangeWidgetRenderEnv]: WidgetRenderEnv;
28
28
  }
29
- export interface OutputParameterSetFilter {
29
+ /** Если будет проработка Target.All, то удалить */
30
+ export declare type DefaultTarget = Target.All | Target.Other;
31
+ export interface OutputParameterSetFilter_Default {
32
+ target: DefaultTarget;
30
33
  filter: Filter;
31
- target: Exclude<Target, Target.Multi>;
34
+ rowIndex: number;
32
35
  }
33
- export interface OutputParameterMultiSetFilter {
34
- filter: Filter[];
36
+ export interface OutputParameterSetFilter_Multi {
35
37
  target: Target.Multi;
38
+ filter: Filter[];
39
+ rowIndex: number;
40
+ }
41
+ export interface OutputParameterSetFilter_Self {
42
+ target: Target.Self;
43
+ filter: DataOptionFilter[];
36
44
  }
37
45
  export interface OutputParameter extends Record<Output, any> {
38
46
  [Output.Init]: void;
39
47
  [Output.Ready]: void;
40
- [Output.SetFilter]: (OutputParameterSetFilter | OutputParameterMultiSetFilter) & {
41
- rowIndex: number;
42
- };
48
+ [Output.SetFilter]: OutputParameterSetFilter_Default | OutputParameterSetFilter_Multi | OutputParameterSetFilter_Self;
43
49
  [Output.RemoveFilterAt]: {
44
50
  index: number;
45
51
  };
@@ -55,8 +61,10 @@ export interface OutputParameter extends Record<Output, any> {
55
61
  dataIndex: number;
56
62
  };
57
63
  }
58
- export interface OutputData {
59
- token: string;
60
- type: Output;
61
- payload?: any;
62
- }
64
+ export declare type OutputData = {
65
+ [K in Output]: {
66
+ token: string;
67
+ type: K;
68
+ payload?: OutputParameter[K];
69
+ };
70
+ }[Output];
@@ -1,4 +1,4 @@
1
1
  import { DataSettings } from '../widget';
2
2
  import { WidgetRepresent } from './widget';
3
- export declare type DataSettingsMethods = Pick<DataSettings, 'setFilter' | 'setMultiFilter' | 'removeFilterAt' | 'setSort' | 'removeSortAt' | 'interact'>;
3
+ export declare type DataSettingsMethods = Pick<DataSettings, 'setFilter' | 'removeFilterAt' | 'setSort' | 'removeSortAt' | 'interact'>;
4
4
  export declare function provideDataTo(widget: any, { dataOptionsMap, viewOptions }: WidgetRepresent, dataSettingsMethods?: DataSettingsMethods): void;
@@ -4,8 +4,9 @@ exports.provideDataTo = void 0;
4
4
  const config_1 = require("./config");
5
5
  const widget_1 = require("./widget");
6
6
  const defaultDataSettingsMethods = {
7
- setFilter() { },
8
- setMultiFilter() { },
7
+ setFilter() {
8
+ return;
9
+ },
9
10
  removeFilterAt() { },
10
11
  setSort() { },
11
12
  removeSortAt() { },
@@ -1,2 +1,2 @@
1
- import { ColumnType, Condition } from "./constants";
1
+ import { ColumnType, Condition } from './constants';
2
2
  export declare function isFulfillingCondition(type: ColumnType, cellValue: any, condition: Condition): boolean;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isFulfillingCondition = void 0;
4
4
  const constants_1 = require("./constants");
5
+ const data_1 = require("../data");
5
6
  function isFulfillingCondition(type, cellValue, condition) {
6
7
  const method = condition.condition;
7
8
  const conditionValue = condition.value;
@@ -26,43 +27,43 @@ function isFulfillingCondition(type, cellValue, condition) {
26
27
  exports.isFulfillingCondition = isFulfillingCondition;
27
28
  function isFulfillingStringCondition(method, cellValue, conditionValue) {
28
29
  switch (method) {
29
- case constants_1.FilterMethod.Equal:
30
+ case data_1.FilterMethod.Equal:
30
31
  return cellValue === conditionValue;
31
- case constants_1.FilterMethod.NotEqual:
32
+ case data_1.FilterMethod.NotEqual:
32
33
  return cellValue !== conditionValue;
33
- case constants_1.FilterMethod.Like:
34
+ case data_1.FilterMethod.Like:
34
35
  return cellValue.includes(conditionValue);
35
- case constants_1.FilterMethod.Like$Not:
36
+ case data_1.FilterMethod.Like$Not:
36
37
  return !cellValue.includes(conditionValue);
37
- case constants_1.FilterMethod.Like$CaseIgnore:
38
+ case data_1.FilterMethod.Like$CaseIgnore:
38
39
  return cellValue
39
40
  .toUpperCase()
40
41
  .includes(conditionValue.toUpperCase());
41
- case constants_1.FilterMethod.Like$Not$CaseIgnore:
42
+ case data_1.FilterMethod.Like$Not$CaseIgnore:
42
43
  return !cellValue
43
44
  .toUpperCase()
44
45
  .includes(conditionValue.toUpperCase());
45
- case constants_1.FilterMethod.StartsLike:
46
+ case data_1.FilterMethod.StartsLike:
46
47
  return cellValue.startsWith(conditionValue);
47
- case constants_1.FilterMethod.StartsLike$Not:
48
+ case data_1.FilterMethod.StartsLike$Not:
48
49
  return !cellValue.startsWith(conditionValue);
49
- case constants_1.FilterMethod.StartsLike$CaseIgnore:
50
+ case data_1.FilterMethod.StartsLike$CaseIgnore:
50
51
  return cellValue
51
52
  .toUpperCase()
52
53
  .startsWith(conditionValue.toUpperCase());
53
- case constants_1.FilterMethod.StartsLike$Not$CaseIgnore:
54
+ case data_1.FilterMethod.StartsLike$Not$CaseIgnore:
54
55
  return !cellValue
55
56
  .toUpperCase()
56
57
  .startsWith(conditionValue.toUpperCase());
57
- case constants_1.FilterMethod.EndsLike:
58
+ case data_1.FilterMethod.EndsLike:
58
59
  return cellValue.endsWith(conditionValue);
59
- case constants_1.FilterMethod.EndsLike$Not:
60
+ case data_1.FilterMethod.EndsLike$Not:
60
61
  return !cellValue.endsWith(conditionValue);
61
- case constants_1.FilterMethod.EndsLike$CaseIgnore:
62
+ case data_1.FilterMethod.EndsLike$CaseIgnore:
62
63
  return cellValue
63
64
  .toUpperCase()
64
65
  .endsWith(conditionValue.toUpperCase());
65
- case constants_1.FilterMethod.EndsLike$Not$CaseIgnore:
66
+ case data_1.FilterMethod.EndsLike$Not$CaseIgnore:
66
67
  return !cellValue
67
68
  .toUpperCase()
68
69
  .endsWith(conditionValue.toUpperCase());
@@ -73,10 +74,10 @@ function isFulfillingStringCondition(method, cellValue, conditionValue) {
73
74
  function isFulfillingNumberCondition(method, cellValue, conditionValue) {
74
75
  if (Array.isArray(conditionValue))
75
76
  switch (method) {
76
- case constants_1.FilterMethod.InList:
77
+ case data_1.FilterMethod.InList:
77
78
  return (cellValue >= conditionValue[0] &&
78
79
  cellValue <= conditionValue[1]);
79
- case constants_1.FilterMethod.NotInList:
80
+ case data_1.FilterMethod.NotInList:
80
81
  return (cellValue < conditionValue[0] ||
81
82
  cellValue > conditionValue[1]);
82
83
  default:
@@ -84,17 +85,17 @@ function isFulfillingNumberCondition(method, cellValue, conditionValue) {
84
85
  }
85
86
  else
86
87
  switch (method) {
87
- case constants_1.FilterMethod.Equal:
88
+ case data_1.FilterMethod.Equal:
88
89
  return cellValue === conditionValue;
89
- case constants_1.FilterMethod.NotEqual:
90
+ case data_1.FilterMethod.NotEqual:
90
91
  return cellValue !== conditionValue;
91
- case constants_1.FilterMethod.GreaterThen:
92
+ case data_1.FilterMethod.GreaterThen:
92
93
  return cellValue > conditionValue;
93
- case constants_1.FilterMethod.GreaterThenOrEqual:
94
+ case data_1.FilterMethod.GreaterThenOrEqual:
94
95
  return cellValue >= conditionValue;
95
- case constants_1.FilterMethod.LessThen:
96
+ case data_1.FilterMethod.LessThen:
96
97
  return cellValue < conditionValue;
97
- case constants_1.FilterMethod.LessThenOrEqual:
98
+ case data_1.FilterMethod.LessThenOrEqual:
98
99
  return cellValue <= conditionValue;
99
100
  default:
100
101
  return false;
@@ -103,10 +104,10 @@ function isFulfillingNumberCondition(method, cellValue, conditionValue) {
103
104
  function isFulfillingDateCondition(method, cellValue, conditionValue) {
104
105
  if (Array.isArray(conditionValue))
105
106
  switch (method) {
106
- case constants_1.FilterMethod.DateRange:
107
+ case data_1.FilterMethod.InList:
107
108
  return (cellValue >= conditionValue[0] &&
108
109
  cellValue <= conditionValue[1]);
109
- case constants_1.FilterMethod.DateRange$Not:
110
+ case data_1.FilterMethod.NotInList:
110
111
  return (cellValue < conditionValue[0] ||
111
112
  cellValue > conditionValue[1]);
112
113
  default:
@@ -114,17 +115,17 @@ function isFulfillingDateCondition(method, cellValue, conditionValue) {
114
115
  }
115
116
  else
116
117
  switch (method) {
117
- case constants_1.FilterMethod.Equal:
118
+ case data_1.FilterMethod.Equal:
118
119
  return cellValue.getTime() === conditionValue.getTime();
119
- case constants_1.FilterMethod.NotEqual:
120
+ case data_1.FilterMethod.NotEqual:
120
121
  return cellValue.getTime() !== conditionValue.getTime();
121
- case constants_1.FilterMethod.GreaterThen:
122
+ case data_1.FilterMethod.GreaterThen:
122
123
  return cellValue > conditionValue;
123
- case constants_1.FilterMethod.GreaterThenOrEqual:
124
+ case data_1.FilterMethod.GreaterThenOrEqual:
124
125
  return cellValue >= conditionValue;
125
- case constants_1.FilterMethod.LessThen:
126
+ case data_1.FilterMethod.LessThen:
126
127
  return cellValue < conditionValue;
127
- case constants_1.FilterMethod.LessThenOrEqual:
128
+ case data_1.FilterMethod.LessThenOrEqual:
128
129
  return cellValue <= conditionValue;
129
130
  default:
130
131
  return false;
@@ -1,35 +1,10 @@
1
+ import { FilterMethod } from '../data';
1
2
  export declare enum ColumnType {
2
3
  String = 0,
3
4
  Number = 1,
4
5
  Date = 2,
5
6
  Boolean = 3
6
7
  }
7
- export declare enum FilterMethod {
8
- Equal = "EQ",
9
- NotEqual = "NEQ",
10
- GreaterThen = "GT",
11
- LessThen = "LT",
12
- GreaterThenOrEqual = "GTE",
13
- LessThenOrEqual = "LTE",
14
- InList = "IN",
15
- NotInList = "NIN",
16
- Like = "LIKE",
17
- Like$CaseIgnore = "LIKE_I",
18
- Like$Not = "NLIKE",
19
- Like$Not$CaseIgnore = "NLIKE_I",
20
- StartsLike = "START_LIKE",
21
- StartsLike$CaseIgnore = "START_LIKE_I",
22
- StartsLike$Not = "NSTART_LIKE",
23
- StartsLike$Not$CaseIgnore = "NSTART_LIKE_I",
24
- EndsLike = "END_LIKE",
25
- EndsLike$CaseIgnore = "END_LIKE_I",
26
- EndsLike$Not = "NEND_LIKE",
27
- EndsLike$Not$CaseIgnore = "NEND_LIKE_I",
28
- DateRange = "DATE_RANGE",
29
- DateRange$Not = "NDATE_RANGE",
30
- Range = "RANGE",
31
- Range$Not = "NRANGE"
32
- }
33
8
  export declare const COLOR_STEPS = 128;
34
9
  export interface Condition {
35
10
  column_id: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COLOR_STEPS = exports.FilterMethod = exports.ColumnType = void 0;
3
+ exports.COLOR_STEPS = exports.ColumnType = void 0;
4
4
  var ColumnType;
5
5
  (function (ColumnType) {
6
6
  ColumnType[ColumnType["String"] = 0] = "String";
@@ -8,31 +8,4 @@ var ColumnType;
8
8
  ColumnType[ColumnType["Date"] = 2] = "Date";
9
9
  ColumnType[ColumnType["Boolean"] = 3] = "Boolean";
10
10
  })(ColumnType = exports.ColumnType || (exports.ColumnType = {}));
11
- var FilterMethod;
12
- (function (FilterMethod) {
13
- FilterMethod["Equal"] = "EQ";
14
- FilterMethod["NotEqual"] = "NEQ";
15
- FilterMethod["GreaterThen"] = "GT";
16
- FilterMethod["LessThen"] = "LT";
17
- FilterMethod["GreaterThenOrEqual"] = "GTE";
18
- FilterMethod["LessThenOrEqual"] = "LTE";
19
- FilterMethod["InList"] = "IN";
20
- FilterMethod["NotInList"] = "NIN";
21
- FilterMethod["Like"] = "LIKE";
22
- FilterMethod["Like$CaseIgnore"] = "LIKE_I";
23
- FilterMethod["Like$Not"] = "NLIKE";
24
- FilterMethod["Like$Not$CaseIgnore"] = "NLIKE_I";
25
- FilterMethod["StartsLike"] = "START_LIKE";
26
- FilterMethod["StartsLike$CaseIgnore"] = "START_LIKE_I";
27
- FilterMethod["StartsLike$Not"] = "NSTART_LIKE";
28
- FilterMethod["StartsLike$Not$CaseIgnore"] = "NSTART_LIKE_I";
29
- FilterMethod["EndsLike"] = "END_LIKE";
30
- FilterMethod["EndsLike$CaseIgnore"] = "END_LIKE_I";
31
- FilterMethod["EndsLike$Not"] = "NEND_LIKE";
32
- FilterMethod["EndsLike$Not$CaseIgnore"] = "NEND_LIKE_I";
33
- FilterMethod["DateRange"] = "DATE_RANGE";
34
- FilterMethod["DateRange$Not"] = "NDATE_RANGE";
35
- FilterMethod["Range"] = "RANGE";
36
- FilterMethod["Range$Not"] = "NRANGE";
37
- })(FilterMethod = exports.FilterMethod || (exports.FilterMethod = {}));
38
11
  exports.COLOR_STEPS = 128;
package/data.d.ts CHANGED
@@ -13,33 +13,63 @@ export declare enum ColumnType {
13
13
  Object = "object"
14
14
  }
15
15
  export declare enum FilterMethod {
16
- Equal = "equally",
17
- NotEqual = "not_equal",
18
- GreaterThen = "gt",
19
- LessThen = "lt",
20
- GreaterThenOrEqual = "gte",
21
- LessThenOrEqual = "lte",
22
- Period = "period",
23
- DateList = "date_list",
24
- InList = "in_list",
25
- NotInList = "nin_list",
26
- StartsOnIndex = "starts_on_i",
27
- StartsOn = "starts_on",
28
- EndsOnIndex = "ends_on_i",
29
- EndsOn = "ends_on",
30
- ContainsIndex = "contains_i",
31
- Contains = "contains",
32
- NotContainIndex = "not_contain_i",
33
- NotContain = "not_contain"
16
+ /** Равно */
17
+ Equal = "EQ",
18
+ /** Не равно */
19
+ NotEqual = "NEQ",
20
+ /** Больше */
21
+ GreaterThen = "GT",
22
+ /** Меньше */
23
+ LessThen = "LT",
24
+ /** Больше или равно */
25
+ GreaterThenOrEqual = "GTE",
26
+ /** Меньше или равно */
27
+ LessThenOrEqual = "LTE",
28
+ /** Принадлежит множеству */
29
+ InList = "IN",
30
+ /** Не принадлежит множеству */
31
+ NotInList = "NIN",
32
+ /** Содержит (с учетом регистра) */
33
+ Like = "LIKE",
34
+ /** Содержит (без учета регистра) */
35
+ Like$CaseIgnore = "LIKE_I",
36
+ /** Не содержит (с учетом регистра) */
37
+ Like$Not = "NLIKE",
38
+ /** Не содержит (без учета регистра) */
39
+ Like$Not$CaseIgnore = "NLIKE_I",
40
+ /** Начинается на (с учетом регистра) */
41
+ StartsLike = "START_LIKE",
42
+ /** Начинается на (без учета регистра) */
43
+ StartsLike$CaseIgnore = "START_LIKE_I",
44
+ /** Не начинается на (с учетом регистра) */
45
+ StartsLike$Not = "NSTART_LIKE",
46
+ /** Не начинается на (без учета регистра) */
47
+ StartsLike$Not$CaseIgnore = "NSTART_LIKE_I",
48
+ /** Заканчивается на (с учетом регистра) */
49
+ EndsLike = "END_LIKE",
50
+ /** Заканчивается на (без учета регистра) */
51
+ EndsLike$CaseIgnore = "END_LIKE_I",
52
+ /** Не заканчивается на (с учетом регистра) */
53
+ EndsLike$Not = "NEND_LIKE",
54
+ /** Не заканчивается на (без учета регистра) */
55
+ EndsLike$Not$CaseIgnore = "NEND_LIKE_I",
56
+ /** Входит в диапазон */
57
+ Range = "RANGE",
58
+ /** Не входит в диапазон */
59
+ Range$Not = "NRANGE"
34
60
  }
35
61
  export declare enum SortDirection {
36
62
  Asc = "ASC",
37
63
  Desc = "DESC"
38
64
  }
39
65
  export declare enum Target {
66
+ /** Использовать для установки собственной фильтрации */
40
67
  Self = "self",
68
+ /** Использовать для установки график-фильтрации */
41
69
  Other = "other",
70
+ /** Использовать для одновременной установки нескольких график-фильтров */
42
71
  Multi = "multi",
72
+ /** Использовать для установки фильтров на все графики (на данный момент не проработан) */
43
73
  All = "all"
44
74
  }
45
75
  export interface DataItem {
@@ -57,6 +87,21 @@ export interface Filter {
57
87
  method: FilterMethod;
58
88
  value: string | number | string[] | number[];
59
89
  }
90
+ export declare type DataOptionFilter = DataOptionFilterWithChild | DataOptionFilterWithoutChild;
91
+ export interface DataOptionFilterWithChild {
92
+ logical?: FilterLogical;
93
+ child: DataOptionFilter[];
94
+ }
95
+ export interface DataOptionFilterWithoutChild {
96
+ logical?: FilterLogical;
97
+ column_id: number;
98
+ action: FilterMethod;
99
+ value: any;
100
+ }
101
+ export declare enum FilterLogical {
102
+ And = "AND",
103
+ Or = "OR"
104
+ }
60
105
  export interface Sort {
61
106
  column: Column;
62
107
  direction: SortDirection;
package/data.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @module Работа с данными
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Target = exports.SortDirection = exports.FilterMethod = exports.ColumnType = void 0;
9
+ exports.FilterLogical = exports.Target = exports.SortDirection = exports.FilterMethod = exports.ColumnType = void 0;
10
10
  // enums
11
11
  var ColumnType;
12
12
  (function (ColumnType) {
@@ -19,24 +19,50 @@ var ColumnType;
19
19
  })(ColumnType = exports.ColumnType || (exports.ColumnType = {}));
20
20
  var FilterMethod;
21
21
  (function (FilterMethod) {
22
- FilterMethod["Equal"] = "equally";
23
- FilterMethod["NotEqual"] = "not_equal";
24
- FilterMethod["GreaterThen"] = "gt";
25
- FilterMethod["LessThen"] = "lt";
26
- FilterMethod["GreaterThenOrEqual"] = "gte";
27
- FilterMethod["LessThenOrEqual"] = "lte";
28
- FilterMethod["Period"] = "period";
29
- FilterMethod["DateList"] = "date_list";
30
- FilterMethod["InList"] = "in_list";
31
- FilterMethod["NotInList"] = "nin_list";
32
- FilterMethod["StartsOnIndex"] = "starts_on_i";
33
- FilterMethod["StartsOn"] = "starts_on";
34
- FilterMethod["EndsOnIndex"] = "ends_on_i";
35
- FilterMethod["EndsOn"] = "ends_on";
36
- FilterMethod["ContainsIndex"] = "contains_i";
37
- FilterMethod["Contains"] = "contains";
38
- FilterMethod["NotContainIndex"] = "not_contain_i";
39
- FilterMethod["NotContain"] = "not_contain";
22
+ /** Равно */
23
+ FilterMethod["Equal"] = "EQ";
24
+ /** Не равно */
25
+ FilterMethod["NotEqual"] = "NEQ";
26
+ /** Больше */
27
+ FilterMethod["GreaterThen"] = "GT";
28
+ /** Меньше */
29
+ FilterMethod["LessThen"] = "LT";
30
+ /** Больше или равно */
31
+ FilterMethod["GreaterThenOrEqual"] = "GTE";
32
+ /** Меньше или равно */
33
+ FilterMethod["LessThenOrEqual"] = "LTE";
34
+ /** Принадлежит множеству */
35
+ FilterMethod["InList"] = "IN";
36
+ /** Не принадлежит множеству */
37
+ FilterMethod["NotInList"] = "NIN";
38
+ /** Содержит (с учетом регистра) */
39
+ FilterMethod["Like"] = "LIKE";
40
+ /** Содержит (без учета регистра) */
41
+ FilterMethod["Like$CaseIgnore"] = "LIKE_I";
42
+ /** Не содержит (с учетом регистра) */
43
+ FilterMethod["Like$Not"] = "NLIKE";
44
+ /** Не содержит (без учета регистра) */
45
+ FilterMethod["Like$Not$CaseIgnore"] = "NLIKE_I";
46
+ /** Начинается на (с учетом регистра) */
47
+ FilterMethod["StartsLike"] = "START_LIKE";
48
+ /** Начинается на (без учета регистра) */
49
+ FilterMethod["StartsLike$CaseIgnore"] = "START_LIKE_I";
50
+ /** Не начинается на (с учетом регистра) */
51
+ FilterMethod["StartsLike$Not"] = "NSTART_LIKE";
52
+ /** Не начинается на (без учета регистра) */
53
+ FilterMethod["StartsLike$Not$CaseIgnore"] = "NSTART_LIKE_I";
54
+ /** Заканчивается на (с учетом регистра) */
55
+ FilterMethod["EndsLike"] = "END_LIKE";
56
+ /** Заканчивается на (без учета регистра) */
57
+ FilterMethod["EndsLike$CaseIgnore"] = "END_LIKE_I";
58
+ /** Не заканчивается на (с учетом регистра) */
59
+ FilterMethod["EndsLike$Not"] = "NEND_LIKE";
60
+ /** Не заканчивается на (без учета регистра) */
61
+ FilterMethod["EndsLike$Not$CaseIgnore"] = "NEND_LIKE_I";
62
+ /** Входит в диапазон */
63
+ FilterMethod["Range"] = "RANGE";
64
+ /** Не входит в диапазон */
65
+ FilterMethod["Range$Not"] = "NRANGE";
40
66
  })(FilterMethod = exports.FilterMethod || (exports.FilterMethod = {}));
41
67
  var SortDirection;
42
68
  (function (SortDirection) {
@@ -45,8 +71,17 @@ var SortDirection;
45
71
  })(SortDirection = exports.SortDirection || (exports.SortDirection = {}));
46
72
  var Target;
47
73
  (function (Target) {
74
+ /** Использовать для установки собственной фильтрации */
48
75
  Target["Self"] = "self";
76
+ /** Использовать для установки график-фильтрации */
49
77
  Target["Other"] = "other";
78
+ /** Использовать для одновременной установки нескольких график-фильтров */
50
79
  Target["Multi"] = "multi";
80
+ /** Использовать для установки фильтров на все графики (на данный момент не проработан) */
51
81
  Target["All"] = "all";
52
82
  })(Target = exports.Target || (exports.Target = {}));
83
+ var FilterLogical;
84
+ (function (FilterLogical) {
85
+ FilterLogical["And"] = "AND";
86
+ FilterLogical["Or"] = "OR";
87
+ })(FilterLogical = exports.FilterLogical || (exports.FilterLogical = {}));
package/declare.js CHANGED
@@ -17,10 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Declare = void 0;
18
18
  const logical_not_1 = require("logical-not");
19
19
  const data_1 = require("./data");
20
- const widget_io_1 = require("./__internal__/widget-io");
21
- const widget_provide_data_1 = require("./__internal__/widget-provide-data");
22
20
  const theme_1 = require("./__internal__/theme");
23
21
  const widget_1 = require("./__internal__/widget");
22
+ const widget_io_1 = require("./__internal__/widget-io");
23
+ const widget_provide_data_1 = require("./__internal__/widget-provide-data");
24
24
  /**
25
25
  * Функция-декоратор
26
26
  */
@@ -49,21 +49,30 @@ function Declare(params) {
49
49
  return preparedFilter;
50
50
  };
51
51
  const dataSettingsMethods = {
52
- setFilter(filter, rowIndex, target = data_1.Target.Self) {
53
- filter = prepare(filter);
54
- output(token, widget_io_1.Output.SetFilter, {
55
- filter,
56
- target,
57
- rowIndex,
58
- });
59
- },
60
- setMultiFilter(filter, rowIndex) {
61
- filter = filter.map(prepare);
62
- output(token, widget_io_1.Output.SetFilter, {
63
- filter,
64
- target: data_1.Target.Multi,
65
- rowIndex,
66
- });
52
+ setFilter(...args) {
53
+ const [target, filter, rowIndex] = args;
54
+ switch (target) {
55
+ case data_1.Target.Multi:
56
+ output(token, widget_io_1.Output.SetFilter, {
57
+ filter: filter.map(prepare),
58
+ target,
59
+ rowIndex,
60
+ });
61
+ break;
62
+ case data_1.Target.Self:
63
+ output(token, widget_io_1.Output.SetFilter, {
64
+ filter,
65
+ target,
66
+ });
67
+ break;
68
+ default:
69
+ output(token, widget_io_1.Output.SetFilter, {
70
+ filter: prepare(filter),
71
+ target,
72
+ rowIndex,
73
+ });
74
+ }
75
+ return;
67
76
  },
68
77
  removeFilterAt(index) {
69
78
  output(token, widget_io_1.Output.RemoveFilterAt, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plmt-constructor-sdk",
3
- "version": "0.13.23",
3
+ "version": "0.13.25",
4
4
  "description": "Набор инструментов для создания виджетов.",
5
5
  "dependencies": {
6
6
  "logical-not": "^1.0.9"
package/widget.d.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * @packageDocumentation
5
5
  * @module Класс Widget
6
6
  */
7
- import { Column, Filter, Target, Sort, DataItem } from './data';
8
7
  import { Locale } from './config';
8
+ import { Column, DataItem, DataOptionFilter, Filter, Sort, Target } from './data';
9
9
  import { Theme } from './theme';
10
10
  export declare abstract class Widget {
11
11
  viewSettings: ViewSettings;
@@ -41,8 +41,7 @@ export interface DataSettings {
41
41
  total: number;
42
42
  limit: number;
43
43
  offset: number;
44
- setFilter(filter: Filter, rowIndex: number, target?: Target): void;
45
- setMultiFilter(filter: Filter[], rowIndex: number): void;
44
+ setFilter: SetFilterFn[Target];
46
45
  removeFilterAt(index: number): void;
47
46
  setSort(sort: Sort | null): void;
48
47
  removeSortAt(index: number): void;
@@ -62,3 +61,21 @@ export declare enum WidgetRenderEnv {
62
61
  Default = "default",
63
62
  Print = "print"
64
63
  }
64
+ export interface SetFilterFn {
65
+ /** Установка фильтрации типа All (на данный момент не проработан) */
66
+ [Target.All]: {
67
+ (target: Target.All, filter: Filter, rowIndex: number): void;
68
+ };
69
+ /** Установка фильтрации для график-фильтрации */
70
+ [Target.Other]: {
71
+ (target: Target.Other, filter: Filter, rowIndex: number): void;
72
+ };
73
+ /** Установка фильтрации для одновременной установки нескольких график-фильтров */
74
+ [Target.Multi]: {
75
+ (target: Target.Multi, filter: Filter[], rowIndex: number): void;
76
+ };
77
+ /** Установка фильтрации для установки собственной фильтрации */
78
+ [Target.Self]: {
79
+ (target: Target.Self, filter: DataOptionFilter[]): void;
80
+ };
81
+ }
package/widget.js CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.WidgetRenderEnv = exports.Widget = void 0;
10
+ const data_1 = require("./data");
10
11
  class Widget {
11
12
  constructor() {
12
13
  this.renderEnv = WidgetRenderEnv.Default;