plmt-constructor-sdk 0.13.27 → 0.13.29

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,6 @@
1
- import { Text, DataQueryMethod, DataQueryFunction, CustomDefaultDataRules } from '../config';
1
+ import { AllColumnsHidden, DataQueryFunction, DataQueryMethod, HiddenColumnIdx, ShowColumnIdx, Text } from '../config';
2
2
  import { ColumnType } from '../data';
3
+ import { CamelToSnakeCase } from '../tools';
3
4
  import { DatasetColumnType_Server } from './dataset';
4
5
  export declare enum ConfigDataBlockType_Server {
5
6
  Column = "column",
@@ -24,7 +25,7 @@ export interface Config_Server {
24
25
  icon: string;
25
26
  data_options: ConfigDataOption_Server[];
26
27
  alternative_sort?: true;
27
- customDefaultDataRules: CustomDefaultDataRules;
28
+ custom_default_data_rules: CustomDefaultDataRules_Server;
28
29
  doc: {
29
30
  info: string;
30
31
  assets: string;
@@ -65,6 +66,10 @@ export interface ConfigDataOptionBlock_Server {
65
66
  function?: DataQueryFunction;
66
67
  sorted?: true;
67
68
  }
69
+ export declare type CustomDefaultDataRules_Server = Rule_Server | Rule_Server[];
70
+ export declare type Rule_Server = {
71
+ [key: string]: CamelToSnakeCase<AllColumnsHidden> | CamelToSnakeCase<HiddenColumnIdx> | CamelToSnakeCase<ShowColumnIdx>;
72
+ };
68
73
  export declare const configDataBlock_Server = "8316067a-d04b-4b21-bd4d-35529846617b";
69
74
  export declare const blockFilterKey = "34642664-dbd1-4e35-b0ea-2eaabe796b48";
70
75
  export declare const blockSortKey = "2c849ed6-6105-4aa2-a961-9f95135dfe3b";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plmt-constructor-sdk",
3
- "version": "0.13.27",
3
+ "version": "0.13.29",
4
4
  "description": "Набор инструментов для создания виджетов.",
5
5
  "dependencies": {
6
6
  "logical-not": "^1.0.9"
@@ -0,0 +1,6 @@
1
+ export declare type CamelToSnakeCaseField<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Capitalize<T> ? '_' : ''}${Lowercase<T>}${CamelToSnakeCaseField<U>}` : S;
2
+ export declare type CamelToSnakeCase<T extends {
3
+ [key: string]: any;
4
+ }> = {
5
+ [K in Extract<keyof T, string> as CamelToSnakeCaseField<K>]: T[K];
6
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './camel-to-snake';
package/tools/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./camel-to-snake"), exports);
package/widget.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * @module Класс Widget
6
6
  */
7
7
  import { DataQueryFunction_Server } from './__internal__/config';
8
- import { DataQueryMethod, Locale } from './config';
8
+ import { AllColumnsHidden, DataQueryMethod, Locale } from './config';
9
9
  import { Column, DataItem, DataOptionFilter, Filter, Sort, SortDirection, Target } from './data';
10
10
  import { Theme } from './theme';
11
11
  export declare abstract class Widget {
@@ -105,21 +105,20 @@ export interface CustomQueryFields {
105
105
  *
106
106
  * При необходимости можно дополнять интерфейс
107
107
  */
108
- declare type CustomDataRule = (AllColumnsHidden | SomeColumnsHidden) & {
108
+ export declare type CustomDataRule = (AllColumnsHidden | HiddenColumnIds | ShowColumnIds) & {
109
109
  sort?: {
110
110
  [id: number]: DataOptionSort;
111
111
  };
112
112
  };
113
- interface AllColumnsHidden {
114
- allColumnsHidden: true;
115
- }
116
- interface SomeColumnsHidden {
113
+ export interface HiddenColumnIds {
117
114
  hiddenColumnIds: number[];
118
115
  }
116
+ export interface ShowColumnIds {
117
+ showColumnIds: number[];
118
+ }
119
119
  export interface DataOptionSort {
120
120
  column_id: number;
121
121
  direction?: SortDirection;
122
122
  agg_fn?: DataQueryFunction_Server;
123
123
  path?: string;
124
124
  }
125
- export {};