@luomus/laji-form 15.1.64 → 15.1.66
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/laji-form.js +1 -1
- package/dist/laji-form.js.LICENSE.txt +1 -1
- package/lib/Context.d.ts +1 -1
- package/lib/Context.js +1 -2
- package/lib/ReactContext.js +22 -8
- package/lib/components/BaseComponent.d.ts +1 -2
- package/lib/components/BaseComponent.js +2 -3
- package/lib/components/LajiForm.d.ts +13 -13
- package/lib/components/LajiForm.js +51 -35
- package/lib/components/VirtualSchemaField.d.ts +14 -14
- package/lib/components/VirtualSchemaField.js +31 -18
- package/lib/components/components/Affix.d.ts +2 -2
- package/lib/components/components/Affix.js +25 -12
- package/lib/components/components/Button.d.ts +6 -6
- package/lib/components/components/Button.js +23 -9
- package/lib/components/components/DeleteButton.d.ts +5 -4
- package/lib/components/components/DeleteButton.js +31 -12
- package/lib/components/components/ErrorPanel.d.ts +3 -3
- package/lib/components/components/ErrorPanel.js +22 -8
- package/lib/components/components/FailedBackgroundJobsPanel.d.ts +2 -2
- package/lib/components/components/FailedBackgroundJobsPanel.js +25 -11
- package/lib/components/components/FetcherInput.d.ts +1 -1
- package/lib/components/components/FetcherInput.js +28 -14
- package/lib/components/components/Fullscreen.d.ts +1 -1
- package/lib/components/components/Fullscreen.js +23 -9
- package/lib/components/components/GlyphButton.d.ts +5 -5
- package/lib/components/components/GlyphButton.js +22 -8
- package/lib/components/components/Help.d.ts +1 -1
- package/lib/components/components/Help.js +25 -12
- package/lib/components/components/Label.d.ts +1 -1
- package/lib/components/components/Label.js +24 -11
- package/lib/components/components/OverlayTrigger.d.ts +4 -4
- package/lib/components/components/OverlayTrigger.js +22 -8
- package/lib/components/components/Stretch.d.ts +4 -4
- package/lib/components/components/Stretch.js +25 -11
- package/lib/components/components/TooltipComponent.d.ts +1 -1
- package/lib/components/components/TooltipComponent.js +26 -12
- package/lib/components/components/index.js +5 -1
- package/lib/components/fields/AnnotationField.d.ts +8 -4
- package/lib/components/fields/AnnotationField.js +34 -20
- package/lib/components/fields/AnyToBooleanField.d.ts +4 -4
- package/lib/components/fields/AnyToBooleanField.js +22 -8
- package/lib/components/fields/ArrayBulkField.d.ts +9 -4
- package/lib/components/fields/ArrayBulkField.js +24 -10
- package/lib/components/fields/ArrayCombinerField.d.ts +4 -4
- package/lib/components/fields/ArrayCombinerField.js +25 -11
- package/lib/components/fields/ArrayField.d.ts +1 -0
- package/lib/components/fields/ArrayField.js +41 -27
- package/lib/components/fields/ArrayPropertySumField.d.ts +2 -2
- package/lib/components/fields/ArrayPropertySumField.js +24 -10
- package/lib/components/fields/AsArrayField.d.ts +7 -5
- package/lib/components/fields/AsArrayField.js +22 -8
- package/lib/components/fields/AudioArrayField.js +22 -8
- package/lib/components/fields/AutoArrayField.d.ts +2 -2
- package/lib/components/fields/AutoArrayField.js +26 -12
- package/lib/components/fields/AutosuggestField.d.ts +14 -6
- package/lib/components/fields/AutosuggestField.js +61 -47
- package/lib/components/fields/CombinedValueDisplayField.d.ts +6 -6
- package/lib/components/fields/CombinedValueDisplayField.js +24 -10
- package/lib/components/fields/CondensedObjectField.d.ts +3 -3
- package/lib/components/fields/CondensedObjectField.js +33 -19
- package/lib/components/fields/ConditionalOnChangeField.d.ts +7 -7
- package/lib/components/fields/ConditionalOnChangeField.js +22 -8
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +19 -19
- package/lib/components/fields/ConditionalUiSchemaField.js +28 -14
- package/lib/components/fields/ContextInjectionField.d.ts +7 -7
- package/lib/components/fields/ContextInjectionField.js +26 -13
- package/lib/components/fields/DataLeakerField.d.ts +6 -6
- package/lib/components/fields/DataLeakerField.js +25 -11
- package/lib/components/fields/DefaultValueArrayField.d.ts +6 -6
- package/lib/components/fields/DefaultValueArrayField.js +23 -9
- package/lib/components/fields/DependentBooleanField.d.ts +6 -6
- package/lib/components/fields/DependentBooleanField.js +24 -10
- package/lib/components/fields/DependentDisableField.d.ts +4 -4
- package/lib/components/fields/DependentDisableField.js +24 -10
- package/lib/components/fields/EnumRangeArrayField.d.ts +2 -3
- package/lib/components/fields/EnumRangeArrayField.js +26 -12
- package/lib/components/fields/ExtraLabelRowField.d.ts +9 -8
- package/lib/components/fields/ExtraLabelRowField.js +27 -13
- package/lib/components/fields/FakePropertyField.d.ts +2 -2
- package/lib/components/fields/FakePropertyField.js +26 -12
- package/lib/components/fields/FillDateRangeField.d.ts +28 -0
- package/lib/components/fields/FillDateRangeField.js +91 -0
- package/lib/components/fields/FilterArrayField.d.ts +13 -12
- package/lib/components/fields/FilterArrayField.js +27 -13
- package/lib/components/fields/FlatField.d.ts +4 -4
- package/lib/components/fields/FlatField.js +35 -21
- package/lib/components/fields/GeocoderField.d.ts +12 -4
- package/lib/components/fields/GeocoderField.js +38 -24
- package/lib/components/fields/GridLayoutField.d.ts +7 -7
- package/lib/components/fields/GridLayoutField.js +23 -9
- package/lib/components/fields/HiddenField.d.ts +2 -2
- package/lib/components/fields/HiddenField.js +22 -8
- package/lib/components/fields/HiddenWithTextField.d.ts +6 -7
- package/lib/components/fields/HiddenWithTextField.js +22 -8
- package/lib/components/fields/ImageArrayField.d.ts +18 -17
- package/lib/components/fields/ImageArrayField.js +57 -41
- package/lib/components/fields/ImageDisplayField.d.ts +4 -3
- package/lib/components/fields/ImageDisplayField.js +25 -11
- package/lib/components/fields/InitiallyHiddenField.d.ts +9 -4
- package/lib/components/fields/InitiallyHiddenField.js +23 -9
- package/lib/components/fields/InjectDefaultValueField.d.ts +6 -6
- package/lib/components/fields/InjectDefaultValueField.js +23 -9
- package/lib/components/fields/InjectField.d.ts +8 -8
- package/lib/components/fields/InjectField.js +34 -20
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +8 -8
- package/lib/components/fields/InputWithDefaultValueButtonField.js +29 -15
- package/lib/components/fields/LocalityField.d.ts +4 -2
- package/lib/components/fields/LocalityField.js +28 -14
- package/lib/components/fields/LocationChooserField.d.ts +5 -4
- package/lib/components/fields/LocationChooserField.js +60 -46
- package/lib/components/fields/MapArrayField.d.ts +17 -4
- package/lib/components/fields/MapArrayField.js +137 -132
- package/lib/components/fields/MapField.d.ts +10 -2
- package/lib/components/fields/MapField.js +42 -29
- package/lib/components/fields/MultiActiveArrayField.d.ts +3 -3
- package/lib/components/fields/MultiActiveArrayField.js +29 -15
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +6 -2
- package/lib/components/fields/MultiAnyToBooleanField.js +25 -11
- package/lib/components/fields/MultiArrayField.d.ts +11 -10
- package/lib/components/fields/MultiArrayField.js +45 -31
- package/lib/components/fields/MultiLanguageField.d.ts +3 -2
- package/lib/components/fields/MultiLanguageField.js +23 -9
- package/lib/components/fields/MultiTagArrayField.d.ts +8 -4
- package/lib/components/fields/MultiTagArrayField.js +34 -20
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooser.d.ts +2 -2
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooser.js +25 -11
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooserField.d.ts +6 -6
- package/lib/components/fields/NamedPlaceChooserField/NamedPlaceChooserField.js +29 -16
- package/lib/components/fields/NamedPlaceChooserField/Popup.d.ts +1 -1
- package/lib/components/fields/NamedPlaceChooserField/Popup.js +29 -15
- package/lib/components/fields/NamedPlaceSaverField.d.ts +7 -5
- package/lib/components/fields/NamedPlaceSaverField.js +35 -21
- package/lib/components/fields/NestField.d.ts +4 -4
- package/lib/components/fields/NestField.js +36 -23
- package/lib/components/fields/ObjectField.js +36 -22
- package/lib/components/fields/PdfArrayField.js +22 -8
- package/lib/components/fields/PrefillingArrayField.d.ts +2 -2
- package/lib/components/fields/PrefillingArrayField.js +23 -9
- package/lib/components/fields/PrefixArrayField.d.ts +35 -0
- package/lib/components/fields/PrefixArrayField.js +138 -0
- package/lib/components/fields/SchemaField.d.ts +1 -1
- package/lib/components/fields/SchemaField.js +34 -20
- package/lib/components/fields/ScopeField.d.ts +14 -6
- package/lib/components/fields/ScopeField.js +53 -39
- package/lib/components/fields/SectionArrayField.d.ts +2 -2
- package/lib/components/fields/SectionArrayField.js +110 -96
- package/lib/components/fields/SelectTreeField.d.ts +0 -1
- package/lib/components/fields/SelectTreeField.js +30 -16
- package/lib/components/fields/SingleActiveArrayField.d.ts +14 -2
- package/lib/components/fields/SingleActiveArrayField.js +112 -98
- package/lib/components/fields/SingleItemArrayField.d.ts +3 -2
- package/lib/components/fields/SingleItemArrayField.js +28 -14
- package/lib/components/fields/SortArrayField.d.ts +9 -9
- package/lib/components/fields/SortArrayField.js +43 -29
- package/lib/components/fields/SplitField.d.ts +4 -4
- package/lib/components/fields/SplitField.js +26 -12
- package/lib/components/fields/StringToArrayField.d.ts +5 -5
- package/lib/components/fields/StringToArrayField.js +23 -9
- package/lib/components/fields/SumField.d.ts +6 -6
- package/lib/components/fields/SumField.js +22 -8
- package/lib/components/fields/TableField.d.ts +4 -3
- package/lib/components/fields/TableField.js +31 -17
- package/lib/components/fields/TagArrayField.d.ts +8 -2
- package/lib/components/fields/TagArrayField.js +37 -23
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +10 -5
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +30 -16
- package/lib/components/fields/UiFieldApplierField.d.ts +4 -4
- package/lib/components/fields/UiFieldApplierField.js +33 -19
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +7 -6
- package/lib/components/fields/UiFieldMapperArrayField.js +26 -12
- package/lib/components/fields/UnitCountShorthandField.d.ts +6 -6
- package/lib/components/fields/UnitCountShorthandField.js +31 -17
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +6 -5
- package/lib/components/fields/UnitListShorthandArrayField.js +31 -17
- package/lib/components/fields/UnitShorthandField.d.ts +11 -5
- package/lib/components/fields/UnitShorthandField.js +41 -27
- package/lib/components/templates/ArrayFieldTemplate.d.ts +2 -1
- package/lib/components/templates/ArrayFieldTemplate.js +60 -46
- package/lib/components/templates/BaseInputTemplate.d.ts +3 -0
- package/lib/components/templates/BaseInputTemplate.js +26 -13
- package/lib/components/templates/DescriptionField.js +25 -11
- package/lib/components/templates/ErrorListTemplate.d.ts +5 -0
- package/lib/components/templates/ErrorListTemplate.js +26 -12
- package/lib/components/templates/FieldTemplate.d.ts +8 -0
- package/lib/components/templates/FieldTemplate.js +31 -17
- package/lib/components/templates/ObjectFieldTemplate.js +30 -17
- package/lib/components/templates/TitleField.js +27 -13
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +6 -6
- package/lib/components/widgets/AnyToBooleanWidget.js +24 -10
- package/lib/components/widgets/AutosuggestWidget.d.ts +14 -2
- package/lib/components/widgets/AutosuggestWidget.js +49 -35
- package/lib/components/widgets/CheckboxWidget.d.ts +3 -0
- package/lib/components/widgets/CheckboxWidget.js +32 -18
- package/lib/components/widgets/DateTimeWidget.d.ts +16 -8
- package/lib/components/widgets/DateTimeWidget.js +67 -35
- package/lib/components/widgets/DateWidget.d.ts +11 -11
- package/lib/components/widgets/DateWidget.js +36 -14
- package/lib/components/widgets/HiddenWidget.d.ts +4 -4
- package/lib/components/widgets/HiddenWidget.js +22 -8
- package/lib/components/widgets/ImageSelectWidget.d.ts +1 -0
- package/lib/components/widgets/ImageSelectWidget.js +24 -10
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +12 -0
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +26 -12
- package/lib/components/widgets/InputGroupWidget.d.ts +4 -3
- package/lib/components/widgets/InputGroupWidget.js +25 -11
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +18 -8
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +50 -14
- package/lib/components/widgets/NumberWidget.d.ts +3 -2
- package/lib/components/widgets/NumberWidget.js +23 -9
- package/lib/components/widgets/PlainTextWidget.d.ts +3 -3
- package/lib/components/widgets/PlainTextWidget.js +24 -10
- package/lib/components/widgets/SelectWidget.d.ts +5 -6
- package/lib/components/widgets/SelectWidget.js +92 -72
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +3 -2
- package/lib/components/widgets/SeparatedDateTimeWidget.js +22 -8
- package/lib/components/widgets/TaxonImageWidget.d.ts +3 -2
- package/lib/components/widgets/TaxonImageWidget.js +24 -10
- package/lib/components/widgets/TextSelectWidget.d.ts +10 -2
- package/lib/components/widgets/TextSelectWidget.js +26 -12
- package/lib/components/widgets/TextareaWidget.d.ts +5 -0
- package/lib/components/widgets/TextareaWidget.js +25 -11
- package/lib/components/widgets/TimeWidget.d.ts +2 -2
- package/lib/components/widgets/TimeWidget.js +24 -10
- package/lib/components/widgets/URLWidget.d.ts +2 -2
- package/lib/components/widgets/URLWidget.js +22 -8
- package/lib/components/widgets/UpperCaseWidget.d.ts +3 -2
- package/lib/components/widgets/UpperCaseWidget.js +23 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +25 -11
- package/lib/services/custom-event-service.d.ts +1 -1
- package/lib/services/focus-service.d.ts +1 -1
- package/lib/services/focus-service.js +3 -3
- package/lib/services/id-service.d.ts +1 -1
- package/lib/services/id-service.js +5 -6
- package/lib/services/key-handler-service.d.ts +3 -4
- package/lib/services/key-handler-service.js +4 -4
- package/lib/services/multi-active-array-service.d.ts +1 -1
- package/lib/services/settings-service.d.ts +2 -3
- package/lib/services/settings-service.js +3 -3
- package/lib/services/submit-hook-service.js +1 -1
- package/lib/themes/bs3.js +22 -8
- package/lib/themes/bs5.js +23 -9
- package/lib/themes/stub.js +22 -8
- package/lib/themes/theme.d.ts +15 -15
- package/lib/types.d.ts +18 -19
- package/lib/types.js +3 -4
- package/lib/utils.d.ts +9 -9
- package/lib/utils.js +138 -134
- package/lib/validation.js +25 -12
- package/package.json +12 -11
- package/test-export/test-utils.d.ts +7 -7
- package/test-export/test-utils.js +36 -22
package/lib/Context.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare const _default: (nameSpace?: number | string) => Record<string, unknown>;
|
|
2
1
|
/**
|
|
3
2
|
* A singleton context container for accessing state between components. Should be used for vars that shouldn't affect React change detection, e.g. not suitable to be stored in React context or are updated mutably.
|
|
4
3
|
*
|
|
5
4
|
* Empty namespace "" is used for global vars.
|
|
6
5
|
*/
|
|
6
|
+
declare const _default: (nameSpace?: number | string) => Record<string, unknown>;
|
|
7
7
|
export default _default;
|
|
8
8
|
export declare function clear(): void;
|
package/lib/Context.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clear =
|
|
3
|
+
exports.clear = clear;
|
|
4
4
|
let singletonContext = {};
|
|
5
5
|
/**
|
|
6
6
|
* A singleton context container for accessing state between components. Should be used for vars that shouldn't affect React change detection, e.g. not suitable to be stored in React context or are updated mutably.
|
|
@@ -15,4 +15,3 @@ exports.default = (nameSpace = "") => {
|
|
|
15
15
|
function clear() {
|
|
16
16
|
singletonContext = {};
|
|
17
17
|
}
|
|
18
|
-
exports.clear = clear;
|
package/lib/ReactContext.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
36
|
const React = __importStar(require("react"));
|
|
23
37
|
const Context = React.createContext({});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FieldProps, WidgetProps } from "../types";
|
|
3
|
-
|
|
2
|
+
type Constructor<T> = new (...args: any[]) => T;
|
|
4
3
|
interface LajiFormComponentForBaseComponent<P, S> extends React.Component<P, S> {
|
|
5
4
|
getStateFromProps?(props: P): S;
|
|
6
5
|
UNSAFE_componentWillReceiveProps?(props: Readonly<P>, nextContext?: any): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseComponent =
|
|
3
|
+
exports.BaseComponent = BaseComponent;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
function BaseComponent(ComposedComponent) {
|
|
6
6
|
var _a;
|
|
@@ -22,8 +22,7 @@ function BaseComponent(ComposedComponent) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
_a.displayName = utils_1.getReactComponentName(ComposedComponent),
|
|
25
|
+
_a.displayName = (0, utils_1.getReactComponentName)(ComposedComponent),
|
|
26
26
|
_a;
|
|
27
27
|
}
|
|
28
|
-
exports.BaseComponent = BaseComponent;
|
|
29
28
|
exports.default = BaseComponent;
|
|
@@ -118,17 +118,17 @@ export interface FormContext {
|
|
|
118
118
|
multiActiveArray: MultiActiveArrayService;
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
export
|
|
121
|
+
export type NotifyMessager = (msg: string) => void;
|
|
122
122
|
export interface Notifier {
|
|
123
123
|
success: NotifyMessager;
|
|
124
124
|
info: NotifyMessager;
|
|
125
125
|
warning: NotifyMessager;
|
|
126
126
|
error: NotifyMessager;
|
|
127
127
|
}
|
|
128
|
-
export
|
|
128
|
+
export type ByLang = {
|
|
129
129
|
[key: string]: string;
|
|
130
130
|
};
|
|
131
|
-
export
|
|
131
|
+
export type Translations = Record<Lang, ByLang>;
|
|
132
132
|
export default class LajiForm extends React.Component<LajiFormProps, LajiFormState> {
|
|
133
133
|
static contextType: React.Context<ContextProps>;
|
|
134
134
|
private contextMemoizeKey;
|
|
@@ -171,7 +171,7 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
171
171
|
componentWillUnmount(): void;
|
|
172
172
|
componentDidCatch(e: Error, i: React.ErrorInfo): void;
|
|
173
173
|
componentDidUpdate(prevProps: LajiFormProps): void;
|
|
174
|
-
onSubmitHooksChange: (submitHooks: SubmitHook[], callback?: (
|
|
174
|
+
onSubmitHooksChange: (submitHooks: SubmitHook[], callback?: () => void) => void;
|
|
175
175
|
resetShortcuts(shortcuts?: ShortcutKeys): void;
|
|
176
176
|
constructTranslations(): Translations;
|
|
177
177
|
getDefaultNotifier: () => Notifier;
|
|
@@ -179,18 +179,18 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
179
179
|
formData: any;
|
|
180
180
|
}) => void;
|
|
181
181
|
getFields: (_fields?: {
|
|
182
|
-
[name: string]: Field
|
|
183
|
-
}
|
|
184
|
-
[x: string]: Field
|
|
182
|
+
[name: string]: Field;
|
|
183
|
+
}) => {
|
|
184
|
+
[x: string]: Field;
|
|
185
185
|
};
|
|
186
186
|
getWidgets: (_widgets?: {
|
|
187
|
-
[name: string]: Widget
|
|
188
|
-
}
|
|
189
|
-
[x: string]: Widget
|
|
187
|
+
[name: string]: Widget;
|
|
188
|
+
}) => {
|
|
189
|
+
[x: string]: Widget;
|
|
190
190
|
};
|
|
191
191
|
getTemplates: (_templates?: {
|
|
192
|
-
[name: string]: TemplatesType
|
|
193
|
-
}
|
|
192
|
+
[name: string]: TemplatesType;
|
|
193
|
+
}) => {
|
|
194
194
|
[x: string]: TemplatesType<any, import("@rjsf/utils").RJSFSchema, any>;
|
|
195
195
|
};
|
|
196
196
|
getContext: (props: LajiFormProps, context: ContextProps) => ContextProps;
|
|
@@ -198,7 +198,7 @@ export default class LajiForm extends React.Component<LajiFormProps, LajiFormSta
|
|
|
198
198
|
renderSubmitHooks: () => JSX.Element | null | undefined;
|
|
199
199
|
validateAndSubmit: (warnings?: boolean, onlySchema?: boolean) => Promise<void>;
|
|
200
200
|
validate: (warnings?: boolean, nonlive?: boolean, onlySchema?: boolean) => Promise<unknown>;
|
|
201
|
-
onSubmit: (onlySchemaValidations?: "onlySchemaValidations"
|
|
201
|
+
onSubmit: (onlySchemaValidations?: "onlySchemaValidations") => false | undefined;
|
|
202
202
|
popErrorListIfNeeded: () => void;
|
|
203
203
|
_onDefaultSubmit: (e: React.SyntheticEvent) => void;
|
|
204
204
|
submit: () => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
36
|
var t = {};
|
|
23
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -130,9 +144,11 @@ const fields = importLocalComponents("fields", [
|
|
|
130
144
|
"AsArrayField",
|
|
131
145
|
"CondensedObjectField",
|
|
132
146
|
"MultiActiveArrayField",
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
{ "
|
|
147
|
+
"PrefixArrayField",
|
|
148
|
+
"FillDateRangeField",
|
|
149
|
+
{ "InputTransformerField": "ConditionalOnChangeField" }, // Alias for backward compatibility.
|
|
150
|
+
{ "ConditionalField": "ConditionalUiSchemaField" }, // Alias for backward compatibility.
|
|
151
|
+
{ "UnitRapidField": "UnitShorthandField" }, // Alias for backward compatibility.
|
|
136
152
|
{ "AccordionArrayField": "SingleActiveArrayField" } // Alias for backward compatibility.
|
|
137
153
|
]);
|
|
138
154
|
const widgets = importLocalComponents("widgets", [
|
|
@@ -224,7 +240,7 @@ class LajiForm extends React.Component {
|
|
|
224
240
|
}
|
|
225
241
|
this.memoizedFormContext.services.ids.setFormData(formData);
|
|
226
242
|
this.memoizedFormContext.services.rootInstance.setFormData(formData);
|
|
227
|
-
!this.validating && this.validate(
|
|
243
|
+
!this.validating && this.validate(true, false);
|
|
228
244
|
});
|
|
229
245
|
};
|
|
230
246
|
this.getFields = (_fields) => (Object.assign(Object.assign({}, fields), (_fields || {})));
|
|
@@ -308,14 +324,14 @@ class LajiForm extends React.Component {
|
|
|
308
324
|
? this.getSchemaValidationErrors(formData)
|
|
309
325
|
: {};
|
|
310
326
|
block && this.memoizedFormContext.services.blocker.push();
|
|
311
|
-
return new Promise(resolve => Promise.all([validation_1.default(validations, formData), validation_1.default(liveValidations, formData)]).then(([_validations, _liveValidations]) => {
|
|
327
|
+
return new Promise(resolve => Promise.all([(0, validation_1.default)(validations, formData), (0, validation_1.default)(liveValidations, formData)]).then(([_validations, _liveValidations]) => {
|
|
312
328
|
if (nonlive || onlySchema) {
|
|
313
|
-
this.cachedNonliveValidations = deepmerge_1.default(schemaErrors, _validations);
|
|
329
|
+
this.cachedNonliveValidations = (0, deepmerge_1.default)(schemaErrors, _validations);
|
|
314
330
|
block && this.memoizedFormContext.services.blocker.pop();
|
|
315
331
|
}
|
|
316
|
-
const merged = deepmerge_1.default(_liveValidations, !nonlive
|
|
332
|
+
const merged = (0, deepmerge_1.default)(_liveValidations, !nonlive
|
|
317
333
|
? (this.cachedNonliveValidations || {})
|
|
318
|
-
: deepmerge_1.default(_validations, schemaErrors));
|
|
334
|
+
: (0, deepmerge_1.default)(_validations, schemaErrors));
|
|
319
335
|
this.validating = false;
|
|
320
336
|
resolve(!Object.keys(merged).length);
|
|
321
337
|
!equals((this.state.extraErrors || {}), merged) && this.setState({ extraErrors: merged }, this.popErrorListIfNeeded);
|
|
@@ -358,7 +374,7 @@ class LajiForm extends React.Component {
|
|
|
358
374
|
var _a;
|
|
359
375
|
this.setState({ runningSubmitHooks: false });
|
|
360
376
|
this.memoizedFormContext.services.blocker.pop();
|
|
361
|
-
utils_1.highlightElem(react_dom_1.findDOMNode((_a = this.bgJobRef) === null || _a === void 0 ? void 0 : _a.current));
|
|
377
|
+
(0, utils_1.highlightElem)((0, react_dom_1.findDOMNode)((_a = this.bgJobRef) === null || _a === void 0 ? void 0 : _a.current));
|
|
362
378
|
});
|
|
363
379
|
return undefined;
|
|
364
380
|
};
|
|
@@ -366,19 +382,19 @@ class LajiForm extends React.Component {
|
|
|
366
382
|
const errorList = this.memoizedFormContext.services.rootInstance.getErrorListInstance();
|
|
367
383
|
let errorListElem;
|
|
368
384
|
try {
|
|
369
|
-
errorListElem = react_dom_1.findDOMNode(errorList);
|
|
385
|
+
errorListElem = (0, react_dom_1.findDOMNode)(errorList);
|
|
370
386
|
}
|
|
371
387
|
catch (e) {
|
|
372
388
|
// Empty
|
|
373
389
|
}
|
|
374
390
|
if (!errorListElem)
|
|
375
391
|
return;
|
|
376
|
-
const wouldScrollTo = utils_1.getScrollPositionForScrollIntoViewIfNeeded(errorListElem, this.props.topOffset, this.props.bottomOffset) || 0;
|
|
377
|
-
const scrollAmount = wouldScrollTo - utils_1.getWindowScrolled();
|
|
392
|
+
const wouldScrollTo = (0, utils_1.getScrollPositionForScrollIntoViewIfNeeded)(errorListElem, this.props.topOffset, this.props.bottomOffset) || 0;
|
|
393
|
+
const scrollAmount = wouldScrollTo - (0, utils_1.getWindowScrolled)();
|
|
378
394
|
if (!errorList.state.poppedTouched && scrollAmount !== 0) {
|
|
379
395
|
errorList.expand();
|
|
380
396
|
}
|
|
381
|
-
utils_1.highlightElem(errorListElem);
|
|
397
|
+
(0, utils_1.highlightElem)(errorListElem);
|
|
382
398
|
};
|
|
383
399
|
this._onDefaultSubmit = (e) => {
|
|
384
400
|
e.preventDefault();
|
|
@@ -393,7 +409,7 @@ class LajiForm extends React.Component {
|
|
|
393
409
|
this.getShorcutButtonTooltip = () => {
|
|
394
410
|
const { translations } = this.state.formContext;
|
|
395
411
|
if (this.keyCombo) {
|
|
396
|
-
return utils_1.translate(translations, "ShortcutHelp", { key: utils_1.stringifyKeyCombo(this.keyCombo) });
|
|
412
|
+
return (0, utils_1.translate)(translations, "ShortcutHelp", { key: (0, utils_1.stringifyKeyCombo)(this.keyCombo) });
|
|
397
413
|
}
|
|
398
414
|
return undefined;
|
|
399
415
|
};
|
|
@@ -401,7 +417,7 @@ class LajiForm extends React.Component {
|
|
|
401
417
|
this.helpVisible ? this.dismissHelp(e) : this.showHelp();
|
|
402
418
|
};
|
|
403
419
|
this.showHelp = () => {
|
|
404
|
-
const node = react_dom_1.findDOMNode(this.shortcutHelpRef.current);
|
|
420
|
+
const node = (0, react_dom_1.findDOMNode)(this.shortcutHelpRef.current);
|
|
405
421
|
if (!this.helpVisible) {
|
|
406
422
|
if (node)
|
|
407
423
|
node.className = node.className.replace(" hidden", "");
|
|
@@ -409,7 +425,7 @@ class LajiForm extends React.Component {
|
|
|
409
425
|
}
|
|
410
426
|
};
|
|
411
427
|
this.dismissHelp = (e) => {
|
|
412
|
-
const node = react_dom_1.findDOMNode(this.shortcutHelpRef.current);
|
|
428
|
+
const node = (0, react_dom_1.findDOMNode)(this.shortcutHelpRef.current);
|
|
413
429
|
e.preventDefault();
|
|
414
430
|
e.stopPropagation();
|
|
415
431
|
if (this.helpVisible && node) {
|
|
@@ -447,7 +463,7 @@ class LajiForm extends React.Component {
|
|
|
447
463
|
this.memoizedFormContext.services.blocker.pop();
|
|
448
464
|
};
|
|
449
465
|
this.focusField = (fieldName) => {
|
|
450
|
-
const id = utils_1.JSONPointerToId(fieldName);
|
|
466
|
+
const id = (0, utils_1.JSONPointerToId)(fieldName);
|
|
451
467
|
this.memoizedFormContext.services.focus.focus("root_" + id);
|
|
452
468
|
};
|
|
453
469
|
this.openAllMultiActiveArrays = () => {
|
|
@@ -481,13 +497,13 @@ class LajiForm extends React.Component {
|
|
|
481
497
|
this.eventListeners = [];
|
|
482
498
|
};
|
|
483
499
|
this.getSchemaValidationErrors = (formData) => {
|
|
484
|
-
const errors = validator_ajv6_1.default.validateFormData(removeUndefinedFromArrays(formData), this.props.schema, undefined, ((e) => validation_2.transformErrors(this.state.formContext.translations, e))).errors;
|
|
485
|
-
return validation_1.toErrorSchema(errors);
|
|
500
|
+
const errors = validator_ajv6_1.default.validateFormData(removeUndefinedFromArrays(formData), this.props.schema, undefined, ((e) => (0, validation_2.transformErrors)(this.state.formContext.translations, e))).errors;
|
|
501
|
+
return (0, validation_1.toErrorSchema)(errors);
|
|
486
502
|
};
|
|
487
503
|
if (props.apiClient) {
|
|
488
504
|
this.apiClient = new ApiClient_1.default(props.apiClient, props.lang, this.translations);
|
|
489
505
|
}
|
|
490
|
-
validation_2.initializeValidation(this.apiClient);
|
|
506
|
+
(0, validation_2.initializeValidation)(this.apiClient);
|
|
491
507
|
this._id = getNewId();
|
|
492
508
|
this.getMemoizedFormContext(props); // Initialize form context.
|
|
493
509
|
this.resetShortcuts((props.uiSchema || {})["ui:shortcuts"]);
|
|
@@ -507,7 +523,7 @@ class LajiForm extends React.Component {
|
|
|
507
523
|
formContext: this.getMemoizedFormContext(props)
|
|
508
524
|
};
|
|
509
525
|
if (((!this.state && props.schema && Object.keys(props.schema).length) || (this.state && !("formData" in this.state))) || ("formData" in props && props.formData !== this.props.formData)) {
|
|
510
|
-
state.formData = state.formContext.services.ids.addLajiFormIds(utils_1.getDefaultFormState(props.schema, props.formData, props.schema))[0];
|
|
526
|
+
state.formData = state.formContext.services.ids.addLajiFormIds((0, utils_1.getDefaultFormState)(props.schema, props.formData, props.schema))[0];
|
|
511
527
|
}
|
|
512
528
|
else if (this.state && this.formRef.current) {
|
|
513
529
|
state.formData = this.formRef.current.state.formData;
|
|
@@ -530,8 +546,8 @@ class LajiForm extends React.Component {
|
|
|
530
546
|
else {
|
|
531
547
|
this.contextFormMemoizeKey = nextKey;
|
|
532
548
|
const { services } = this.memoizedFormContext || {};
|
|
533
|
-
this.memoizedFormContext = Object.assign(Object.assign({}, props.formContext), { translations: this.translations[props.lang], lang: props.lang, uiSchemaContext: props.uiSchemaContext || {}, topOffset: props.topOffset || 0, bottomOffset: props.bottomOffset || 0, contextId: this._id, formID: props.id, googleApiKey: props.googleApiKey, notifier: props.notifier || this.getDefaultNotifier(), apiClient: this.apiClient, Label: (props.fields || {}).Label || components_1.Label, mediaMetadata: props.mediaMetadata, setTimeout: this.setTimeout, services: {}, formRef: this.formRef, lajiGeoServerAddress: props.lajiGeoServerAddress, globals: Context_1.default(this._id) });
|
|
534
|
-
this.memoizedFormContext.utils = utils_1.ReactUtils(this.memoizedFormContext);
|
|
549
|
+
this.memoizedFormContext = Object.assign(Object.assign({}, props.formContext), { translations: this.translations[props.lang], lang: props.lang, uiSchemaContext: props.uiSchemaContext || {}, topOffset: props.topOffset || 0, bottomOffset: props.bottomOffset || 0, contextId: this._id, formID: props.id, googleApiKey: props.googleApiKey, notifier: props.notifier || this.getDefaultNotifier(), apiClient: this.apiClient, Label: (props.fields || {}).Label || components_1.Label, mediaMetadata: props.mediaMetadata, setTimeout: this.setTimeout, services: {}, formRef: this.formRef, lajiGeoServerAddress: props.lajiGeoServerAddress, globals: (0, Context_1.default)(this._id) });
|
|
550
|
+
this.memoizedFormContext.utils = (0, utils_1.ReactUtils)(this.memoizedFormContext);
|
|
535
551
|
if (services) {
|
|
536
552
|
this.memoizedFormContext.services = services;
|
|
537
553
|
services.keyHandler.setFormContext(this.memoizedFormContext);
|
|
@@ -597,7 +613,7 @@ class LajiForm extends React.Component {
|
|
|
597
613
|
});
|
|
598
614
|
}
|
|
599
615
|
constructTranslations() {
|
|
600
|
-
return utils_1.constructTranslations(translations_json_1.default);
|
|
616
|
+
return (0, utils_1.constructTranslations)(translations_json_1.default);
|
|
601
617
|
}
|
|
602
618
|
render() {
|
|
603
619
|
if (this.state.error)
|
|
@@ -634,7 +650,7 @@ class LajiForm extends React.Component {
|
|
|
634
650
|
if (targetLabel)
|
|
635
651
|
translation = `${translation} ${targetLabel}`;
|
|
636
652
|
return (React.createElement("tr", { key: idx },
|
|
637
|
-
React.createElement("td", null, utils_1.stringifyKeyCombo(keyCombo)),
|
|
653
|
+
React.createElement("td", null, (0, utils_1.stringifyKeyCombo)(keyCombo)),
|
|
638
654
|
React.createElement("td", null, translation)));
|
|
639
655
|
})))),
|
|
640
656
|
this.renderSubmitHooks())));
|
|
@@ -643,7 +659,6 @@ class LajiForm extends React.Component {
|
|
|
643
659
|
return this.memoizedFormContext.services.settings.getSettings(global);
|
|
644
660
|
}
|
|
645
661
|
}
|
|
646
|
-
exports.default = LajiForm;
|
|
647
662
|
LajiForm.contextType = ReactContext_1.default;
|
|
648
663
|
LajiForm.propTypes = {
|
|
649
664
|
uiSchemaContext: PropTypes.object,
|
|
@@ -656,8 +671,9 @@ LajiForm.defaultProps = {
|
|
|
656
671
|
schema: {},
|
|
657
672
|
uiSchema: {}
|
|
658
673
|
};
|
|
674
|
+
exports.default = LajiForm;
|
|
659
675
|
const removeUndefinedFromArrays = (formData) => {
|
|
660
|
-
if (utils_1.isObject(formData)) {
|
|
676
|
+
if ((0, utils_1.isObject)(formData)) {
|
|
661
677
|
return Object.keys(formData).reduce((obj, k) => {
|
|
662
678
|
obj[k] = removeUndefinedFromArrays(formData[k]);
|
|
663
679
|
return obj;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { FieldProps } from "../types";
|
|
3
3
|
export declare function getPropsWithInnerUiSchema(props: FieldProps): FieldProps;
|
|
4
|
-
|
|
4
|
+
type Constructor<LFC> = new (...args: any[]) => LFC;
|
|
5
5
|
interface LajiFormComponentForVirtualSchemaField extends Omit<React.Component<FieldProps>, "render"> {
|
|
6
6
|
getStateFromProps?(propsWithInnerUiSchema: FieldProps, origProps: FieldProps): any;
|
|
7
7
|
render?(): React.ReactNode;
|
|
@@ -14,28 +14,28 @@ export default function VirtualSchemaField<LFC extends Constructor<LajiFormCompo
|
|
|
14
14
|
getUiOptions(): any;
|
|
15
15
|
getStateFromProps: (props: FieldProps) => any;
|
|
16
16
|
render: () => React.ReactNode;
|
|
17
|
-
readonly props: Readonly<FieldProps<any, import("../types").JSONSchemaObject>> & Readonly<{
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
}>;
|
|
20
|
-
context: any;
|
|
21
17
|
state: Readonly<{}>;
|
|
22
|
-
|
|
23
|
-
setState: <K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FieldProps
|
|
18
|
+
context: any;
|
|
19
|
+
setState: <K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<FieldProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined) => void;
|
|
24
20
|
forceUpdate: (callback?: (() => void) | undefined) => void;
|
|
21
|
+
readonly props: Readonly<FieldProps> & Readonly<{
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}>;
|
|
25
24
|
refs: {
|
|
26
25
|
[key: string]: React.ReactInstance;
|
|
27
26
|
};
|
|
28
|
-
|
|
27
|
+
componentDidMount?: (() => void) | undefined;
|
|
28
|
+
shouldComponentUpdate?: ((nextProps: Readonly<FieldProps>, nextState: Readonly<{}>, nextContext: any) => boolean) | undefined;
|
|
29
29
|
componentWillUnmount?: (() => void) | undefined;
|
|
30
30
|
componentDidCatch?: ((error: Error, errorInfo: React.ErrorInfo) => void) | undefined;
|
|
31
|
-
getSnapshotBeforeUpdate?: ((prevProps: Readonly<FieldProps
|
|
32
|
-
componentDidUpdate?: ((prevProps: Readonly<FieldProps
|
|
31
|
+
getSnapshotBeforeUpdate?: ((prevProps: Readonly<FieldProps>, prevState: Readonly<{}>) => any) | undefined;
|
|
32
|
+
componentDidUpdate?: ((prevProps: Readonly<FieldProps>, prevState: Readonly<{}>, snapshot?: any) => void) | undefined;
|
|
33
33
|
componentWillMount?: (() => void) | undefined;
|
|
34
34
|
UNSAFE_componentWillMount?: (() => void) | undefined;
|
|
35
|
-
componentWillReceiveProps?: ((nextProps: Readonly<FieldProps
|
|
36
|
-
UNSAFE_componentWillReceiveProps?: ((nextProps: Readonly<FieldProps
|
|
37
|
-
componentWillUpdate?: ((nextProps: Readonly<FieldProps
|
|
38
|
-
UNSAFE_componentWillUpdate?: ((nextProps: Readonly<FieldProps
|
|
35
|
+
componentWillReceiveProps?: ((nextProps: Readonly<FieldProps>, nextContext: any) => void) | undefined;
|
|
36
|
+
UNSAFE_componentWillReceiveProps?: ((nextProps: Readonly<FieldProps>, nextContext: any) => void) | undefined;
|
|
37
|
+
componentWillUpdate?: ((nextProps: Readonly<FieldProps>, nextState: Readonly<{}>, nextContext: any) => void) | undefined;
|
|
38
|
+
UNSAFE_componentWillUpdate?: ((nextProps: Readonly<FieldProps>, nextState: Readonly<{}>, nextContext: any) => void) | undefined;
|
|
39
39
|
};
|
|
40
40
|
displayName: string;
|
|
41
41
|
} & LFC;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -17,26 +21,36 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
17
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
23
|
};
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
27
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
43
|
};
|
|
30
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.getPropsWithInnerUiSchema =
|
|
45
|
+
exports.getPropsWithInnerUiSchema = getPropsWithInnerUiSchema;
|
|
46
|
+
exports.default = VirtualSchemaField;
|
|
32
47
|
const React = __importStar(require("react"));
|
|
33
48
|
const utils_1 = require("../utils");
|
|
34
49
|
const BaseComponent_1 = __importDefault(require("./BaseComponent"));
|
|
35
50
|
const Context_1 = __importDefault(require("../Context"));
|
|
36
51
|
function getPropsWithInnerUiSchema(props) {
|
|
37
|
-
return Object.assign(Object.assign({}, props), { uiSchema: utils_1.getInnerUiSchema(props.uiSchema) });
|
|
52
|
+
return Object.assign(Object.assign({}, props), { uiSchema: (0, utils_1.getInnerUiSchema)(props.uiSchema) });
|
|
38
53
|
}
|
|
39
|
-
exports.getPropsWithInnerUiSchema = getPropsWithInnerUiSchema;
|
|
40
54
|
/**
|
|
41
55
|
* Virtual SchemaFields are components which are just state transforming machines.
|
|
42
56
|
*/
|
|
@@ -75,23 +89,22 @@ function VirtualSchemaField(ComposedComponent) {
|
|
|
75
89
|
this.render = this.render.bind(this);
|
|
76
90
|
}
|
|
77
91
|
getUiOptions() {
|
|
78
|
-
return utils_1.getUiOptions(this.props.uiSchema);
|
|
92
|
+
return (0, utils_1.getUiOptions)(this.props.uiSchema);
|
|
79
93
|
}
|
|
80
94
|
};
|
|
81
|
-
VirtualSchemaField.displayName = utils_1.getReactComponentName(ComposedComponent);
|
|
95
|
+
VirtualSchemaField.displayName = (0, utils_1.getReactComponentName)(ComposedComponent);
|
|
82
96
|
VirtualSchemaField = __decorate([
|
|
83
97
|
BaseComponent_1.default
|
|
84
98
|
], VirtualSchemaField);
|
|
85
99
|
if (ComposedComponent.getName) {
|
|
86
100
|
const name = ComposedComponent.getName();
|
|
87
|
-
Context_1.default("VIRTUAL_SCHEMA_NAMES")[name] = true;
|
|
88
|
-
if (process.env.NODE_ENV !== "production" && ComposedComponent.getName() !== utils_1.getReactComponentName(ComposedComponent)) {
|
|
89
|
-
console.warn(`${utils_1.getReactComponentName(ComposedComponent)} getName() doesn't return it's component name! (It returned '${name}')`);
|
|
101
|
+
(0, Context_1.default)("VIRTUAL_SCHEMA_NAMES")[name] = true;
|
|
102
|
+
if (process.env.NODE_ENV !== "production" && ComposedComponent.getName() !== (0, utils_1.getReactComponentName)(ComposedComponent)) {
|
|
103
|
+
console.warn(`${(0, utils_1.getReactComponentName)(ComposedComponent)} getName() doesn't return it's component name! (It returned '${name}')`);
|
|
90
104
|
}
|
|
91
105
|
}
|
|
92
106
|
else {
|
|
93
|
-
console.warn(`${utils_1.getReactComponentName(ComposedComponent)} is missing static getName() method!`);
|
|
107
|
+
console.warn(`${(0, utils_1.getReactComponentName)(ComposedComponent)} is missing static getName() method!`);
|
|
94
108
|
}
|
|
95
109
|
return VirtualSchemaField;
|
|
96
110
|
}
|
|
97
|
-
exports.default = VirtualSchemaField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
type Props = {
|
|
3
3
|
onAffixChange?: (changed: boolean) => void;
|
|
4
4
|
topOffset?: number;
|
|
5
5
|
bottomOffset?: number;
|
|
@@ -12,7 +12,7 @@ declare enum AFFIX_STATE {
|
|
|
12
12
|
AFFIXED = "AFFIXED",
|
|
13
13
|
BOTTOM = "BOTTOM"
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
type State = {
|
|
16
16
|
affixState?: AFFIX_STATE | undefined;
|
|
17
17
|
change?: number;
|
|
18
18
|
width?: number;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
36
|
exports.Affix = void 0;
|
|
23
37
|
const React = __importStar(require("react"));
|
|
@@ -38,8 +52,8 @@ class Affix extends React.Component {
|
|
|
38
52
|
this.getState = (props) => {
|
|
39
53
|
var _a;
|
|
40
54
|
const { topOffset = 0, bottomOffset = 0, containerRef } = props;
|
|
41
|
-
const container = react_dom_1.findDOMNode((containerRef || this.containerRef).current);
|
|
42
|
-
const wrapperElem = react_dom_1.findDOMNode(this.wrapperRef.current);
|
|
55
|
+
const container = (0, react_dom_1.findDOMNode)((containerRef || this.containerRef).current);
|
|
56
|
+
const wrapperElem = (0, react_dom_1.findDOMNode)(this.wrapperRef.current);
|
|
43
57
|
if (!container || !document.body.contains(container) || !wrapperElem) {
|
|
44
58
|
return {};
|
|
45
59
|
}
|
|
@@ -48,7 +62,6 @@ class Affix extends React.Component {
|
|
|
48
62
|
const containerVisibleHeight = containerHeight + containerTop;
|
|
49
63
|
const wrapperHeight = wrapperElem.offsetHeight;
|
|
50
64
|
const wrapperScrollHeight = wrapperElem.scrollHeight;
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
52
65
|
const scrolled = this.containerRef.current.getBoundingClientRect().top < topOffset;
|
|
53
66
|
const viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
54
67
|
const bottomDist = viewportHeight - container.getBoundingClientRect().top - containerHeight;
|
|
@@ -97,7 +110,7 @@ class Affix extends React.Component {
|
|
|
97
110
|
requestAnimationFrame(this._onScroll);
|
|
98
111
|
};
|
|
99
112
|
this._onResize = () => {
|
|
100
|
-
const positioner = react_dom_1.findDOMNode(this.positionerRef.current);
|
|
113
|
+
const positioner = (0, react_dom_1.findDOMNode)(this.positionerRef.current);
|
|
101
114
|
const width = positioner.getBoundingClientRect().width;
|
|
102
115
|
const nextState = { width };
|
|
103
116
|
const currentState = this.getState(this.props);
|