plmt-constructor-sdk 0.13.37 → 0.13.39

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.
@@ -16,10 +16,16 @@ function isFulfillingCondition(type, cellValue, condition) {
16
16
  : conditionValue;
17
17
  return isFulfillingNumberCondition(method, cellValue, value);
18
18
  case constants_1.ColumnType.Date:
19
- const date = Array.isArray(conditionValue)
20
- ? conditionValue.map((item) => new Date(item))
21
- : new Date(conditionValue);
22
- return isFulfillingDateCondition(method, new Date(cellValue), date);
19
+ const cellDate = new Date(cellValue);
20
+ if (Array.isArray(conditionValue)) {
21
+ if (conditionValue.length < 2)
22
+ return false;
23
+ return isFulfillingDateCondition(method, cellDate, [
24
+ new Date(conditionValue[0]),
25
+ new Date(conditionValue[1]),
26
+ ]);
27
+ }
28
+ return isFulfillingDateCondition(method, cellDate, new Date(conditionValue));
23
29
  default:
24
30
  return false;
25
31
  }
@@ -104,30 +110,58 @@ function isFulfillingNumberCondition(method, cellValue, conditionValue) {
104
110
  function isFulfillingDateCondition(method, cellValue, conditionValue) {
105
111
  if (Array.isArray(conditionValue))
106
112
  switch (method) {
107
- case data_1.FilterMethod.InList:
113
+ case data_1.FilterMethod.InList: {
108
114
  return (cellValue >= conditionValue[0] &&
109
115
  cellValue <= conditionValue[1]);
110
- case data_1.FilterMethod.NotInList:
116
+ }
117
+ case data_1.FilterMethod.NotInList: {
111
118
  return (cellValue < conditionValue[0] ||
112
119
  cellValue > conditionValue[1]);
120
+ }
121
+ case data_1.FilterMethod.Range: {
122
+ const start = startOfDay(conditionValue[0]);
123
+ const end = endOfDay(conditionValue[1]);
124
+ return cellValue >= start && cellValue <= end;
125
+ }
126
+ case data_1.FilterMethod.Range$Not: {
127
+ const start = startOfDay(conditionValue[0]);
128
+ const end = endOfDay(conditionValue[1]);
129
+ return cellValue < start || cellValue > end;
130
+ }
113
131
  default:
114
132
  return false;
115
133
  }
116
134
  else
117
135
  switch (method) {
118
- case data_1.FilterMethod.Equal:
119
- return cellValue.getTime() === conditionValue.getTime();
120
- case data_1.FilterMethod.NotEqual:
121
- return cellValue.getTime() !== conditionValue.getTime();
136
+ case data_1.FilterMethod.Equal: {
137
+ const start = startOfDay(conditionValue);
138
+ const end = endOfDay(conditionValue);
139
+ return cellValue >= start && cellValue <= end;
140
+ }
141
+ case data_1.FilterMethod.NotEqual: {
142
+ const start = startOfDay(conditionValue);
143
+ const end = endOfDay(conditionValue);
144
+ return cellValue < start || cellValue > end;
145
+ }
122
146
  case data_1.FilterMethod.GreaterThen:
123
- return cellValue > conditionValue;
147
+ return cellValue > endOfDay(conditionValue);
124
148
  case data_1.FilterMethod.GreaterThenOrEqual:
125
- return cellValue >= conditionValue;
149
+ return cellValue >= startOfDay(conditionValue);
126
150
  case data_1.FilterMethod.LessThen:
127
- return cellValue < conditionValue;
151
+ return cellValue < startOfDay(conditionValue);
128
152
  case data_1.FilterMethod.LessThenOrEqual:
129
- return cellValue <= conditionValue;
153
+ return cellValue <= endOfDay(conditionValue);
130
154
  default:
131
155
  return false;
132
156
  }
133
157
  }
158
+ function startOfDay(date) {
159
+ const normalizedDate = new Date(date.getTime());
160
+ normalizedDate.setHours(0, 0, 0, 0);
161
+ return normalizedDate;
162
+ }
163
+ function endOfDay(date) {
164
+ const normalizedDate = new Date(date.getTime());
165
+ normalizedDate.setHours(23, 59, 59, 999);
166
+ return normalizedDate;
167
+ }
@@ -1,10 +1,5 @@
1
- import { FilterMethod } from '../data';
2
- export declare enum ColumnType {
3
- String = 0,
4
- Number = 1,
5
- Date = 2,
6
- Boolean = 3
7
- }
1
+ import { ColumnType, FilterMethod } from '../data';
2
+ export { ColumnType };
8
3
  export declare const COLOR_STEPS = 128;
9
4
  export interface Condition {
10
5
  column_id: number;
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.COLOR_STEPS = exports.ColumnType = void 0;
4
- var ColumnType;
5
- (function (ColumnType) {
6
- ColumnType[ColumnType["String"] = 0] = "String";
7
- ColumnType[ColumnType["Number"] = 1] = "Number";
8
- ColumnType[ColumnType["Date"] = 2] = "Date";
9
- ColumnType[ColumnType["Boolean"] = 3] = "Boolean";
10
- })(ColumnType = exports.ColumnType || (exports.ColumnType = {}));
4
+ const data_1 = require("../data");
5
+ Object.defineProperty(exports, "ColumnType", { enumerable: true, get: function () { return data_1.ColumnType; } });
11
6
  exports.COLOR_STEPS = 128;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plmt-constructor-sdk",
3
- "version": "0.13.37",
3
+ "version": "0.13.39",
4
4
  "description": "Набор инструментов для создания виджетов.",
5
5
  "dependencies": {
6
6
  "logical-not": "^1.0.9"
package/widget.d.ts CHANGED
@@ -123,6 +123,8 @@ export interface CustomQueryFields {
123
123
  sort?: DataOptionSort[];
124
124
  /** Смещение относительно данных датасета (применимо например в пагинации)*/
125
125
  offset?: number;
126
+ /** Кол-во запрашиваемых строк*/
127
+ limit?: number;
126
128
  /** Идентификатор для определния принадлежности данных*/
127
129
  action?: any;
128
130
  }