@researchdatabox/sails-ng-common 5.1.0-beta.12573 → 5.1.0-beta.13939
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/src/config/component/question-tree.helper.d.ts +1 -1
- package/dist/src/config/component/save-button.model.d.ts +4 -0
- package/dist/src/config/component/save-button.model.js +5 -1
- package/dist/src/config/component/save-button.outline.d.ts +6 -0
- package/dist/src/config/form-override.model.d.ts +1 -1
- package/dist/src/config/form-override.model.js +2 -2
- package/dist/src/config/visitor/base.model.d.ts +1 -1
- package/dist/src/config/visitor/common.model.d.ts +1 -1
- package/dist/src/export.model.d.ts +27 -0
- package/dist/src/export.model.js +3 -0
- package/dist/src/handlebars-helpers.d.ts +125 -4
- package/dist/src/handlebars-helpers.js +530 -34
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +3 -2
- package/dist/src/logger.model.d.ts +63 -0
- package/dist/src/logger.model.js +116 -0
- package/package.json +13 -7
- package/dist/src/logger.interface.d.ts +0 -14
- package/dist/src/logger.interface.js +0 -3
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import Handlebars from 'handlebars';
|
|
2
|
+
export declare const dateModifyOperations: readonly ["startOf", "endOf", "plus"];
|
|
3
|
+
export declare const dateModifyShiftUnits: readonly ["year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond"];
|
|
4
|
+
export declare const dateModifyPlusUnits: readonly ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"];
|
|
5
|
+
export type DateModifyOperations = (typeof dateModifyOperations)[number];
|
|
2
6
|
/**
|
|
3
7
|
* Helper function definitions that can be registered with Handlebars.
|
|
4
8
|
* Each function is a pure, deterministic helper that does not execute arbitrary code.
|
|
9
|
+
*
|
|
10
|
+
* These functions return an appropriate empty value, or the first value, when given unexpected arguments, instead of throwing an error.
|
|
11
|
+
* Templates can be edited by users, and we want to validate where the user is editing and be able to show the rendered content.
|
|
12
|
+
*
|
|
13
|
+
* All functions must allow for a handlebars options object as the last argument.
|
|
5
14
|
*/
|
|
6
15
|
export declare const handlebarsHelperDefinitions: {
|
|
7
16
|
/**
|
|
@@ -9,9 +18,11 @@ export declare const handlebarsHelperDefinitions: {
|
|
|
9
18
|
* Supports ISO date strings and JavaScript Date instances.
|
|
10
19
|
* Replaces lodash template usage like: ${ DateTime.fromISO(data.date).toFormat('dd/MM/yyyy hh:mm a') }
|
|
11
20
|
*
|
|
12
|
-
*
|
|
21
|
+
* An explicit zone changes the display zone while preserving the instant.
|
|
22
|
+
* Without a zone, existing host-zone formatting is retained.
|
|
23
|
+
* @example {{formatDate lastSaveDate "dd/MM/yyyy hh:mm a" "Australia/Sydney"}}
|
|
13
24
|
*/
|
|
14
|
-
formatDate: (dateValue: string | Date, formatOrOptions?: string | Record<string, unknown>) => string;
|
|
25
|
+
formatDate: (dateValue: string | Date, formatOrOptions?: string | Record<string, unknown>, zoneOrOptions?: string | Record<string, unknown>) => string;
|
|
15
26
|
/**
|
|
16
27
|
* Format a date value using locale-aware presets.
|
|
17
28
|
* Supports ISO date strings and JavaScript Date instances.
|
|
@@ -25,6 +36,23 @@ export declare const handlebarsHelperDefinitions: {
|
|
|
25
36
|
* @example {{parseDateString dateString}}
|
|
26
37
|
*/
|
|
27
38
|
parseDateString: (dateString: string) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Modify a date by adding the provided time units, or setting to the start or end of the given time unit.
|
|
41
|
+
* Supports ISO date strings and JavaScript Date instances.
|
|
42
|
+
*
|
|
43
|
+
* The parsed date time uses the specified offset, or 'UTC' otherwise.
|
|
44
|
+
* The date time is then converted to UTC.
|
|
45
|
+
* Use formatDate or formatDateLocale to format date for display.
|
|
46
|
+
*
|
|
47
|
+
* Returns a new date value with the described change applied.
|
|
48
|
+
* Returns the first provided argument unchanged if the call was not valid.
|
|
49
|
+
* Returns empty string if no arguments were provided.
|
|
50
|
+
* @param args The arguments to set the operation, duration units, and duration values.
|
|
51
|
+
* 1. The date value to modify or handlebars options.
|
|
52
|
+
* 2. Then the first 'plus' operation duration unit, or the operation name, or the handlebars options.
|
|
53
|
+
* 3. Then the duration unit, or duration value (allows multiple pairs), or handlebars options.
|
|
54
|
+
*/
|
|
55
|
+
dateModify: (...args: unknown[]) => string | Date | unknown;
|
|
28
56
|
/**
|
|
29
57
|
* Get a nested property from an object using dot notation.
|
|
30
58
|
* Replaces lodash template usage like: ${ _.get(data, 'metadata.contributor_ci', '') }
|
|
@@ -102,42 +130,56 @@ export declare const handlebarsHelperDefinitions: {
|
|
|
102
130
|
not: (value: unknown) => boolean;
|
|
103
131
|
/**
|
|
104
132
|
* Greater than comparison.
|
|
133
|
+
* Returns false if the comparison cannot be performed.
|
|
105
134
|
*
|
|
106
135
|
* @example {{#if (gt count 0)}}has items{{/if}}
|
|
107
136
|
*/
|
|
108
137
|
gt: (a: unknown, b: unknown) => boolean;
|
|
109
138
|
/**
|
|
110
139
|
* Greater than or equal comparison.
|
|
140
|
+
* Returns false if the comparison cannot be performed.
|
|
111
141
|
*
|
|
112
142
|
* @example {{#if (gte count 1)}}at least one{{/if}}
|
|
113
143
|
*/
|
|
114
144
|
gte: (a: unknown, b: unknown) => boolean;
|
|
115
145
|
/**
|
|
116
146
|
* Less than comparison.
|
|
147
|
+
* Returns false if the comparison cannot be performed.
|
|
117
148
|
*
|
|
118
149
|
* @example {{#if (lt count 10)}}less than ten{{/if}}
|
|
119
150
|
*/
|
|
120
151
|
lt: (a: unknown, b: unknown) => boolean;
|
|
121
152
|
/**
|
|
122
153
|
* Less than or equal comparison.
|
|
154
|
+
* Returns false if the comparison cannot be performed.
|
|
123
155
|
*
|
|
124
156
|
* @example {{#if (lte count 10)}}ten or less{{/if}}
|
|
125
157
|
*/
|
|
126
158
|
lte: (a: unknown, b: unknown) => boolean;
|
|
127
159
|
/**
|
|
128
160
|
* Trim leading/trailing whitespace from a string value.
|
|
161
|
+
* Returns input value converted to a string for non-string input.
|
|
129
162
|
*
|
|
130
163
|
* @example {{trim title}}
|
|
131
164
|
*/
|
|
132
165
|
trim: (value: unknown) => string;
|
|
166
|
+
/**
|
|
167
|
+
* Trim leading and trailing whitespace from each string item in an array.
|
|
168
|
+
* @example {{trimArray [' value ', 0]}} -> ['value', 0]
|
|
169
|
+
* @example {{trimArray {aProp: ['value']}}} -> {aProp: ['value']}
|
|
170
|
+
* @param value
|
|
171
|
+
*/
|
|
172
|
+
trimArray: (value: unknown) => string[] | unknown;
|
|
133
173
|
/**
|
|
134
174
|
* Convert a value to lowercase text.
|
|
175
|
+
* Returns input value converted to a string for non-string input.
|
|
135
176
|
*
|
|
136
177
|
* @example {{toLower value}}
|
|
137
178
|
*/
|
|
138
179
|
toLower: (value: unknown) => string;
|
|
139
180
|
/**
|
|
140
181
|
* Convert a value to uppercase text.
|
|
182
|
+
* Returns input value converted to a string for non-string input.
|
|
141
183
|
*
|
|
142
184
|
* @example {{toUpper value}}
|
|
143
185
|
*/
|
|
@@ -160,14 +202,17 @@ export declare const handlebarsHelperDefinitions: {
|
|
|
160
202
|
*/
|
|
161
203
|
join: (arr: unknown[], separator?: string) => string;
|
|
162
204
|
/**
|
|
163
|
-
* Extract
|
|
205
|
+
* Extract one or more properties from each item in an array using dot notation.
|
|
164
206
|
* Replaces lodash usage like: _.map(creators, c => c.email).
|
|
165
207
|
* Returns an empty array for non-array input. Combine with {{join}} to
|
|
166
208
|
* build a delimited string, e.g. {{join (pluck creators "email") ","}}.
|
|
167
209
|
*
|
|
210
|
+
* For one property, returns an array of the property values.
|
|
211
|
+
* For more than one property, returns an array of arrays containing the specified property values in the same order.
|
|
212
|
+
*
|
|
168
213
|
* @example {{join (pluck record.metadata.creators "email") ","}}
|
|
169
214
|
*/
|
|
170
|
-
pluck: (
|
|
215
|
+
pluck: (...args: unknown[]) => unknown[];
|
|
171
216
|
/**
|
|
172
217
|
* Return part of a string using slice semantics.
|
|
173
218
|
*
|
|
@@ -233,6 +278,82 @@ export declare const handlebarsHelperDefinitions: {
|
|
|
233
278
|
* @example {{attachmentDownloadUrl this oid branding portal}}
|
|
234
279
|
*/
|
|
235
280
|
attachmentDownloadUrl: (attachment: unknown, oid: unknown, branding: unknown, portal: unknown) => string;
|
|
281
|
+
/**
|
|
282
|
+
* Convert a value with an unknown type to an array.
|
|
283
|
+
* With one value, ensures it is an array.
|
|
284
|
+
* With more than one value, returns all values in an array.
|
|
285
|
+
* Does not flatten nested arrays.
|
|
286
|
+
*
|
|
287
|
+
* @example {{asArray ['value']}} -> ['value]
|
|
288
|
+
* @example {{asArray 'value'}} -> ['value']
|
|
289
|
+
* @example {{asArray {aProp: 'value'} null 0 ['value']}} -> [{aProp: 'value'}, null, 0, ['value']]
|
|
290
|
+
* @param args The values to get as an array.
|
|
291
|
+
*/
|
|
292
|
+
asArray: (...args: unknown[]) => unknown[];
|
|
293
|
+
/**
|
|
294
|
+
* Convert a value with an unknown type to an array.
|
|
295
|
+
* With one value, ensures it is an array.
|
|
296
|
+
* With more than one value, returns all values in an array.
|
|
297
|
+
* Flattens nested arrays to depth 1. Use multiple times to flatten deeply nested arrays.
|
|
298
|
+
*
|
|
299
|
+
* @example {{flattenArray ['value']}} -> ['value]
|
|
300
|
+
* @example {{flattenArray 'value'}} -> ['value']
|
|
301
|
+
* @example {{flattenArray {aProp: 'value'} null 0 ['value']}} -> [{aProp: 'value'}, null, 0, 'value']
|
|
302
|
+
* @example {{flattenArray {aProp: 'value'} null 0 [['value']]}} -> [{aProp: 'value'}, null, 0, ['value']]
|
|
303
|
+
* @example {{flattenArray [{aProp: 'value'} null 0 ['value']]}} -> [{aProp: 'value'}, null, 0, 'value']
|
|
304
|
+
* @param args
|
|
305
|
+
*/
|
|
306
|
+
flattenArray: (...args: unknown[]) => unknown[];
|
|
307
|
+
/**
|
|
308
|
+
* Remove undefined, null, and empty trimmed strings from an array.
|
|
309
|
+
* When provided a non-array value, returns it unchanged.
|
|
310
|
+
*
|
|
311
|
+
* @example {{filterArray ['one', ' ', undefined, null, {}]}} -> ['one', {}]
|
|
312
|
+
* @example {{filterArray undefined}} -> undefined
|
|
313
|
+
* @param value The array to filter.
|
|
314
|
+
*/
|
|
315
|
+
filterArray: (value: unknown) => unknown[] | unknown;
|
|
316
|
+
/**
|
|
317
|
+
* Build a display name from a contributor object.
|
|
318
|
+
* Returns empty string if the value is not a plain object.
|
|
319
|
+
* The provided path options will be checked in order, and the first that has a truthy value will be used.
|
|
320
|
+
* @example {{displayName {text_full_name: 'My Name'} }} -> 'My Name'
|
|
321
|
+
* @example {{displayName {given_name: 'given', family_name: 'family'} }} -> 'given family'
|
|
322
|
+
* @param value Contributor object.
|
|
323
|
+
* @param fullOrOptions Paths to use as full name.
|
|
324
|
+
* @param honorificOrOptions Paths to use as honorific.
|
|
325
|
+
* @param givenOrOptions Paths to use as given name.
|
|
326
|
+
* @param familyOrOptions Paths to use as family name.
|
|
327
|
+
*/
|
|
328
|
+
displayName: (value: unknown, fullOrOptions?: string[], honorificOrOptions?: string[], givenOrOptions?: string[], familyOrOptions?: string[]) => string;
|
|
329
|
+
/**
|
|
330
|
+
* Build a display name from a contributor object for each item in an array.
|
|
331
|
+
* Returns empty string if the value is not a plain object.
|
|
332
|
+
* The provided path options will be checked in order, and the first that has a truthy value will be used.
|
|
333
|
+
* @example {{displayNameArray [{text_full_name: 'My Name'}] }} -> ['My Name']
|
|
334
|
+
* @example {{displayNameArray [{given_name: 'given', family_name: 'family'}] }} -> ['given family']
|
|
335
|
+
* @param value Array of contributor objects.
|
|
336
|
+
* @param fullOrOptions Paths to use as full name.
|
|
337
|
+
* @param honorificOrOptions Paths to use as honorific.
|
|
338
|
+
* @param givenOrOptions Paths to use as given name.
|
|
339
|
+
* @param familyOrOptions Paths to use as family name.
|
|
340
|
+
*/
|
|
341
|
+
displayNameArray: (value: unknown, fullOrOptions?: string[], honorificOrOptions?: string[], givenOrOptions?: string[], familyOrOptions?: string[]) => string[] | unknown;
|
|
342
|
+
/**
|
|
343
|
+
* Create a new array with items case-insensitive sorted order.
|
|
344
|
+
* A non-array argument is returned without changes.
|
|
345
|
+
* @example {{sort ['value2', 'value1']}} -> ['value1', 'value2']
|
|
346
|
+
* @example {{sort {text_full_name: 'My Name'} }} -> {text_full_name: 'My Name'}
|
|
347
|
+
* @param value
|
|
348
|
+
*/
|
|
349
|
+
sort: (value: unknown) => any[] | unknown;
|
|
350
|
+
/**
|
|
351
|
+
* Remove duplicate strings from an array.
|
|
352
|
+
* Non-string duplicate entries are kept.
|
|
353
|
+
* A non-array is returned without changes.
|
|
354
|
+
* @param value
|
|
355
|
+
*/
|
|
356
|
+
unique: (value: unknown) => string[] | unknown;
|
|
236
357
|
};
|
|
237
358
|
/**
|
|
238
359
|
* Register Handlebars helpers for use in dashboard and report templates.
|