plmt-constructor-sdk 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -244,7 +244,7 @@ background: var(--background-bright);
244
244
  в блоке с ключом `blocke-key`:
245
245
 
246
246
  ```ts
247
- import { DataSettings } from 'plmt-constructor-sdk';
247
+ import { DataSettings, ViewSettings } from 'plmt-constructor-sdk';
248
248
  import {
249
249
  CreateViewSettings,
250
250
  input,
@@ -269,23 +269,27 @@ export const createViewSettings: CreateViewSettings<DataSettings> = ({
269
269
  ];
270
270
  };
271
271
 
272
- export const validation: ViewSettingsValidation = {
273
- ['number-key']: (value: any) => {
274
- const number = parseInt(value);
275
-
276
- if (isNaN(number))
277
- return {
278
- ru: 'Значение должно быть числом',
279
- en: 'Not a number',
280
- };
281
-
282
- if (number < 1 || number > max)
283
- return {
284
- ru: `Значение должно быть в диапозоне от 1 до ${max}`,
285
- en: `Not in range 1 до ${max}`,
286
- };
287
-
288
- return null;
289
- },
272
+ export const validation: ViewSettingsValidation = (
273
+ viewSettings: ViewSettings,
274
+ ) => {
275
+ return {
276
+ ['number-key']: (value: any) => {
277
+ const number = parseInt(value);
278
+
279
+ if (isNaN(number))
280
+ return {
281
+ ru: 'Значение должно быть числом',
282
+ en: 'Not a number',
283
+ };
284
+
285
+ if (number < 1 || number > max)
286
+ return {
287
+ ru: `Значение должно быть в диапозоне от 1 до ${max}`,
288
+ en: `Not in range 1 до ${max}`,
289
+ };
290
+
291
+ return null;
292
+ },
293
+ };
290
294
  };
291
295
  ```
@@ -67,6 +67,7 @@ export interface ViewSettingsItemValue {
67
67
  value: string;
68
68
  }[];
69
69
  span?: number;
70
+ invalidChars?: string[];
70
71
  }
71
72
  export declare const viewSettingsItemValue = "418d9556-a046-4623-be0b-4f4f69ccb783";
72
73
  export declare function viewSettingsExtract(viewSettings: ViewSettingsItem[]): ViewSettingsItemValue[];
@@ -58,6 +58,7 @@ function viewSettingsExtract(viewSettings) {
58
58
  tooltip: item.tooltip,
59
59
  options: item.options || [],
60
60
  span: getSpan(item.span),
61
+ invalidChars: item.invalidChars,
61
62
  }));
62
63
  }
63
64
  exports.viewSettingsExtract = viewSettingsExtract;
package/config.d.ts CHANGED
@@ -137,9 +137,9 @@ export interface CreateViewSettings<DataSettings extends WidgetDataSettings | Wi
137
137
  }
138
138
  export declare type ViewSettingsValidator = (value: any) => Text | null;
139
139
  declare type ViewSettingsLabel = Text | string;
140
- export interface ViewSettingsValidation {
140
+ export declare type ViewSettingsValidation = (viewSettings: ViewSettings) => {
141
141
  [key: string]: ViewSettingsValidator;
142
- }
142
+ };
143
143
  export declare class ViewSettingsItem {
144
144
  private [viewSettingsItemValue];
145
145
  constructor(_: symbol);
@@ -156,6 +156,7 @@ export declare function input(params: {
156
156
  flex?: true;
157
157
  id?: number;
158
158
  typeInput?: InputType;
159
+ invalidChars?: string[];
159
160
  }): ViewSettingsItem;
160
161
  export declare function textArea(params: {
161
162
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plmt-constructor-sdk",
3
- "version": "0.15.1",
3
+ "version": "0.17.0",
4
4
  "description": "Набор инструментов для создания виджетов.",
5
5
  "dependencies": {
6
6
  "logical-not": "^1.0.9"