@luomus/laji-form 15.0.0 → 15.1.1
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/CHANGELOG.md +0 -4
- package/dist/laji-form.js +1 -1
- package/dist/styles.css +81 -90
- package/jsonconfig.json +26 -0
- package/migrate.sh +0 -1
- package/package.json +8 -8
- package/test-export/array-spec.js +204 -0
- package/test-export/bird-point-count-spec.d.ts +1 -0
- package/test-export/bird-point-count-spec.js +62 -0
- package/test-export/collection-contest-form-spec.d.ts +1 -0
- package/test-export/collection-contest-form-spec.js +38 -0
- package/test-export/dataset-form-spec.d.ts +1 -0
- package/test-export/dataset-form-spec.js +50 -0
- package/test-export/date-time-widget-spec.d.ts +1 -0
- package/test-export/date-time-widget-spec.js +188 -0
- package/test-export/geocoder-spec.d.ts +1 -0
- package/test-export/geocoder-spec.js +135 -0
- package/test-export/image-array-spec.d.ts +1 -0
- package/test-export/image-array-spec.js +94 -0
- package/test-export/inject-field-spec.d.ts +1 -0
- package/test-export/inject-field-spec.js +148 -0
- package/test-export/internal-uuids-spec.d.ts +1 -0
- package/test-export/internal-uuids-spec.js +157 -0
- package/test-export/invasive-species-eradication-np-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-np-spec.js +18 -0
- package/test-export/invasive-species-eradication-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-spec.js +25 -0
- package/test-export/line-transect-spec.d.ts +1 -0
- package/test-export/line-transect-spec.js +121 -0
- package/test-export/mobile-form-spec.d.ts +1 -0
- package/test-export/mobile-form-spec.js +84 -0
- package/test-export/nafi-spec.d.ts +1 -0
- package/test-export/nafi-spec.js +85 -0
- package/test-export/select-widget-spec.d.ts +1 -0
- package/test-export/select-widget-spec.js +68 -0
- package/test-export/single-item-array-field-spec.d.ts +1 -0
- package/test-export/single-item-array-field-spec.js +92 -0
- package/test-export/syke-butterfly-spec.d.ts +1 -0
- package/test-export/syke-butterfly-spec.js +163 -0
- package/test-export/test-utils.d.ts +150 -176
- package/test-export/test-utils.js +218 -210
- package/test-export/transaction-form-spec.d.ts +1 -0
- package/test-export/transaction-form-spec.js +63 -0
- package/test-export/trip-report-autosuggest-spec.d.ts +1 -0
- package/test-export/trip-report-autosuggest-spec.js +272 -0
- package/test-export/trip-report-spec.d.ts +1 -0
- package/test-export/trip-report-spec.js +456 -0
- package/test-export/unit-list-shorthand-array-field-spec.d.ts +1 -0
- package/test-export/unit-list-shorthand-array-field-spec.js +71 -0
- package/test-export/validation-spec.d.ts +1 -0
- package/test-export/validation-spec.js +336 -0
- package/test-export/water-bird-spec.d.ts +1 -0
- package/test-export/water-bird-spec.js +30 -0
- package/test-export/wbc-spec.d.ts +1 -0
- package/test-export/wbc-spec.js +82 -0
- package/tsconfig.test.json +1 -1
- package/xsel -b +9 -0
- package/cypress/fixtures/example.json +0 -5
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and closes suggestion list (failed).png +0 -0
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and is marked as suggested (failed).png +0 -0
- package/lib/ApiClient.d.ts +0 -46
- package/lib/ApiClient.js +0 -93
- package/lib/Context.d.ts +0 -8
- package/lib/Context.js +0 -18
- package/lib/ReactContext.d.ts +0 -7
- package/lib/ReactContext.js +0 -5
- package/lib/components/BaseComponent.d.ts +0 -9
- package/lib/components/BaseComponent.js +0 -29
- package/lib/components/LajiForm.d.ts +0 -221
- package/lib/components/LajiForm.js +0 -615
- package/lib/components/VirtualSchemaField.d.ts +0 -42
- package/lib/components/VirtualSchemaField.js +0 -74
- package/lib/components/components.d.ts +0 -119
- package/lib/components/components.js +0 -606
- package/lib/components/fields/AnnotationField.d.ts +0 -34
- package/lib/components/fields/AnnotationField.js +0 -242
- package/lib/components/fields/AnyToBooleanField.d.ts +0 -18
- package/lib/components/fields/AnyToBooleanField.js +0 -20
- package/lib/components/fields/ArrayBulkField.d.ts +0 -23
- package/lib/components/fields/ArrayBulkField.js +0 -82
- package/lib/components/fields/ArrayCombinerField.d.ts +0 -36
- package/lib/components/fields/ArrayCombinerField.js +0 -138
- package/lib/components/fields/ArrayField.d.ts +0 -39
- package/lib/components/fields/ArrayField.js +0 -148
- package/lib/components/fields/AudioArrayField.d.ts +0 -22
- package/lib/components/fields/AudioArrayField.js +0 -100
- package/lib/components/fields/AutoArrayField.d.ts +0 -24
- package/lib/components/fields/AutoArrayField.js +0 -56
- package/lib/components/fields/AutosuggestField.d.ts +0 -69
- package/lib/components/fields/AutosuggestField.js +0 -299
- package/lib/components/fields/CombinedValueDisplayField.d.ts +0 -41
- package/lib/components/fields/CombinedValueDisplayField.js +0 -100
- package/lib/components/fields/ConditionalOnChangeField.d.ts +0 -42
- package/lib/components/fields/ConditionalOnChangeField.js +0 -107
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +0 -123
- package/lib/components/fields/ConditionalUiSchemaField.js +0 -143
- package/lib/components/fields/ContextInjectionField.d.ts +0 -24
- package/lib/components/fields/ContextInjectionField.js +0 -68
- package/lib/components/fields/DataLeakerField.d.ts +0 -40
- package/lib/components/fields/DataLeakerField.js +0 -68
- package/lib/components/fields/DefaultValueArrayField.d.ts +0 -34
- package/lib/components/fields/DefaultValueArrayField.js +0 -59
- package/lib/components/fields/DependentBooleanField.d.ts +0 -38
- package/lib/components/fields/DependentBooleanField.js +0 -87
- package/lib/components/fields/DependentDisableField.d.ts +0 -35
- package/lib/components/fields/DependentDisableField.js +0 -71
- package/lib/components/fields/EnumRangeArrayField.d.ts +0 -27
- package/lib/components/fields/EnumRangeArrayField.js +0 -115
- package/lib/components/fields/ExtraLabelRowField.d.ts +0 -38
- package/lib/components/fields/ExtraLabelRowField.js +0 -100
- package/lib/components/fields/FakePropertyField.d.ts +0 -18
- package/lib/components/fields/FakePropertyField.js +0 -48
- package/lib/components/fields/FilterArrayField.d.ts +0 -73
- package/lib/components/fields/FilterArrayField.js +0 -121
- package/lib/components/fields/FlatField.d.ts +0 -29
- package/lib/components/fields/FlatField.js +0 -171
- package/lib/components/fields/GeocoderField.d.ts +0 -47
- package/lib/components/fields/GeocoderField.js +0 -372
- package/lib/components/fields/GridLayoutField.d.ts +0 -18
- package/lib/components/fields/GridLayoutField.js +0 -32
- package/lib/components/fields/HiddenField.d.ts +0 -10
- package/lib/components/fields/HiddenField.js +0 -11
- package/lib/components/fields/ImageArrayField.d.ts +0 -172
- package/lib/components/fields/ImageArrayField.js +0 -697
- package/lib/components/fields/ImageDisplayField.d.ts +0 -18
- package/lib/components/fields/ImageDisplayField.js +0 -44
- package/lib/components/fields/InitiallyHiddenField.d.ts +0 -21
- package/lib/components/fields/InitiallyHiddenField.js +0 -58
- package/lib/components/fields/InjectDefaultValueField.d.ts +0 -37
- package/lib/components/fields/InjectDefaultValueField.js +0 -68
- package/lib/components/fields/InjectField.d.ts +0 -46
- package/lib/components/fields/InjectField.js +0 -88
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +0 -25
- package/lib/components/fields/InputWithDefaultValueButtonField.js +0 -61
- package/lib/components/fields/LocalityField.d.ts +0 -22
- package/lib/components/fields/LocalityField.js +0 -94
- package/lib/components/fields/LocationChooserField.d.ts +0 -27
- package/lib/components/fields/LocationChooserField.js +0 -440
- package/lib/components/fields/MapArrayField.d.ts +0 -78
- package/lib/components/fields/MapArrayField.js +0 -1783
- package/lib/components/fields/MapField.d.ts +0 -48
- package/lib/components/fields/MapField.js +0 -434
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +0 -25
- package/lib/components/fields/MultiAnyToBooleanField.js +0 -100
- package/lib/components/fields/MultiArrayField.d.ts +0 -53
- package/lib/components/fields/MultiArrayField.js +0 -224
- package/lib/components/fields/MultiLanguageField.d.ts +0 -13
- package/lib/components/fields/MultiLanguageField.js +0 -52
- package/lib/components/fields/MultiTagArrayField.d.ts +0 -36
- package/lib/components/fields/MultiTagArrayField.js +0 -142
- package/lib/components/fields/NamedPlaceChooserField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceChooserField.js +0 -380
- package/lib/components/fields/NamedPlaceSaverField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceSaverField.js +0 -237
- package/lib/components/fields/NestField.d.ts +0 -148
- package/lib/components/fields/NestField.js +0 -289
- package/lib/components/fields/ObjectField.d.ts +0 -2
- package/lib/components/fields/ObjectField.js +0 -119
- package/lib/components/fields/PdfArrayField.d.ts +0 -21
- package/lib/components/fields/PdfArrayField.js +0 -40
- package/lib/components/fields/PrefillingArrayField.d.ts +0 -22
- package/lib/components/fields/PrefillingArrayField.js +0 -65
- package/lib/components/fields/SchemaField.d.ts +0 -7
- package/lib/components/fields/SchemaField.js +0 -109
- package/lib/components/fields/ScopeField.d.ts +0 -85
- package/lib/components/fields/ScopeField.js +0 -521
- package/lib/components/fields/SectionArrayField.d.ts +0 -38
- package/lib/components/fields/SectionArrayField.js +0 -618
- package/lib/components/fields/SelectTreeField.d.ts +0 -39
- package/lib/components/fields/SelectTreeField.js +0 -143
- package/lib/components/fields/SingleActiveArrayField.d.ts +0 -49
- package/lib/components/fields/SingleActiveArrayField.js +0 -974
- package/lib/components/fields/SingleItemArrayField.d.ts +0 -15
- package/lib/components/fields/SingleItemArrayField.js +0 -60
- package/lib/components/fields/SortArrayField.d.ts +0 -73
- package/lib/components/fields/SortArrayField.js +0 -351
- package/lib/components/fields/SplitField.d.ts +0 -28
- package/lib/components/fields/SplitField.js +0 -65
- package/lib/components/fields/StringToArrayField.d.ts +0 -24
- package/lib/components/fields/StringToArrayField.js +0 -48
- package/lib/components/fields/SumField.d.ts +0 -35
- package/lib/components/fields/SumField.js +0 -83
- package/lib/components/fields/TableField.d.ts +0 -18
- package/lib/components/fields/TableField.js +0 -136
- package/lib/components/fields/TagArrayField.d.ts +0 -38
- package/lib/components/fields/TagArrayField.js +0 -128
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +0 -26
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +0 -81
- package/lib/components/fields/UiFieldApplierField.d.ts +0 -30
- package/lib/components/fields/UiFieldApplierField.js +0 -106
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +0 -42
- package/lib/components/fields/UiFieldMapperArrayField.js +0 -121
- package/lib/components/fields/UnitCountShorthandField.d.ts +0 -22
- package/lib/components/fields/UnitCountShorthandField.js +0 -149
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +0 -26
- package/lib/components/fields/UnitListShorthandArrayField.js +0 -108
- package/lib/components/fields/UnitShorthandField.d.ts +0 -32
- package/lib/components/fields/UnitShorthandField.js +0 -220
- package/lib/components/templates/ArrayFieldTemplate.d.ts +0 -85
- package/lib/components/templates/ArrayFieldTemplate.js +0 -417
- package/lib/components/templates/BaseInputTemplate.d.ts +0 -11
- package/lib/components/templates/BaseInputTemplate.js +0 -80
- package/lib/components/templates/DescriptionField.d.ts +0 -1
- package/lib/components/templates/DescriptionField.js +0 -37
- package/lib/components/templates/ErrorListTemplate.d.ts +0 -9
- package/lib/components/templates/ErrorListTemplate.js +0 -95
- package/lib/components/templates/FieldTemplate.d.ts +0 -6
- package/lib/components/templates/FieldTemplate.js +0 -112
- package/lib/components/templates/ObjectFieldTemplate.d.ts +0 -7
- package/lib/components/templates/ObjectFieldTemplate.js +0 -66
- package/lib/components/templates/TitleField.d.ts +0 -9
- package/lib/components/templates/TitleField.js +0 -51
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +0 -20
- package/lib/components/widgets/AnyToBooleanWidget.js +0 -49
- package/lib/components/widgets/AutosuggestWidget.d.ts +0 -66
- package/lib/components/widgets/AutosuggestWidget.js +0 -1127
- package/lib/components/widgets/CheckboxWidget.d.ts +0 -37
- package/lib/components/widgets/CheckboxWidget.js +0 -139
- package/lib/components/widgets/DateTimeWidget.d.ts +0 -62
- package/lib/components/widgets/DateTimeWidget.js +0 -251
- package/lib/components/widgets/DateWidget.d.ts +0 -23
- package/lib/components/widgets/DateWidget.js +0 -41
- package/lib/components/widgets/HiddenWidget.d.ts +0 -15
- package/lib/components/widgets/HiddenWidget.js +0 -19
- package/lib/components/widgets/ImageSelectWidget.d.ts +0 -14
- package/lib/components/widgets/ImageSelectWidget.js +0 -57
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +0 -43
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +0 -237
- package/lib/components/widgets/InputGroupWidget.d.ts +0 -21
- package/lib/components/widgets/InputGroupWidget.js +0 -36
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +0 -21
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +0 -47
- package/lib/components/widgets/NumberWidget.d.ts +0 -13
- package/lib/components/widgets/NumberWidget.js +0 -21
- package/lib/components/widgets/PlainTextWidget.d.ts +0 -12
- package/lib/components/widgets/PlainTextWidget.js +0 -24
- package/lib/components/widgets/SelectWidget.d.ts +0 -52
- package/lib/components/widgets/SelectWidget.js +0 -158
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +0 -19
- package/lib/components/widgets/SeparatedDateTimeWidget.js +0 -59
- package/lib/components/widgets/TaxonImageWidget.d.ts +0 -13
- package/lib/components/widgets/TaxonImageWidget.js +0 -30
- package/lib/components/widgets/TextSelectWidget.d.ts +0 -25
- package/lib/components/widgets/TextSelectWidget.js +0 -94
- package/lib/components/widgets/TextareaWidget.d.ts +0 -32
- package/lib/components/widgets/TextareaWidget.js +0 -87
- package/lib/components/widgets/TimeWidget.d.ts +0 -11
- package/lib/components/widgets/TimeWidget.js +0 -19
- package/lib/components/widgets/URLWidget.d.ts +0 -14
- package/lib/components/widgets/URLWidget.js +0 -12
- package/lib/components/widgets/UpperCaseWidget.d.ts +0 -13
- package/lib/components/widgets/UpperCaseWidget.js +0 -21
- package/lib/index.d.ts +0 -20
- package/lib/index.js +0 -50
- package/lib/services/blocker-service.d.ts +0 -11
- package/lib/services/blocker-service.js +0 -55
- package/lib/services/custom-event-service.d.ts +0 -17
- package/lib/services/custom-event-service.js +0 -35
- package/lib/services/dom-id-service.d.ts +0 -8
- package/lib/services/dom-id-service.js +0 -30
- package/lib/services/focus-service.d.ts +0 -13
- package/lib/services/focus-service.js +0 -60
- package/lib/services/id-service.d.ts +0 -22
- package/lib/services/id-service.js +0 -130
- package/lib/services/key-handler-service.d.ts +0 -56
- package/lib/services/key-handler-service.js +0 -184
- package/lib/services/root-instance-service.d.ts +0 -25
- package/lib/services/root-instance-service.js +0 -49
- package/lib/services/settings-service.d.ts +0 -34
- package/lib/services/settings-service.js +0 -154
- package/lib/services/singleton-map-service.d.ts +0 -23
- package/lib/services/singleton-map-service.js +0 -44
- package/lib/services/submit-hook-service.d.ts +0 -24
- package/lib/services/submit-hook-service.js +0 -73
- package/lib/styles.js +0 -4
- package/lib/themes/bs3.d.ts +0 -3
- package/lib/themes/bs3.js +0 -133
- package/lib/themes/bs5.d.ts +0 -3
- package/lib/themes/bs5.js +0 -111
- package/lib/themes/glyphicon-fa-mapping.d.ts +0 -3
- package/lib/themes/glyphicon-fa-mapping.js +0 -271
- package/lib/themes/stub.d.ts +0 -3
- package/lib/themes/stub.js +0 -82
- package/lib/themes/theme.d.ts +0 -233
- package/lib/themes/theme.js +0 -2
- package/lib/translations.json +0 -847
- package/lib/utils.d.ts +0 -171
- package/lib/utils.js +0 -1191
- package/lib/validation.d.ts +0 -7
- package/lib/validation.js +0 -141
- package/llol +0 -10
- package/llol.pdf +0 -10
- package/playwright-report/index.html +0 -62
- package/q +0 -196
- package/rename.sh +0 -24
- package/trip-report.spec.ts +0 -594
- /package/{lib/styles.d.ts → test-export/array-spec.d.ts} +0 -0
package/lib/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const LajiForm_1 = require("./components/LajiForm");
|
|
15
|
-
const React = require("react");
|
|
16
|
-
const react_dom_1 = require("react-dom");
|
|
17
|
-
class LajiFormWrapper {
|
|
18
|
-
constructor(props) {
|
|
19
|
-
this.submit = () => {
|
|
20
|
-
this.lajiForm.submit();
|
|
21
|
-
};
|
|
22
|
-
this.submitOnlySchemaValidations = () => {
|
|
23
|
-
this.lajiForm.submitOnlySchemaValidations();
|
|
24
|
-
};
|
|
25
|
-
this.setState = (state) => {
|
|
26
|
-
this.state = Object.assign(Object.assign({}, this.state), state);
|
|
27
|
-
this.lajiForm = react_dom_1.render(React.createElement(LajiForm_1.default, Object.assign(Object.assign({}, this.props), this.state), null), this.rootElem);
|
|
28
|
-
};
|
|
29
|
-
this.pushBlockingLoader = () => {
|
|
30
|
-
this.lajiForm.pushBlockingLoader();
|
|
31
|
-
};
|
|
32
|
-
this.popBlockingLoader = () => {
|
|
33
|
-
this.lajiForm.popBlockingLoader();
|
|
34
|
-
};
|
|
35
|
-
this.getSettings = () => {
|
|
36
|
-
return this.lajiForm.getSettings();
|
|
37
|
-
};
|
|
38
|
-
this.destroy = () => {
|
|
39
|
-
this.lajiForm.destroy();
|
|
40
|
-
react_dom_1.unmountComponentAtNode(this.rootElem);
|
|
41
|
-
};
|
|
42
|
-
this.unmount = this.destroy;
|
|
43
|
-
const { rootElem } = props, _props = __rest(props, ["rootElem"]);
|
|
44
|
-
this.props = props;
|
|
45
|
-
this.rootElem = rootElem;
|
|
46
|
-
this.lajiForm = react_dom_1.render(React.createElement(LajiForm_1.default, _props, null), this.rootElem);
|
|
47
|
-
this.state = {};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.default = LajiFormWrapper;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FormContext } from "../components/LajiForm";
|
|
2
|
-
export default class BlockerService {
|
|
3
|
-
private formContext;
|
|
4
|
-
private blockingLoaderCounter;
|
|
5
|
-
private blockingLoaderRef;
|
|
6
|
-
constructor(formContext: FormContext);
|
|
7
|
-
initialize(): void;
|
|
8
|
-
destroy(): void;
|
|
9
|
-
push: () => void;
|
|
10
|
-
pop: () => void;
|
|
11
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class BlockerService {
|
|
4
|
-
constructor(formContext) {
|
|
5
|
-
this.blockingLoaderCounter = 0;
|
|
6
|
-
this.push = () => {
|
|
7
|
-
this.blockingLoaderCounter++;
|
|
8
|
-
if (this.blockingLoaderCounter === 1) {
|
|
9
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader entering";
|
|
10
|
-
this.formContext.services.keyHandler.block();
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
this.pop = () => {
|
|
14
|
-
this.blockingLoaderCounter--;
|
|
15
|
-
if (this.blockingLoaderCounter < 0) {
|
|
16
|
-
console.warn("laji-form: Blocking loader was popped before pushing!");
|
|
17
|
-
}
|
|
18
|
-
else if (this.blockingLoaderCounter === 0) {
|
|
19
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader leave-start";
|
|
20
|
-
this.formContext.setTimeout(() => {
|
|
21
|
-
if (this.blockingLoaderCounter > 0) {
|
|
22
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader entering";
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (this.blockingLoaderRef)
|
|
26
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader leaving";
|
|
27
|
-
this.formContext.setTimeout(() => {
|
|
28
|
-
if (!this.blockingLoaderRef) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (this.blockingLoaderCounter > 0) {
|
|
32
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader entering";
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader";
|
|
36
|
-
}
|
|
37
|
-
}, 200); // should match css transition time.
|
|
38
|
-
});
|
|
39
|
-
this.formContext.services.keyHandler.unblock();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
this.formContext = formContext;
|
|
43
|
-
}
|
|
44
|
-
initialize() {
|
|
45
|
-
this.blockingLoaderRef = document.createElement("div");
|
|
46
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader";
|
|
47
|
-
if (this.blockingLoaderCounter > 0)
|
|
48
|
-
this.blockingLoaderRef.className = "laji-form blocking-loader entering";
|
|
49
|
-
document.body.appendChild(this.blockingLoaderRef);
|
|
50
|
-
}
|
|
51
|
-
destroy() {
|
|
52
|
-
document.body.removeChild(this.blockingLoaderRef);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.default = BlockerService;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare type CustomEventListener = (data?: any, callback?: () => void) => boolean | void;
|
|
2
|
-
/**
|
|
3
|
-
* A service for sending events outside DOM.
|
|
4
|
-
*/
|
|
5
|
-
export default class CustomEventService {
|
|
6
|
-
eventListeners: {
|
|
7
|
-
[eventName: string]: {
|
|
8
|
-
[id: string]: CustomEventListener[];
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
add(id: string, eventName: string, fn: CustomEventListener): void;
|
|
12
|
-
remove(id: string, eventName: string, fn: CustomEventListener): void;
|
|
13
|
-
send(id: string, eventName: string, data?: any, callback?: () => void, { bubble }?: {
|
|
14
|
-
bubble?: boolean | undefined;
|
|
15
|
-
}): void;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* A service for sending events outside DOM.
|
|
5
|
-
*/
|
|
6
|
-
class CustomEventService {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.eventListeners = {};
|
|
9
|
-
}
|
|
10
|
-
add(id, eventName, fn) {
|
|
11
|
-
if (!this.eventListeners[eventName])
|
|
12
|
-
this.eventListeners[eventName] = {};
|
|
13
|
-
if (!this.eventListeners[eventName][id])
|
|
14
|
-
this.eventListeners[eventName][id] = [];
|
|
15
|
-
this.eventListeners[eventName][id].push(fn);
|
|
16
|
-
}
|
|
17
|
-
remove(id, eventName, fn) {
|
|
18
|
-
this.eventListeners[eventName][id] = this.eventListeners[eventName][id].filter(_fn => _fn !== fn);
|
|
19
|
-
}
|
|
20
|
-
send(id, eventName, data, callback, { bubble = true } = {}) {
|
|
21
|
-
const ids = Object.keys(this.eventListeners[eventName] || {}).filter(_id => id.startsWith(_id)).sort().reverse();
|
|
22
|
-
outer: for (let _id of ids) {
|
|
23
|
-
for (let listener of this.eventListeners[eventName][_id]) {
|
|
24
|
-
const result = listener(data, callback);
|
|
25
|
-
if (!bubble)
|
|
26
|
-
break outer;
|
|
27
|
-
if (result === true || result === undefined) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
callback && callback();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.default = CustomEventService;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keeps track of reserved DOM IDs so that the IDs are rendered only once.
|
|
3
|
-
**/
|
|
4
|
-
export default class DOMIdService {
|
|
5
|
-
private ids;
|
|
6
|
-
reserve: (id: string, sendId: (id: string) => void) => string | void;
|
|
7
|
-
release: (id: string, sendId: (id: string) => void) => void;
|
|
8
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Keeps track of reserved DOM IDs so that the IDs are rendered only once.
|
|
5
|
-
**/
|
|
6
|
-
class DOMIdService {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.ids = {};
|
|
9
|
-
// First call returns id, next call (and only the very next) reserves the id until it is released.
|
|
10
|
-
this.reserve = (id, sendId) => {
|
|
11
|
-
if (this.ids[id] && this.ids[id].length) {
|
|
12
|
-
this.ids[id].push(sendId);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
this.ids[id] = [sendId]; // Just mark that the id is now used. It isn't reserved yet.
|
|
16
|
-
return id;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
this.release = (id, sendId) => {
|
|
20
|
-
if (this.ids[id]) {
|
|
21
|
-
const idx = this.ids[id].indexOf(sendId);
|
|
22
|
-
this.ids[id].splice(idx, 1);
|
|
23
|
-
if (this.ids[id].length > 0) {
|
|
24
|
-
this.ids[id][0](id);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = DOMIdService;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FormContext } from "../components/LajiForm";
|
|
2
|
-
declare type FocusHandler = () => Promise<void> | void;
|
|
3
|
-
export default class FocusService {
|
|
4
|
-
private formContext;
|
|
5
|
-
private focusHandlers;
|
|
6
|
-
constructor(formContext: FormContext);
|
|
7
|
-
setFormContext(formContext: FormContext): void;
|
|
8
|
-
addFocusHandler(id: string, fn: FocusHandler): void;
|
|
9
|
-
removeFocusHandler(id: string, fn: FocusHandler): void;
|
|
10
|
-
focus(id: string): void;
|
|
11
|
-
focusNextInput(reverse?: boolean): void;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../utils");
|
|
4
|
-
class FocusService {
|
|
5
|
-
constructor(formContext) {
|
|
6
|
-
this.focusHandlers = {};
|
|
7
|
-
this.formContext = formContext;
|
|
8
|
-
this.focus = this.focus.bind(this);
|
|
9
|
-
this.focusNextInput = this.focusNextInput.bind(this);
|
|
10
|
-
}
|
|
11
|
-
setFormContext(formContext) {
|
|
12
|
-
this.formContext = formContext;
|
|
13
|
-
}
|
|
14
|
-
addFocusHandler(id, fn) {
|
|
15
|
-
if (!this.focusHandlers[id])
|
|
16
|
-
this.focusHandlers[id] = [];
|
|
17
|
-
this.focusHandlers[id].push(fn);
|
|
18
|
-
}
|
|
19
|
-
removeFocusHandler(id, fn) {
|
|
20
|
-
if (!this.focusHandlers[id]) {
|
|
21
|
-
console.warn(`laji-form warning: removing focus handler that isn't registered for id ${id}.`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
this.focusHandlers[id] = this.focusHandlers[id].filter(_fn => fn !== _fn);
|
|
25
|
-
}
|
|
26
|
-
focus(id) {
|
|
27
|
-
const idParts = id.split("_");
|
|
28
|
-
// Some components focus asynchronously (due to state changes etc), so we reduce
|
|
29
|
-
// the focus handlers to a promise chain.
|
|
30
|
-
let _id = "";
|
|
31
|
-
idParts.reduce((promise, idPart) => {
|
|
32
|
-
return promise.then(() => {
|
|
33
|
-
_id = _id ? `${_id}_${idPart}` : idPart;
|
|
34
|
-
return (this.focusHandlers[_id] || []).reduce((_promise, fn) => {
|
|
35
|
-
const status = fn(); // Either undefined or a Promise.
|
|
36
|
-
return status && status.then ? status : Promise.resolve();
|
|
37
|
-
}, Promise.resolve());
|
|
38
|
-
});
|
|
39
|
-
}, Promise.resolve()).then(() => {
|
|
40
|
-
const container = this.formContext.utils.getSchemaElementById(id);
|
|
41
|
-
const elem = container || document.querySelector(`#laji-form-error-container-${id}`);
|
|
42
|
-
const input = document.querySelector(`#${id}`);
|
|
43
|
-
if (elem)
|
|
44
|
-
utils_1.scrollIntoViewIfNeeded(elem, this.formContext.topOffset, this.formContext.bottomOffset);
|
|
45
|
-
if (input && input.focus)
|
|
46
|
-
input.focus();
|
|
47
|
-
if (!elem)
|
|
48
|
-
return;
|
|
49
|
-
utils_1.highlightElem(elem);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
focusNextInput(reverse = false) {
|
|
53
|
-
if (!this.formContext.formRef.current) {
|
|
54
|
-
console.warn("Focus service can't doesn't have ref to the form");
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
return this.formContext.utils.focusNextInput(reverse);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.default = FocusService;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { RJSFSchema } from "@rjsf/utils";
|
|
2
|
-
export default class IdService {
|
|
3
|
-
private tmpIdTree;
|
|
4
|
-
private formData;
|
|
5
|
-
constructor(schema: RJSFSchema, formData: any);
|
|
6
|
-
setSchema(schema: RJSFSchema): void;
|
|
7
|
-
setFormData(formData: any): void;
|
|
8
|
-
addLajiFormIds(formData: any, immutably?: boolean): [any, {
|
|
9
|
-
[id: string]: true;
|
|
10
|
-
}];
|
|
11
|
-
getAllLajiFormIdsDeeply(formData: any): {
|
|
12
|
-
[id: string]: true;
|
|
13
|
-
};
|
|
14
|
-
removeLajiFormIds(formData: any): any;
|
|
15
|
-
getUUID: (item: any) => any;
|
|
16
|
-
findPointerForLajiFormId(tmpIdTree: any, formData: any, lajiFormId: string | number): string | undefined;
|
|
17
|
-
getJSONPointerFromLajiFormIdAndRelativePointer(lajiFormId: string | number, relativePointer: string): string;
|
|
18
|
-
getJSONPointerFromLajiFormIdAndFormDataAndIdSchemaId(idSchemaId: string, lajiFormId: string | number): string;
|
|
19
|
-
getRelativePointer(idSchemaId: string, lajiFormId: string | number): string | undefined;
|
|
20
|
-
getRelativeTmpIdTree(id: string): any;
|
|
21
|
-
}
|
|
22
|
-
export declare function createTmpIdTree(schema: RJSFSchema): {} | undefined;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTmpIdTree = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
class IdService {
|
|
6
|
-
constructor(schema, formData) {
|
|
7
|
-
this.getUUID = (item) => item ? (item.id || item._lajiFormId) : undefined;
|
|
8
|
-
this.tmpIdTree = createTmpIdTree(schema);
|
|
9
|
-
this.formData = formData;
|
|
10
|
-
}
|
|
11
|
-
setSchema(schema) {
|
|
12
|
-
this.tmpIdTree = createTmpIdTree(schema);
|
|
13
|
-
}
|
|
14
|
-
setFormData(formData) {
|
|
15
|
-
this.formData = formData;
|
|
16
|
-
}
|
|
17
|
-
addLajiFormIds(formData, immutably = true) {
|
|
18
|
-
return utils_1.addLajiFormIds(formData, this.tmpIdTree, immutably);
|
|
19
|
-
}
|
|
20
|
-
getAllLajiFormIdsDeeply(formData) {
|
|
21
|
-
return utils_1.getAllLajiFormIdsDeeply(formData, this.tmpIdTree);
|
|
22
|
-
}
|
|
23
|
-
removeLajiFormIds(formData) {
|
|
24
|
-
return utils_1.removeLajiFormIds(formData, this.tmpIdTree);
|
|
25
|
-
}
|
|
26
|
-
findPointerForLajiFormId(tmpIdTree = {}, formData, lajiFormId) {
|
|
27
|
-
if (tmpIdTree._hasId) {
|
|
28
|
-
if (Array.isArray(formData)) {
|
|
29
|
-
for (let idx in (formData || [])) {
|
|
30
|
-
const item = formData[idx];
|
|
31
|
-
if (this.getUUID(item) === lajiFormId) {
|
|
32
|
-
return "/" + idx;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else if (formData && this.getUUID(formData) === lajiFormId) {
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
for (const k of Object.keys(tmpIdTree)) {
|
|
41
|
-
if (utils_1.isObject(formData[k])) {
|
|
42
|
-
const find = this.findPointerForLajiFormId(tmpIdTree[k], formData[k], lajiFormId);
|
|
43
|
-
if (find !== undefined || find === "") {
|
|
44
|
-
return `/${k}${find}`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else if (Array.isArray(formData[k])) {
|
|
48
|
-
for (const i in formData[k]) {
|
|
49
|
-
const item = formData[k][i];
|
|
50
|
-
const find = this.findPointerForLajiFormId(tmpIdTree[k], item, lajiFormId);
|
|
51
|
-
if (find !== undefined || find === "") {
|
|
52
|
-
return `/${k}/${i}${find}`;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
getJSONPointerFromLajiFormIdAndRelativePointer(lajiFormId, relativePointer) {
|
|
60
|
-
const containerPointer = this.findPointerForLajiFormId(this.tmpIdTree, this.formData, lajiFormId);
|
|
61
|
-
if (!containerPointer) {
|
|
62
|
-
return "";
|
|
63
|
-
}
|
|
64
|
-
return containerPointer + relativePointer;
|
|
65
|
-
}
|
|
66
|
-
getJSONPointerFromLajiFormIdAndFormDataAndIdSchemaId(idSchemaId, lajiFormId) {
|
|
67
|
-
const relativePointer = this.getRelativePointer(idSchemaId, lajiFormId);
|
|
68
|
-
return this.getJSONPointerFromLajiFormIdAndRelativePointer(lajiFormId, relativePointer || "");
|
|
69
|
-
}
|
|
70
|
-
getRelativePointer(idSchemaId, lajiFormId) {
|
|
71
|
-
var _a;
|
|
72
|
-
const containerPointer = this.findPointerForLajiFormId(this.tmpIdTree, this.formData, lajiFormId);
|
|
73
|
-
if (!containerPointer) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const indicesCount = ((_a = containerPointer.match(/\/[0-9]+/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
77
|
-
const containerPointerWithoutArrayIndices = containerPointer.replace(/[0-9]+/g, "");
|
|
78
|
-
const thisPointer = idSchemaId.replace("root", "").replace(/_/g, "/");
|
|
79
|
-
let thisPointerWithoutContainerIndices = thisPointer;
|
|
80
|
-
for (let i = indicesCount; i > 0; i--) {
|
|
81
|
-
thisPointerWithoutContainerIndices = thisPointerWithoutContainerIndices.replace(/[0-9]+/, "");
|
|
82
|
-
}
|
|
83
|
-
return thisPointerWithoutContainerIndices.replace(containerPointerWithoutArrayIndices, "");
|
|
84
|
-
}
|
|
85
|
-
getRelativeTmpIdTree(id) {
|
|
86
|
-
let tmpIdTree = this.tmpIdTree;
|
|
87
|
-
if (!tmpIdTree) {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
const treePath = id.replace(/root|_[0-9]+|_/g, "_").split("_").filter(i => i);
|
|
91
|
-
for (const k of treePath) {
|
|
92
|
-
if (tmpIdTree[k]) {
|
|
93
|
-
tmpIdTree = tmpIdTree[k];
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
tmpIdTree = undefined;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return tmpIdTree;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.default = IdService;
|
|
104
|
-
function createTmpIdTree(schema) {
|
|
105
|
-
function walk(_schema) {
|
|
106
|
-
if (_schema.properties) {
|
|
107
|
-
const _walked = Object.keys(_schema.properties).reduce((paths, key) => {
|
|
108
|
-
const walked = walk(_schema.properties[key]);
|
|
109
|
-
if (walked) {
|
|
110
|
-
paths[key] = walked;
|
|
111
|
-
}
|
|
112
|
-
return paths;
|
|
113
|
-
}, {});
|
|
114
|
-
if (Object.keys(_walked).length)
|
|
115
|
-
return _walked;
|
|
116
|
-
}
|
|
117
|
-
else if (_schema.type === "array" && _schema.items.type === "object") {
|
|
118
|
-
return Object.keys(_schema.items.properties).reduce((paths, key) => {
|
|
119
|
-
const walked = walk(_schema.items.properties[key]);
|
|
120
|
-
if (walked) {
|
|
121
|
-
paths[key] = walked;
|
|
122
|
-
}
|
|
123
|
-
return paths;
|
|
124
|
-
}, { _hasId: true });
|
|
125
|
-
}
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
return walk(schema);
|
|
129
|
-
}
|
|
130
|
-
exports.createTmpIdTree = createTmpIdTree;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FormContext } from "../components/LajiForm";
|
|
3
|
-
export declare type KeyFunctions = {
|
|
4
|
-
[fnName: string]: (e: KeyboardEvent, options: any) => boolean | void;
|
|
5
|
-
};
|
|
6
|
-
interface ShortcutKey {
|
|
7
|
-
fn: string;
|
|
8
|
-
target?: string;
|
|
9
|
-
[param: string]: any;
|
|
10
|
-
}
|
|
11
|
-
export declare type ShortcutKeys = Record<string, ShortcutKey>;
|
|
12
|
-
export interface InternalKeyHandler extends ShortcutKey {
|
|
13
|
-
conditions: ((e: KeyboardEvent) => boolean)[];
|
|
14
|
-
}
|
|
15
|
-
declare type InternalKeyHandlers = InternalKeyHandler[];
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* A service for adding key listeners. Key events are handled in a custom event handling system, which allows many useful
|
|
19
|
-
* features like listening to DOM document root, fine grained control over the order of event bubbling etc and passing any
|
|
20
|
-
* needed data to the event handler.
|
|
21
|
-
*
|
|
22
|
-
* When initialized, it adds a global keydown listener to the document which handles the LajiForm key shortcuts defined in
|
|
23
|
-
* uiSchema["ui:shortcuts"].
|
|
24
|
-
*
|
|
25
|
-
**/
|
|
26
|
-
export default class KeyhandlerService {
|
|
27
|
-
shortcuts: ShortcutKeys;
|
|
28
|
-
private keyHandlers;
|
|
29
|
-
private keyHandlerTargets;
|
|
30
|
-
private keyHandleListeners;
|
|
31
|
-
private keyHandleIdFunctions;
|
|
32
|
-
private blocked;
|
|
33
|
-
private formContext;
|
|
34
|
-
private globalEventsRootHandler;
|
|
35
|
-
private globalEventHandlers;
|
|
36
|
-
constructor(formContext: FormContext);
|
|
37
|
-
initialize(): void;
|
|
38
|
-
destroy(): void;
|
|
39
|
-
block(): void;
|
|
40
|
-
unblock(): void;
|
|
41
|
-
setShortcuts(shortcuts: ShortcutKeys | undefined, keyFunctions: KeyFunctions): void;
|
|
42
|
-
setFormContext(formContext: FormContext): void;
|
|
43
|
-
getKeyHandlers(shortcuts?: ShortcutKeys): InternalKeyHandlers;
|
|
44
|
-
addKeyHandler: (id: string, keyFunctions: KeyFunctions, additionalParams?: any) => void;
|
|
45
|
-
removeKeyHandler: (_id: string, _keyFunctions: {
|
|
46
|
-
[fnName: string]: () => boolean | void;
|
|
47
|
-
}) => void;
|
|
48
|
-
onKeyDown(e: KeyboardEvent): void;
|
|
49
|
-
/**
|
|
50
|
-
* Global event handlers are listened for the whole DOM document. React can't listen to events on document level, hence this is useful.
|
|
51
|
-
**/
|
|
52
|
-
addGlobalEventHandler(name: string, fn: React.EventHandler<any>): void;
|
|
53
|
-
removeGlobalEventHandler(name: string, fn: React.EventHandler<any>): void;
|
|
54
|
-
private handleKeysWith;
|
|
55
|
-
}
|
|
56
|
-
export {};
|