@formio/js 5.1.0-dev.6094.c49181e → 5.1.0-dev.6102.8eddaab
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/formio.form.js +84 -117
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +90 -123
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +33 -44
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +44 -66
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Element.js +13 -36
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -5
- package/lib/cjs/Webform.js +5 -6
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +22 -9
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.js +29 -53
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +6 -6
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +4 -4
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/datagrid/DataGrid.js +1 -1
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -1
- package/lib/cjs/components/datamap/DataMap.js +4 -4
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +13 -15
- package/lib/cjs/components/day/Day.js +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +1 -1
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/file/File.js +1 -1
- package/lib/cjs/components/form/Form.js +1 -1
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +7 -30
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/formio.form.js +3 -3
- package/lib/cjs/i18n.js +1 -1
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/cjs/utils/Evaluator.d.ts +13 -6
- package/lib/cjs/utils/Evaluator.js +27 -15
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/i18n.js +3 -3
- package/lib/cjs/utils/index.d.ts +160 -2
- package/lib/cjs/utils/index.js +12 -2
- package/lib/cjs/utils/utils.d.ts +28 -23
- package/lib/cjs/utils/utils.js +91 -89
- package/lib/cjs/widgets/CalendarWidget.d.ts +7 -0
- package/lib/cjs/widgets/CalendarWidget.js +37 -13
- package/lib/mjs/Element.js +6 -6
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.js +1 -2
- package/lib/mjs/Webform.js +3 -4
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +14 -2
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.js +2 -3
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +6 -6
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/datagrid/DataGrid.js +1 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +13 -15
- package/lib/mjs/components/day/Day.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/file/File.js +1 -1
- package/lib/mjs/components/form/Form.js +1 -1
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +1 -1
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/formio.form.js +2 -2
- package/lib/mjs/i18n.js +1 -1
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
- package/lib/mjs/utils/Evaluator.d.ts +13 -6
- package/lib/mjs/utils/Evaluator.js +21 -13
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/i18n.js +1 -1
- package/lib/mjs/utils/index.d.ts +160 -2
- package/lib/mjs/utils/index.js +11 -1
- package/lib/mjs/utils/utils.d.ts +28 -23
- package/lib/mjs/utils/utils.js +83 -67
- package/lib/mjs/widgets/CalendarWidget.d.ts +7 -0
- package/lib/mjs/widgets/CalendarWidget.js +37 -13
- package/package.json +2 -3
package/lib/cjs/utils/index.d.ts
CHANGED
@@ -1,3 +1,161 @@
|
|
1
|
-
export
|
1
|
+
export * from "./utils";
|
2
|
+
export * from "./formUtils";
|
2
3
|
export default FormioUtils;
|
3
|
-
|
4
|
+
declare const FormioUtils: {
|
5
|
+
Evaluator: import("./Evaluator").DefaultEvaluator;
|
6
|
+
flattenComponents: typeof import("@formio/core/lib/utils/formUtil").flattenComponents;
|
7
|
+
guid: typeof import("@formio/core/lib/utils/formUtil").guid;
|
8
|
+
uniqueName: typeof import("@formio/core/lib/utils/formUtil").uniqueName;
|
9
|
+
MODEL_TYPES_OF_KNOWN_COMPONENTS: {
|
10
|
+
nestedArray: string[];
|
11
|
+
nestedDataArray: string[];
|
12
|
+
dataObject: string[];
|
13
|
+
object: string[];
|
14
|
+
map: string[];
|
15
|
+
content: string[];
|
16
|
+
string: string[];
|
17
|
+
number: string[];
|
18
|
+
boolean: string[];
|
19
|
+
none: string[];
|
20
|
+
any: string[];
|
21
|
+
};
|
22
|
+
getModelType: typeof import("@formio/core/lib/utils/formUtil").getModelType;
|
23
|
+
getComponentPath: any;
|
24
|
+
setComponentScope: typeof import("@formio/core/lib/utils/formUtil").setComponentScope;
|
25
|
+
resetComponentScope: typeof import("@formio/core/lib/utils/formUtil").resetComponentScope;
|
26
|
+
isComponentNestedDataType: typeof import("@formio/core/lib/utils/formUtil").isComponentNestedDataType;
|
27
|
+
componentPath: typeof import("@formio/core/lib/utils/formUtil").componentPath;
|
28
|
+
getComponentPaths: typeof import("@formio/core/lib/utils/formUtil").getComponentPaths;
|
29
|
+
componentMatches: typeof import("@formio/core/lib/utils/formUtil").componentMatches;
|
30
|
+
getBestMatch: typeof import("@formio/core/lib/utils/formUtil").getBestMatch;
|
31
|
+
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
32
|
+
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
33
|
+
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
34
|
+
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
|
35
|
+
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
|
36
|
+
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
37
|
+
getContextualRowPath: typeof import("@formio/core/lib/utils/formUtil").getContextualRowPath;
|
38
|
+
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
39
|
+
componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
|
40
|
+
eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
|
41
|
+
eachComponentAsync: typeof import("@formio/core/lib/utils/formUtil").eachComponentAsync;
|
42
|
+
getComponentData: typeof import("@formio/core/lib/utils/formUtil").getComponentData;
|
43
|
+
getComponentActualValue: any;
|
44
|
+
isLayoutComponent: typeof import("@formio/core/lib/utils/formUtil").isLayoutComponent;
|
45
|
+
matchComponent: typeof import("@formio/core/lib/utils/formUtil").matchComponent;
|
46
|
+
getComponent: typeof import("@formio/core/lib/utils/formUtil").getComponent;
|
47
|
+
searchComponents: typeof import("@formio/core/lib/utils/formUtil").searchComponents;
|
48
|
+
removeComponent: typeof import("@formio/core/lib/utils/formUtil").removeComponent;
|
49
|
+
hasCondition: typeof import("@formio/core/lib/utils/formUtil").hasCondition;
|
50
|
+
parseFloatExt: typeof import("@formio/core/lib/utils/formUtil").parseFloatExt;
|
51
|
+
formatAsCurrency: typeof import("@formio/core/lib/utils/formUtil").formatAsCurrency;
|
52
|
+
escapeRegExCharacters: typeof import("@formio/core/lib/utils/formUtil").escapeRegExCharacters;
|
53
|
+
getValue: typeof import("@formio/core/lib/utils/formUtil").getValue;
|
54
|
+
getStrings: typeof import("@formio/core/lib/utils/formUtil").getStrings;
|
55
|
+
generateFormChange: typeof import("@formio/core/lib/utils/formUtil").generateFormChange;
|
56
|
+
applyFormChanges: typeof import("@formio/core/lib/utils/formUtil").applyFormChanges;
|
57
|
+
findComponent: typeof import("@formio/core/lib/utils/formUtil").findComponent;
|
58
|
+
getEmptyValue: typeof import("@formio/core/lib/utils/formUtil").getEmptyValue;
|
59
|
+
isComponentDataEmpty: typeof import("@formio/core/lib/utils/formUtil").isComponentDataEmpty;
|
60
|
+
isSelectResourceWithObjectValue: typeof import("@formio/core/lib/utils/formUtil").isSelectResourceWithObjectValue;
|
61
|
+
compareSelectResourceWithObjectTypeValues: typeof import("@formio/core/lib/utils/formUtil").compareSelectResourceWithObjectTypeValues;
|
62
|
+
getItemTemplateKeys: typeof import("@formio/core/lib/utils/formUtil").getItemTemplateKeys;
|
63
|
+
evaluate(func: string | object | Function, args: any, ret: string, interpolate: boolean, options?: import("@formio/core").EvaluatorOptions): any;
|
64
|
+
getRandomComponentId(): string;
|
65
|
+
getPropertyValue(style: CSSStyleDeclaration, prop: string): number;
|
66
|
+
getElementRect(element: HTMLElement): {
|
67
|
+
x: number;
|
68
|
+
y: number;
|
69
|
+
width: number;
|
70
|
+
height: number;
|
71
|
+
};
|
72
|
+
getScriptPlugin(property: string): any;
|
73
|
+
boolValue(value: string | boolean): boolean;
|
74
|
+
isMongoId(text: string): boolean;
|
75
|
+
checkCalculated(component: import("@formio/core").Component, submission: import("@formio/core").Submission, rowData: any): void;
|
76
|
+
checkSimpleConditional(component: any, condition: any, row: any, data: any, instance: any): boolean;
|
77
|
+
checkCustomConditional(component: import("@formio/core").Component, custom: string, row: any, data: any, form: import("@formio/core").Form, variable: string, onError: any, instance: any): any;
|
78
|
+
checkJsonConditional(component: import("@formio/core").Component, json: import("@formio/core").JSONConditional, row: any, data: any, form: import("@formio/core").Form, onError: any): boolean;
|
79
|
+
checkCondition(component: import("@formio/core").Component, row: any, data: any, form: import("@formio/core").Form, instance: any): boolean;
|
80
|
+
checkTrigger(component: import("@formio/core").Component, trigger: any, row: import("@formio/core").DataObject, data: import("@formio/core").DataObject, form: import("@formio/core").Form, instance: any): boolean;
|
81
|
+
setActionProperty(component: import("@formio/core").Component, action: any, result: string, row: import("@formio/core").DataObject, data: import("@formio/core").DataObject, instance: any): import("@formio/core").Component;
|
82
|
+
removeHTML(str: string): string;
|
83
|
+
unescapeHTML(str: string): string;
|
84
|
+
convertStringToHTMLElement(str: string, selector: string): HTMLElement;
|
85
|
+
getDateSetting(date: string | Date): Date | null;
|
86
|
+
isValidDate(date: string | Date): boolean;
|
87
|
+
currentTimezone(): string;
|
88
|
+
offsetDate(date: Date, timezone: string): Date;
|
89
|
+
zonesLoaded(): boolean;
|
90
|
+
shouldLoadZones(timezone: string): boolean;
|
91
|
+
loadZones(url: string, timezone: string): any;
|
92
|
+
momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
93
|
+
formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
94
|
+
formatOffset(timezonesUrl: string, formatFn: Function, date: string | Date, format: string, timezone: string): string;
|
95
|
+
getLocaleDateFormatInfo(locale: Intl.LocalesArgument): object;
|
96
|
+
convertFormatToFlatpickr(format: string): string;
|
97
|
+
convertFormatToMoment(format: string): string;
|
98
|
+
convertFormatToMask(format: string): string;
|
99
|
+
getInputMask(mask: string, placeholderChar: string): any[];
|
100
|
+
unmaskValue(value: string, mask: string, placeholderChar: string): string;
|
101
|
+
matchInputMask(value: string, inputMask: string): boolean;
|
102
|
+
getNumberSeparators(lang?: string): {
|
103
|
+
delimiter: string;
|
104
|
+
decimalSeparator: string;
|
105
|
+
};
|
106
|
+
getNumberDecimalLimit(component: import("@formio/core").Component, defaultLimit: number): number;
|
107
|
+
getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }: {
|
108
|
+
currency: string;
|
109
|
+
decimalLimit: number;
|
110
|
+
decimalSeparator: string;
|
111
|
+
lang: string;
|
112
|
+
}): {
|
113
|
+
prefix: string;
|
114
|
+
suffix: string;
|
115
|
+
};
|
116
|
+
fieldData(data: import("@formio/core").DataObject, component: import("@formio/core").Component): any;
|
117
|
+
delay(fn: Function, delay?: number, ...args: any[]): any;
|
118
|
+
iterateKey(key: string): string;
|
119
|
+
uniqueKey(map: Record<string, string>, base: string): string;
|
120
|
+
bootstrapVersion(options: {
|
121
|
+
bootstrap: string;
|
122
|
+
}): number;
|
123
|
+
unfold(e: any): any;
|
124
|
+
withSwitch(a: any, b: any): Functions[];
|
125
|
+
observeOverload(callback: Function, options?: {
|
126
|
+
limit: number;
|
127
|
+
delay: number;
|
128
|
+
}): Function;
|
129
|
+
getContextComponents(context: any, excludeNested: boolean, excludedTypes?: string[]): any[];
|
130
|
+
getContextButtons(context: any): any[];
|
131
|
+
translateHTMLTemplate(template: string, translate: Function): string;
|
132
|
+
sanitize(string: string, options: any): string;
|
133
|
+
fastCloneDeep(obj: any): any;
|
134
|
+
isInputComponent(componentJson: import("@formio/core").Component): bool;
|
135
|
+
getArrayFromComponentPath(pathStr: string): Arryay<number>;
|
136
|
+
isChildOf(child: any, parent: any): boolean;
|
137
|
+
getStringFromComponentPath(path: number[]): string;
|
138
|
+
round(number: number, precision: number): string;
|
139
|
+
getIEBrowserVersion(): number | null;
|
140
|
+
getBrowserInfo(): object;
|
141
|
+
getComponentPathWithoutIndicies(path?: string): string;
|
142
|
+
getDataParentComponent(componentInstance: Component): any;
|
143
|
+
isPromise(value: any): boolean;
|
144
|
+
getFocusableElements(element: HTMLElement): NodeList<HTMLElement>;
|
145
|
+
getComponentSavedTypes(fullSchema: import("@formio/core").Component): string[] | null;
|
146
|
+
hasEncodedTimezone(value: string): boolean;
|
147
|
+
firstNonNil: any;
|
148
|
+
componentValueTypes: {
|
149
|
+
number: string;
|
150
|
+
string: string;
|
151
|
+
boolean: string;
|
152
|
+
array: string;
|
153
|
+
object: string;
|
154
|
+
date: string;
|
155
|
+
any: string;
|
156
|
+
};
|
157
|
+
interpolateErrors: (component: Component, errors: FieldError[], interpolateFn: Function) => [];
|
158
|
+
};
|
159
|
+
import { Evaluator } from './Evaluator';
|
160
|
+
import { registerEvaluator } from './Evaluator';
|
161
|
+
export { FormioUtils as Utils, Evaluator, registerEvaluator };
|
package/lib/cjs/utils/index.js
CHANGED
@@ -22,11 +22,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27
|
+
};
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.Utils = void 0;
|
27
|
-
const
|
29
|
+
exports.registerEvaluator = exports.Evaluator = exports.Utils = void 0;
|
30
|
+
const utils = __importStar(require("./utils"));
|
31
|
+
const formUtils = __importStar(require("./formUtils"));
|
32
|
+
const Evaluator_1 = require("./Evaluator");
|
33
|
+
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
34
|
+
Object.defineProperty(exports, "registerEvaluator", { enumerable: true, get: function () { return Evaluator_1.registerEvaluator; } });
|
35
|
+
const FormioUtils = Object.assign(Object.assign(Object.assign({}, utils), formUtils), { Evaluator: Evaluator_1.Evaluator });
|
28
36
|
exports.Utils = FormioUtils;
|
29
37
|
if (typeof global === 'object') {
|
30
38
|
global.FormioUtils = FormioUtils;
|
31
39
|
}
|
40
|
+
__exportStar(require("./utils"), exports);
|
41
|
+
__exportStar(require("./formUtils"), exports);
|
32
42
|
exports.default = FormioUtils;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -164,9 +164,9 @@ export function guid(): string;
|
|
164
164
|
/**
|
165
165
|
* Return a translated date setting.
|
166
166
|
* @param {string|Date} date - The date to translate.
|
167
|
-
* @returns {(null|
|
167
|
+
* @returns {(null|Date)} - The translated date.
|
168
168
|
*/
|
169
|
-
export function getDateSetting(date: string | Date): (null |
|
169
|
+
export function getDateSetting(date: string | Date): (null | Date);
|
170
170
|
/**
|
171
171
|
* Returns true if the date is a valid date. False otherwise.
|
172
172
|
* @param {Date|string} date - The date to check for validity.
|
@@ -182,45 +182,56 @@ export function currentTimezone(): string;
|
|
182
182
|
* Get an offset date provided a date object and timezone object.
|
183
183
|
* @param {Date} date - The date to offset.
|
184
184
|
* @param {string} timezone - The timezone to offset the date to.
|
185
|
-
* @returns {
|
185
|
+
* @returns {Date} - The offset date.
|
186
186
|
*/
|
187
|
-
export function offsetDate(date: Date, timezone: string):
|
188
|
-
|
189
|
-
|
190
|
-
};
|
187
|
+
export function offsetDate(date: Date, timezone: string): Date;
|
188
|
+
/**
|
189
|
+
* Returns if the zones are loaded.
|
190
|
+
* @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
|
191
|
+
*/
|
192
|
+
export function zonesLoaded(): boolean;
|
191
193
|
/**
|
192
|
-
* Returns if we should
|
194
|
+
* Returns if we should load the zones.
|
193
195
|
* @param {string} timezone - The timezone to check if we should load the zones.
|
194
|
-
* @returns {boolean} - TRUE if we should
|
196
|
+
* @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
|
197
|
+
*/
|
198
|
+
export function shouldLoadZones(timezone: string): boolean;
|
199
|
+
/**
|
200
|
+
* Externally load the timezone data.
|
201
|
+
* @param {string} url - The URL to load the timezone data from.
|
202
|
+
* @param {string} timezone - The timezone to load.
|
203
|
+
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
195
204
|
*/
|
196
|
-
export function
|
205
|
+
export function loadZones(url: string, timezone: string): Promise<any> | any;
|
197
206
|
/**
|
198
|
-
* Get the
|
199
|
-
* @param {string|Date} value - The value to convert into a
|
207
|
+
* Get the moment date object for translating dates with timezones.
|
208
|
+
* @param {string|Date} value - The value to convert into a moment date.
|
200
209
|
* @param {string} format - The format to convert the date to.
|
201
210
|
* @param {string} timezone - The timezone to convert the date to.
|
202
211
|
* @param {object} options - The options object
|
203
|
-
* @returns {
|
212
|
+
* @returns {Date} - The moment date object.
|
204
213
|
*/
|
205
|
-
export function
|
214
|
+
export function momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
|
206
215
|
/**
|
207
216
|
* Format a date provided a value, format, and timezone object.
|
217
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
208
218
|
* @param {string|Date} value - The value to format.
|
209
219
|
* @param {string} format - The format to format the date to.
|
210
220
|
* @param {string} timezone - The timezone to format the date to.
|
211
221
|
* @param {string} flatPickrInputFormat - The format to use for flatpickr input.
|
212
222
|
* @returns {string} - The formatted date.
|
213
223
|
*/
|
214
|
-
export function formatDate(value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
224
|
+
export function formatDate(timezonesUrl: string, value: string | Date, format: string, timezone: string, flatPickrInputFormat: string): string;
|
215
225
|
/**
|
216
226
|
* Pass a format function to format within a timezone.
|
227
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
217
228
|
* @param {Function} formatFn - The format function to use.
|
218
229
|
* @param {Date|string} date - The date to format.
|
219
230
|
* @param {string} format - The format to format the date to.
|
220
231
|
* @param {string} timezone - The timezone to format the date to.
|
221
232
|
* @returns {string} - The formatted date.
|
222
233
|
*/
|
223
|
-
export function formatOffset(formatFn: Function, date: Date | string, format: string, timezone: string): string;
|
234
|
+
export function formatOffset(timezonesUrl: string, formatFn: Function, date: Date | string, format: string, timezone: string): string;
|
224
235
|
/**
|
225
236
|
* Returns the local date format information.
|
226
237
|
* @param {Intl.LocalesArgument} locale - The locale to get the date format for.
|
@@ -238,7 +249,7 @@ export function convertFormatToFlatpickr(format: string): string;
|
|
238
249
|
* @param {string} format - The format to convert.
|
239
250
|
* @returns {string} - The converted format.
|
240
251
|
*/
|
241
|
-
export function
|
252
|
+
export function convertFormatToMoment(format: string): string;
|
242
253
|
/**
|
243
254
|
* Convert the format from the angular-datepicker module to mask format.
|
244
255
|
* @param {string} format - The format to convert.
|
@@ -488,7 +499,6 @@ export function getComponentSavedTypes(fullSchema: import('@formio/core').Compon
|
|
488
499
|
* @returns {boolean} if value has encoded timezone
|
489
500
|
*/
|
490
501
|
export function hasEncodedTimezone(value: string): boolean;
|
491
|
-
export * from "./formUtils";
|
492
502
|
/**
|
493
503
|
* Map values through unfold and return first non-nil value.
|
494
504
|
* @param {Array<T>} collection - The collection to map through unfold.;
|
@@ -505,8 +515,3 @@ export namespace componentValueTypes {
|
|
505
515
|
let any: string;
|
506
516
|
}
|
507
517
|
export function interpolateErrors(component: Component, errors: FieldError[], interpolateFn: Function): [];
|
508
|
-
import dayjs from "dayjs";
|
509
|
-
import ConditionOperators from './conditionOperators';
|
510
|
-
import { Evaluator } from './Evaluator';
|
511
|
-
export const interpolate: typeof Evaluator.interpolate;
|
512
|
-
export { jsonLogic, ConditionOperators, moment, Evaluator, _ };
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -1,64 +1,19 @@
|
|
1
1
|
"use strict";
|
2
|
-
/* global jQuery */
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
-
if (k2 === undefined) k2 = k;
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
-
}
|
9
|
-
Object.defineProperty(o, k2, desc);
|
10
|
-
}) : (function(o, m, k, k2) {
|
11
|
-
if (k2 === undefined) k2 = k;
|
12
|
-
o[k2] = m[k];
|
13
|
-
}));
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
16
|
-
};
|
17
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
18
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
19
4
|
};
|
20
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
|
-
exports.observeOverload = exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.
|
22
|
-
exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports.
|
6
|
+
exports.getContextComponents = exports.observeOverload = exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = void 0;
|
7
|
+
exports.hasEncodedTimezone = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports.getFocusableElements = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = void 0;
|
8
|
+
/* global jQuery */
|
23
9
|
const lodash_1 = __importDefault(require("lodash"));
|
24
|
-
exports._ = lodash_1.default;
|
25
|
-
const json_logic_js_1 = __importDefault(require("json-logic-js"));
|
26
|
-
exports.jsonLogic = json_logic_js_1.default;
|
27
10
|
const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
|
28
|
-
exports.moment = moment_timezone_1.default;
|
29
11
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
30
|
-
const operators_1 = require("./jsonlogic/operators");
|
31
12
|
const dompurify_1 = __importDefault(require("dompurify"));
|
32
13
|
const formUtils_1 = require("./formUtils");
|
33
14
|
const Evaluator_1 = require("./Evaluator");
|
34
|
-
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
35
15
|
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
36
|
-
exports.ConditionOperators = conditionOperators_1.default;
|
37
16
|
const core_1 = require("@formio/core");
|
38
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
39
|
-
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
40
|
-
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
41
|
-
const advancedFormat_1 = __importDefault(require("dayjs/plugin/advancedFormat"));
|
42
|
-
dayjs_1.default.extend(timezone_1.default);
|
43
|
-
dayjs_1.default.extend(advancedFormat_1.default);
|
44
|
-
dayjs_1.default.extend(utc_1.default);
|
45
|
-
const interpolate = Evaluator_1.Evaluator.interpolate;
|
46
|
-
exports.interpolate = interpolate;
|
47
|
-
__exportStar(require("./formUtils"), exports);
|
48
|
-
// Configure JsonLogic
|
49
|
-
operators_1.lodashOperators.forEach((name) => json_logic_js_1.default.add_operation(`_${name}`, lodash_1.default[name]));
|
50
|
-
// Retrieve Any Date
|
51
|
-
json_logic_js_1.default.add_operation('getDate', (date) => {
|
52
|
-
return (0, moment_timezone_1.default)(date).toISOString();
|
53
|
-
});
|
54
|
-
// Set Relative Minimum Date
|
55
|
-
json_logic_js_1.default.add_operation('relativeMinDate', (relativeMinDate) => {
|
56
|
-
return (0, moment_timezone_1.default)().subtract(relativeMinDate, 'days').toISOString();
|
57
|
-
});
|
58
|
-
// Set Relative Maximum Date
|
59
|
-
json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
|
60
|
-
return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
|
61
|
-
});
|
62
17
|
/**
|
63
18
|
* Evaluate a method.
|
64
19
|
* @param {Function|string|object} func - The function to evaluate.
|
@@ -342,7 +297,7 @@ exports.checkCustomConditional = checkCustomConditional;
|
|
342
297
|
*/
|
343
298
|
function checkJsonConditional(component, json, row, data, form, onError) {
|
344
299
|
try {
|
345
|
-
return
|
300
|
+
return core_1.jsonLogic.apply(json, {
|
346
301
|
data,
|
347
302
|
row,
|
348
303
|
form,
|
@@ -560,7 +515,7 @@ exports.guid = guid;
|
|
560
515
|
/**
|
561
516
|
* Return a translated date setting.
|
562
517
|
* @param {string|Date} date - The date to translate.
|
563
|
-
* @returns {(null|
|
518
|
+
* @returns {(null|Date)} - The translated date.
|
564
519
|
*/
|
565
520
|
function getDateSetting(date) {
|
566
521
|
if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
|
@@ -580,13 +535,13 @@ function getDateSetting(date) {
|
|
580
535
|
try {
|
581
536
|
const value = Evaluator_1.Evaluator.evaluator(`return ${date};`, 'moment')(moment_timezone_1.default);
|
582
537
|
if (typeof value === 'string') {
|
583
|
-
dateSetting = (0,
|
538
|
+
dateSetting = (0, moment_timezone_1.default)(value);
|
584
539
|
}
|
585
540
|
else if (typeof value.toDate === 'function') {
|
586
|
-
dateSetting = (0,
|
541
|
+
dateSetting = (0, moment_timezone_1.default)(value.toDate().toUTCString());
|
587
542
|
}
|
588
543
|
else if (value instanceof Date) {
|
589
|
-
dateSetting = (0,
|
544
|
+
dateSetting = (0, moment_timezone_1.default)(value);
|
590
545
|
}
|
591
546
|
}
|
592
547
|
catch (e) {
|
@@ -616,18 +571,18 @@ exports.isValidDate = isValidDate;
|
|
616
571
|
* @returns {string} - The current timezone.
|
617
572
|
*/
|
618
573
|
function currentTimezone() {
|
619
|
-
if (
|
620
|
-
return
|
574
|
+
if (moment_timezone_1.default.currentTimezone) {
|
575
|
+
return moment_timezone_1.default.currentTimezone;
|
621
576
|
}
|
622
|
-
|
623
|
-
return
|
577
|
+
moment_timezone_1.default.currentTimezone = jstimezonedetect_1.default.determine().name();
|
578
|
+
return moment_timezone_1.default.currentTimezone;
|
624
579
|
}
|
625
580
|
exports.currentTimezone = currentTimezone;
|
626
581
|
/**
|
627
582
|
* Get an offset date provided a date object and timezone object.
|
628
583
|
* @param {Date} date - The date to offset.
|
629
584
|
* @param {string} timezone - The timezone to offset the date to.
|
630
|
-
* @returns {
|
585
|
+
* @returns {Date} - The offset date.
|
631
586
|
*/
|
632
587
|
function offsetDate(date, timezone) {
|
633
588
|
if (timezone === 'UTC') {
|
@@ -636,7 +591,7 @@ function offsetDate(date, timezone) {
|
|
636
591
|
abbr: 'UTC'
|
637
592
|
};
|
638
593
|
}
|
639
|
-
const dateMoment = (0,
|
594
|
+
const dateMoment = (0, moment_timezone_1.default)(date).tz(timezone);
|
640
595
|
return {
|
641
596
|
date: new Date(date.getTime() + ((dateMoment.utcOffset() + date.getTimezoneOffset()) * 60000)),
|
642
597
|
abbr: dateMoment.format('z')
|
@@ -644,85 +599,132 @@ function offsetDate(date, timezone) {
|
|
644
599
|
}
|
645
600
|
exports.offsetDate = offsetDate;
|
646
601
|
/**
|
647
|
-
* Returns if
|
602
|
+
* Returns if the zones are loaded.
|
603
|
+
* @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
|
604
|
+
*/
|
605
|
+
function zonesLoaded() {
|
606
|
+
return moment_timezone_1.default.zonesLoaded;
|
607
|
+
}
|
608
|
+
exports.zonesLoaded = zonesLoaded;
|
609
|
+
/**
|
610
|
+
* Returns if we should load the zones.
|
648
611
|
* @param {string} timezone - The timezone to check if we should load the zones.
|
649
|
-
* @returns {boolean} - TRUE if we should
|
612
|
+
* @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
|
650
613
|
*/
|
651
|
-
function
|
652
|
-
|
614
|
+
function shouldLoadZones(timezone) {
|
615
|
+
if (timezone === currentTimezone() || timezone === 'UTC') {
|
616
|
+
return false;
|
617
|
+
}
|
618
|
+
return true;
|
619
|
+
}
|
620
|
+
exports.shouldLoadZones = shouldLoadZones;
|
621
|
+
/**
|
622
|
+
* Externally load the timezone data.
|
623
|
+
* @param {string} url - The URL to load the timezone data from.
|
624
|
+
* @param {string} timezone - The timezone to load.
|
625
|
+
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
626
|
+
*/
|
627
|
+
function loadZones(url, timezone) {
|
628
|
+
if (timezone && !shouldLoadZones(timezone)) {
|
629
|
+
// Return non-resolving promise.
|
630
|
+
return new Promise(lodash_1.default.noop);
|
631
|
+
}
|
632
|
+
if (moment_timezone_1.default.zonesPromise) {
|
633
|
+
return moment_timezone_1.default.zonesPromise;
|
634
|
+
}
|
635
|
+
return moment_timezone_1.default.zonesPromise = fetch(url)
|
636
|
+
.then(resp => resp.json().then(zones => {
|
637
|
+
moment_timezone_1.default.tz.load(zones);
|
638
|
+
moment_timezone_1.default.zonesLoaded = true;
|
639
|
+
// Trigger a global event that the timezones have finished loading.
|
640
|
+
if (document && document.createEvent && document.body && document.body.dispatchEvent) {
|
641
|
+
var event = document.createEvent('Event');
|
642
|
+
event.initEvent('zonesLoaded', true, true);
|
643
|
+
document.body.dispatchEvent(event);
|
644
|
+
}
|
645
|
+
}));
|
653
646
|
}
|
654
|
-
exports.
|
647
|
+
exports.loadZones = loadZones;
|
655
648
|
/**
|
656
|
-
* Get the
|
657
|
-
* @param {string|Date} value - The value to convert into a
|
649
|
+
* Get the moment date object for translating dates with timezones.
|
650
|
+
* @param {string|Date} value - The value to convert into a moment date.
|
658
651
|
* @param {string} format - The format to convert the date to.
|
659
652
|
* @param {string} timezone - The timezone to convert the date to.
|
660
653
|
* @param {object} options - The options object
|
661
|
-
* @returns {
|
654
|
+
* @returns {Date} - The moment date object.
|
662
655
|
*/
|
663
|
-
function
|
664
|
-
const
|
656
|
+
function momentDate(value, format, timezone, options) {
|
657
|
+
const momentDate = (0, moment_timezone_1.default)(value);
|
665
658
|
if (!timezone) {
|
666
|
-
return
|
659
|
+
return momentDate;
|
667
660
|
}
|
668
661
|
if (timezone === 'UTC') {
|
669
662
|
timezone = 'Etc/UTC';
|
670
663
|
}
|
671
|
-
if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (
|
672
|
-
return
|
664
|
+
if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (moment_timezone_1.default.zonesLoaded || (options === null || options === void 0 ? void 0 : options.email))) {
|
665
|
+
return momentDate.tz(timezone);
|
673
666
|
}
|
674
|
-
return
|
667
|
+
return momentDate;
|
675
668
|
}
|
676
|
-
exports.
|
669
|
+
exports.momentDate = momentDate;
|
677
670
|
/**
|
678
671
|
* Format a date provided a value, format, and timezone object.
|
672
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
679
673
|
* @param {string|Date} value - The value to format.
|
680
674
|
* @param {string} format - The format to format the date to.
|
681
675
|
* @param {string} timezone - The timezone to format the date to.
|
682
676
|
* @param {string} flatPickrInputFormat - The format to use for flatpickr input.
|
683
677
|
* @returns {string} - The formatted date.
|
684
678
|
*/
|
685
|
-
function formatDate(value, format, timezone, flatPickrInputFormat) {
|
686
|
-
const
|
679
|
+
function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
|
680
|
+
const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
|
687
681
|
if (timezone === currentTimezone()) {
|
688
682
|
// See if our format contains a "z" timezone character.
|
689
683
|
if (format.match(/\s(z$|z\s)/)) {
|
690
|
-
|
691
|
-
|
684
|
+
loadZones(timezonesUrl);
|
685
|
+
if (moment_timezone_1.default.zonesLoaded) {
|
686
|
+
return momentDate.tz(timezone).format(convertFormatToMoment(format));
|
692
687
|
}
|
693
688
|
else {
|
694
|
-
return
|
689
|
+
return momentDate.format(convertFormatToMoment(format.replace(/\s(z$|z\s)/, '')));
|
695
690
|
}
|
696
691
|
}
|
697
692
|
// Return the standard format.
|
698
|
-
return
|
693
|
+
return momentDate.format(convertFormatToMoment(format));
|
699
694
|
}
|
700
695
|
if (timezone === 'UTC') {
|
701
|
-
const offset = offsetDate(
|
702
|
-
return `${(0,
|
696
|
+
const offset = offsetDate(momentDate.toDate(), 'UTC');
|
697
|
+
return `${(0, moment_timezone_1.default)(offset.date).format(convertFormatToMoment(format))} UTC`;
|
698
|
+
}
|
699
|
+
// Load the zones since we need timezone information.
|
700
|
+
loadZones(timezonesUrl);
|
701
|
+
if (moment_timezone_1.default.zonesLoaded && timezone) {
|
702
|
+
return momentDate.tz(timezone).format(`${convertFormatToMoment(format)} z`);
|
703
703
|
}
|
704
|
-
|
705
|
-
return
|
704
|
+
else {
|
705
|
+
return momentDate.format(convertFormatToMoment(format));
|
706
706
|
}
|
707
|
-
return dayjsDate.format(convertFormatToDayjs(format));
|
708
707
|
}
|
709
708
|
exports.formatDate = formatDate;
|
710
709
|
/**
|
711
710
|
* Pass a format function to format within a timezone.
|
711
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
712
712
|
* @param {Function} formatFn - The format function to use.
|
713
713
|
* @param {Date|string} date - The date to format.
|
714
714
|
* @param {string} format - The format to format the date to.
|
715
715
|
* @param {string} timezone - The timezone to format the date to.
|
716
716
|
* @returns {string} - The formatted date.
|
717
717
|
*/
|
718
|
-
function formatOffset(formatFn, date, format, timezone) {
|
718
|
+
function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
719
719
|
if (timezone === currentTimezone()) {
|
720
720
|
return formatFn(date, format);
|
721
721
|
}
|
722
722
|
if (timezone === 'UTC') {
|
723
723
|
return `${formatFn(offsetDate(date, 'UTC').date, format)} UTC`;
|
724
724
|
}
|
725
|
-
|
725
|
+
// Load the zones since we need timezone information.
|
726
|
+
loadZones(timezonesUrl);
|
727
|
+
if (moment_timezone_1.default.zonesLoaded) {
|
726
728
|
const offset = offsetDate(date, timezone);
|
727
729
|
return `${formatFn(offset.date, format)} ${offset.abbr}`;
|
728
730
|
}
|
@@ -782,7 +784,7 @@ exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
|
|
782
784
|
* @param {string} format - The format to convert.
|
783
785
|
* @returns {string} - The converted format.
|
784
786
|
*/
|
785
|
-
function
|
787
|
+
function convertFormatToMoment(format) {
|
786
788
|
return format
|
787
789
|
// Year conversion.
|
788
790
|
.replace(/y/g, 'Y')
|
@@ -795,7 +797,7 @@ function convertFormatToDayjs(format) {
|
|
795
797
|
// Unix Timestamp
|
796
798
|
.replace(/U/g, 'X');
|
797
799
|
}
|
798
|
-
exports.
|
800
|
+
exports.convertFormatToMoment = convertFormatToMoment;
|
799
801
|
/**
|
800
802
|
* Convert the format from the angular-datepicker module to mask format.
|
801
803
|
* @param {string} format - The format to convert.
|
@@ -22,6 +22,13 @@ export default class CalendarWidget extends InputWidget {
|
|
22
22
|
minDate: string;
|
23
23
|
maxDate: string;
|
24
24
|
};
|
25
|
+
zoneLoading: boolean;
|
26
|
+
timezonesUrl: string;
|
27
|
+
/**
|
28
|
+
* Load the timezones.
|
29
|
+
* @returns {boolean} TRUE if the zones are loading, FALSE otherwise.
|
30
|
+
*/
|
31
|
+
loadZones(): boolean;
|
25
32
|
attach(input: any): Promise<any>;
|
26
33
|
defaultFormat: {
|
27
34
|
date: string;
|