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 +23 -19
- package/__internal__/view-settings.d.ts +1 -0
- package/__internal__/view-settings.js +1 -0
- package/config.d.ts +3 -2
- package/package.json +1 -1
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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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[];
|
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
|
|
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;
|