@luomus/laji-form 15.1.0 → 15.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/CHANGELOG.md +0 -4
  2. package/dist/laji-form.js +1 -1
  3. package/jsonconfig.json +26 -0
  4. package/migrate.sh +0 -1
  5. package/package.json +8 -8
  6. package/test-export/test-utils.d.ts +100 -54
  7. package/test-export/test-utils.js +102 -84
  8. package/xsel -b +9 -0
  9. package/cypress/fixtures/example.json +0 -5
  10. package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and closes suggestion list (failed).png +0 -0
  11. package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and is marked as suggested (failed).png +0 -0
  12. package/lib/ApiClient.d.ts +0 -46
  13. package/lib/ApiClient.js +0 -93
  14. package/lib/Context.d.ts +0 -8
  15. package/lib/Context.js +0 -18
  16. package/lib/ReactContext.d.ts +0 -7
  17. package/lib/ReactContext.js +0 -5
  18. package/lib/components/BaseComponent.d.ts +0 -9
  19. package/lib/components/BaseComponent.js +0 -29
  20. package/lib/components/LajiForm.d.ts +0 -221
  21. package/lib/components/LajiForm.js +0 -615
  22. package/lib/components/VirtualSchemaField.d.ts +0 -42
  23. package/lib/components/VirtualSchemaField.js +0 -74
  24. package/lib/components/components.d.ts +0 -119
  25. package/lib/components/components.js +0 -606
  26. package/lib/components/fields/AnnotationField.d.ts +0 -34
  27. package/lib/components/fields/AnnotationField.js +0 -242
  28. package/lib/components/fields/AnyToBooleanField.d.ts +0 -18
  29. package/lib/components/fields/AnyToBooleanField.js +0 -20
  30. package/lib/components/fields/ArrayBulkField.d.ts +0 -23
  31. package/lib/components/fields/ArrayBulkField.js +0 -82
  32. package/lib/components/fields/ArrayCombinerField.d.ts +0 -36
  33. package/lib/components/fields/ArrayCombinerField.js +0 -138
  34. package/lib/components/fields/ArrayField.d.ts +0 -39
  35. package/lib/components/fields/ArrayField.js +0 -148
  36. package/lib/components/fields/AudioArrayField.d.ts +0 -22
  37. package/lib/components/fields/AudioArrayField.js +0 -100
  38. package/lib/components/fields/AutoArrayField.d.ts +0 -24
  39. package/lib/components/fields/AutoArrayField.js +0 -56
  40. package/lib/components/fields/AutosuggestField.d.ts +0 -69
  41. package/lib/components/fields/AutosuggestField.js +0 -299
  42. package/lib/components/fields/CombinedValueDisplayField.d.ts +0 -41
  43. package/lib/components/fields/CombinedValueDisplayField.js +0 -100
  44. package/lib/components/fields/ConditionalOnChangeField.d.ts +0 -42
  45. package/lib/components/fields/ConditionalOnChangeField.js +0 -107
  46. package/lib/components/fields/ConditionalUiSchemaField.d.ts +0 -123
  47. package/lib/components/fields/ConditionalUiSchemaField.js +0 -143
  48. package/lib/components/fields/ContextInjectionField.d.ts +0 -24
  49. package/lib/components/fields/ContextInjectionField.js +0 -68
  50. package/lib/components/fields/DataLeakerField.d.ts +0 -40
  51. package/lib/components/fields/DataLeakerField.js +0 -68
  52. package/lib/components/fields/DefaultValueArrayField.d.ts +0 -34
  53. package/lib/components/fields/DefaultValueArrayField.js +0 -59
  54. package/lib/components/fields/DependentBooleanField.d.ts +0 -38
  55. package/lib/components/fields/DependentBooleanField.js +0 -87
  56. package/lib/components/fields/DependentDisableField.d.ts +0 -35
  57. package/lib/components/fields/DependentDisableField.js +0 -71
  58. package/lib/components/fields/EnumRangeArrayField.d.ts +0 -27
  59. package/lib/components/fields/EnumRangeArrayField.js +0 -115
  60. package/lib/components/fields/ExtraLabelRowField.d.ts +0 -38
  61. package/lib/components/fields/ExtraLabelRowField.js +0 -100
  62. package/lib/components/fields/FakePropertyField.d.ts +0 -18
  63. package/lib/components/fields/FakePropertyField.js +0 -48
  64. package/lib/components/fields/FilterArrayField.d.ts +0 -73
  65. package/lib/components/fields/FilterArrayField.js +0 -121
  66. package/lib/components/fields/FlatField.d.ts +0 -29
  67. package/lib/components/fields/FlatField.js +0 -171
  68. package/lib/components/fields/GeocoderField.d.ts +0 -47
  69. package/lib/components/fields/GeocoderField.js +0 -372
  70. package/lib/components/fields/GridLayoutField.d.ts +0 -18
  71. package/lib/components/fields/GridLayoutField.js +0 -32
  72. package/lib/components/fields/HiddenField.d.ts +0 -10
  73. package/lib/components/fields/HiddenField.js +0 -11
  74. package/lib/components/fields/ImageArrayField.d.ts +0 -172
  75. package/lib/components/fields/ImageArrayField.js +0 -697
  76. package/lib/components/fields/ImageDisplayField.d.ts +0 -18
  77. package/lib/components/fields/ImageDisplayField.js +0 -44
  78. package/lib/components/fields/InitiallyHiddenField.d.ts +0 -21
  79. package/lib/components/fields/InitiallyHiddenField.js +0 -58
  80. package/lib/components/fields/InjectDefaultValueField.d.ts +0 -37
  81. package/lib/components/fields/InjectDefaultValueField.js +0 -68
  82. package/lib/components/fields/InjectField.d.ts +0 -46
  83. package/lib/components/fields/InjectField.js +0 -88
  84. package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +0 -25
  85. package/lib/components/fields/InputWithDefaultValueButtonField.js +0 -61
  86. package/lib/components/fields/LocalityField.d.ts +0 -22
  87. package/lib/components/fields/LocalityField.js +0 -94
  88. package/lib/components/fields/LocationChooserField.d.ts +0 -27
  89. package/lib/components/fields/LocationChooserField.js +0 -440
  90. package/lib/components/fields/MapArrayField.d.ts +0 -78
  91. package/lib/components/fields/MapArrayField.js +0 -1783
  92. package/lib/components/fields/MapField.d.ts +0 -48
  93. package/lib/components/fields/MapField.js +0 -434
  94. package/lib/components/fields/MultiAnyToBooleanField.d.ts +0 -25
  95. package/lib/components/fields/MultiAnyToBooleanField.js +0 -100
  96. package/lib/components/fields/MultiArrayField.d.ts +0 -53
  97. package/lib/components/fields/MultiArrayField.js +0 -224
  98. package/lib/components/fields/MultiLanguageField.d.ts +0 -13
  99. package/lib/components/fields/MultiLanguageField.js +0 -52
  100. package/lib/components/fields/MultiTagArrayField.d.ts +0 -36
  101. package/lib/components/fields/MultiTagArrayField.js +0 -142
  102. package/lib/components/fields/NamedPlaceChooserField.d.ts +0 -29
  103. package/lib/components/fields/NamedPlaceChooserField.js +0 -380
  104. package/lib/components/fields/NamedPlaceSaverField.d.ts +0 -29
  105. package/lib/components/fields/NamedPlaceSaverField.js +0 -237
  106. package/lib/components/fields/NestField.d.ts +0 -148
  107. package/lib/components/fields/NestField.js +0 -289
  108. package/lib/components/fields/ObjectField.d.ts +0 -2
  109. package/lib/components/fields/ObjectField.js +0 -119
  110. package/lib/components/fields/PdfArrayField.d.ts +0 -21
  111. package/lib/components/fields/PdfArrayField.js +0 -40
  112. package/lib/components/fields/PrefillingArrayField.d.ts +0 -22
  113. package/lib/components/fields/PrefillingArrayField.js +0 -65
  114. package/lib/components/fields/SchemaField.d.ts +0 -7
  115. package/lib/components/fields/SchemaField.js +0 -109
  116. package/lib/components/fields/ScopeField.d.ts +0 -85
  117. package/lib/components/fields/ScopeField.js +0 -521
  118. package/lib/components/fields/SectionArrayField.d.ts +0 -38
  119. package/lib/components/fields/SectionArrayField.js +0 -618
  120. package/lib/components/fields/SelectTreeField.d.ts +0 -39
  121. package/lib/components/fields/SelectTreeField.js +0 -143
  122. package/lib/components/fields/SingleActiveArrayField.d.ts +0 -49
  123. package/lib/components/fields/SingleActiveArrayField.js +0 -974
  124. package/lib/components/fields/SingleItemArrayField.d.ts +0 -15
  125. package/lib/components/fields/SingleItemArrayField.js +0 -60
  126. package/lib/components/fields/SortArrayField.d.ts +0 -73
  127. package/lib/components/fields/SortArrayField.js +0 -351
  128. package/lib/components/fields/SplitField.d.ts +0 -28
  129. package/lib/components/fields/SplitField.js +0 -65
  130. package/lib/components/fields/StringToArrayField.d.ts +0 -24
  131. package/lib/components/fields/StringToArrayField.js +0 -48
  132. package/lib/components/fields/SumField.d.ts +0 -35
  133. package/lib/components/fields/SumField.js +0 -83
  134. package/lib/components/fields/TableField.d.ts +0 -18
  135. package/lib/components/fields/TableField.js +0 -136
  136. package/lib/components/fields/TagArrayField.d.ts +0 -38
  137. package/lib/components/fields/TagArrayField.js +0 -128
  138. package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +0 -26
  139. package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +0 -81
  140. package/lib/components/fields/UiFieldApplierField.d.ts +0 -30
  141. package/lib/components/fields/UiFieldApplierField.js +0 -106
  142. package/lib/components/fields/UiFieldMapperArrayField.d.ts +0 -42
  143. package/lib/components/fields/UiFieldMapperArrayField.js +0 -121
  144. package/lib/components/fields/UnitCountShorthandField.d.ts +0 -22
  145. package/lib/components/fields/UnitCountShorthandField.js +0 -149
  146. package/lib/components/fields/UnitListShorthandArrayField.d.ts +0 -26
  147. package/lib/components/fields/UnitListShorthandArrayField.js +0 -108
  148. package/lib/components/fields/UnitShorthandField.d.ts +0 -32
  149. package/lib/components/fields/UnitShorthandField.js +0 -220
  150. package/lib/components/templates/ArrayFieldTemplate.d.ts +0 -85
  151. package/lib/components/templates/ArrayFieldTemplate.js +0 -417
  152. package/lib/components/templates/BaseInputTemplate.d.ts +0 -11
  153. package/lib/components/templates/BaseInputTemplate.js +0 -80
  154. package/lib/components/templates/DescriptionField.d.ts +0 -1
  155. package/lib/components/templates/DescriptionField.js +0 -37
  156. package/lib/components/templates/ErrorListTemplate.d.ts +0 -9
  157. package/lib/components/templates/ErrorListTemplate.js +0 -95
  158. package/lib/components/templates/FieldTemplate.d.ts +0 -6
  159. package/lib/components/templates/FieldTemplate.js +0 -112
  160. package/lib/components/templates/ObjectFieldTemplate.d.ts +0 -7
  161. package/lib/components/templates/ObjectFieldTemplate.js +0 -66
  162. package/lib/components/templates/TitleField.d.ts +0 -9
  163. package/lib/components/templates/TitleField.js +0 -51
  164. package/lib/components/widgets/AnyToBooleanWidget.d.ts +0 -20
  165. package/lib/components/widgets/AnyToBooleanWidget.js +0 -49
  166. package/lib/components/widgets/AutosuggestWidget.d.ts +0 -66
  167. package/lib/components/widgets/AutosuggestWidget.js +0 -1127
  168. package/lib/components/widgets/CheckboxWidget.d.ts +0 -37
  169. package/lib/components/widgets/CheckboxWidget.js +0 -139
  170. package/lib/components/widgets/DateTimeWidget.d.ts +0 -62
  171. package/lib/components/widgets/DateTimeWidget.js +0 -251
  172. package/lib/components/widgets/DateWidget.d.ts +0 -23
  173. package/lib/components/widgets/DateWidget.js +0 -41
  174. package/lib/components/widgets/HiddenWidget.d.ts +0 -15
  175. package/lib/components/widgets/HiddenWidget.js +0 -19
  176. package/lib/components/widgets/ImageSelectWidget.d.ts +0 -14
  177. package/lib/components/widgets/ImageSelectWidget.js +0 -57
  178. package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +0 -43
  179. package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +0 -237
  180. package/lib/components/widgets/InputGroupWidget.d.ts +0 -21
  181. package/lib/components/widgets/InputGroupWidget.js +0 -36
  182. package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +0 -21
  183. package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +0 -47
  184. package/lib/components/widgets/NumberWidget.d.ts +0 -13
  185. package/lib/components/widgets/NumberWidget.js +0 -21
  186. package/lib/components/widgets/PlainTextWidget.d.ts +0 -12
  187. package/lib/components/widgets/PlainTextWidget.js +0 -24
  188. package/lib/components/widgets/SelectWidget.d.ts +0 -52
  189. package/lib/components/widgets/SelectWidget.js +0 -158
  190. package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +0 -19
  191. package/lib/components/widgets/SeparatedDateTimeWidget.js +0 -59
  192. package/lib/components/widgets/TaxonImageWidget.d.ts +0 -13
  193. package/lib/components/widgets/TaxonImageWidget.js +0 -30
  194. package/lib/components/widgets/TextSelectWidget.d.ts +0 -25
  195. package/lib/components/widgets/TextSelectWidget.js +0 -94
  196. package/lib/components/widgets/TextareaWidget.d.ts +0 -32
  197. package/lib/components/widgets/TextareaWidget.js +0 -87
  198. package/lib/components/widgets/TimeWidget.d.ts +0 -11
  199. package/lib/components/widgets/TimeWidget.js +0 -19
  200. package/lib/components/widgets/URLWidget.d.ts +0 -14
  201. package/lib/components/widgets/URLWidget.js +0 -12
  202. package/lib/components/widgets/UpperCaseWidget.d.ts +0 -13
  203. package/lib/components/widgets/UpperCaseWidget.js +0 -21
  204. package/lib/index.d.ts +0 -20
  205. package/lib/index.js +0 -50
  206. package/lib/services/blocker-service.d.ts +0 -11
  207. package/lib/services/blocker-service.js +0 -55
  208. package/lib/services/custom-event-service.d.ts +0 -17
  209. package/lib/services/custom-event-service.js +0 -35
  210. package/lib/services/dom-id-service.d.ts +0 -8
  211. package/lib/services/dom-id-service.js +0 -30
  212. package/lib/services/focus-service.d.ts +0 -13
  213. package/lib/services/focus-service.js +0 -60
  214. package/lib/services/id-service.d.ts +0 -22
  215. package/lib/services/id-service.js +0 -130
  216. package/lib/services/key-handler-service.d.ts +0 -56
  217. package/lib/services/key-handler-service.js +0 -184
  218. package/lib/services/root-instance-service.d.ts +0 -25
  219. package/lib/services/root-instance-service.js +0 -49
  220. package/lib/services/settings-service.d.ts +0 -34
  221. package/lib/services/settings-service.js +0 -154
  222. package/lib/services/singleton-map-service.d.ts +0 -23
  223. package/lib/services/singleton-map-service.js +0 -44
  224. package/lib/services/submit-hook-service.d.ts +0 -24
  225. package/lib/services/submit-hook-service.js +0 -73
  226. package/lib/styles.d.ts +0 -1
  227. package/lib/styles.js +0 -4
  228. package/lib/themes/bs3.d.ts +0 -3
  229. package/lib/themes/bs3.js +0 -133
  230. package/lib/themes/bs5.d.ts +0 -3
  231. package/lib/themes/bs5.js +0 -111
  232. package/lib/themes/glyphicon-fa-mapping.d.ts +0 -3
  233. package/lib/themes/glyphicon-fa-mapping.js +0 -271
  234. package/lib/themes/stub.d.ts +0 -3
  235. package/lib/themes/stub.js +0 -82
  236. package/lib/themes/theme.d.ts +0 -233
  237. package/lib/themes/theme.js +0 -2
  238. package/lib/translations.json +0 -847
  239. package/lib/utils.d.ts +0 -171
  240. package/lib/utils.js +0 -1191
  241. package/lib/validation.d.ts +0 -7
  242. package/lib/validation.js +0 -141
  243. package/llol +0 -10
  244. package/llol.pdf +0 -10
  245. package/playwright-report/index.html +0 -62
  246. package/q +0 -196
  247. package/rename.sh +0 -24
  248. package/trip-report.spec.ts +0 -594
@@ -1,18 +0,0 @@
1
- export default class ImageDisplayField extends React.Component<any, any, any> {
2
- static propTypes: {
3
- uiSchema: PropTypes.Requireable<PropTypes.InferProps<{
4
- "ui:options": PropTypes.Requireable<PropTypes.InferProps<{
5
- urls: PropTypes.Requireable<string | (string | null | undefined)[]>;
6
- buttons: PropTypes.Requireable<(string | null | undefined)[]>;
7
- }>>;
8
- }>>;
9
- schema: PropTypes.Validator<PropTypes.InferProps<{
10
- type: PropTypes.Requireable<string>;
11
- }>>;
12
- formData: PropTypes.Requireable<object>;
13
- };
14
- constructor(props: any);
15
- constructor(props: any, context: any);
16
- }
17
- import * as React from "react";
18
- import * as PropTypes from "prop-types";
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const React = require("react");
10
- const PropTypes = require("prop-types");
11
- const BaseComponent_1 = require("../BaseComponent");
12
- const utils_1 = require("../../utils");
13
- const immutability_helper_1 = require("immutability-helper");
14
- // TODO should work as widget also
15
- let ImageDisplayField = class ImageDisplayField extends React.Component {
16
- render() {
17
- const { SchemaField } = this.props.registry.fields;
18
- let uiSchema = utils_1.getInnerUiSchema(this.props.uiSchema);
19
- const { urls = [], buttons = [] } = utils_1.getUiOptions(this.props.uiSchema);
20
- uiSchema = immutability_helper_1.default(uiSchema, { "ui:options": { buttons: { $set: [...buttons,
21
- { position: "left", render: () => React.createElement("div", { className: "laji-form-medias", key: "image-display" }, (Array.isArray(urls) ? urls : [urls]).map(url => React.createElement("div", { className: "media-container", key: url },
22
- React.createElement("img", { src: url }))))
23
- }
24
- ] } } });
25
- return (React.createElement(React.Fragment, null,
26
- React.createElement(SchemaField, Object.assign({}, this.props, { uiSchema: uiSchema }))));
27
- }
28
- };
29
- ImageDisplayField.propTypes = {
30
- uiSchema: PropTypes.shape({
31
- "ui:options": PropTypes.shape({
32
- urls: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
33
- buttons: PropTypes.arrayOf(PropTypes.string),
34
- }),
35
- }),
36
- schema: PropTypes.shape({
37
- type: PropTypes.oneOf(["array", "object"])
38
- }).isRequired,
39
- formData: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
40
- };
41
- ImageDisplayField = __decorate([
42
- BaseComponent_1.default
43
- ], ImageDisplayField);
44
- exports.default = ImageDisplayField;
@@ -1,21 +0,0 @@
1
- export default class InitiallyHiddenField extends React.Component<any, any, any> {
2
- static contextType: React.Context<import("../../ReactContext").ContextProps>;
3
- static propTypes: {
4
- uiSchema: PropTypes.Validator<PropTypes.InferProps<{
5
- "ui:options": PropTypes.Requireable<PropTypes.InferProps<{
6
- uiSchema: PropTypes.Requireable<object>;
7
- }>>;
8
- }>>;
9
- schema: PropTypes.Validator<PropTypes.InferProps<{
10
- type: PropTypes.Requireable<string>;
11
- }>>;
12
- formData: PropTypes.Validator<object>;
13
- };
14
- constructor(props: any);
15
- getStateFromProps(props: any): {
16
- uiSchema: any;
17
- };
18
- toggleVisibility: () => void;
19
- }
20
- import * as React from "react";
21
- import * as PropTypes from "prop-types";
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const React = require("react");
10
- const PropTypes = require("prop-types");
11
- const utils_1 = require("../../utils");
12
- const components_1 = require("../components");
13
- const BaseComponent_1 = require("../BaseComponent");
14
- const ReactContext_1 = require("../../ReactContext");
15
- let InitiallyHiddenField = class InitiallyHiddenField extends React.Component {
16
- constructor(props) {
17
- super(props);
18
- this.toggleVisibility = () => {
19
- this.setState({ visible: !this.state.visible });
20
- };
21
- this.state = Object.assign({ visible: false }, this.getStateFromProps(props));
22
- }
23
- getStateFromProps(props) {
24
- return { uiSchema: utils_1.getInnerUiSchema(props.uiSchema) };
25
- }
26
- render() {
27
- let shouldShow = this.state.visible;
28
- const SchemaField = this.props.registry.fields.SchemaField;
29
- const { Row, Col, Collapse } = this.context.theme;
30
- return (React.createElement("div", null,
31
- React.createElement(Collapse, { in: !shouldShow },
32
- React.createElement(Row, null,
33
- React.createElement(Col, { xs: 2, xsOffset: 10 },
34
- React.createElement(components_1.Button, { className: "button-right", onClick: this.toggleVisibility },
35
- this.props.schema.title || this.props.name,
36
- " ",
37
- React.createElement("span", { className: "caret" }))))),
38
- React.createElement(Collapse, { in: shouldShow },
39
- React.createElement("div", null,
40
- React.createElement(SchemaField, Object.assign({}, this.props, this.state))))));
41
- }
42
- };
43
- InitiallyHiddenField.contextType = ReactContext_1.default;
44
- InitiallyHiddenField.propTypes = {
45
- uiSchema: PropTypes.shape({
46
- "ui:options": PropTypes.shape({
47
- uiSchema: PropTypes.object
48
- })
49
- }).isRequired,
50
- schema: PropTypes.shape({
51
- type: PropTypes.oneOf(["object", "array"])
52
- }).isRequired,
53
- formData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
54
- };
55
- InitiallyHiddenField = __decorate([
56
- BaseComponent_1.default
57
- ], InitiallyHiddenField);
58
- exports.default = InitiallyHiddenField;
@@ -1,37 +0,0 @@
1
- /**
2
- * Injects given fields value as default value to target field.
3
- * uiSchema = { "ui:options": {
4
- * "injections": [
5
- * {
6
- * "fields": [field1, field2...], (fields to inject from source field)
7
- * "target": fieldName (target field where default value is injected)
8
- * "source": fieldName (source field where default value is injected from. Must be object field)
9
- * }
10
- * ...
11
- * ]
12
- * }}
13
- */
14
- export default class InjectDefaultValueField extends React.Component<any, any, any> {
15
- static propTypes: {
16
- uiSchema: PropTypes.Validator<PropTypes.InferProps<{
17
- "ui:options": PropTypes.Validator<PropTypes.InferProps<{
18
- fields: PropTypes.Validator<(string | null | undefined)[]>;
19
- target: PropTypes.Validator<string>;
20
- source: PropTypes.Validator<string>;
21
- }>>;
22
- }>>;
23
- schema: PropTypes.Validator<PropTypes.InferProps<{
24
- type: PropTypes.Requireable<string>;
25
- }>>;
26
- formData: PropTypes.Validator<object>;
27
- };
28
- static getName(): string;
29
- constructor(props: any);
30
- constructor(props: any, context: any);
31
- getStateFromProps(): {
32
- onChange: (formData: any) => void;
33
- };
34
- onChange: (formData: any) => void;
35
- }
36
- import * as React from "react";
37
- import * as PropTypes from "prop-types";
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const React = require("react");
10
- const PropTypes = require("prop-types");
11
- const immutability_helper_1 = require("immutability-helper");
12
- const VirtualSchemaField_1 = require("../VirtualSchemaField");
13
- /**
14
- * Injects given fields value as default value to target field.
15
- * uiSchema = { "ui:options": {
16
- * "injections": [
17
- * {
18
- * "fields": [field1, field2...], (fields to inject from source field)
19
- * "target": fieldName (target field where default value is injected)
20
- * "source": fieldName (source field where default value is injected from. Must be object field)
21
- * }
22
- * ...
23
- * ]
24
- * }}
25
- */
26
- let InjectDefaultValueField = class InjectDefaultValueField extends React.Component {
27
- constructor() {
28
- super(...arguments);
29
- this.onChange = (formData) => {
30
- let { schema } = this.props;
31
- const options = this.getUiOptions();
32
- const { fields, target } = options;
33
- let source = options.source ? formData[options.source] : formData;
34
- fields.forEach(field => {
35
- if (schema.properties[target].type === "array") {
36
- if (formData && formData[target])
37
- formData[target].forEach((item, i) => {
38
- if (item[field] === this.props.formData[options.source][field]) {
39
- formData = immutability_helper_1.default(formData, { [target]: { $splice: [[i, 1, immutability_helper_1.default(item, { $merge: { [field]: source[field] } })]] } });
40
- }
41
- });
42
- }
43
- });
44
- this.props.onChange(formData);
45
- };
46
- }
47
- static getName() { return "InjectDefaultValueField"; }
48
- getStateFromProps() {
49
- return { onChange: this.onChange };
50
- }
51
- };
52
- InjectDefaultValueField.propTypes = {
53
- uiSchema: PropTypes.shape({
54
- "ui:options": PropTypes.shape({
55
- fields: PropTypes.arrayOf(PropTypes.string).isRequired,
56
- target: PropTypes.string.isRequired,
57
- source: PropTypes.string.isRequired
58
- }).isRequired
59
- }).isRequired,
60
- schema: PropTypes.shape({
61
- type: PropTypes.oneOf(["object", "array"])
62
- }).isRequired,
63
- formData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
64
- };
65
- InjectDefaultValueField = __decorate([
66
- VirtualSchemaField_1.default
67
- ], InjectDefaultValueField);
68
- exports.default = InjectDefaultValueField;
@@ -1,46 +0,0 @@
1
- /**
2
- * Inject a schema object property to nested schema.
3
- * uiSchema = { "ui:options": {
4
- * "injections": [
5
- * {
6
- * "fields": [field1, field2...],
7
- * "target": fieldName
8
- * }
9
- * ...
10
- * ]
11
- * }}
12
- */
13
- export default class InjectField extends React.Component<any, any, any> {
14
- static propTypes: {
15
- uiSchema: PropTypes.Validator<PropTypes.InferProps<{
16
- "ui:options": PropTypes.Validator<PropTypes.InferProps<{
17
- injections: PropTypes.Validator<PropTypes.InferProps<{
18
- fields: PropTypes.Validator<(string | null | undefined)[]>;
19
- target: PropTypes.Validator<string>;
20
- }> | (PropTypes.InferProps<{
21
- fields: PropTypes.Validator<(string | null | undefined)[]>;
22
- target: PropTypes.Validator<string>;
23
- }> | null | undefined)[]>;
24
- }>>;
25
- uiSchema: PropTypes.Requireable<object>;
26
- }>>;
27
- schema: PropTypes.Validator<PropTypes.InferProps<{
28
- type: PropTypes.Requireable<string>;
29
- }>>;
30
- formData: PropTypes.Validator<object>;
31
- };
32
- static getName(): string;
33
- constructor(props: any);
34
- constructor(props: any, context: any);
35
- getStateFromProps(props: any): {
36
- schema: any;
37
- uiSchema: any;
38
- idSchema: any;
39
- formData: any;
40
- errorSchema: any;
41
- onChange: (formData: any) => void;
42
- };
43
- onChange: (formData: any) => void;
44
- }
45
- import * as React from "react";
46
- import * as PropTypes from "prop-types";
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const React = require("react");
10
- const PropTypes = require("prop-types");
11
- const utils_1 = require("../../utils");
12
- const VirtualSchemaField_1 = require("../VirtualSchemaField");
13
- const injectionPropType = PropTypes.shape({
14
- fields: PropTypes.arrayOf(PropTypes.string).isRequired,
15
- target: PropTypes.string.isRequired
16
- });
17
- /**
18
- * Inject a schema object property to nested schema.
19
- * uiSchema = { "ui:options": {
20
- * "injections": [
21
- * {
22
- * "fields": [field1, field2...],
23
- * "target": fieldName
24
- * }
25
- * ...
26
- * ]
27
- * }}
28
- */
29
- let InjectField = class InjectField extends React.Component {
30
- constructor() {
31
- super(...arguments);
32
- this.onChange = (formData) => {
33
- const options = this.getUiOptions();
34
- (Array.isArray(options.injections) ? options.injections.slice(0).reverse() : [options.injections]).forEach((injection) => {
35
- let { fields, target } = injection;
36
- target = utils_1.toJSONPointer(target);
37
- formData = fields.reduce((formData, fieldPointer) => {
38
- fieldPointer = utils_1.toJSONPointer(fieldPointer);
39
- const fieldName = fieldPointer.split("/").pop();
40
- formData = utils_1.updateFormDataWithJSONPointer(Object.assign(Object.assign({}, this.props), { formData }), utils_1.parseJSONPointer(formData, `${target}/${fieldName}`), fieldPointer);
41
- formData = utils_1.immutableDelete(formData, `${target}/${fieldName}`);
42
- return formData;
43
- }, formData);
44
- });
45
- this.props.onChange(formData);
46
- };
47
- }
48
- static getName() { return "InjectField"; }
49
- getStateFromProps(props) {
50
- const options = utils_1.getUiOptions(props.uiSchema);
51
- const { injections } = options;
52
- let { schema, uiSchema, idSchema, formData, errorSchema } = props;
53
- (Array.isArray(injections) ? injections : [injections]).forEach((injection) => {
54
- let { fields, target } = injection;
55
- target = utils_1.toJSONPointer(target);
56
- const origSchema = schema;
57
- fields.forEach((fieldPath) => {
58
- fieldPath = utils_1.toJSONPointer(fieldPath);
59
- const fieldName = fieldPath.split("/").pop();
60
- schema = utils_1.updateSafelyWithJSONPointer(schema, utils_1.parseJSONPointer(origSchema, utils_1.schemaJSONPointer(origSchema, fieldPath)), `${utils_1.schemaJSONPointer(origSchema, target)}/properties/${fieldName}`);
61
- schema = utils_1.immutableDelete(schema, utils_1.schemaJSONPointer(origSchema, fieldPath));
62
- uiSchema = utils_1.updateSafelyWithJSONPointer(uiSchema, utils_1.parseJSONPointer(uiSchema, utils_1.uiSchemaJSONPointer(origSchema, fieldPath)), `${utils_1.uiSchemaJSONPointer(origSchema, target)}/${fieldName}`);
63
- uiSchema = utils_1.immutableDelete(uiSchema, utils_1.uiSchemaJSONPointer(origSchema, fieldPath));
64
- const [_formData, _idSchema, _errorSchema] = [formData, idSchema, errorSchema].map(prop => utils_1.immutableDelete(utils_1.updateSafelyWithJSONPointer(prop, utils_1.parseJSONPointer(prop, fieldPath), `${target}/${fieldName}`), fieldPath));
65
- formData = _formData;
66
- errorSchema = _errorSchema;
67
- idSchema = _idSchema;
68
- });
69
- });
70
- return { schema, uiSchema, idSchema, formData, errorSchema, onChange: this.onChange };
71
- }
72
- };
73
- InjectField.propTypes = {
74
- uiSchema: PropTypes.shape({
75
- "ui:options": PropTypes.shape({
76
- injections: PropTypes.oneOfType([PropTypes.arrayOf(injectionPropType), injectionPropType]).isRequired,
77
- }).isRequired,
78
- uiSchema: PropTypes.object
79
- }).isRequired,
80
- schema: PropTypes.shape({
81
- type: PropTypes.oneOf(["object"])
82
- }).isRequired,
83
- formData: PropTypes.object.isRequired
84
- };
85
- InjectField = __decorate([
86
- VirtualSchemaField_1.default
87
- ], InjectField);
88
- exports.default = InjectField;
@@ -1,25 +0,0 @@
1
- export default class InputWithDefaultValueButtonField extends React.Component<any, any, any> {
2
- static propTypes: {
3
- uiSchema: PropTypes.Validator<PropTypes.InferProps<{
4
- "ui:options": PropTypes.Validator<PropTypes.InferProps<{
5
- buttonLabel: PropTypes.Validator<string>;
6
- buttonField: PropTypes.Validator<string>;
7
- valueFields: PropTypes.Requireable<PropTypes.InferProps<{
8
- field: PropTypes.Validator<string>;
9
- contextFieldForDefaultValue: PropTypes.Validator<string>;
10
- }>[]>;
11
- }>>;
12
- }>>;
13
- schema: PropTypes.Validator<PropTypes.InferProps<{
14
- type: PropTypes.Requireable<string>;
15
- }>>;
16
- formData: PropTypes.Validator<object>;
17
- };
18
- static getName(): string;
19
- constructor(props: any);
20
- constructor(props: any, context: any);
21
- getStateFromProps(props: any): any;
22
- onClick: () => void;
23
- }
24
- import * as React from "react";
25
- import * as PropTypes from "prop-types";
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- const React = require("react");
10
- const PropTypes = require("prop-types");
11
- const VirtualSchemaField_1 = require("../VirtualSchemaField");
12
- const utils_1 = require("../../utils");
13
- let InputWithDefaultValueButtonField = class InputWithDefaultValueButtonField extends React.Component {
14
- constructor() {
15
- super(...arguments);
16
- this.onClick = () => {
17
- let { uiSchema, formData } = this.props;
18
- const uiSchemaContext = this.props.formContext.uiSchemaContext || {};
19
- const { valueFields } = utils_1.getUiOptions(uiSchema);
20
- valueFields.forEach(({ field, contextFieldForDefaultValue }) => {
21
- formData = utils_1.updateSafelyWithJSONPointer(formData, uiSchemaContext[contextFieldForDefaultValue], field);
22
- });
23
- this.props.onChange(formData);
24
- };
25
- }
26
- static getName() { return "InputWithDefaultValueButtonField"; }
27
- getStateFromProps(props) {
28
- let { schema, uiSchema } = props;
29
- const { buttonField, buttonLabel } = utils_1.getUiOptions(uiSchema);
30
- const innerUiSchema = utils_1.getInnerUiSchema(uiSchema);
31
- const _uiSchemaJSONPointer = utils_1.uiSchemaJSONPointer(schema, buttonField);
32
- uiSchema = utils_1.updateSafelyWithJSONPointer(innerUiSchema, {
33
- "ui:widget": "InputWithDefaultValueButtonWidget",
34
- "ui:options": {
35
- buttonLabel,
36
- onClick: this.onClick
37
- },
38
- }, _uiSchemaJSONPointer);
39
- return Object.assign(Object.assign({}, props), { uiSchema });
40
- }
41
- };
42
- InputWithDefaultValueButtonField.propTypes = {
43
- uiSchema: PropTypes.shape({
44
- "ui:options": PropTypes.shape({
45
- buttonLabel: PropTypes.string.isRequired,
46
- buttonField: PropTypes.string.isRequired,
47
- valueFields: PropTypes.arrayOf(PropTypes.shape({
48
- field: PropTypes.string.isRequired,
49
- contextFieldForDefaultValue: PropTypes.string.isRequired
50
- }).isRequired)
51
- }).isRequired
52
- }).isRequired,
53
- schema: PropTypes.shape({
54
- type: PropTypes.oneOf(["object"])
55
- }).isRequired,
56
- formData: PropTypes.oneOfType([PropTypes.object]).isRequired
57
- };
58
- InputWithDefaultValueButtonField = __decorate([
59
- VirtualSchemaField_1.default
60
- ], InputWithDefaultValueButtonField);
61
- exports.default = InputWithDefaultValueButtonField;
@@ -1,22 +0,0 @@
1
- export default class LocalityField extends React.Component<any, any, any> {
2
- static contextType: React.Context<import("../../ReactContext").ContextProps>;
3
- static propTypes: {
4
- uiSchema: PropTypes.Requireable<object>;
5
- schema: PropTypes.Validator<PropTypes.InferProps<{
6
- type: PropTypes.Requireable<string>;
7
- }>>;
8
- formData: PropTypes.Validator<object>;
9
- };
10
- constructor(props: any);
11
- showEditor: () => void;
12
- hideEditor: () => void;
13
- setFormRef: (elem: any) => void;
14
- lajiForm: any;
15
- renderModal: () => JSX.Element;
16
- onSubmitClick: (e: any) => void;
17
- onSubmit: ({ formData }: {
18
- formData: any;
19
- }) => void;
20
- }
21
- import * as React from "react";
22
- import * as PropTypes from "prop-types";
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __rest = (this && this.__rest) || function (s, e) {
9
- var t = {};
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
11
- t[p] = s[p];
12
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
13
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
14
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
15
- t[p[i]] = s[p[i]];
16
- }
17
- return t;
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- const React = require("react");
21
- const PropTypes = require("prop-types");
22
- const utils_1 = require("../../utils");
23
- const BaseComponent_1 = require("../BaseComponent");
24
- const components_1 = require("../components");
25
- const LajiForm_1 = require("../LajiForm");
26
- const MapField_1 = require("./MapField");
27
- const ReactContext_1 = require("../../ReactContext");
28
- let LocalityField = class LocalityField extends React.Component {
29
- constructor(props) {
30
- super(props);
31
- this.showEditor = () => {
32
- this.setState({ modal: true });
33
- };
34
- this.hideEditor = () => {
35
- this.setState({ modal: false });
36
- };
37
- this.setFormRef = (elem) => {
38
- this.lajiForm = elem;
39
- };
40
- this.renderModal = () => {
41
- const _a = this.props, { onChange } = _a, props = __rest(_a, ["onChange"]); // eslint-disable-line @typescript-eslint/no-unused-vars
42
- const { Modal } = this.context.theme;
43
- return (React.createElement(Modal, { dialogClassName: "laji-form image-modal", show: true, onHide: this.hideEditor },
44
- React.createElement(Modal.Header, { closeButton: true }),
45
- React.createElement(Modal.Body, null,
46
- React.createElement(LajiForm_1.default, Object.assign({ ref: this.setFormRef }, props, { uiSchema: utils_1.getInnerUiSchema(this.props.uiSchema), onSubmit: this.onSubmit, lang: this.props.formContext.lang, showShortcutButton: false, renderSubmit: false, validators: {}, warnings: {}, apiClient: this.props.formContext.apiClient.apiClient, uiSchemaContext: this.props.formContext.uiSchemaContext })),
47
- React.createElement(components_1.Button, { block: true, onClick: this.onSubmitClick }, "OK"),
48
- React.createElement(components_1.Button, { block: true, onClick: this.hideEditor }, this.props.formContext.translations.Cancel))));
49
- };
50
- this.onSubmitClick = (e) => {
51
- this.lajiForm._onDefaultSubmit(e);
52
- };
53
- this.onSubmit = ({ formData }) => {
54
- this.props.onChange(formData);
55
- this.hideEditor();
56
- };
57
- this.state = {};
58
- }
59
- render() {
60
- const { radius: _radius, geometry } = utils_1.getUiOptions(this.props.uiSchema);
61
- const fields = Object.keys(this.props.schema.properties);
62
- const values = fields.filter(s => !utils_1.isEmptyString(this.props.formData[s])).map(f => this.props.formData[f]);
63
- const radius = typeof _radius === "number"
64
- ? _radius
65
- : geometry
66
- ? MapField_1.getCenterAndRadiusFromGeometry(geometry).radius
67
- : undefined;
68
- if (typeof radius === "number") {
69
- values.push(`(${this.props.formContext.translations.accuracy}: ${parseInt(radius)}m)`);
70
- }
71
- const { Panel, Row, Col } = this.context.theme;
72
- return (React.createElement(Row, null,
73
- React.createElement(Col, { xs: 12 },
74
- React.createElement(Panel, { className: utils_1.getUiOptions(this.props.uiSchema).panelClassName },
75
- React.createElement(Panel.Body, null,
76
- values.map((v, i) => (React.createElement("span", { key: i },
77
- v,
78
- i < values.length - 1 ? ", " : ""))),
79
- React.createElement(components_1.GlyphButton, { onClick: this.showEditor, glyph: "pencil", variant: "default", className: "pull-right" })))),
80
- this.state.modal && this.renderModal()));
81
- }
82
- };
83
- LocalityField.contextType = ReactContext_1.default;
84
- LocalityField.propTypes = {
85
- uiSchema: PropTypes.object,
86
- schema: PropTypes.shape({
87
- type: PropTypes.oneOf(["object"])
88
- }).isRequired,
89
- formData: PropTypes.object.isRequired
90
- };
91
- LocalityField = __decorate([
92
- BaseComponent_1.default
93
- ], LocalityField);
94
- exports.default = LocalityField;
@@ -1,27 +0,0 @@
1
- export default class LocationChooserField extends React.Component<any, any, any> {
2
- static propTypes: {
3
- uiSchema: PropTypes.Validator<PropTypes.InferProps<{
4
- "ui:options": PropTypes.Requireable<PropTypes.InferProps<{
5
- uiSchema: PropTypes.Requireable<object>;
6
- taxonField: PropTypes.Requireable<string>;
7
- geometryField: PropTypes.Requireable<string>;
8
- strategy: PropTypes.Requireable<string>;
9
- mapOptions: PropTypes.Requireable<object>;
10
- maxShapes: PropTypes.Requireable<number>;
11
- preselectMarker: PropTypes.Requireable<boolean>;
12
- color: PropTypes.Requireable<string>;
13
- }>>;
14
- }>>;
15
- schema: PropTypes.Validator<PropTypes.InferProps<{
16
- type: PropTypes.Requireable<string>;
17
- }>>;
18
- formData: PropTypes.Validator<object>;
19
- };
20
- constructor(props: any);
21
- constructor(props: any, context: any);
22
- getStateFromProps(props: any): {
23
- uiSchema: any;
24
- };
25
- }
26
- import * as React from "react";
27
- import * as PropTypes from "prop-types";