@synergy-client/types 0.1.1 → 0.1.4

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type ViewType = 'list' | 'detail' | 'other' | 'worker' | 'static' | 'select' | 'component' | 'print';
2
- export type ItemType = 'objectField' | 'field' | 'advancedComponent' | 'dynamic' | 'tabs' | 'tab' | 'radio' | 'file' | 'img' | 'text' | 'dynamicList' | 'dynamicTable' | 'group' | 'card' | 'progress' | 'calendar' | 'link' | 'button' | 'tablePart';
2
+ export type ItemType = 'objectField' | 'field' | 'advancedComponent' | 'dynamic' | 'tabs' | 'tab' | 'radio' | 'file' | 'img' | 'text' | 'dynamicList' | 'dynamicTable' | 'group' | 'card' | 'progress' | 'calendar' | 'link' | 'button' | 'tablePart' | 'tableField' | 'select' | 'viewList';
3
3
  export type FieldType = 'object' | 'text' | 'number' | 'enum' | 'boolean' | 'date' | 'datetime' | 'time' | 'textarea';
4
4
  export type ToolbarPosition = 'top' | 'bottom' | 'none';
5
5
  export type ToolbarButtonsPosition = 'left' | 'right' | 'middle' | 'none';
@@ -24,7 +24,7 @@ export interface ViewItem {
24
24
  valueTypes?: any;
25
25
  selectView?: any;
26
26
  viewAttribute: boolean;
27
- ref: null | string;
27
+ ref: string | string[] | null;
28
28
  required: boolean;
29
29
  visible: boolean;
30
30
  translate: boolean;
@@ -36,8 +36,10 @@ export interface ViewItem {
36
36
  itemOffset: number;
37
37
  dataType: 'string' | 'integer' | 'decimal' | 'date' | 'enum';
38
38
  dateType: 'date' | 'datetime' | 'time';
39
- detailView: null;
39
+ detailView: any;
40
40
  disabled: boolean;
41
+ /** Render slot key (for slot-based group items). */
42
+ slot?: string;
41
43
  options?: any;
42
44
  format: string | null;
43
45
  filter?: any;
@@ -86,6 +88,28 @@ export interface ViewItem {
86
88
  textVariant?: any;
87
89
  bgVariant?: any;
88
90
  attrs: any;
91
+ /** Server function name invoked on select. */
92
+ onSelect?: string | null;
93
+ /** Detail-view route path for reference fields. */
94
+ detailPath?: string | null;
95
+ /** Referenced component id (for advancedComponent items). */
96
+ componentId?: string;
97
+ selectType?: string;
98
+ /** Render key. */
99
+ key?: string;
100
+ /** Dynamic-parameter payload (advanced components). */
101
+ parameter?: any;
102
+ parameterId?: string;
103
+ /** Totals row config (list/table parts). */
104
+ isTotal?: boolean;
105
+ totalFunc?: string | null;
106
+ totalExp?: string | null;
107
+ valueString?: any;
108
+ valueNumber?: any;
109
+ valueBoolean?: any;
110
+ valueDate?: any;
111
+ valueObject?: any;
112
+ valueRef?: any;
89
113
  /** Nested items (for groups/tables). */
90
114
  items?: ViewItem[];
91
115
  }
@@ -174,6 +198,10 @@ export interface ToolbarItem {
174
198
  tooltip?: string;
175
199
  type?: string;
176
200
  click?: Function;
201
+ /** Server function name invoked on click (resolved via serverFunc). */
202
+ onClick?: string;
203
+ /** i18n overrides (lang.title[langCode], ...). */
204
+ lang?: any;
177
205
  items?: ToolbarItem[];
178
206
  }
179
207
  export interface Toolbar {
@@ -222,6 +250,18 @@ export interface Router {
222
250
  forward(): void;
223
251
  go(delta: number): void;
224
252
  }
253
+ /** onCreate / onMount / afterConfirm / afterMarkedToDelete / afterDelete / onBeforeDestroy. */
254
+ export type ModuleHook = () => void | Promise<void>;
255
+ /** beforeWrite / beforeConfirm / beforeMarkedToDelete / beforeDelete — set params.cancel to abort. */
256
+ export type CancelableHook = (params: {
257
+ cancel: boolean;
258
+ }) => void | Promise<void>;
259
+ /** afterWrite — receives { close } (optional; also called with no args). */
260
+ export type AfterWriteHook = (options?: {
261
+ close?: boolean;
262
+ }) => void | Promise<void>;
263
+ /** setCustomStage — override the business-process stage. */
264
+ export type SetCustomStageHook = (process: any) => any | Promise<any>;
225
265
  /** Entity data store (useStore('object'), or a view's `store`). */
226
266
  export interface Store {
227
267
  findByPk(payload?: any): Promise<any>;
@@ -241,3 +281,44 @@ export interface Store {
241
281
  objectMeta: any;
242
282
  };
243
283
  }
284
+ /** Control object passed to cancelable client `before*` hooks. Set `cancel` to abort the request. */
285
+ export interface CancelParams {
286
+ cancel: boolean;
287
+ message?: string;
288
+ }
289
+ /**
290
+ * `this` inside an object client-module EVENT hook (`events.*`).
291
+ * The module receives no injected globals — the environment is reached through
292
+ * these `$`-prefixed helpers on `this`.
293
+ */
294
+ export interface ObjectModuleContext {
295
+ /** HTTP client (axios instance), e.g. `this.$axios.get('/products')`. */
296
+ $axios: any;
297
+ /** Get another object's data store by name. */
298
+ $useStore(name: string): Store;
299
+ /** i18n translation. */
300
+ $t(key: string, ...args: any[]): string;
301
+ /** Moment.js date helper. */
302
+ $moment(input?: any): any;
303
+ /** Lodash utilities. */
304
+ $lodash: any;
305
+ /** This object's views (ObjectView / ListView state). */
306
+ views: any[];
307
+ /** This object's metadata (blank-record template, fields). */
308
+ objectMeta: any;
309
+ /** Module actions merged into the store. */
310
+ actions: Record<string, (...args: any[]) => any>;
311
+ /** Module helper functions (`this.functions.x`). */
312
+ functions: Record<string, (...args: any[]) => any>;
313
+ /** Module getters. */
314
+ getters: Record<string, any>;
315
+ }
316
+ /**
317
+ * `this` inside an object client-module ACTION (`actions.*`) — the entity store
318
+ * (all store methods + `views` / `objectMeta`). Overriding an action fully
319
+ * replaces the built-in one (its `before*`/`after*` hooks are bypassed).
320
+ */
321
+ export interface ObjectModuleActionThis extends Store {
322
+ views: any[];
323
+ objectMeta: any;
324
+ }
@@ -1 +1 @@
1
- export const moduleApiDts = "type ViewType = 'list' | 'detail' | 'other' | 'worker' | 'static' | 'select' | 'component' | 'print';\ntype ItemType = 'objectField' | 'field' | 'advancedComponent' | 'dynamic' | 'tabs' | 'tab' | 'radio' | 'file' | 'img' | 'text' | 'dynamicList' | 'dynamicTable' | 'group' | 'card' | 'progress' | 'calendar' | 'link' | 'button' | 'tablePart';\ntype FieldType = 'object' | 'text' | 'number' | 'enum' | 'boolean' | 'date' | 'datetime' | 'time' | 'textarea';\ntype ToolbarPosition = 'top' | 'bottom' | 'none';\ntype ToolbarButtonsPosition = 'left' | 'right' | 'middle' | 'none';\n/** A form element (field, group, table, button, ...). */\ninterface ViewItem {\n id: string;\n type: ItemType;\n name: string;\n label: string;\n labelPosition: 'left' | 'top' | 'none';\n groupType?: 'toolbar' | 'collapsible';\n tagName?: string;\n tagRef?: any;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n fieldPath: string;\n fieldTypePath?: string;\n dataLinked?: boolean;\n dataPath?: string;\n defaultValue?: any;\n fieldType: FieldType;\n valueTypes?: any;\n selectView?: any;\n viewAttribute: boolean;\n ref: null | string;\n required: boolean;\n visible: boolean;\n translate: boolean;\n newRow: boolean;\n noGreed?: boolean;\n fieldCols: number;\n labelCols: number;\n contentCols: number | null;\n itemOffset: number;\n dataType: 'string' | 'integer' | 'decimal' | 'date' | 'enum';\n dateType: 'date' | 'datetime' | 'time';\n detailView: null;\n disabled: boolean;\n options?: any;\n format: string | null;\n filter?: any;\n filters?: any;\n lang: any;\n switch?: boolean;\n maxLength: string | null;\n numberPrecision: string | null;\n numberScale: string | null;\n onChange: string | null;\n placeholder: string | null;\n component?: any;\n icon: string;\n tooltip?: any;\n classes: string | null;\n styles: string | null;\n inputClasses: string | null;\n inputStyles: string | null;\n browseText?: any;\n accept?: any;\n noDrop?: boolean;\n multiple?: boolean;\n appObjectId?: any;\n showTotals?: boolean;\n disableSorting?: boolean;\n disableRowset?: boolean;\n hideToolbar?: boolean;\n hideActions?: boolean;\n usePagination?: boolean;\n rowsLimit?: number;\n maxHeight?: number;\n selectBtn?: boolean;\n openBtn?: boolean;\n addBtn?: boolean;\n hyperLink?: boolean;\n beforeSelect?: any;\n maxRows?: number;\n rowsCount?: number;\n variant?: string;\n pill?: boolean;\n squared?: boolean;\n block?: boolean;\n toggleGroup?: any;\n itemIcon?: any;\n max?: any;\n textVariant?: any;\n bgVariant?: any;\n attrs: any;\n /** Nested items (for groups/tables). */\n items?: ViewItem[];\n}\n/** A view attribute (form-level field, not bound to the object). */\ninterface ViewAttribute {\n id: string;\n title: string;\n name: string;\n type: 'field' | 'tableField' | 'dynamicTable' | null;\n dataType: string | null;\n standard?: boolean;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n typeOptions?: any;\n dateType: string;\n defaultValue?: any;\n format: string | null;\n ref: string | string[] | null;\n lang?: any;\n tableName?: string | null;\n childs: ViewAttribute[];\n}\ninterface ViewAttributeTreeItem extends Omit<ViewAttribute, 'id' | 'childs'> {\n attrId: string;\n path: string;\n fullName: string;\n fullPath: string;\n fullTitle: string;\n expanded?: boolean;\n viewAttribute?: boolean;\n dependent: boolean;\n childs: ViewAttributeTreeItem[];\n}\n/** A field of an app object (catalog/document/register). */\ninterface ObjectField {\n id: string;\n name: string;\n title: string;\n ref: string | string[] | null;\n lang: any;\n type: string | null;\n filter: string | null;\n format: string | null;\n leadingAlias: any;\n primaryKey: boolean;\n leading: boolean;\n decryptable: boolean;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n defaultValue: any;\n standard?: any;\n dbName: string;\n dateType: string;\n notNull: boolean;\n autoIncrement: boolean;\n unique: boolean;\n index: boolean;\n password: boolean;\n isTablePart: boolean;\n model?: string;\n role: string | null;\n fullSearch: boolean;\n fullName?: string;\n typeOptions: any;\n virtual: boolean;\n comment: string | null;\n confidential?: boolean;\n confidentialRoleId?: string | null;\n fields?: ObjectField[];\n get: any;\n set: any;\n}\n/** A toolbar button/group. */\ninterface ToolbarItem {\n id: string;\n title: string;\n icon?: string | null;\n presentation: string;\n variant: string;\n size: string;\n disabled: boolean;\n visible: boolean;\n systemDisabled: boolean;\n systemVisible: boolean;\n hidden: boolean;\n tooltip?: string;\n type?: string;\n click?: Function;\n items?: ToolbarItem[];\n}\ninterface Toolbar {\n position: ToolbarPosition;\n buttonsPosition: ToolbarButtonsPosition;\n classes: string | null;\n styles: string | null;\n items: ToolbarItem[];\n staticItems: ToolbarItem[];\n commonCommands: ToolbarItem[];\n}\ninterface SortBy {\n key: string;\n order?: 'asc' | 'desc' | string;\n sortByOrig?: any;\n}\n/** List/table view data (list and select forms). */\ninterface ListViewTable {\n items: any[];\n fields: any[];\n total: number;\n page: number;\n limit: number;\n filters: Record<string, any>;\n sort: SortBy[];\n folders: {\n items: any[];\n expanded: any[];\n };\n}\n/** Current route (vue-router). */\ninterface Route {\n path: string;\n fullPath: string;\n name?: string | symbol | null;\n params: Record<string, any>;\n query: Record<string, any>;\n hash: string;\n meta: Record<string, any>;\n}\n/** Router instance (vue-router). */\ninterface Router {\n push(to: any): Promise<any>;\n replace(to: any): Promise<any>;\n back(): void;\n forward(): void;\n go(delta: number): void;\n}\n/** Entity data store (useStore('object'), or a view's `store`). */\ninterface Store {\n findByPk(payload?: any): Promise<any>;\n findAll(payload?: any): Promise<any>;\n count(payload?: any): Promise<number>;\n create(payload?: any): Promise<any>;\n createItem(payload?: any): Promise<any>;\n update(payload?: any): Promise<any>;\n updateItem(payload?: any): Promise<any>;\n delete(payload?: any): Promise<any>;\n deleteItem(payload?: any): Promise<any>;\n addNewItem(payload?: any): Promise<any>;\n changeDeletionMark(payload?: any): Promise<any>;\n getView(): {\n object: any;\n attrs: any;\n objectMeta: any;\n };\n}";
1
+ export const moduleApiDts = "type ViewType = 'list' | 'detail' | 'other' | 'worker' | 'static' | 'select' | 'component' | 'print';\ntype ItemType = 'objectField' | 'field' | 'advancedComponent' | 'dynamic' | 'tabs' | 'tab' | 'radio' | 'file' | 'img' | 'text' | 'dynamicList' | 'dynamicTable' | 'group' | 'card' | 'progress' | 'calendar' | 'link' | 'button' | 'tablePart' | 'tableField' | 'select' | 'viewList';\ntype FieldType = 'object' | 'text' | 'number' | 'enum' | 'boolean' | 'date' | 'datetime' | 'time' | 'textarea';\ntype ToolbarPosition = 'top' | 'bottom' | 'none';\ntype ToolbarButtonsPosition = 'left' | 'right' | 'middle' | 'none';\n/** A form element (field, group, table, button, ...). */\ninterface ViewItem {\n id: string;\n type: ItemType;\n name: string;\n label: string;\n labelPosition: 'left' | 'top' | 'none';\n groupType?: 'toolbar' | 'collapsible';\n tagName?: string;\n tagRef?: any;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n fieldPath: string;\n fieldTypePath?: string;\n dataLinked?: boolean;\n dataPath?: string;\n defaultValue?: any;\n fieldType: FieldType;\n valueTypes?: any;\n selectView?: any;\n viewAttribute: boolean;\n ref: string | string[] | null;\n required: boolean;\n visible: boolean;\n translate: boolean;\n newRow: boolean;\n noGreed?: boolean;\n fieldCols: number;\n labelCols: number;\n contentCols: number | null;\n itemOffset: number;\n dataType: 'string' | 'integer' | 'decimal' | 'date' | 'enum';\n dateType: 'date' | 'datetime' | 'time';\n detailView: any;\n disabled: boolean;\n /** Render slot key (for slot-based group items). */\n slot?: string;\n options?: any;\n format: string | null;\n filter?: any;\n filters?: any;\n lang: any;\n switch?: boolean;\n maxLength: string | null;\n numberPrecision: string | null;\n numberScale: string | null;\n onChange: string | null;\n placeholder: string | null;\n component?: any;\n icon: string;\n tooltip?: any;\n classes: string | null;\n styles: string | null;\n inputClasses: string | null;\n inputStyles: string | null;\n browseText?: any;\n accept?: any;\n noDrop?: boolean;\n multiple?: boolean;\n appObjectId?: any;\n showTotals?: boolean;\n disableSorting?: boolean;\n disableRowset?: boolean;\n hideToolbar?: boolean;\n hideActions?: boolean;\n usePagination?: boolean;\n rowsLimit?: number;\n maxHeight?: number;\n selectBtn?: boolean;\n openBtn?: boolean;\n addBtn?: boolean;\n hyperLink?: boolean;\n beforeSelect?: any;\n maxRows?: number;\n rowsCount?: number;\n variant?: string;\n pill?: boolean;\n squared?: boolean;\n block?: boolean;\n toggleGroup?: any;\n itemIcon?: any;\n max?: any;\n textVariant?: any;\n bgVariant?: any;\n attrs: any;\n /** Server function name invoked on select. */\n onSelect?: string | null;\n /** Detail-view route path for reference fields. */\n detailPath?: string | null;\n /** Referenced component id (for advancedComponent items). */\n componentId?: string;\n selectType?: string;\n /** Render key. */\n key?: string;\n /** Dynamic-parameter payload (advanced components). */\n parameter?: any;\n parameterId?: string;\n /** Totals row config (list/table parts). */\n isTotal?: boolean;\n totalFunc?: string | null;\n totalExp?: string | null;\n valueString?: any;\n valueNumber?: any;\n valueBoolean?: any;\n valueDate?: any;\n valueObject?: any;\n valueRef?: any;\n /** Nested items (for groups/tables). */\n items?: ViewItem[];\n}\n/** A view attribute (form-level field, not bound to the object). */\ninterface ViewAttribute {\n id: string;\n title: string;\n name: string;\n type: 'field' | 'tableField' | 'dynamicTable' | null;\n dataType: string | null;\n standard?: boolean;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n typeOptions?: any;\n dateType: string;\n defaultValue?: any;\n format: string | null;\n ref: string | string[] | null;\n lang?: any;\n tableName?: string | null;\n childs: ViewAttribute[];\n}\ninterface ViewAttributeTreeItem extends Omit<ViewAttribute, 'id' | 'childs'> {\n attrId: string;\n path: string;\n fullName: string;\n fullPath: string;\n fullTitle: string;\n expanded?: boolean;\n viewAttribute?: boolean;\n dependent: boolean;\n childs: ViewAttributeTreeItem[];\n}\n/** A field of an app object (catalog/document/register). */\ninterface ObjectField {\n id: string;\n name: string;\n title: string;\n ref: string | string[] | null;\n lang: any;\n type: string | null;\n filter: string | null;\n format: string | null;\n leadingAlias: any;\n primaryKey: boolean;\n leading: boolean;\n decryptable: boolean;\n multiType: boolean;\n multiTypeVariant: 'common' | 'objects';\n defaultValue: any;\n standard?: any;\n dbName: string;\n dateType: string;\n notNull: boolean;\n autoIncrement: boolean;\n unique: boolean;\n index: boolean;\n password: boolean;\n isTablePart: boolean;\n model?: string;\n role: string | null;\n fullSearch: boolean;\n fullName?: string;\n typeOptions: any;\n virtual: boolean;\n comment: string | null;\n confidential?: boolean;\n confidentialRoleId?: string | null;\n fields?: ObjectField[];\n get: any;\n set: any;\n}\n/** A toolbar button/group. */\ninterface ToolbarItem {\n id: string;\n title: string;\n icon?: string | null;\n presentation: string;\n variant: string;\n size: string;\n disabled: boolean;\n visible: boolean;\n systemDisabled: boolean;\n systemVisible: boolean;\n hidden: boolean;\n tooltip?: string;\n type?: string;\n click?: Function;\n /** Server function name invoked on click (resolved via serverFunc). */\n onClick?: string;\n /** i18n overrides (lang.title[langCode], ...). */\n lang?: any;\n items?: ToolbarItem[];\n}\ninterface Toolbar {\n position: ToolbarPosition;\n buttonsPosition: ToolbarButtonsPosition;\n classes: string | null;\n styles: string | null;\n items: ToolbarItem[];\n staticItems: ToolbarItem[];\n commonCommands: ToolbarItem[];\n}\ninterface SortBy {\n key: string;\n order?: 'asc' | 'desc' | string;\n sortByOrig?: any;\n}\n/** List/table view data (list and select forms). */\ninterface ListViewTable {\n items: any[];\n fields: any[];\n total: number;\n page: number;\n limit: number;\n filters: Record<string, any>;\n sort: SortBy[];\n folders: {\n items: any[];\n expanded: any[];\n };\n}\n/** Current route (vue-router). */\ninterface Route {\n path: string;\n fullPath: string;\n name?: string | symbol | null;\n params: Record<string, any>;\n query: Record<string, any>;\n hash: string;\n meta: Record<string, any>;\n}\n/** Router instance (vue-router). */\ninterface Router {\n push(to: any): Promise<any>;\n replace(to: any): Promise<any>;\n back(): void;\n forward(): void;\n go(delta: number): void;\n}\n/** onCreate / onMount / afterConfirm / afterMarkedToDelete / afterDelete / onBeforeDestroy. */\ntype ModuleHook = () => void | Promise<void>;\n/** beforeWrite / beforeConfirm / beforeMarkedToDelete / beforeDelete — set params.cancel to abort. */\ntype CancelableHook = (params: {\n cancel: boolean;\n}) => void | Promise<void>;\n/** afterWrite — receives { close } (optional; also called with no args). */\ntype AfterWriteHook = (options?: {\n close?: boolean;\n}) => void | Promise<void>;\n/** setCustomStage — override the business-process stage. */\ntype SetCustomStageHook = (process: any) => any | Promise<any>;\n/** Entity data store (useStore('object'), or a view's `store`). */\ninterface Store {\n findByPk(payload?: any): Promise<any>;\n findAll(payload?: any): Promise<any>;\n count(payload?: any): Promise<number>;\n create(payload?: any): Promise<any>;\n createItem(payload?: any): Promise<any>;\n update(payload?: any): Promise<any>;\n updateItem(payload?: any): Promise<any>;\n delete(payload?: any): Promise<any>;\n deleteItem(payload?: any): Promise<any>;\n addNewItem(payload?: any): Promise<any>;\n changeDeletionMark(payload?: any): Promise<any>;\n getView(): {\n object: any;\n attrs: any;\n objectMeta: any;\n };\n}\n/** Control object passed to cancelable client `before*` hooks. Set `cancel` to abort the request. */\ninterface CancelParams {\n cancel: boolean;\n message?: string;\n}\n/**\n * `this` inside an object client-module EVENT hook (`events.*`).\n * The module receives no injected globals — the environment is reached through\n * these `$`-prefixed helpers on `this`.\n */\ninterface ObjectModuleContext {\n /** HTTP client (axios instance), e.g. `this.$axios.get('/products')`. */\n $axios: any;\n /** Get another object's data store by name. */\n $useStore(name: string): Store;\n /** i18n translation. */\n $t(key: string, ...args: any[]): string;\n /** Moment.js date helper. */\n $moment(input?: any): any;\n /** Lodash utilities. */\n $lodash: any;\n /** This object's views (ObjectView / ListView state). */\n views: any[];\n /** This object's metadata (blank-record template, fields). */\n objectMeta: any;\n /** Module actions merged into the store. */\n actions: Record<string, (...args: any[]) => any>;\n /** Module helper functions (`this.functions.x`). */\n functions: Record<string, (...args: any[]) => any>;\n /** Module getters. */\n getters: Record<string, any>;\n}\n/**\n * `this` inside an object client-module ACTION (`actions.*`) — the entity store\n * (all store methods + `views` / `objectMeta`). Overriding an action fully\n * replaces the built-in one (its `before*`/`after*` hooks are bypassed).\n */\ninterface ObjectModuleActionThis extends Store {\n views: any[];\n objectMeta: any;\n}";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergy-client/types",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "Shared Synergy domain types (views, attributes, objects, store) used by the client and the configurator.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",