@vuu-ui/vuu-data-types 0.8.91 → 0.8.92

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.
Files changed (2) hide show
  1. package/index.d.ts +107 -0
  2. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -31,6 +31,113 @@ import type {
31
31
  TypeAheadMethod,
32
32
  VuuRange,
33
33
  } from "@vuu-ui/vuu-protocol-types";
34
+ import { DataValueTypeDescriptor } from "@vuu-ui/vuu-table-types";
35
+
36
+ export declare type DataValueValidationSuccessResult = {
37
+ ok: true;
38
+ };
39
+ export declare type DataValueValidationFailResult = {
40
+ ok: false;
41
+ messages: string[];
42
+ };
43
+ export declare type DataValueValidationResult =
44
+ | DataValueValidationSuccessResult
45
+ | DataValueValidationFailResult;
46
+
47
+ export declare type DataValueValidationChecker = (
48
+ value?: VuuRowDataItemType,
49
+ ) => DataValueValidationResult;
50
+
51
+ export declare type EditRuleValidationSuccessResult = {
52
+ ok: true;
53
+ };
54
+
55
+ export declare type EditRuleValidationFailResult = {
56
+ ok: false;
57
+ message: string;
58
+ };
59
+
60
+ export declare type EditRuleValidationResult =
61
+ | EditRuleValidationSuccessResult
62
+ | EditRuleValidationFailResult;
63
+
64
+ /**
65
+ * EditRuleValidator is a function registered with component registry. It can then
66
+ * be referenced in editRules applied to table columns or form fields.
67
+ *
68
+ * @returns value to indicate whether validation rule passed:
69
+ * - true value passes validation
70
+ * - false value fails validation
71
+ * - string value fails validation, this message described failure
72
+ */
73
+ export declare type EditRuleValidator = (
74
+ editRule: EditValidationRule,
75
+ value?: VuuRowDataItemType,
76
+ ) => EditRuleValidationResult;
77
+
78
+ /**
79
+ * Edit validation functions (EditRuleValidator) must be registered with the component registry.
80
+ * They can then be referenced by name from EditValidationRule(s)
81
+ */
82
+ export interface EditValidationRule {
83
+ /**
84
+ * when is the rule applied
85
+ * - 'commit' - when suer commits change, e.g. by pressent ENTER (on an input), or TAB
86
+ * - 'change' - for a text input, on every keystroke
87
+ * */
88
+ apply?: "commit" | "change";
89
+ name: string;
90
+ message?: string;
91
+ value?: string;
92
+ }
93
+
94
+ export declare type DataValueTypeSimple =
95
+ | "string"
96
+ | "number"
97
+ | "boolean"
98
+ | "json"
99
+ | DateTimeDataValueTypeSimple
100
+ | "checkbox";
101
+
102
+ export declare type DataValueType =
103
+ | DataValueTypeSimple
104
+ | DataValueTypeDescriptor;
105
+
106
+ export declare type DateTimeDataValueTypeSimple = "date/time";
107
+
108
+ export declare type DateTimeDataValueType =
109
+ | DateTimeColumnTypeSimple
110
+ | (Omit<DataValueTypeDescriptor, "name"> & {
111
+ name: DateTimeColumnTypeSimple;
112
+ });
113
+
114
+ export declare type BulkEdit = "bulk" | false | "read-only";
115
+
116
+ export interface DataValueDescriptor {
117
+ editable?: boolean;
118
+ /**
119
+ There are three values for editableBulk.
120
+ - false user will not see these values when applying a bulk edit.
121
+ - "bulk" user can edit these values when applying a bulk edit.
122
+ - "read-only" user will see these values when applying a bulk edit, but not be allowed to edit them.
123
+ */
124
+ editableBulk?: BulkEdit;
125
+ /** Display label for form fields, table column headings etc. */
126
+ label?: string;
127
+ /** unique name for this data value */
128
+ name: string;
129
+ /** The type defined on server for this data value */
130
+ serverDataType?: VuuColumnDataType;
131
+ /** Type hints for the UI that supplement the serverDataType */
132
+ type?: DataValueType;
133
+ }
134
+
135
+ export declare type DateTimeDataValueDescriptor = Omit<
136
+ DataValueDescriptor,
137
+ "type"
138
+ > & {
139
+ type: DateTimeDataValueType;
140
+ };
34
141
 
35
142
  export interface DataSourceFilter extends VuuFilter {
36
143
  filterStruct?: Filter;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-data-types",
3
- "version": "0.8.91",
3
+ "version": "0.8.92",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-filter-types": "0.8.91",
8
- "@vuu-ui/vuu-protocol-types": "0.8.91"
7
+ "@vuu-ui/vuu-filter-types": "0.8.92",
8
+ "@vuu-ui/vuu-protocol-types": "0.8.92"
9
9
  },
10
10
  "dependencies": {},
11
11
  "peerDependencies": {},