@vulcanjs/react-ui 0.6.6-alpha.5 → 0.6.6-y.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Datatable/DatatableFilter.d.ts +1 -1
- package/dist/components/Datatable/DatatableFilter.d.ts.map +1 -1
- package/dist/components/Datatable/others/NewButton.d.ts +1 -1
- package/dist/components/Datatable/others/NewButton.d.ts.map +1 -1
- package/dist/components/LoadingButton.d.ts +1 -1
- package/dist/components/LoadingButton.d.ts.map +1 -1
- package/dist/components/VulcanComponents/defaultVulcanComponents/formComponents.d.ts.map +1 -1
- package/dist/components/VulcanComponents/defaultVulcanComponents/index.d.ts +2 -2
- package/dist/components/VulcanComponents/typings.d.ts +6 -5
- package/dist/components/VulcanComponents/typings.d.ts.map +1 -1
- package/dist/components/core/Button.d.ts +4 -0
- package/dist/components/core/Button.d.ts.map +1 -0
- package/dist/components/core/Loading.d.ts +3 -0
- package/dist/components/core/Loading.d.ts.map +1 -0
- package/dist/components/form/Form/fields.d.ts +1 -1
- package/dist/components/form/FormComponent.d.ts +3 -3
- package/dist/components/form/core/Form/Form.d.ts +4 -0
- package/dist/components/form/core/Form/Form.d.ts.map +1 -0
- package/dist/components/form/core/Form/fields.d.ts +22 -0
- package/dist/components/form/core/Form/fields.d.ts.map +1 -0
- package/dist/components/form/core/Form/index.d.ts +3 -0
- package/dist/components/form/core/Form/index.d.ts.map +1 -0
- package/dist/components/form/core/Form/typings.d.ts +76 -0
- package/dist/components/form/core/Form/typings.d.ts.map +1 -0
- package/dist/components/form/core/Form/utils.d.ts +2 -0
- package/dist/components/form/core/Form/utils.d.ts.map +1 -0
- package/dist/components/form/core/FormComponent.d.ts +31 -0
- package/dist/components/form/core/FormComponent.d.ts.map +1 -0
- package/dist/components/form/core/FormComponentInner.d.ts +32 -0
- package/dist/components/form/core/FormComponentInner.d.ts.map +1 -0
- package/dist/components/form/core/FormComponentLoader.d.ts +15 -0
- package/dist/components/form/core/FormComponentLoader.d.ts.map +1 -0
- package/dist/components/form/core/FormContainer.d.ts +18 -0
- package/dist/components/form/core/FormContainer.d.ts.map +1 -0
- package/dist/components/form/core/FormContext.d.ts +25 -0
- package/dist/components/form/core/FormContext.d.ts.map +1 -0
- package/dist/components/form/core/FormGroup.d.ts +30 -0
- package/dist/components/form/core/FormGroup.d.ts.map +1 -0
- package/dist/components/form/core/index.d.ts +7 -0
- package/dist/components/form/core/index.d.ts.map +1 -0
- package/dist/components/form/elements/FieldErrors.d.ts +5 -0
- package/dist/components/form/elements/FieldErrors.d.ts.map +1 -0
- package/dist/components/form/elements/FormElement.d.ts +4 -0
- package/dist/components/form/elements/FormElement.d.ts.map +1 -0
- package/dist/components/form/elements/FormError.d.ts +11 -0
- package/dist/components/form/elements/FormError.d.ts.map +1 -0
- package/dist/components/form/elements/FormErrors.d.ts +3 -0
- package/dist/components/form/elements/FormErrors.d.ts.map +1 -0
- package/dist/components/form/elements/FormLayout.d.ts +10 -0
- package/dist/components/form/elements/FormLayout.d.ts.map +1 -0
- package/dist/components/form/elements/FormSubmit.d.ts +38 -0
- package/dist/components/form/elements/FormSubmit.d.ts.map +1 -0
- package/dist/components/form/elements/index.d.ts +7 -0
- package/dist/components/form/elements/index.d.ts.map +1 -0
- package/dist/components/form/hooks/useBlockTransition/block.d.ts +4 -0
- package/dist/components/form/hooks/useBlockTransition/block.d.ts.map +1 -0
- package/dist/components/form/hooks/useBlockTransition/useBlockTransition.d.ts +5 -0
- package/dist/components/form/hooks/useBlockTransition/useBlockTransition.d.ts.map +1 -0
- package/dist/components/form/hooks/useWarnOnUnsaved/index.d.ts +2 -0
- package/dist/components/form/hooks/useWarnOnUnsaved/index.d.ts.map +1 -0
- package/dist/components/form/hooks/useWarnOnUnsaved/useWarnOnUnsaved.d.ts +5 -0
- package/dist/components/form/hooks/useWarnOnUnsaved/useWarnOnUnsaved.d.ts.map +1 -0
- package/dist/components/form/index.d.ts +4 -4
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/AutocompleteMultiple.d.ts +1 -1
- package/dist/components/form/inputs/AutocompleteMultiple.d.ts.map +1 -1
- package/dist/components/form/inputs/BasicInputs.d.ts +1 -1
- package/dist/components/form/inputs/BasicInputs.d.ts.map +1 -1
- package/dist/components/form/inputs/Checkboxgroup.d.ts +1 -1
- package/dist/components/form/inputs/Checkboxgroup.d.ts.map +1 -1
- package/dist/components/form/inputs/FormItem.d.ts +1 -1
- package/dist/components/form/inputs/FormItem.d.ts.map +1 -1
- package/dist/components/form/inputs/FormOptionLabel.d.ts +7 -0
- package/dist/components/form/inputs/FormOptionLabel.d.ts.map +1 -0
- package/dist/components/form/inputs/RadioGroup.d.ts +1 -1
- package/dist/components/form/inputs/RadioGroup.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInputs.d.ts +1 -1
- package/dist/components/form/inputs/SelectInputs.d.ts.map +1 -1
- package/dist/components/form/inputs/consts.d.ts +1 -1
- package/dist/components/form/inputs/consts.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +3 -1
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/form/intl/FormIntl.d.ts +15 -0
- package/dist/components/form/intl/FormIntl.d.ts.map +1 -0
- package/dist/components/form/nested/FormNestedArray.d.ts +26 -0
- package/dist/components/form/nested/FormNestedArray.d.ts.map +1 -0
- package/dist/components/form/nested/FormNestedArrayLayout.d.ts +18 -0
- package/dist/components/form/nested/FormNestedArrayLayout.d.ts.map +1 -0
- package/dist/components/form/nested/FormNestedDivider.d.ts +13 -0
- package/dist/components/form/nested/FormNestedDivider.d.ts.map +1 -0
- package/dist/components/form/nested/FormNestedItem.d.ts +52 -0
- package/dist/components/form/nested/FormNestedItem.d.ts.map +1 -0
- package/dist/components/form/nested/FormNestedObject.d.ts +35 -0
- package/dist/components/form/nested/FormNestedObject.d.ts.map +1 -0
- package/dist/components/form/nested/index.d.ts +6 -0
- package/dist/components/form/nested/index.d.ts.map +1 -0
- package/dist/components/form/utils/formFragments.d.ts +16 -0
- package/dist/components/form/utils/formFragments.d.ts.map +1 -0
- package/dist/components/form/utils/path_utils.d.ts +6 -0
- package/dist/components/form/utils/path_utils.d.ts.map +1 -0
- package/dist/components/form/utils/schema_utils.d.ts +14 -0
- package/dist/components/form/utils/schema_utils.d.ts.map +1 -0
- package/dist/components/form/utils/ui_utils.d.ts +3 -0
- package/dist/components/form/utils/ui_utils.d.ts.map +1 -0
- package/dist/components/form/utils/utils.d.ts +17 -0
- package/dist/components/form/utils/utils.d.ts.map +1 -0
- package/dist/index.js +353 -338
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/form/FieldErrors.d.ts.map +0 -1
- package/dist/components/form/Form/Form.d.ts.map +0 -1
- package/dist/components/form/Form/fields.d.ts.map +0 -1
- package/dist/components/form/Form/index.d.ts.map +0 -1
- package/dist/components/form/Form/typings.d.ts.map +0 -1
- package/dist/components/form/Form/utils.d.ts.map +0 -1
- package/dist/components/form/FormComponent.d.ts.map +0 -1
- package/dist/components/form/FormComponentInner.d.ts.map +0 -1
- package/dist/components/form/FormComponentLoader.d.ts.map +0 -1
- package/dist/components/form/FormContainer.d.ts.map +0 -1
- package/dist/components/form/FormContext.d.ts.map +0 -1
- package/dist/components/form/FormElement.d.ts.map +0 -1
- package/dist/components/form/FormError.d.ts.map +0 -1
- package/dist/components/form/FormErrors.d.ts.map +0 -1
- package/dist/components/form/FormGroup.d.ts.map +0 -1
- package/dist/components/form/FormIntl.d.ts.map +0 -1
- package/dist/components/form/FormLayout.d.ts.map +0 -1
- package/dist/components/form/FormNestedArray.d.ts.map +0 -1
- package/dist/components/form/FormNestedArrayLayout.d.ts.map +0 -1
- package/dist/components/form/FormNestedDivider.d.ts.map +0 -1
- package/dist/components/form/FormNestedItem.d.ts.map +0 -1
- package/dist/components/form/FormNestedObject.d.ts.map +0 -1
- package/dist/components/form/FormOptionLabel.d.ts.map +0 -1
- package/dist/components/form/FormSubmit.d.ts.map +0 -1
- package/dist/components/form/core/Button.d.ts.map +0 -1
- package/dist/components/form/core/Loading.d.ts.map +0 -1
- package/dist/components/form/modules/formFragments.d.ts.map +0 -1
- package/dist/components/form/modules/path_utils.d.ts.map +0 -1
- package/dist/components/form/modules/schema_utils.d.ts.map +0 -1
- package/dist/components/form/modules/utils.d.ts.map +0 -1
- package/dist/components/form/ui_utils.d.ts.map +0 -1
- package/dist/components/form/useBlockTransition/block.d.ts.map +0 -1
- package/dist/components/form/useBlockTransition/useBlockTransition.d.ts.map +0 -1
- package/dist/components/form/useWarnOnUnsaved/index.d.ts.map +0 -1
- package/dist/components/form/useWarnOnUnsaved/useWarnOnUnsaved.d.ts.map +0 -1
package/dist/index.js
CHANGED
@@ -5872,7 +5872,7 @@ init_esm_shims();
|
|
5872
5872
|
// components/form/index.ts
|
5873
5873
|
init_esm_shims();
|
5874
5874
|
|
5875
|
-
// components/form/FormContainer.tsx
|
5875
|
+
// components/form/core/FormContainer.tsx
|
5876
5876
|
init_esm_shims();
|
5877
5877
|
import React5 from "react";
|
5878
5878
|
|
@@ -8169,7 +8169,7 @@ var extras = {
|
|
8169
8169
|
gql["default"] = gql;
|
8170
8170
|
var lib_default = gql;
|
8171
8171
|
|
8172
|
-
// components/form/
|
8172
|
+
// components/form/utils/formFragments.ts
|
8173
8173
|
init_esm_shims();
|
8174
8174
|
import _uniq from "lodash/uniq.js";
|
8175
8175
|
import _intersection from "lodash/intersection.js";
|
@@ -8311,7 +8311,7 @@ var getFormFragments = /* @__PURE__ */ __name(({ formType = "new", model, fields
|
|
8311
8311
|
}, "getFormFragments");
|
8312
8312
|
var formFragments_default = getFormFragments;
|
8313
8313
|
|
8314
|
-
// components/form/FormContainer.tsx
|
8314
|
+
// components/form/core/FormContainer.tsx
|
8315
8315
|
import { getFragmentName as getFragmentName2 } from "@vulcanjs/graphql";
|
8316
8316
|
import { capitalize as capitalize2 } from "@vulcanjs/utils";
|
8317
8317
|
import { useSingle, useCreate, useUpdate, useDelete } from "@vulcanjs/react-hooks";
|
@@ -8374,7 +8374,7 @@ var withVulcanComponents = /* @__PURE__ */ __name((C) => (props) => {
|
|
8374
8374
|
}, props));
|
8375
8375
|
}, "withVulcanComponents");
|
8376
8376
|
|
8377
|
-
// components/form/FormContainer.tsx
|
8377
|
+
// components/form/core/FormContainer.tsx
|
8378
8378
|
import { debugVulcan } from "@vulcanjs/utils";
|
8379
8379
|
|
8380
8380
|
// components/VulcanCurrentUser/Consumer.tsx
|
@@ -8393,7 +8393,7 @@ var VulcanCurrentUserContext = React4.createContext({
|
|
8393
8393
|
var VulcanCurrentUserConsumer = VulcanCurrentUserContext.Consumer;
|
8394
8394
|
var useVulcanCurrentUser = /* @__PURE__ */ __name(() => useContext2(VulcanCurrentUserContext), "useVulcanCurrentUser");
|
8395
8395
|
|
8396
|
-
// components/form/FormContainer.tsx
|
8396
|
+
// components/form/core/FormContainer.tsx
|
8397
8397
|
function _extends2() {
|
8398
8398
|
_extends2 = Object.assign || function(target) {
|
8399
8399
|
for (var i = 1; i < arguments.length; i++) {
|
@@ -8546,10 +8546,10 @@ var FormContainer = /* @__PURE__ */ __name((props) => {
|
|
8546
8546
|
}, "FormContainer");
|
8547
8547
|
var SmartForm = FormContainer;
|
8548
8548
|
|
8549
|
-
// components/form/Form/index.ts
|
8549
|
+
// components/form/core/Form/index.ts
|
8550
8550
|
init_esm_shims();
|
8551
8551
|
|
8552
|
-
// components/form/Form/Form.tsx
|
8552
|
+
// components/form/core/Form/Form.tsx
|
8553
8553
|
init_esm_shims();
|
8554
8554
|
import React7, { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
8555
8555
|
import { runCallbacks, getErrors } from "@vulcanjs/core";
|
@@ -8571,11 +8571,11 @@ import update from "lodash/update.js";
|
|
8571
8571
|
import without from "lodash/without.js";
|
8572
8572
|
import isEmpty from "lodash/isEmpty.js";
|
8573
8573
|
|
8574
|
-
// components/form/
|
8574
|
+
// components/form/utils/schema_utils.ts
|
8575
8575
|
init_esm_shims();
|
8576
8576
|
import { canCreateField, canUpdateField } from "@vulcanjs/permissions";
|
8577
8577
|
|
8578
|
-
// components/form/
|
8578
|
+
// components/form/utils/utils.ts
|
8579
8579
|
init_esm_shims();
|
8580
8580
|
import merge from "lodash/merge.js";
|
8581
8581
|
import find from "lodash/find.js";
|
@@ -8583,7 +8583,7 @@ import isPlainObject from "lodash/isPlainObject.js";
|
|
8583
8583
|
import set from "lodash/set.js";
|
8584
8584
|
import size from "lodash/size.js";
|
8585
8585
|
|
8586
|
-
// components/form/
|
8586
|
+
// components/form/utils/path_utils.ts
|
8587
8587
|
init_esm_shims();
|
8588
8588
|
import toPath from "lodash/toPath.js";
|
8589
8589
|
import initial from "lodash/initial.js";
|
@@ -8593,7 +8593,7 @@ var splitPath = /* @__PURE__ */ __name((string) => toPath(string), "splitPath");
|
|
8593
8593
|
var joinPath = /* @__PURE__ */ __name((array) => array.reduce((string, item) => string + (Number.isNaN(Number(item)) ? `${string === "" ? "" : "."}${item}` : `[${item}]`), ""), "joinPath");
|
8594
8594
|
var getParentPath = flow(splitPath, initial, joinPath);
|
8595
8595
|
|
8596
|
-
// components/form/
|
8596
|
+
// components/form/utils/utils.ts
|
8597
8597
|
var isEmptyValue = /* @__PURE__ */ __name((value) => typeof value === "undefined" || value === null || value === "" || Array.isArray(value) && value.length === 0, "isEmptyValue");
|
8598
8598
|
var getFieldType = /* @__PURE__ */ __name((fieldSchema) => fieldSchema.type, "getFieldType");
|
8599
8599
|
var getNullValue = /* @__PURE__ */ __name((datatype) => {
|
@@ -8611,7 +8611,7 @@ var getNullValue = /* @__PURE__ */ __name((datatype) => {
|
|
8611
8611
|
}
|
8612
8612
|
}, "getNullValue");
|
8613
8613
|
|
8614
|
-
// components/form/
|
8614
|
+
// components/form/utils/schema_utils.ts
|
8615
8615
|
var getInsertableFields = /* @__PURE__ */ __name(function(schema, user) {
|
8616
8616
|
const fields = Object.keys(schema).filter(function(fieldName) {
|
8617
8617
|
var field = schema[fieldName];
|
@@ -8781,7 +8781,7 @@ var formProperties = [
|
|
8781
8781
|
"fieldProperties"
|
8782
8782
|
];
|
8783
8783
|
|
8784
|
-
// components/form/FormContext.tsx
|
8784
|
+
// components/form/core/FormContext.tsx
|
8785
8785
|
init_esm_shims();
|
8786
8786
|
import React6, { useContext as useContext3 } from "react";
|
8787
8787
|
var FormContext = /* @__PURE__ */ React6.createContext(void 0);
|
@@ -8792,7 +8792,7 @@ var useFormContext = /* @__PURE__ */ __name(() => {
|
|
8792
8792
|
return formContext;
|
8793
8793
|
}, "useFormContext");
|
8794
8794
|
|
8795
|
-
// components/form/Form/fields.ts
|
8795
|
+
// components/form/core/Form/fields.ts
|
8796
8796
|
init_esm_shims();
|
8797
8797
|
import uniq from "lodash/uniq.js";
|
8798
8798
|
import compact2 from "lodash/compact.js";
|
@@ -9015,7 +9015,7 @@ var getFieldGroups = /* @__PURE__ */ __name((props, state, context, mutableField
|
|
9015
9015
|
return groupsWithFields;
|
9016
9016
|
}, "getFieldGroups");
|
9017
9017
|
|
9018
|
-
// components/form/Form/utils.ts
|
9018
|
+
// components/form/core/Form/utils.ts
|
9019
9019
|
init_esm_shims();
|
9020
9020
|
import find2 from "lodash/find.js";
|
9021
9021
|
import isEqualWith from "lodash/isEqualWith.js";
|
@@ -9029,17 +9029,17 @@ var isNotSameDocument = /* @__PURE__ */ __name((initialDocument, changedDocument
|
|
9029
9029
|
return typeof changedValue !== "undefined";
|
9030
9030
|
}, "isNotSameDocument");
|
9031
9031
|
|
9032
|
-
// components/form/useWarnOnUnsaved/index.ts
|
9032
|
+
// components/form/hooks/useWarnOnUnsaved/index.ts
|
9033
9033
|
init_esm_shims();
|
9034
9034
|
|
9035
|
-
// components/form/useWarnOnUnsaved/useWarnOnUnsaved.ts
|
9035
|
+
// components/form/hooks/useWarnOnUnsaved/useWarnOnUnsaved.ts
|
9036
9036
|
init_esm_shims();
|
9037
9037
|
|
9038
|
-
// components/form/useBlockTransition/useBlockTransition.ts
|
9038
|
+
// components/form/hooks/useBlockTransition/useBlockTransition.ts
|
9039
9039
|
init_esm_shims();
|
9040
9040
|
import { useEffect, useRef } from "react";
|
9041
9041
|
|
9042
|
-
// components/form/useBlockTransition/block.ts
|
9042
|
+
// components/form/hooks/useBlockTransition/block.ts
|
9043
9043
|
init_esm_shims();
|
9044
9044
|
import debug from "debug";
|
9045
9045
|
var debugTransitions = debug("vn:route-transition");
|
@@ -9072,7 +9072,7 @@ var block = /* @__PURE__ */ __name((setConfirmationMessage, onUnblock) => {
|
|
9072
9072
|
return unblock;
|
9073
9073
|
}, "block");
|
9074
9074
|
|
9075
|
-
// components/form/useBlockTransition/useBlockTransition.ts
|
9075
|
+
// components/form/hooks/useBlockTransition/useBlockTransition.ts
|
9076
9076
|
import debug2 from "debug";
|
9077
9077
|
var debugTransitions2 = debug2("vn:router-transitions");
|
9078
9078
|
var useBlockTransition = /* @__PURE__ */ __name(({ shouldBlock, getBlockedMessage }) => {
|
@@ -9111,7 +9111,7 @@ var useBlockTransition = /* @__PURE__ */ __name(({ shouldBlock, getBlockedMessag
|
|
9111
9111
|
]);
|
9112
9112
|
}, "useBlockTransition");
|
9113
9113
|
|
9114
|
-
// components/form/useWarnOnUnsaved/useWarnOnUnsaved.ts
|
9114
|
+
// components/form/hooks/useWarnOnUnsaved/useWarnOnUnsaved.ts
|
9115
9115
|
import debug3 from "debug";
|
9116
9116
|
import { useIntlContext } from "@vulcanjs/react-i18n";
|
9117
9117
|
var debugTransitions3 = debug3("vn:route-transitions");
|
@@ -9131,7 +9131,7 @@ var useWarnOnUnsaved = /* @__PURE__ */ __name(({ isChanged, warnUnsavedChanges }
|
|
9131
9131
|
});
|
9132
9132
|
}, "useWarnOnUnsaved");
|
9133
9133
|
|
9134
|
-
// components/form/Form/Form.tsx
|
9134
|
+
// components/form/core/Form/Form.tsx
|
9135
9135
|
function _extends3() {
|
9136
9136
|
_extends3 = Object.assign || function(target) {
|
9137
9137
|
for (var i = 1; i < arguments.length; i++) {
|
@@ -9594,7 +9594,7 @@ var Form = /* @__PURE__ */ __name((props) => {
|
|
9594
9594
|
}, formGroupProps(group)))))));
|
9595
9595
|
}, "Form");
|
9596
9596
|
|
9597
|
-
// components/form/Form/typings.ts
|
9597
|
+
// components/form/core/Form/typings.ts
|
9598
9598
|
init_esm_shims();
|
9599
9599
|
|
9600
9600
|
// components/VulcanComponents/index.ts
|
@@ -9610,9 +9610,27 @@ init_esm_shims();
|
|
9610
9610
|
// components/VulcanComponents/defaultVulcanComponents/formComponents.ts
|
9611
9611
|
init_esm_shims();
|
9612
9612
|
|
9613
|
-
// components/form/
|
9613
|
+
// components/form/elements/index.ts
|
9614
|
+
init_esm_shims();
|
9615
|
+
|
9616
|
+
// components/form/elements/FieldErrors.tsx
|
9614
9617
|
init_esm_shims();
|
9615
9618
|
import React8 from "react";
|
9619
|
+
var FieldErrors = /* @__PURE__ */ __name(({ errors }) => {
|
9620
|
+
const VulcanComponents = useVulcanComponents();
|
9621
|
+
return /* @__PURE__ */ React8.createElement("ul", {
|
9622
|
+
className: "form-input-errors"
|
9623
|
+
}, errors.map((error, index) => /* @__PURE__ */ React8.createElement("li", {
|
9624
|
+
key: index
|
9625
|
+
}, /* @__PURE__ */ React8.createElement(VulcanComponents.FormError, {
|
9626
|
+
error,
|
9627
|
+
errorContext: "field"
|
9628
|
+
}))));
|
9629
|
+
}, "FieldErrors");
|
9630
|
+
|
9631
|
+
// components/form/elements/FormError.tsx
|
9632
|
+
init_esm_shims();
|
9633
|
+
import React9 from "react";
|
9616
9634
|
import get3 from "lodash/get.js";
|
9617
9635
|
function _extends4() {
|
9618
9636
|
_extends4 = Object.assign || function(target) {
|
@@ -9658,7 +9676,7 @@ var FormError = /* @__PURE__ */ __name(({ error, errorContext }) => {
|
|
9658
9676
|
values: exception.data
|
9659
9677
|
});
|
9660
9678
|
}
|
9661
|
-
return /* @__PURE__ */
|
9679
|
+
return /* @__PURE__ */ React9.createElement(VulcanComponents.FormattedMessage, _extends4({
|
9662
9680
|
html: true
|
9663
9681
|
}, messageProps));
|
9664
9682
|
}, "FormError");
|
@@ -9666,15 +9684,158 @@ FormError.defaultProps = {
|
|
9666
9684
|
errorContext: ""
|
9667
9685
|
};
|
9668
9686
|
|
9669
|
-
// components/form/
|
9687
|
+
// components/form/elements/FormErrors.tsx
|
9688
|
+
init_esm_shims();
|
9689
|
+
import React10 from "react";
|
9690
|
+
var FormErrors = /* @__PURE__ */ __name(() => {
|
9691
|
+
const VulcanComponents = useVulcanComponents();
|
9692
|
+
const { errors } = useFormContext();
|
9693
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
9694
|
+
className: "form-errors"
|
9695
|
+
}, !!errors.length && /* @__PURE__ */ React10.createElement(VulcanComponents.Alert, {
|
9696
|
+
className: "flash-message",
|
9697
|
+
variant: "danger"
|
9698
|
+
}, /* @__PURE__ */ React10.createElement("ul", null, errors.map((error, index) => /* @__PURE__ */ React10.createElement("li", {
|
9699
|
+
key: index
|
9700
|
+
}, /* @__PURE__ */ React10.createElement(VulcanComponents.FormError, {
|
9701
|
+
error,
|
9702
|
+
errorContext: "form"
|
9703
|
+
}))))));
|
9704
|
+
}, "FormErrors");
|
9705
|
+
|
9706
|
+
// components/form/elements/FormSubmit.tsx
|
9707
|
+
init_esm_shims();
|
9708
|
+
var import_prop_types = __toESM(require_prop_types(), 1);
|
9709
|
+
import React11 from "react";
|
9710
|
+
import { canDeleteDocument } from "@vulcanjs/permissions";
|
9711
|
+
var FormSubmit = /* @__PURE__ */ __name(({
|
9712
|
+
submitLabel,
|
9713
|
+
cancelLabel,
|
9714
|
+
cancelCallback,
|
9715
|
+
revertLabel,
|
9716
|
+
revertCallback,
|
9717
|
+
document,
|
9718
|
+
deleteDocument,
|
9719
|
+
model,
|
9720
|
+
currentUser
|
9721
|
+
}) => {
|
9722
|
+
const VulcanComponents = useVulcanComponents();
|
9723
|
+
const { clearForm } = useFormContext();
|
9724
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
9725
|
+
className: "form-submit"
|
9726
|
+
}, /* @__PURE__ */ React11.createElement(VulcanComponents.Button, {
|
9727
|
+
type: "submit",
|
9728
|
+
variant: "primary"
|
9729
|
+
}, submitLabel ? submitLabel : /* @__PURE__ */ React11.createElement(VulcanComponents.FormattedMessage, {
|
9730
|
+
id: "forms.submit",
|
9731
|
+
defaultMessage: "Submit"
|
9732
|
+
})), cancelCallback ? /* @__PURE__ */ React11.createElement("a", {
|
9733
|
+
className: "form-cancel",
|
9734
|
+
onClick: (e) => {
|
9735
|
+
e.preventDefault();
|
9736
|
+
cancelCallback(document);
|
9737
|
+
}
|
9738
|
+
}, cancelLabel ? cancelLabel : /* @__PURE__ */ React11.createElement(VulcanComponents.FormattedMessage, {
|
9739
|
+
id: "forms.cancel",
|
9740
|
+
defaultMessage: "Cancel"
|
9741
|
+
})) : null, revertCallback ? /* @__PURE__ */ React11.createElement("a", {
|
9742
|
+
className: "form-cancel",
|
9743
|
+
onClick: (e) => {
|
9744
|
+
e.preventDefault();
|
9745
|
+
clearForm();
|
9746
|
+
revertCallback(document);
|
9747
|
+
}
|
9748
|
+
}, revertLabel ? revertLabel : /* @__PURE__ */ React11.createElement(VulcanComponents.FormattedMessage, {
|
9749
|
+
id: "forms.revert",
|
9750
|
+
defaultMessage: "Revert"
|
9751
|
+
})) : null, deleteDocument && canDeleteDocument({
|
9752
|
+
user: currentUser,
|
9753
|
+
document,
|
9754
|
+
model
|
9755
|
+
}) ? /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("hr", null), /* @__PURE__ */ React11.createElement(VulcanComponents.Button, {
|
9756
|
+
variant: "link",
|
9757
|
+
onClick: deleteDocument,
|
9758
|
+
className: `delete-link ${model.name}-delete-link`
|
9759
|
+
}, /* @__PURE__ */ React11.createElement(VulcanComponents.Icon, {
|
9760
|
+
name: "close"
|
9761
|
+
}), " ", /* @__PURE__ */ React11.createElement(VulcanComponents.FormattedMessage, {
|
9762
|
+
id: "forms.delete",
|
9763
|
+
defaultMessage: "Delete"
|
9764
|
+
}))) : null);
|
9765
|
+
}, "FormSubmit");
|
9766
|
+
FormSubmit.propTypes = {
|
9767
|
+
submitLabel: import_prop_types.default.node,
|
9768
|
+
cancelLabel: import_prop_types.default.node,
|
9769
|
+
cancelCallback: import_prop_types.default.func,
|
9770
|
+
revertLabel: import_prop_types.default.node,
|
9771
|
+
revertCallback: import_prop_types.default.func,
|
9772
|
+
document: import_prop_types.default.object,
|
9773
|
+
deleteDocument: import_prop_types.default.func,
|
9774
|
+
collectionName: import_prop_types.default.string,
|
9775
|
+
classes: import_prop_types.default.object
|
9776
|
+
};
|
9777
|
+
|
9778
|
+
// components/form/elements/FormLayout.tsx
|
9670
9779
|
init_esm_shims();
|
9671
|
-
import
|
9780
|
+
import React12 from "react";
|
9781
|
+
function _extends5() {
|
9782
|
+
_extends5 = Object.assign || function(target) {
|
9783
|
+
for (var i = 1; i < arguments.length; i++) {
|
9784
|
+
var source = arguments[i];
|
9785
|
+
for (var key in source) {
|
9786
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
9787
|
+
target[key] = source[key];
|
9788
|
+
}
|
9789
|
+
}
|
9790
|
+
}
|
9791
|
+
return target;
|
9792
|
+
};
|
9793
|
+
return _extends5.apply(this, arguments);
|
9794
|
+
}
|
9795
|
+
__name(_extends5, "_extends");
|
9796
|
+
var FormLayout = /* @__PURE__ */ __name(({ commonProps, formProps, repeatErrors, submitProps, children }) => {
|
9797
|
+
const VulcanComponents = useVulcanComponents();
|
9798
|
+
return /* @__PURE__ */ React12.createElement(VulcanComponents.FormElement, _extends5({}, formProps), /* @__PURE__ */ React12.createElement(VulcanComponents.FormErrors, _extends5({}, commonProps)), children, repeatErrors && /* @__PURE__ */ React12.createElement(VulcanComponents.FormErrors, _extends5({}, commonProps)), /* @__PURE__ */ React12.createElement(VulcanComponents.FormSubmit, _extends5({}, commonProps, submitProps)));
|
9799
|
+
}, "FormLayout");
|
9800
|
+
|
9801
|
+
// components/form/elements/FormElement.tsx
|
9802
|
+
init_esm_shims();
|
9803
|
+
import React13 from "react";
|
9804
|
+
function _extends6() {
|
9805
|
+
_extends6 = Object.assign || function(target) {
|
9806
|
+
for (var i = 1; i < arguments.length; i++) {
|
9807
|
+
var source = arguments[i];
|
9808
|
+
for (var key in source) {
|
9809
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
9810
|
+
target[key] = source[key];
|
9811
|
+
}
|
9812
|
+
}
|
9813
|
+
}
|
9814
|
+
return target;
|
9815
|
+
};
|
9816
|
+
return _extends6.apply(this, arguments);
|
9817
|
+
}
|
9818
|
+
__name(_extends6, "_extends");
|
9819
|
+
var FormElement = /* @__PURE__ */ React13.forwardRef((_a, ref) => {
|
9820
|
+
var _b = _a, { children } = _b, otherProps = __objRest(_b, ["children"]);
|
9821
|
+
const { submitForm } = useFormContext();
|
9822
|
+
return /* @__PURE__ */ React13.createElement("form", _extends6({}, otherProps, {
|
9823
|
+
onSubmit: submitForm,
|
9824
|
+
ref
|
9825
|
+
}), children);
|
9826
|
+
});
|
9827
|
+
|
9828
|
+
// components/form/core/index.ts
|
9829
|
+
init_esm_shims();
|
9830
|
+
|
9831
|
+
// components/form/core/FormComponent.tsx
|
9832
|
+
init_esm_shims();
|
9833
|
+
import React14, { useEffect as useEffect3, useState as useState2 } from "react";
|
9672
9834
|
import get4 from "lodash/get.js";
|
9673
|
-
import
|
9835
|
+
import SimpleSchema from "simpl-schema";
|
9674
9836
|
|
9675
9837
|
// components/form/inputs/consts.ts
|
9676
9838
|
init_esm_shims();
|
9677
|
-
import SimpleSchema from "simpl-schema";
|
9678
9839
|
var standardInputs = [
|
9679
9840
|
"number",
|
9680
9841
|
"url",
|
@@ -9712,13 +9873,13 @@ var allVulcanInputs = [
|
|
9712
9873
|
...derivedInputs
|
9713
9874
|
];
|
9714
9875
|
var getAutoInputFromType = /* @__PURE__ */ __name((fieldType) => {
|
9715
|
-
const autoType = fieldType === Number
|
9876
|
+
const autoType = fieldType === Number ? "number" : fieldType === Boolean ? "checkbox" : fieldType === Date ? "date" : "text";
|
9716
9877
|
return autoType;
|
9717
9878
|
}, "getAutoInputFromType");
|
9718
9879
|
|
9719
|
-
// components/form/FormComponent.tsx
|
9720
|
-
function
|
9721
|
-
|
9880
|
+
// components/form/core/FormComponent.tsx
|
9881
|
+
function _extends7() {
|
9882
|
+
_extends7 = Object.assign || function(target) {
|
9722
9883
|
for (var i = 1; i < arguments.length; i++) {
|
9723
9884
|
var source = arguments[i];
|
9724
9885
|
for (var key in source) {
|
@@ -9729,9 +9890,9 @@ function _extends5() {
|
|
9729
9890
|
}
|
9730
9891
|
return target;
|
9731
9892
|
};
|
9732
|
-
return
|
9893
|
+
return _extends7.apply(this, arguments);
|
9733
9894
|
}
|
9734
|
-
__name(
|
9895
|
+
__name(_extends7, "_extends");
|
9735
9896
|
var getCharacterCounts = /* @__PURE__ */ __name((value, max) => {
|
9736
9897
|
const characterCount = value && value.length ? value.length : 0;
|
9737
9898
|
return {
|
@@ -9758,7 +9919,7 @@ var isArrayField = /* @__PURE__ */ __name((type) => {
|
|
9758
9919
|
return type === Array;
|
9759
9920
|
}, "isArrayField");
|
9760
9921
|
var isObjectField = /* @__PURE__ */ __name((type) => {
|
9761
|
-
return type instanceof
|
9922
|
+
return type instanceof SimpleSchema;
|
9762
9923
|
}, "isObjectField");
|
9763
9924
|
var getInputName = /* @__PURE__ */ __name((fieldType, input) => {
|
9764
9925
|
if (input)
|
@@ -9859,7 +10020,7 @@ var FormComponent = /* @__PURE__ */ __name((props) => {
|
|
9859
10020
|
}
|
9860
10021
|
if (type === Number && value != null) {
|
9861
10022
|
value = Number(value);
|
9862
|
-
} else if (type ===
|
10023
|
+
} else if (type === SimpleSchema.Integer && value != null) {
|
9863
10024
|
value = parseInt(value);
|
9864
10025
|
}
|
9865
10026
|
if (value !== getValue()) {
|
@@ -9906,16 +10067,16 @@ var FormComponent = /* @__PURE__ */ __name((props) => {
|
|
9906
10067
|
}, "clearField");
|
9907
10068
|
const FormComponents = useVulcanComponents();
|
9908
10069
|
if (intlInput) {
|
9909
|
-
return /* @__PURE__ */
|
10070
|
+
return /* @__PURE__ */ React14.createElement(FormComponents.FormIntl, _extends7({}, props));
|
9910
10071
|
} else if (!input && nestedInput) {
|
9911
10072
|
if (isArrayField(type)) {
|
9912
|
-
return /* @__PURE__ */
|
10073
|
+
return /* @__PURE__ */ React14.createElement(FormComponents.FormNestedArray, _extends7({}, props, {
|
9913
10074
|
formComponents: FormComponents,
|
9914
10075
|
errors: getErrors2(),
|
9915
10076
|
value: getValue()
|
9916
10077
|
}));
|
9917
10078
|
} else if (isObjectField(type)) {
|
9918
|
-
return /* @__PURE__ */
|
10079
|
+
return /* @__PURE__ */ React14.createElement(FormComponents.FormNestedObject, _extends7({}, props, {
|
9919
10080
|
formComponents: FormComponents,
|
9920
10081
|
errors: getErrors2(),
|
9921
10082
|
value: getValue()
|
@@ -9938,17 +10099,17 @@ var FormComponent = /* @__PURE__ */ __name((props) => {
|
|
9938
10099
|
if (!query && typeof options === "function") {
|
9939
10100
|
fciProps.options = options(fciProps);
|
9940
10101
|
}
|
9941
|
-
const fci = /* @__PURE__ */
|
9942
|
-
return query ? /* @__PURE__ */
|
10102
|
+
const fci = /* @__PURE__ */ React14.createElement(FormComponents.FormComponentInner, _extends7({}, fciProps));
|
10103
|
+
return query ? /* @__PURE__ */ React14.createElement(FormComponents.FormComponentLoader, _extends7({}, fciProps), fci) : fci;
|
9943
10104
|
}, "FormComponent");
|
9944
10105
|
var FormComponent_default = FormComponent;
|
9945
10106
|
|
9946
|
-
// components/form/FormComponentInner.tsx
|
10107
|
+
// components/form/core/FormComponentInner.tsx
|
9947
10108
|
init_esm_shims();
|
9948
|
-
import
|
10109
|
+
import React15 from "react";
|
9949
10110
|
import { useIntlContext as useIntlContext3 } from "@vulcanjs/react-i18n";
|
9950
10111
|
|
9951
|
-
// components/form/ui_utils.ts
|
10112
|
+
// components/form/utils/ui_utils.ts
|
9952
10113
|
init_esm_shims();
|
9953
10114
|
import pick3 from "lodash/pick.js";
|
9954
10115
|
var whitelistInputProps = /* @__PURE__ */ __name((props) => {
|
@@ -9963,13 +10124,19 @@ var whitelistInputProps = /* @__PURE__ */ __name((props) => {
|
|
9963
10124
|
"disabled",
|
9964
10125
|
"placeholder"
|
9965
10126
|
];
|
9966
|
-
|
10127
|
+
const value = props.value;
|
10128
|
+
let safeValue = value;
|
10129
|
+
if (value === null)
|
10130
|
+
safeValue = void 0;
|
10131
|
+
return __spreadProps(__spreadValues({}, pick3(props, whitelist)), {
|
10132
|
+
value: safeValue
|
10133
|
+
});
|
9967
10134
|
}, "whitelistInputProps");
|
9968
10135
|
|
9969
|
-
// components/form/FormComponentInner.tsx
|
10136
|
+
// components/form/core/FormComponentInner.tsx
|
9970
10137
|
import classNames from "classnames";
|
9971
|
-
function
|
9972
|
-
|
10138
|
+
function _extends8() {
|
10139
|
+
_extends8 = Object.assign || function(target) {
|
9973
10140
|
for (var i = 1; i < arguments.length; i++) {
|
9974
10141
|
var source = arguments[i];
|
9975
10142
|
for (var key in source) {
|
@@ -9980,21 +10147,21 @@ function _extends6() {
|
|
9980
10147
|
}
|
9981
10148
|
return target;
|
9982
10149
|
};
|
9983
|
-
return
|
10150
|
+
return _extends8.apply(this, arguments);
|
9984
10151
|
}
|
9985
|
-
__name(
|
10152
|
+
__name(_extends8, "_extends");
|
9986
10153
|
var FormComponentInner = /* @__PURE__ */ __name((props) => {
|
9987
10154
|
const intl = useIntlContext3();
|
9988
10155
|
const { inputType: inputType1, disabled, clearField } = props;
|
9989
10156
|
const renderClear = /* @__PURE__ */ __name(() => {
|
9990
10157
|
if (clearableInputs.includes(inputType1) && !disabled) {
|
9991
|
-
return /* @__PURE__ */
|
10158
|
+
return /* @__PURE__ */ React15.createElement("button", {
|
9992
10159
|
className: "form-component-clear",
|
9993
10160
|
title: intl.formatMessage({
|
9994
10161
|
id: "forms.clear_field"
|
9995
10162
|
}),
|
9996
10163
|
onClick: clearField
|
9997
|
-
}, /* @__PURE__ */
|
10164
|
+
}, /* @__PURE__ */ React15.createElement("span", null, "\u2715"));
|
9998
10165
|
}
|
9999
10166
|
}, "renderClear");
|
10000
10167
|
const getProperties = /* @__PURE__ */ __name(() => {
|
@@ -10037,20 +10204,20 @@ var FormComponentInner = /* @__PURE__ */ __name((props) => {
|
|
10037
10204
|
});
|
10038
10205
|
const properties1 = getProperties();
|
10039
10206
|
const FormInput = formInput;
|
10040
|
-
return /* @__PURE__ */
|
10207
|
+
return /* @__PURE__ */ React15.createElement("div", {
|
10041
10208
|
className: inputClass
|
10042
|
-
}, /* @__PURE__ */
|
10209
|
+
}, /* @__PURE__ */ React15.createElement(FormInput, _extends8({}, properties1)), hasErrors ? /* @__PURE__ */ React15.createElement(FormComponents.FieldErrors, {
|
10043
10210
|
errors
|
10044
|
-
}) : null, renderClear(), showCharsRemaining && /* @__PURE__ */
|
10211
|
+
}) : null, renderClear(), showCharsRemaining && /* @__PURE__ */ React15.createElement("div", {
|
10045
10212
|
className: classNames("form-control-limit", {
|
10046
10213
|
danger: charsRemaining < 10
|
10047
10214
|
})
|
10048
10215
|
}, charsRemaining));
|
10049
10216
|
}, "FormComponentInner");
|
10050
10217
|
|
10051
|
-
// components/form/FormComponentLoader.tsx
|
10218
|
+
// components/form/core/FormComponentLoader.tsx
|
10052
10219
|
init_esm_shims();
|
10053
|
-
import
|
10220
|
+
import React16, { useEffect as useEffect4 } from "react";
|
10054
10221
|
import { useLazyQuery } from "@apollo/client";
|
10055
10222
|
import isEmpty2 from "lodash/isEmpty.js";
|
10056
10223
|
var FormComponentLoader = /* @__PURE__ */ __name((props) => {
|
@@ -10079,9 +10246,9 @@ var FormComponentLoader = /* @__PURE__ */ __name((props) => {
|
|
10079
10246
|
throw new Error(error.toString());
|
10080
10247
|
}
|
10081
10248
|
if (loading) {
|
10082
|
-
return /* @__PURE__ */
|
10249
|
+
return /* @__PURE__ */ React16.createElement("div", {
|
10083
10250
|
className: "form-component-loader"
|
10084
|
-
}, /* @__PURE__ */
|
10251
|
+
}, /* @__PURE__ */ React16.createElement(VulcanComponents.Loading, null));
|
10085
10252
|
}
|
10086
10253
|
const extraProps = {
|
10087
10254
|
data,
|
@@ -10095,50 +10262,23 @@ var FormComponentLoader = /* @__PURE__ */ __name((props) => {
|
|
10095
10262
|
data
|
10096
10263
|
}));
|
10097
10264
|
}
|
10098
|
-
if (!/* @__PURE__ */
|
10265
|
+
if (!/* @__PURE__ */ React16.isValidElement(children)) {
|
10099
10266
|
throw new Error("Children of FormComponentLoader must be a React element, got " + children);
|
10100
10267
|
}
|
10101
|
-
const fci = /* @__PURE__ */
|
10102
|
-
return /* @__PURE__ */
|
10268
|
+
const fci = /* @__PURE__ */ React16.cloneElement(children, extraProps);
|
10269
|
+
return /* @__PURE__ */ React16.createElement("div", {
|
10103
10270
|
className: "form-component-loader"
|
10104
10271
|
}, fci);
|
10105
10272
|
}, "FormComponentLoader");
|
10106
10273
|
FormComponentLoader.propTypes = {};
|
10107
10274
|
|
10108
|
-
// components/form/
|
10275
|
+
// components/form/core/FormGroup.tsx
|
10109
10276
|
init_esm_shims();
|
10110
|
-
import
|
10111
|
-
function _extends7() {
|
10112
|
-
_extends7 = Object.assign || function(target) {
|
10113
|
-
for (var i = 1; i < arguments.length; i++) {
|
10114
|
-
var source = arguments[i];
|
10115
|
-
for (var key in source) {
|
10116
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
10117
|
-
target[key] = source[key];
|
10118
|
-
}
|
10119
|
-
}
|
10120
|
-
}
|
10121
|
-
return target;
|
10122
|
-
};
|
10123
|
-
return _extends7.apply(this, arguments);
|
10124
|
-
}
|
10125
|
-
__name(_extends7, "_extends");
|
10126
|
-
var FormElement = /* @__PURE__ */ React12.forwardRef((_a, ref) => {
|
10127
|
-
var _b = _a, { children } = _b, otherProps = __objRest(_b, ["children"]);
|
10128
|
-
const { submitForm } = useFormContext();
|
10129
|
-
return /* @__PURE__ */ React12.createElement("form", _extends7({}, otherProps, {
|
10130
|
-
onSubmit: submitForm,
|
10131
|
-
ref
|
10132
|
-
}), children);
|
10133
|
-
});
|
10134
|
-
|
10135
|
-
// components/form/FormGroup.tsx
|
10136
|
-
init_esm_shims();
|
10137
|
-
import React13, { useState as useState3 } from "react";
|
10277
|
+
import React17, { useState as useState3 } from "react";
|
10138
10278
|
import _some from "lodash/some.js";
|
10139
10279
|
import { isAdmin } from "@vulcanjs/permissions";
|
10140
|
-
function
|
10141
|
-
|
10280
|
+
function _extends9() {
|
10281
|
+
_extends9 = Object.assign || function(target) {
|
10142
10282
|
for (var i = 1; i < arguments.length; i++) {
|
10143
10283
|
var source = arguments[i];
|
10144
10284
|
for (var key in source) {
|
@@ -10149,14 +10289,14 @@ function _extends8() {
|
|
10149
10289
|
}
|
10150
10290
|
return target;
|
10151
10291
|
};
|
10152
|
-
return
|
10292
|
+
return _extends9.apply(this, arguments);
|
10153
10293
|
}
|
10154
|
-
__name(
|
10294
|
+
__name(_extends9, "_extends");
|
10155
10295
|
var FormGroupLayout = /* @__PURE__ */ __name((_a) => {
|
10156
10296
|
var _b = _a, { anchorName, collapsed, hasErrors, group, document, toggle } = _b, props = __objRest(_b, ["anchorName", "collapsed", "hasErrors", "group", "document", "toggle"]);
|
10157
|
-
return /* @__PURE__ */
|
10297
|
+
return /* @__PURE__ */ React17.createElement("fieldset", _extends9({}, props));
|
10158
10298
|
}, "FormGroupLayout");
|
10159
|
-
var FormGroupHeader = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10299
|
+
var FormGroupHeader = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React17.createElement("h2", _extends9({}, props)), "FormGroupHeader");
|
10160
10300
|
var FormGroup = /* @__PURE__ */ __name((props) => {
|
10161
10301
|
const { name: name2, label, group, fields, hidden, document, currentUser, disabled, itemProperties, prefilledProps, formType } = props;
|
10162
10302
|
const { errors, clearFieldErrors } = useFormContext();
|
@@ -10169,7 +10309,7 @@ var FormGroup = /* @__PURE__ */ __name((props) => {
|
|
10169
10309
|
const isHidden = typeof hidden === "function" ? hidden(__spreadProps(__spreadValues({}, props), {
|
10170
10310
|
document
|
10171
10311
|
})) : hidden || false;
|
10172
|
-
const heading = /* @__PURE__ */
|
10312
|
+
const heading = /* @__PURE__ */ React17.createElement(VulcanComponents.FormGroupHeader, {
|
10173
10313
|
toggle,
|
10174
10314
|
label,
|
10175
10315
|
collapsed: collapsed1,
|
@@ -10180,7 +10320,7 @@ var FormGroup = /* @__PURE__ */ __name((props) => {
|
|
10180
10320
|
return null;
|
10181
10321
|
}
|
10182
10322
|
const anchorName = name2.split(".").length > 1 ? name2.split(".")[1] : name2;
|
10183
|
-
return /* @__PURE__ */
|
10323
|
+
return /* @__PURE__ */ React17.createElement(VulcanComponents.FormGroupLayout, {
|
10184
10324
|
label,
|
10185
10325
|
anchorName,
|
10186
10326
|
toggle,
|
@@ -10190,7 +10330,7 @@ var FormGroup = /* @__PURE__ */ __name((props) => {
|
|
10190
10330
|
heading: name2 === "default" ? null : heading,
|
10191
10331
|
hasErrors,
|
10192
10332
|
document
|
10193
|
-
}, fields.map((field) => /* @__PURE__ */
|
10333
|
+
}, fields.map((field) => /* @__PURE__ */ React17.createElement(VulcanComponents.FormComponent, _extends9({
|
10194
10334
|
key: field.name,
|
10195
10335
|
disabled
|
10196
10336
|
}, field, {
|
@@ -10203,12 +10343,12 @@ var FormGroup = /* @__PURE__ */ __name((props) => {
|
|
10203
10343
|
}))));
|
10204
10344
|
}, "FormGroup");
|
10205
10345
|
|
10206
|
-
// components/form/FormIntl.tsx
|
10346
|
+
// components/form/intl/FormIntl.tsx
|
10207
10347
|
init_esm_shims();
|
10208
|
-
import
|
10348
|
+
import React18 from "react";
|
10209
10349
|
import omit2 from "lodash/omit.js";
|
10210
|
-
function
|
10211
|
-
|
10350
|
+
function _extends10() {
|
10351
|
+
_extends10 = Object.assign || function(target) {
|
10212
10352
|
for (var i = 1; i < arguments.length; i++) {
|
10213
10353
|
var source = arguments[i];
|
10214
10354
|
for (var key in source) {
|
@@ -10219,13 +10359,13 @@ function _extends9() {
|
|
10219
10359
|
}
|
10220
10360
|
return target;
|
10221
10361
|
};
|
10222
|
-
return
|
10362
|
+
return _extends10.apply(this, arguments);
|
10223
10363
|
}
|
10224
|
-
__name(
|
10225
|
-
var FormIntlLayout = /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */
|
10364
|
+
__name(_extends10, "_extends");
|
10365
|
+
var FormIntlLayout = /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ React18.createElement("div", {
|
10226
10366
|
className: "form-intl"
|
10227
10367
|
}, children), "FormIntlLayout");
|
10228
|
-
var FormIntlItemLayout = /* @__PURE__ */ __name(({ locale, children }) => /* @__PURE__ */
|
10368
|
+
var FormIntlItemLayout = /* @__PURE__ */ __name(({ locale, children }) => /* @__PURE__ */ React18.createElement("div", {
|
10229
10369
|
className: `form-intl-${locale.id}`
|
10230
10370
|
}, children), "FormIntlItemLayout");
|
10231
10371
|
var FormIntl = /* @__PURE__ */ __name((props) => {
|
@@ -10237,133 +10377,22 @@ var FormIntl = /* @__PURE__ */ __name((props) => {
|
|
10237
10377
|
}, "getLocalePath");
|
10238
10378
|
const { name: name2 } = props;
|
10239
10379
|
const properties = omit2(props, "value", "inputProperties", "intlInput", "nestedInput");
|
10240
|
-
return /* @__PURE__ */
|
10380
|
+
return /* @__PURE__ */ React18.createElement(FormComponents.FormIntlLayout, null, Locales.map((locale, i) => /* @__PURE__ */ React18.createElement(FormComponents.FormIntlItemLayout, {
|
10241
10381
|
key: locale.id,
|
10242
10382
|
locale
|
10243
|
-
}, /* @__PURE__ */
|
10383
|
+
}, /* @__PURE__ */ React18.createElement(FormComponents.FormComponent, _extends10({}, properties, {
|
10244
10384
|
label: getLabel2(name2, locale.id),
|
10245
10385
|
path: getLocalePath(i),
|
10246
10386
|
locale: locale.id
|
10247
10387
|
})))));
|
10248
10388
|
}, "FormIntl");
|
10249
10389
|
|
10250
|
-
// components/form/
|
10390
|
+
// components/form/nested/index.ts
|
10251
10391
|
init_esm_shims();
|
10252
|
-
import React15 from "react";
|
10253
|
-
var FormErrors = /* @__PURE__ */ __name(() => {
|
10254
|
-
const VulcanComponents = useVulcanComponents();
|
10255
|
-
const { errors } = useFormContext();
|
10256
|
-
return /* @__PURE__ */ React15.createElement("div", {
|
10257
|
-
className: "form-errors"
|
10258
|
-
}, !!errors.length && /* @__PURE__ */ React15.createElement(VulcanComponents.Alert, {
|
10259
|
-
className: "flash-message",
|
10260
|
-
variant: "danger"
|
10261
|
-
}, /* @__PURE__ */ React15.createElement("ul", null, errors.map((error, index) => /* @__PURE__ */ React15.createElement("li", {
|
10262
|
-
key: index
|
10263
|
-
}, /* @__PURE__ */ React15.createElement(VulcanComponents.FormError, {
|
10264
|
-
error,
|
10265
|
-
errorContext: "form"
|
10266
|
-
}))))));
|
10267
|
-
}, "FormErrors");
|
10268
10392
|
|
10269
|
-
// components/form/
|
10393
|
+
// components/form/nested/FormNestedArray.tsx
|
10270
10394
|
init_esm_shims();
|
10271
|
-
|
10272
|
-
import React16 from "react";
|
10273
|
-
import { canDeleteDocument } from "@vulcanjs/permissions";
|
10274
|
-
var FormSubmit = /* @__PURE__ */ __name(({
|
10275
|
-
submitLabel,
|
10276
|
-
cancelLabel,
|
10277
|
-
cancelCallback,
|
10278
|
-
revertLabel,
|
10279
|
-
revertCallback,
|
10280
|
-
document,
|
10281
|
-
deleteDocument,
|
10282
|
-
model,
|
10283
|
-
currentUser
|
10284
|
-
}) => {
|
10285
|
-
const VulcanComponents = useVulcanComponents();
|
10286
|
-
const { clearForm } = useFormContext();
|
10287
|
-
return /* @__PURE__ */ React16.createElement("div", {
|
10288
|
-
className: "form-submit"
|
10289
|
-
}, /* @__PURE__ */ React16.createElement(VulcanComponents.Button, {
|
10290
|
-
type: "submit",
|
10291
|
-
variant: "primary"
|
10292
|
-
}, submitLabel ? submitLabel : /* @__PURE__ */ React16.createElement(VulcanComponents.FormattedMessage, {
|
10293
|
-
id: "forms.submit",
|
10294
|
-
defaultMessage: "Submit"
|
10295
|
-
})), cancelCallback ? /* @__PURE__ */ React16.createElement("a", {
|
10296
|
-
className: "form-cancel",
|
10297
|
-
onClick: (e) => {
|
10298
|
-
e.preventDefault();
|
10299
|
-
cancelCallback(document);
|
10300
|
-
}
|
10301
|
-
}, cancelLabel ? cancelLabel : /* @__PURE__ */ React16.createElement(VulcanComponents.FormattedMessage, {
|
10302
|
-
id: "forms.cancel",
|
10303
|
-
defaultMessage: "Cancel"
|
10304
|
-
})) : null, revertCallback ? /* @__PURE__ */ React16.createElement("a", {
|
10305
|
-
className: "form-cancel",
|
10306
|
-
onClick: (e) => {
|
10307
|
-
e.preventDefault();
|
10308
|
-
clearForm();
|
10309
|
-
revertCallback(document);
|
10310
|
-
}
|
10311
|
-
}, revertLabel ? revertLabel : /* @__PURE__ */ React16.createElement(VulcanComponents.FormattedMessage, {
|
10312
|
-
id: "forms.revert",
|
10313
|
-
defaultMessage: "Revert"
|
10314
|
-
})) : null, deleteDocument && canDeleteDocument({
|
10315
|
-
user: currentUser,
|
10316
|
-
document,
|
10317
|
-
model
|
10318
|
-
}) ? /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement("hr", null), /* @__PURE__ */ React16.createElement(VulcanComponents.Button, {
|
10319
|
-
variant: "link",
|
10320
|
-
onClick: deleteDocument,
|
10321
|
-
className: `delete-link ${model.name}-delete-link`
|
10322
|
-
}, /* @__PURE__ */ React16.createElement(VulcanComponents.Icon, {
|
10323
|
-
name: "close"
|
10324
|
-
}), " ", /* @__PURE__ */ React16.createElement(VulcanComponents.FormattedMessage, {
|
10325
|
-
id: "forms.delete",
|
10326
|
-
defaultMessage: "Delete"
|
10327
|
-
}))) : null);
|
10328
|
-
}, "FormSubmit");
|
10329
|
-
FormSubmit.propTypes = {
|
10330
|
-
submitLabel: import_prop_types.default.node,
|
10331
|
-
cancelLabel: import_prop_types.default.node,
|
10332
|
-
cancelCallback: import_prop_types.default.func,
|
10333
|
-
revertLabel: import_prop_types.default.node,
|
10334
|
-
revertCallback: import_prop_types.default.func,
|
10335
|
-
document: import_prop_types.default.object,
|
10336
|
-
deleteDocument: import_prop_types.default.func,
|
10337
|
-
collectionName: import_prop_types.default.string,
|
10338
|
-
classes: import_prop_types.default.object
|
10339
|
-
};
|
10340
|
-
|
10341
|
-
// components/form/FormLayout.tsx
|
10342
|
-
init_esm_shims();
|
10343
|
-
import React17 from "react";
|
10344
|
-
function _extends10() {
|
10345
|
-
_extends10 = Object.assign || function(target) {
|
10346
|
-
for (var i = 1; i < arguments.length; i++) {
|
10347
|
-
var source = arguments[i];
|
10348
|
-
for (var key in source) {
|
10349
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
10350
|
-
target[key] = source[key];
|
10351
|
-
}
|
10352
|
-
}
|
10353
|
-
}
|
10354
|
-
return target;
|
10355
|
-
};
|
10356
|
-
return _extends10.apply(this, arguments);
|
10357
|
-
}
|
10358
|
-
__name(_extends10, "_extends");
|
10359
|
-
var FormLayout = /* @__PURE__ */ __name(({ commonProps, formProps, repeatErrors, submitProps, children }) => {
|
10360
|
-
const VulcanComponents = useVulcanComponents();
|
10361
|
-
return /* @__PURE__ */ React17.createElement(VulcanComponents.FormElement, _extends10({}, formProps), /* @__PURE__ */ React17.createElement(VulcanComponents.FormErrors, _extends10({}, commonProps)), children, repeatErrors && /* @__PURE__ */ React17.createElement(VulcanComponents.FormErrors, _extends10({}, commonProps)), /* @__PURE__ */ React17.createElement(VulcanComponents.FormSubmit, _extends10({}, commonProps, submitProps)));
|
10362
|
-
}, "FormLayout");
|
10363
|
-
|
10364
|
-
// components/form/FormNestedArray.tsx
|
10365
|
-
init_esm_shims();
|
10366
|
-
import React18, { useEffect as useEffect5 } from "react";
|
10395
|
+
import React19, { useEffect as useEffect5 } from "react";
|
10367
10396
|
import _omit from "lodash/omit.js";
|
10368
10397
|
import _get from "lodash/get.js";
|
10369
10398
|
function _extends11() {
|
@@ -10384,12 +10413,12 @@ __name(_extends11, "_extends");
|
|
10384
10413
|
var FormNestedArrayInnerLayout = /* @__PURE__ */ __name((props) => {
|
10385
10414
|
const { label, children, addItem, BeforeComponent, AfterComponent } = props;
|
10386
10415
|
const FormComponents = useVulcanComponents();
|
10387
|
-
return /* @__PURE__ */
|
10416
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
10388
10417
|
className: "form-nested-array-inner-layout"
|
10389
|
-
}, /* @__PURE__ */
|
10418
|
+
}, /* @__PURE__ */ React19.createElement(BeforeComponent, _extends11({}, props)), children, /* @__PURE__ */ React19.createElement(FormComponents.FormNestedDivider, {
|
10390
10419
|
label,
|
10391
10420
|
addItem
|
10392
|
-
}), /* @__PURE__ */
|
10421
|
+
}), /* @__PURE__ */ React19.createElement(AfterComponent, _extends11({}, props)));
|
10393
10422
|
}, "FormNestedArrayInnerLayout");
|
10394
10423
|
var FormNestedArray = /* @__PURE__ */ __name((props) => {
|
10395
10424
|
const { updateCurrentValues, deletedValues, errors } = useFormContext();
|
@@ -10436,18 +10465,18 @@ var FormNestedArray = /* @__PURE__ */ __name((props) => {
|
|
10436
10465
|
properties.addItem = !maxCount || arrayLength < maxCount ? addItem : null;
|
10437
10466
|
properties.nestedArrayErrors = errors.filter((error) => error.path && error.path === path1);
|
10438
10467
|
properties.hasErrors = !!(properties.nestedArrayErrors && properties.nestedArrayErrors.length);
|
10439
|
-
return /* @__PURE__ */
|
10468
|
+
return /* @__PURE__ */ React19.createElement(FormComponents.FormNestedArrayLayout, _extends11({}, properties), value.map((subDocument, i) => {
|
10440
10469
|
if (isDeleted(i))
|
10441
10470
|
return null;
|
10442
10471
|
const path = `${props.path}.${i}`;
|
10443
10472
|
const visibleItemIndex = visibleItemIndexes[i];
|
10444
|
-
return /* @__PURE__ */
|
10473
|
+
return /* @__PURE__ */ React19.createElement(FormComponents.FormNestedArrayInnerLayout, _extends11({}, arrayField, {
|
10445
10474
|
key: path,
|
10446
10475
|
addItem,
|
10447
10476
|
itemIndex: i,
|
10448
10477
|
visibleItemIndex,
|
10449
10478
|
path
|
10450
|
-
}), /* @__PURE__ */
|
10479
|
+
}), /* @__PURE__ */ React19.createElement(FormComponents.FormNestedItem, _extends11({}, properties, {
|
10451
10480
|
itemIndex: i,
|
10452
10481
|
visibleItemIndex,
|
10453
10482
|
path,
|
@@ -10458,29 +10487,29 @@ var FormNestedArray = /* @__PURE__ */ __name((props) => {
|
|
10458
10487
|
})));
|
10459
10488
|
}));
|
10460
10489
|
}, "FormNestedArray");
|
10461
|
-
var IconAdd = /* @__PURE__ */ __name(({ width = 24, height = 24 }) => /* @__PURE__ */
|
10490
|
+
var IconAdd = /* @__PURE__ */ __name(({ width = 24, height = 24 }) => /* @__PURE__ */ React19.createElement("svg", {
|
10462
10491
|
width,
|
10463
10492
|
height,
|
10464
10493
|
xmlns: "http://www.w3.org/2000/svg",
|
10465
10494
|
viewBox: "0 0 448 512"
|
10466
|
-
}, /* @__PURE__ */
|
10495
|
+
}, /* @__PURE__ */ React19.createElement("path", {
|
10467
10496
|
fill: "currentColor",
|
10468
10497
|
d: "M448 294.2v-76.4c0-13.3-10.7-24-24-24H286.2V56c0-13.3-10.7-24-24-24h-76.4c-13.3 0-24 10.7-24 24v137.8H24c-13.3 0-24 10.7-24 24v76.4c0 13.3 10.7 24 24 24h137.8V456c0 13.3 10.7 24 24 24h76.4c13.3 0 24-10.7 24-24V318.2H424c13.3 0 24-10.7 24-24z"
|
10469
10498
|
})), "IconAdd");
|
10470
|
-
var IconRemove = /* @__PURE__ */ __name(({ width = 24, height = 24 }) => /* @__PURE__ */
|
10499
|
+
var IconRemove = /* @__PURE__ */ __name(({ width = 24, height = 24 }) => /* @__PURE__ */ React19.createElement("svg", {
|
10471
10500
|
width,
|
10472
10501
|
height,
|
10473
10502
|
xmlns: "http://www.w3.org/2000/svg",
|
10474
10503
|
viewBox: "0 0 448 512"
|
10475
|
-
}, /* @__PURE__ */
|
10504
|
+
}, /* @__PURE__ */ React19.createElement("path", {
|
10476
10505
|
fill: "currentColor",
|
10477
10506
|
d: "M424 318.2c13.3 0 24-10.7 24-24v-76.4c0-13.3-10.7-24-24-24H24c-13.3 0-24 10.7-24 24v76.4c0 13.3 10.7 24 24 24h400z"
|
10478
10507
|
})), "IconRemove");
|
10479
10508
|
|
10480
|
-
// components/form/FormNestedArrayLayout.tsx
|
10509
|
+
// components/form/nested/FormNestedArrayLayout.tsx
|
10481
10510
|
init_esm_shims();
|
10482
10511
|
var import_prop_types2 = __toESM(require_prop_types(), 1);
|
10483
|
-
import
|
10512
|
+
import React20 from "react";
|
10484
10513
|
function _extends12() {
|
10485
10514
|
_extends12 = Object.assign || function(target) {
|
10486
10515
|
for (var i = 1; i < arguments.length; i++) {
|
@@ -10499,24 +10528,24 @@ __name(_extends12, "_extends");
|
|
10499
10528
|
var FormNestedArrayLayout = /* @__PURE__ */ __name((props) => {
|
10500
10529
|
const { hasErrors, nestedArrayErrors, label, addItem, BeforeComponent, AfterComponent, children } = props;
|
10501
10530
|
const VulcanComponents = useVulcanComponents();
|
10502
|
-
return /* @__PURE__ */
|
10531
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
10503
10532
|
className: `form-group row form-nested ${hasErrors ? "input-error" : ""}`
|
10504
|
-
}, BeforeComponent && /* @__PURE__ */
|
10533
|
+
}, BeforeComponent && /* @__PURE__ */ React20.createElement(BeforeComponent, _extends12({}, props)), /* @__PURE__ */ React20.createElement("label", {
|
10505
10534
|
className: "control-label col-sm-3"
|
10506
|
-
}, label), /* @__PURE__ */
|
10535
|
+
}, label), /* @__PURE__ */ React20.createElement("div", {
|
10507
10536
|
className: "col-sm-9"
|
10508
|
-
}, children, addItem && /* @__PURE__ */
|
10537
|
+
}, children, addItem && /* @__PURE__ */ React20.createElement(VulcanComponents.Button, {
|
10509
10538
|
className: "form-nested-button form-nested-add",
|
10510
10539
|
size: "sm",
|
10511
10540
|
variant: "success",
|
10512
10541
|
onClick: addItem
|
10513
|
-
}, /* @__PURE__ */
|
10542
|
+
}, /* @__PURE__ */ React20.createElement(VulcanComponents.IconAdd, {
|
10514
10543
|
height: 12,
|
10515
10544
|
width: 12
|
10516
|
-
})), props.hasErrors ? /* @__PURE__ */
|
10545
|
+
})), props.hasErrors ? /* @__PURE__ */ React20.createElement(VulcanComponents.FieldErrors, {
|
10517
10546
|
key: "form-nested-errors",
|
10518
10547
|
errors: nestedArrayErrors
|
10519
|
-
}) : null), AfterComponent && /* @__PURE__ */
|
10548
|
+
}) : null), AfterComponent && /* @__PURE__ */ React20.createElement(AfterComponent, _extends12({}, props)));
|
10520
10549
|
}, "FormNestedArrayLayout");
|
10521
10550
|
FormNestedArrayLayout.propTypes = {
|
10522
10551
|
hasErrors: import_prop_types2.default.bool.isRequired,
|
@@ -10530,10 +10559,10 @@ FormNestedArrayLayout.propTypes = {
|
|
10530
10559
|
children: import_prop_types2.default.node
|
10531
10560
|
};
|
10532
10561
|
|
10533
|
-
// components/form/FormNestedItem.tsx
|
10562
|
+
// components/form/nested/FormNestedItem.tsx
|
10534
10563
|
init_esm_shims();
|
10535
10564
|
var import_prop_types3 = __toESM(require_prop_types(), 1);
|
10536
|
-
import
|
10565
|
+
import React21 from "react";
|
10537
10566
|
import { intlShape } from "@vulcanjs/react-i18n";
|
10538
10567
|
import { useIntlContext as useIntlContext4 } from "@vulcanjs/react-i18n";
|
10539
10568
|
function _extends13() {
|
@@ -10551,16 +10580,16 @@ function _extends13() {
|
|
10551
10580
|
return _extends13.apply(this, arguments);
|
10552
10581
|
}
|
10553
10582
|
__name(_extends13, "_extends");
|
10554
|
-
var FormNestedItemLayout = /* @__PURE__ */ __name(({ content, removeButton }) => /* @__PURE__ */
|
10583
|
+
var FormNestedItemLayout = /* @__PURE__ */ __name(({ content, removeButton }) => /* @__PURE__ */ React21.createElement("div", {
|
10555
10584
|
className: "form-nested-item"
|
10556
|
-
}, /* @__PURE__ */
|
10585
|
+
}, /* @__PURE__ */ React21.createElement("div", {
|
10557
10586
|
className: "form-nested-item-inner"
|
10558
10587
|
}, content), removeButton && [
|
10559
|
-
/* @__PURE__ */
|
10588
|
+
/* @__PURE__ */ React21.createElement("div", {
|
10560
10589
|
key: "remove-button",
|
10561
10590
|
className: "form-nested-item-remove"
|
10562
10591
|
}, removeButton),
|
10563
|
-
/* @__PURE__ */
|
10592
|
+
/* @__PURE__ */ React21.createElement("div", {
|
10564
10593
|
key: "remove-button-overlay",
|
10565
10594
|
className: "form-nested-item-deleted-overlay"
|
10566
10595
|
})
|
@@ -10574,9 +10603,9 @@ var FormNestedItem = /* @__PURE__ */ __name((_a) => {
|
|
10574
10603
|
const VulcanComponents = useVulcanComponents();
|
10575
10604
|
const intl = useIntlContext4();
|
10576
10605
|
const isArray = typeof itemIndex !== "undefined";
|
10577
|
-
return /* @__PURE__ */
|
10606
|
+
return /* @__PURE__ */ React21.createElement(VulcanComponents.FormNestedItemLayout, {
|
10578
10607
|
content: nestedFields.map((field, i) => {
|
10579
|
-
return /* @__PURE__ */
|
10608
|
+
return /* @__PURE__ */ React21.createElement(VulcanComponents.FormComponent, _extends13({
|
10580
10609
|
key: i
|
10581
10610
|
}, props, field, {
|
10582
10611
|
path: `${path}.${field.name}`,
|
@@ -10584,10 +10613,10 @@ var FormNestedItem = /* @__PURE__ */ __name((_a) => {
|
|
10584
10613
|
}));
|
10585
10614
|
}),
|
10586
10615
|
removeButton: isArray && !hideRemove && [
|
10587
|
-
/* @__PURE__ */
|
10616
|
+
/* @__PURE__ */ React21.createElement("div", {
|
10588
10617
|
key: "remove-button",
|
10589
10618
|
className: "form-nested-item-remove"
|
10590
|
-
}, /* @__PURE__ */
|
10619
|
+
}, /* @__PURE__ */ React21.createElement(VulcanComponents.Button, {
|
10591
10620
|
className: "form-nested-button",
|
10592
10621
|
variant: "danger",
|
10593
10622
|
size: "sm",
|
@@ -10601,11 +10630,11 @@ var FormNestedItem = /* @__PURE__ */ __name((_a) => {
|
|
10601
10630
|
}, {
|
10602
10631
|
label
|
10603
10632
|
})
|
10604
|
-
}, /* @__PURE__ */
|
10633
|
+
}, /* @__PURE__ */ React21.createElement(VulcanComponents.IconRemove, {
|
10605
10634
|
height: 12,
|
10606
10635
|
width: 12
|
10607
10636
|
}))),
|
10608
|
-
/* @__PURE__ */
|
10637
|
+
/* @__PURE__ */ React21.createElement("div", {
|
10609
10638
|
key: "remove-button-overlay",
|
10610
10639
|
className: "form-nested-item-deleted-overlay"
|
10611
10640
|
})
|
@@ -10623,32 +10652,17 @@ FormNestedItem.contextTypes = {
|
|
10623
10652
|
intl: intlShape
|
10624
10653
|
};
|
10625
10654
|
|
10626
|
-
// components/form/FormNestedDivider.tsx
|
10655
|
+
// components/form/nested/FormNestedDivider.tsx
|
10627
10656
|
init_esm_shims();
|
10628
10657
|
var import_prop_types4 = __toESM(require_prop_types(), 1);
|
10629
|
-
import
|
10630
|
-
var FormNestedDivider = /* @__PURE__ */ __name(({ label, addItem }) => /* @__PURE__ */
|
10658
|
+
import React22 from "react";
|
10659
|
+
var FormNestedDivider = /* @__PURE__ */ __name(({ label, addItem }) => /* @__PURE__ */ React22.createElement("div", null), "FormNestedDivider");
|
10631
10660
|
FormNestedDivider.propTypes = {
|
10632
10661
|
label: import_prop_types4.default.string,
|
10633
10662
|
addItem: import_prop_types4.default.func
|
10634
10663
|
};
|
10635
10664
|
|
10636
|
-
// components/form/
|
10637
|
-
init_esm_shims();
|
10638
|
-
import React22 from "react";
|
10639
|
-
var FieldErrors = /* @__PURE__ */ __name(({ errors }) => {
|
10640
|
-
const VulcanComponents = useVulcanComponents();
|
10641
|
-
return /* @__PURE__ */ React22.createElement("ul", {
|
10642
|
-
className: "form-input-errors"
|
10643
|
-
}, errors.map((error, index) => /* @__PURE__ */ React22.createElement("li", {
|
10644
|
-
key: index
|
10645
|
-
}, /* @__PURE__ */ React22.createElement(VulcanComponents.FormError, {
|
10646
|
-
error,
|
10647
|
-
errorContext: "field"
|
10648
|
-
}))));
|
10649
|
-
}, "FieldErrors");
|
10650
|
-
|
10651
|
-
// components/form/FormNestedObject.tsx
|
10665
|
+
// components/form/nested/FormNestedObject.tsx
|
10652
10666
|
init_esm_shims();
|
10653
10667
|
var import_prop_types5 = __toESM(require_prop_types(), 1);
|
10654
10668
|
import React23 from "react";
|
@@ -10713,34 +10727,12 @@ FormNestedObject.propTypes = {
|
|
10713
10727
|
formComponents: import_prop_types5.default.object
|
10714
10728
|
};
|
10715
10729
|
|
10716
|
-
// components/form/FormOptionLabel.tsx
|
10717
|
-
init_esm_shims();
|
10718
|
-
import React24 from "react";
|
10719
|
-
var FormOptionLabel = /* @__PURE__ */ __name(({ option }) => {
|
10720
|
-
const { label } = option;
|
10721
|
-
return /* @__PURE__ */ React24.createElement("span", {
|
10722
|
-
className: "form-option-label"
|
10723
|
-
}, label);
|
10724
|
-
}, "FormOptionLabel");
|
10725
|
-
|
10726
10730
|
// components/form/inputs/index.ts
|
10727
10731
|
init_esm_shims();
|
10728
10732
|
|
10729
|
-
// components/form/inputs/FormItem.tsx
|
10730
|
-
init_esm_shims();
|
10731
|
-
import React25 from "react";
|
10732
|
-
var FormItem = /* @__PURE__ */ __name((props) => {
|
10733
|
-
const { inputProperties, label, name: name2 } = props;
|
10734
|
-
return /* @__PURE__ */ React25.createElement("div", {
|
10735
|
-
className: `form-item ${name2}`
|
10736
|
-
}, /* @__PURE__ */ React25.createElement("label", {
|
10737
|
-
htmlFor: name2
|
10738
|
-
}, label), props.children);
|
10739
|
-
}, "FormItem");
|
10740
|
-
|
10741
10733
|
// components/form/inputs/BasicInputs.tsx
|
10742
10734
|
init_esm_shims();
|
10743
|
-
import
|
10735
|
+
import React24 from "react";
|
10744
10736
|
function _extends15() {
|
10745
10737
|
_extends15 = Object.assign || function(target) {
|
10746
10738
|
for (var i = 1; i < arguments.length; i++) {
|
@@ -10760,49 +10752,49 @@ var HTMLInputAdapter = /* @__PURE__ */ __name((props) => {
|
|
10760
10752
|
const Components2 = useVulcanComponents();
|
10761
10753
|
const { inputProperties = {}, itemProperties = {}, path } = props;
|
10762
10754
|
const _a = inputProperties, { label, name: name2 } = _a, otherInputProperties = __objRest(_a, ["label", "name"]);
|
10763
|
-
return /* @__PURE__ */
|
10755
|
+
return /* @__PURE__ */ React24.createElement(Components2.FormItem, _extends15({
|
10764
10756
|
name: name2,
|
10765
10757
|
path,
|
10766
10758
|
label,
|
10767
10759
|
inputProperties
|
10768
|
-
}, itemProperties), /* @__PURE__ */
|
10760
|
+
}, itemProperties), /* @__PURE__ */ React24.createElement("input", _extends15({}, otherInputProperties, {
|
10769
10761
|
id: name2,
|
10770
10762
|
name: name2,
|
10771
10763
|
type: props.type
|
10772
10764
|
})));
|
10773
10765
|
}, "HTMLInputAdapter");
|
10774
|
-
var FormComponentDefault = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10766
|
+
var FormComponentDefault = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10775
10767
|
type: "text"
|
10776
10768
|
}, props)), "FormComponentDefault");
|
10777
|
-
var FormComponentPassword = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10769
|
+
var FormComponentPassword = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10778
10770
|
type: "password"
|
10779
10771
|
}, props)), "FormComponentPassword");
|
10780
|
-
var FormComponentNumber = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10772
|
+
var FormComponentNumber = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10781
10773
|
type: "number"
|
10782
10774
|
}, props)), "FormComponentNumber");
|
10783
|
-
var FormComponentUrl = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10775
|
+
var FormComponentUrl = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10784
10776
|
type: "url"
|
10785
10777
|
}, props)), "FormComponentUrl");
|
10786
|
-
var FormComponentEmail = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10778
|
+
var FormComponentEmail = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10787
10779
|
type: "email"
|
10788
10780
|
}, props)), "FormComponentEmail");
|
10789
10781
|
var FormComponentCheckbox = /* @__PURE__ */ __name((props) => {
|
10790
|
-
return /* @__PURE__ */
|
10782
|
+
return /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10791
10783
|
type: "checkbox"
|
10792
10784
|
}, props));
|
10793
10785
|
}, "FormComponentCheckbox");
|
10794
|
-
var FormComponentDate = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10786
|
+
var FormComponentDate = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10795
10787
|
type: "date"
|
10796
10788
|
}, props)), "FormComponentDate");
|
10797
|
-
var FormComponentDateTime = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10789
|
+
var FormComponentDateTime = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10798
10790
|
type: "datetime-local"
|
10799
10791
|
}, props)), "FormComponentDateTime");
|
10800
|
-
var FormComponentTime = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
10792
|
+
var FormComponentTime = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React24.createElement(HTMLInputAdapter, _extends15({
|
10801
10793
|
type: "time"
|
10802
10794
|
}, props)), "FormComponentTime");
|
10803
10795
|
var FormComponentStaticText = /* @__PURE__ */ __name((props) => {
|
10804
10796
|
const { inputProperties } = props;
|
10805
|
-
return /* @__PURE__ */
|
10797
|
+
return /* @__PURE__ */ React24.createElement("input", _extends15({}, inputProperties, {
|
10806
10798
|
disabled: true
|
10807
10799
|
}));
|
10808
10800
|
}, "FormComponentStaticText");
|
@@ -10812,19 +10804,19 @@ var FormComponentTextarea = /* @__PURE__ */ __name((props) => {
|
|
10812
10804
|
const Components2 = useVulcanComponents();
|
10813
10805
|
const { inputProperties = {}, itemProperties = {}, path } = props;
|
10814
10806
|
const _a = inputProperties, { label, name: name2 } = _a, otherInputProperties = __objRest(_a, ["label", "name"]);
|
10815
|
-
return /* @__PURE__ */
|
10807
|
+
return /* @__PURE__ */ React24.createElement(Components2.FormItem, _extends15({
|
10816
10808
|
name: name2,
|
10817
10809
|
path,
|
10818
10810
|
label,
|
10819
10811
|
inputProperties
|
10820
|
-
}, itemProperties), /* @__PURE__ */
|
10812
|
+
}, itemProperties), /* @__PURE__ */ React24.createElement("label", {
|
10821
10813
|
htmlFor: "name"
|
10822
|
-
}, label), /* @__PURE__ */
|
10814
|
+
}, label), /* @__PURE__ */ React24.createElement("textarea", _extends15({}, inputProperties)));
|
10823
10815
|
}, "FormComponentTextarea");
|
10824
10816
|
|
10825
10817
|
// components/form/inputs/RadioGroup.tsx
|
10826
10818
|
init_esm_shims();
|
10827
|
-
import
|
10819
|
+
import React25 from "react";
|
10828
10820
|
function _extends16() {
|
10829
10821
|
_extends16 = Object.assign || function(target) {
|
10830
10822
|
for (var i = 1; i < arguments.length; i++) {
|
@@ -10841,38 +10833,38 @@ function _extends16() {
|
|
10841
10833
|
}
|
10842
10834
|
__name(_extends16, "_extends");
|
10843
10835
|
var FormComponentRadioGroup = /* @__PURE__ */ __name((props) => {
|
10844
|
-
const { path, inputProperties, options = [], itemProperties } = props;
|
10836
|
+
const { value: propsValue, path, inputProperties, options = [], itemProperties } = props;
|
10845
10837
|
const { label, name: name2 } = inputProperties;
|
10846
10838
|
if (!Array.isArray(options))
|
10847
10839
|
throw new Error("RadioGroup not yet supporting functional options");
|
10848
10840
|
const Components2 = useVulcanComponents();
|
10849
|
-
return /* @__PURE__ */
|
10841
|
+
return /* @__PURE__ */ React25.createElement(Components2.FormItem, _extends16({
|
10850
10842
|
path,
|
10851
10843
|
name: name2,
|
10852
10844
|
label,
|
10853
10845
|
inputProperties
|
10854
10846
|
}, itemProperties), options.map((option) => {
|
10855
10847
|
const { value, label: label2 } = option;
|
10856
|
-
return /* @__PURE__ */
|
10848
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
10857
10849
|
key: value,
|
10858
10850
|
className: "form-radio-group-radio-item"
|
10859
|
-
}, /* @__PURE__ */
|
10851
|
+
}, /* @__PURE__ */ React25.createElement(Components2.FormOptionLabel, {
|
10860
10852
|
option
|
10861
|
-
}), /* @__PURE__ */
|
10853
|
+
}), /* @__PURE__ */ React25.createElement("input", _extends16({
|
10862
10854
|
type: "radio",
|
10863
10855
|
id: value,
|
10864
10856
|
name: name2,
|
10865
10857
|
key: value
|
10866
10858
|
}, inputProperties, {
|
10867
10859
|
value,
|
10868
|
-
checked: value ===
|
10860
|
+
checked: value === propsValue
|
10869
10861
|
})));
|
10870
10862
|
}));
|
10871
10863
|
}, "FormComponentRadioGroup");
|
10872
10864
|
|
10873
10865
|
// components/form/inputs/Checkboxgroup.tsx
|
10874
10866
|
init_esm_shims();
|
10875
|
-
import
|
10867
|
+
import React26, { useState as useState4 } from "react";
|
10876
10868
|
import without2 from "lodash/without.js";
|
10877
10869
|
import omit3 from "lodash/omit.js";
|
10878
10870
|
import uniq2 from "lodash/uniq.js";
|
@@ -10924,9 +10916,9 @@ var OtherComponent = /* @__PURE__ */ __name(({ value, path }) => {
|
|
10924
10916
|
const textFieldItemProperties = {
|
10925
10917
|
layout: "elementOnly"
|
10926
10918
|
};
|
10927
|
-
return /* @__PURE__ */
|
10919
|
+
return /* @__PURE__ */ React26.createElement("div", {
|
10928
10920
|
className: "form-option-other"
|
10929
|
-
}, /* @__PURE__ */
|
10921
|
+
}, /* @__PURE__ */ React26.createElement(Components2.FormComponentCheckbox, {
|
10930
10922
|
layout: "elementOnly",
|
10931
10923
|
label: "Other",
|
10932
10924
|
value: showOther,
|
@@ -10949,7 +10941,7 @@ var OtherComponent = /* @__PURE__ */ __name(({ value, path }) => {
|
|
10949
10941
|
});
|
10950
10942
|
}
|
10951
10943
|
}
|
10952
|
-
}), showOther && /* @__PURE__ */
|
10944
|
+
}), showOther && /* @__PURE__ */ React26.createElement(Components2.FormComponentText, {
|
10953
10945
|
inputProperties: textFieldInputProperties,
|
10954
10946
|
itemProperties: textFieldItemProperties
|
10955
10947
|
}));
|
@@ -10963,23 +10955,23 @@ var FormComponentCheckboxGroup = /* @__PURE__ */ __name((props) => {
|
|
10963
10955
|
throw new Error("FormComponentCheckboxGroup not yet supporting functional options");
|
10964
10956
|
const value = valueFromProps ? uniq2(valueFromProps.filter((v) => isOtherValue(v) || options.map((o) => o.value).includes(v))) : [];
|
10965
10957
|
const hasValue = value.length > 0;
|
10966
|
-
return /* @__PURE__ */
|
10958
|
+
return /* @__PURE__ */ React26.createElement(Components2.FormItem, _extends17({
|
10967
10959
|
name: name2,
|
10968
10960
|
label,
|
10969
10961
|
path,
|
10970
10962
|
inputProperties
|
10971
|
-
}, itemProperties), /* @__PURE__ */
|
10963
|
+
}, itemProperties), /* @__PURE__ */ React26.createElement("div", {
|
10972
10964
|
className: "form-item-options"
|
10973
10965
|
}, options.map((option, i) => {
|
10974
10966
|
const isChecked1 = value.includes(option.value);
|
10975
10967
|
const checkClass = hasValue ? isChecked1 ? "form-check-checked" : "form-check-unchecked" : "";
|
10976
|
-
return /* @__PURE__ */
|
10968
|
+
return /* @__PURE__ */ React26.createElement("div", {
|
10977
10969
|
className: "form-item-option",
|
10978
10970
|
key: option.value
|
10979
|
-
}, /* @__PURE__ */
|
10971
|
+
}, /* @__PURE__ */ React26.createElement(Components2.FormOptionLabel, {
|
10980
10972
|
option,
|
10981
10973
|
name: name2
|
10982
|
-
}), /* @__PURE__ */
|
10974
|
+
}), /* @__PURE__ */ React26.createElement("input", _extends17({
|
10983
10975
|
type: "checkbox"
|
10984
10976
|
}, omit3(inputProperties, "value"), {
|
10985
10977
|
name: name2,
|
@@ -10998,7 +10990,7 @@ var FormComponentCheckboxGroup = /* @__PURE__ */ __name((props) => {
|
|
10998
10990
|
},
|
10999
10991
|
className: checkClass
|
11000
10992
|
})));
|
11001
|
-
}), itemProperties.showOther && /* @__PURE__ */
|
10993
|
+
}), itemProperties.showOther && /* @__PURE__ */ React26.createElement(OtherComponent, {
|
11002
10994
|
value,
|
11003
10995
|
path
|
11004
10996
|
})));
|
@@ -11006,7 +10998,7 @@ var FormComponentCheckboxGroup = /* @__PURE__ */ __name((props) => {
|
|
11006
10998
|
|
11007
10999
|
// components/form/inputs/SelectInputs.tsx
|
11008
11000
|
init_esm_shims();
|
11009
|
-
import
|
11001
|
+
import React27 from "react";
|
11010
11002
|
function _extends18() {
|
11011
11003
|
_extends18 = Object.assign || function(target) {
|
11012
11004
|
for (var i = 1; i < arguments.length; i++) {
|
@@ -11028,29 +11020,52 @@ var HTMLSelectAdapter = /* @__PURE__ */ __name((props) => {
|
|
11028
11020
|
if (!Array.isArray(options))
|
11029
11021
|
throw new Error("HTMLSelectAdapater not yet supporting functional options");
|
11030
11022
|
const Components2 = useVulcanComponents();
|
11031
|
-
return /* @__PURE__ */
|
11023
|
+
return /* @__PURE__ */ React27.createElement(Components2.FormItem, _extends18({
|
11032
11024
|
name: name2,
|
11033
11025
|
label: label1,
|
11034
11026
|
path,
|
11035
11027
|
inputProperties
|
11036
|
-
}, itemProperties), /* @__PURE__ */
|
11028
|
+
}, itemProperties), /* @__PURE__ */ React27.createElement("select", _extends18({
|
11037
11029
|
multiple
|
11038
11030
|
}, inputProperties, {
|
11039
11031
|
value: inputProperties.value === null ? void 0 : inputProperties.value
|
11040
|
-
}), options.map(({ label, value }) => /* @__PURE__ */
|
11032
|
+
}), options.map(({ label, value }) => /* @__PURE__ */ React27.createElement("option", {
|
11041
11033
|
key: value,
|
11042
11034
|
label,
|
11043
11035
|
value
|
11044
11036
|
}))));
|
11045
11037
|
}, "HTMLSelectAdapter");
|
11046
|
-
var FormComponentSelect = /* @__PURE__ */ __name((props) => /* @__PURE__ */
|
11038
|
+
var FormComponentSelect = /* @__PURE__ */ __name((props) => /* @__PURE__ */ React27.createElement(HTMLSelectAdapter, _extends18({}, props)), "FormComponentSelect");
|
11047
11039
|
var FormComponentSelectMultiple = /* @__PURE__ */ __name((props) => {
|
11048
11040
|
const Components2 = useVulcanComponents();
|
11049
|
-
return /* @__PURE__ */
|
11041
|
+
return /* @__PURE__ */ React27.createElement(Components2.FormComponentSelect, _extends18({
|
11050
11042
|
multiple: true
|
11051
11043
|
}, props));
|
11052
11044
|
}, "FormComponentSelectMultiple");
|
11053
11045
|
|
11046
|
+
// components/form/inputs/FormItem.tsx
|
11047
|
+
init_esm_shims();
|
11048
|
+
import React28 from "react";
|
11049
|
+
var FormItem = /* @__PURE__ */ __name((props) => {
|
11050
|
+
const { inputProperties, label, name: name2 } = props;
|
11051
|
+
return /* @__PURE__ */ React28.createElement("div", {
|
11052
|
+
className: `form-item ${name2}`
|
11053
|
+
}, /* @__PURE__ */ React28.createElement("label", {
|
11054
|
+
htmlFor: name2
|
11055
|
+
}, label), props.children);
|
11056
|
+
}, "FormItem");
|
11057
|
+
|
11058
|
+
// components/form/inputs/FormOptionLabel.tsx
|
11059
|
+
init_esm_shims();
|
11060
|
+
import React29 from "react";
|
11061
|
+
var FormOptionLabel = /* @__PURE__ */ __name(({ option, name: name2 }) => {
|
11062
|
+
const { label } = option;
|
11063
|
+
return /* @__PURE__ */ React29.createElement("label", {
|
11064
|
+
htmlFor: name2,
|
11065
|
+
className: "form-option-label"
|
11066
|
+
}, label);
|
11067
|
+
}, "FormOptionLabel");
|
11068
|
+
|
11054
11069
|
// components/form/inputs/AutocompleteMultiple.tsx
|
11055
11070
|
init_esm_shims();
|
11056
11071
|
import { AsyncTypeahead } from "react-bootstrap-typeahead";
|
@@ -12730,7 +12745,7 @@ var defaultCellComponents = {
|
|
12730
12745
|
init_esm_shims();
|
12731
12746
|
import { FormattedMessage } from "@vulcanjs/react-i18n";
|
12732
12747
|
|
12733
|
-
// components/
|
12748
|
+
// components/core/Button.tsx
|
12734
12749
|
init_esm_shims();
|
12735
12750
|
import React56 from "react";
|
12736
12751
|
function _extends33() {
|
@@ -12753,7 +12768,7 @@ var Button = /* @__PURE__ */ __name((_a) => {
|
|
12753
12768
|
return /* @__PURE__ */ React56.createElement("button", _extends33({}, props), children);
|
12754
12769
|
}, "Button");
|
12755
12770
|
|
12756
|
-
// components/
|
12771
|
+
// components/core/Loading.tsx
|
12757
12772
|
init_esm_shims();
|
12758
12773
|
import React57 from "react";
|
12759
12774
|
var Loading = /* @__PURE__ */ __name(() => /* @__PURE__ */ React57.createElement("span", {
|