@evoke-platform/context 1.0.0-dev.91 → 1.0.0-dev.93

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
@@ -337,7 +337,7 @@ const callback = (changes: DocumentChange[]) => {
337
337
  console.log(changes);
338
338
  };
339
339
 
340
- documentChanges.subscribe('myObjectId' , 'myInstanceId', callback);
340
+ documentChanges.subscribe('myObjectId', 'myInstanceId', callback);
341
341
 
342
342
  documentChanges.unsubscribe('myObjectId', 'myInstanceId', callback);
343
343
  ```
@@ -4,32 +4,95 @@ export type BaseObjReference = {
4
4
  objectId: string;
5
5
  discriminatorValue: unknown;
6
6
  };
7
+ export type ViewLayout = {
8
+ table?: TableViewLayout;
9
+ dropdown?: DropdownViewLayout;
10
+ };
11
+ export type DropdownViewLayout = {
12
+ secondaryTextExpression: string;
13
+ };
14
+ export type TableViewLayout = {
15
+ properties: PropertyReference[];
16
+ sort?: Sort;
17
+ };
18
+ export type PropertyReference = {
19
+ id: string;
20
+ format?: string;
21
+ };
22
+ export type Sort = {
23
+ colId: string;
24
+ sort?: 'asc' | 'desc';
25
+ };
7
26
  export type Obj = {
8
27
  id: string;
9
28
  name: string;
10
29
  typeDiscriminatorProperty?: string;
30
+ viewLayout?: ViewLayout;
11
31
  baseObject?: BaseObjReference;
12
32
  properties?: Property[];
13
33
  actions?: Action[];
14
34
  };
15
- export type PropertyType = 'address' | 'array' | 'boolean' | 'collection' | 'date' | 'date-time' | 'image' | 'integer' | 'number' | 'object' | 'string' | 'time';
35
+ export type PropertyType = 'address' | 'array' | 'boolean' | 'collection' | 'date' | 'date-time' | 'image' | 'integer' | 'number' | 'object' | 'richText' | 'string' | 'time' | 'user';
36
+ export type NumericValidation = {
37
+ errorMessage?: string;
38
+ minimum?: number;
39
+ maximum?: number;
40
+ };
41
+ export type DateValidation = {
42
+ errorMessage?: string;
43
+ to?: string;
44
+ from?: string;
45
+ };
46
+ export type CriteriaValidation = {
47
+ criteria?: Record<string, unknown>;
48
+ };
49
+ export type StringValidation = {
50
+ operator: 'any' | 'all';
51
+ rules?: {
52
+ regex: string;
53
+ errorMessage?: string;
54
+ }[];
55
+ };
56
+ export type PropertyValidation = StringValidation | NumericValidation | DateValidation | CriteriaValidation;
16
57
  export type Property = {
17
58
  id: string;
18
59
  name: string;
19
60
  type: PropertyType;
20
61
  enum?: string[];
21
62
  objectId?: string;
63
+ relatedPropertyId?: string;
22
64
  required?: boolean;
23
65
  searchable?: boolean;
24
66
  formula?: string;
67
+ formulaType?: 'aggregate' | 'custom' | 'arithmetic';
68
+ mask?: string;
69
+ validation?: PropertyValidation;
70
+ manyToManyPropertyId?: string;
71
+ textTransform?: 'titleCase' | 'upperCase' | 'lowerCase' | 'sentenceCase';
25
72
  };
26
73
  export type ActionType = 'create' | 'update' | 'delete';
74
+ export type InputStringValidation = StringValidation & {
75
+ minLength?: number;
76
+ maxLength?: number;
77
+ mask?: string;
78
+ };
79
+ export type InputParameter = {
80
+ id: string;
81
+ type: PropertyType;
82
+ required?: boolean;
83
+ enum?: string[];
84
+ validation?: PropertyValidation | InputStringValidation;
85
+ };
27
86
  export type Action = {
28
87
  id: string;
29
88
  name: string;
30
89
  type: ActionType;
31
90
  outputEvent: string;
32
91
  inputProperties?: ActionInput[];
92
+ parameters?: InputParameter[];
93
+ form?: Form;
94
+ customCode?: string;
95
+ preconditions?: object;
33
96
  };
34
97
  export type ObjectInstance = {
35
98
  id: string;
@@ -45,38 +108,149 @@ export type SelectOption = {
45
108
  label: string;
46
109
  value: string;
47
110
  };
111
+ export type VisibilityConfiguration = {
112
+ operator?: 'any' | 'all';
113
+ conditions?: {
114
+ property: string;
115
+ operator: 'eq' | 'neq';
116
+ value: string | number | boolean;
117
+ }[];
118
+ };
119
+ export type RelatedObjectDefaultValue = {
120
+ criteria: Record<string, unknown>;
121
+ sortBy?: string;
122
+ orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC';
123
+ };
124
+ export type DisplayConfiguration = {
125
+ label?: string;
126
+ placeholder?: string;
127
+ required?: boolean;
128
+ description?: string;
129
+ defaultValue?: string | number | string[] | RelatedObjectDefaultValue;
130
+ readOnly?: boolean;
131
+ tooltip?: string;
132
+ prefix?: string;
133
+ suffix?: string;
134
+ placeholderChar?: string;
135
+ rowCount?: number;
136
+ charCount?: boolean;
137
+ mode?: 'default' | 'existingOnly';
138
+ relatedObjectDisplay?: 'dropdown' | 'dialogBox';
139
+ visibility?: VisibilityConfiguration | string;
140
+ };
141
+ export type InputParameterReference = {
142
+ type: 'input';
143
+ parameterId: string;
144
+ display?: DisplayConfiguration;
145
+ enumWithLabels?: SelectOption[];
146
+ };
147
+ export type Content = {
148
+ type: 'content';
149
+ html: string;
150
+ visibility?: VisibilityConfiguration | string;
151
+ };
152
+ export type Column = {
153
+ width: number;
154
+ entries?: FormEntry[];
155
+ };
156
+ export type Columns = {
157
+ type: 'columns';
158
+ columns: Column[];
159
+ visibility?: VisibilityConfiguration | string;
160
+ };
161
+ export type Section = {
162
+ label: string;
163
+ entries?: FormEntry[];
164
+ };
165
+ export type Sections = {
166
+ type: 'sections';
167
+ sections: Section[];
168
+ visibility?: VisibilityConfiguration | string;
169
+ };
170
+ export type FormEntry = InputParameterReference | Columns | Sections | Content;
171
+ export type Form = {
172
+ entries?: FormEntry[];
173
+ };
174
+ export type ActionInputType = 'button' | 'Section' | 'Columns' | 'Content' | 'Select' | 'TextField' | 'DateTime' | 'RepeatableField' | 'MultiSelect' | 'Decimal' | 'RichText' | 'Date' | 'Integer' | 'Image' | 'Object' | 'Time' | 'User';
48
175
  /**
49
176
  * Represents an object action inputProperty object.
50
177
  */
51
178
  export type ActionInput = {
52
- label: string;
53
- type: string;
54
- key: string;
55
- initialValue?: unknown;
179
+ id?: string;
180
+ label?: string;
181
+ type?: ActionInputType;
182
+ key?: string;
183
+ initialValue?: string | number | SelectOption[] | SelectOption;
184
+ defaultToCurrentDate?: boolean;
185
+ defaultToCurrentTime?: boolean;
186
+ defaultValueCriteria?: object;
187
+ sortBy?: string;
188
+ orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC';
189
+ html?: string;
190
+ labelPosition?: string;
56
191
  placeholder?: string;
57
192
  description?: string;
58
193
  tooltip?: string;
59
194
  prefix?: string;
60
195
  suffix?: string;
61
- showCharCount?: boolean;
62
- readOnly?: boolean;
63
- isMultiLineText?: boolean;
64
196
  data?: {
65
197
  /**
66
198
  * An array of values required for select options.
67
199
  */
68
200
  values?: SelectOption[];
69
201
  };
202
+ inputMask?: string;
203
+ inputMaskPlaceholderChar?: string;
204
+ tableView?: boolean;
205
+ mode?: 'default' | 'existingOnly';
206
+ displayOption?: 'dropdown' | 'dialogBox';
207
+ rows?: number;
208
+ showCharCount?: boolean;
209
+ readOnly?: boolean;
210
+ isMultiLineText?: boolean;
211
+ verticalLayout?: boolean;
212
+ input?: boolean;
213
+ widget?: string;
214
+ conditional?: {
215
+ json?: string;
216
+ show?: boolean;
217
+ when?: string;
218
+ eq?: string | number;
219
+ };
220
+ property?: {
221
+ id: string;
222
+ };
70
223
  validate?: {
71
224
  required?: boolean;
225
+ criteria?: object;
72
226
  operator?: 'any' | 'all';
73
227
  regexes?: RegexValidation[];
228
+ minLength?: number;
229
+ maxLength?: number;
230
+ minDate?: string;
231
+ maxDate?: string;
232
+ minTime?: string;
233
+ maxTime?: string;
234
+ min?: number;
235
+ max?: number;
236
+ customMessage?: string;
74
237
  };
75
238
  /**
76
239
  * An array of sub-components to be rendered inside sections.
77
240
  */
78
- components?: ActionInput[];
79
- [key: string]: unknown;
241
+ components?: {
242
+ key: string;
243
+ label?: string;
244
+ components: ActionInput[];
245
+ }[];
246
+ /**
247
+ * An array of sub-components to be rendered inside columns.
248
+ */
249
+ columns?: {
250
+ width: number;
251
+ currentWidth?: number;
252
+ components: ActionInput[];
253
+ }[];
80
254
  };
81
255
  export type ActionRequest = {
82
256
  actionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/context",
3
- "version": "1.0.0-dev.91",
3
+ "version": "1.0.0-dev.93",
4
4
  "description": "Utilities that provide context to Evoke platform widgets",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",