@vulcanjs/react-ui 0.7.2-alpha.4 → 0.7.2-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Datatable/Datatable.d.ts +39 -0
- package/dist/components/Datatable/DatatableCell.d.ts +26 -0
- package/dist/components/Datatable/DatatableContents.d.ts +53 -0
- package/dist/components/Datatable/DatatableFilter.d.ts +33 -0
- package/dist/components/Datatable/DatatableHeader.d.ts +23 -0
- package/dist/components/Datatable/DatatableRow.d.ts +25 -0
- package/dist/components/Datatable/DatatableSelect.d.ts +11 -0
- package/dist/components/Datatable/DatatableSorter.d.ts +8 -0
- package/dist/components/Datatable/DatatableSubmitSelected.d.ts +6 -0
- package/dist/components/Datatable/others/DeleteButton.d.ts +13 -0
- package/dist/components/Datatable/others/EditButton.d.ts +20 -0
- package/dist/components/Datatable/others/NewButton.d.ts +20 -0
- package/dist/components/HeadTags.d.ts +13 -0
- package/dist/components/LoadingButton.d.ts +11 -0
- package/dist/components/MutationButton.d.ts +20 -0
- package/dist/components/VulcanComponents/defaultVulcanComponents/cellComponents.d.ts +3 -0
- package/dist/components/VulcanComponents/defaultVulcanComponents/coreComponents.d.ts +3 -0
- package/dist/components/VulcanComponents/defaultVulcanComponents/datatableComponents.d.ts +3 -0
- package/dist/components/VulcanComponents/defaultVulcanComponents/formComponents.d.ts +3 -0
- package/dist/components/bootstrap/Dropdown.d.ts +24 -0
- package/dist/components/bootstrap/Modal.d.ts +25 -0
- package/dist/components/bootstrap/ModalTrigger.d.ts +18 -0
- package/dist/components/bootstrap/TooltipTrigger.d.ts +6 -0
- package/dist/components/cell/CardItem.d.ts +14 -0
- package/dist/components/cell/CardItemArray.d.ts +6 -0
- package/dist/components/cell/CardItemDate.d.ts +5 -0
- package/dist/components/cell/CardItemDefault.d.ts +5 -0
- package/dist/components/cell/CardItemHTML.d.ts +5 -0
- package/dist/components/cell/CardItemImage.d.ts +6 -0
- package/dist/components/cell/CardItemNumber.d.ts +5 -0
- package/dist/components/cell/CardItemObject.d.ts +3 -0
- package/dist/components/cell/CardItemRelationHasMany.d.ts +3 -0
- package/dist/components/cell/CardItemRelationHasOne.d.ts +3 -0
- package/dist/components/cell/CardItemRelationItem.d.ts +15 -0
- package/dist/components/cell/CardItemString.d.ts +5 -0
- package/dist/components/cell/CardItemURL.d.ts +6 -0
- package/dist/components/core/Button.d.ts +4 -0
- package/dist/components/core/Loading.d.ts +3 -0
- package/dist/components/form/FieldErrors.d.ts +6 -0
- package/dist/components/form/Form/Form.d.ts +4 -0
- package/dist/components/form/Form/fields.d.ts +22 -0
- package/dist/components/form/Form/index.d.ts +3 -0
- package/dist/components/form/Form/typings.d.ts +76 -0
- package/dist/components/form/Form/utils.d.ts +2 -0
- package/dist/components/form/FormComponent.d.ts +31 -0
- package/dist/components/form/FormComponentInner.d.ts +32 -0
- package/dist/components/form/FormComponentLoader.d.ts +15 -0
- package/dist/components/form/FormContainer.d.ts +18 -0
- package/dist/components/form/FormContext.d.ts +25 -0
- package/dist/components/form/FormElement.d.ts +4 -0
- package/dist/components/form/FormError.d.ts +11 -0
- package/dist/components/form/FormErrors.d.ts +3 -0
- package/dist/components/form/FormGroup.d.ts +30 -0
- package/dist/components/form/FormIntl.d.ts +15 -0
- package/dist/components/form/FormLayout.d.ts +10 -0
- package/dist/components/form/FormNestedArray.d.ts +26 -0
- package/dist/components/form/FormNestedArrayLayout.d.ts +18 -0
- package/dist/components/form/FormNestedDivider.d.ts +13 -0
- package/dist/components/form/FormNestedItem.d.ts +52 -0
- package/dist/components/form/FormNestedObject.d.ts +35 -0
- package/dist/components/form/FormOptionLabel.d.ts +5 -0
- package/dist/components/form/FormSubmit.d.ts +38 -0
- package/dist/components/form/core/Button.d.ts +4 -0
- package/dist/components/form/core/Form/Form.d.ts.map +1 -1
- package/dist/components/form/core/FormComponent.d.ts +31 -0
- package/dist/components/form/core/FormComponentInner.d.ts +32 -0
- package/dist/components/form/core/FormComponentLoader.d.ts +15 -0
- package/dist/components/form/core/FormContext.d.ts +1 -1
- package/dist/components/form/core/FormContext.d.ts.map +1 -1
- package/dist/components/form/core/FormGroup.d.ts +30 -0
- package/dist/components/form/core/Loading.d.ts +3 -0
- package/dist/components/form/elements/FieldErrors.d.ts +5 -0
- package/dist/components/form/elements/FormElement.d.ts +4 -0
- package/dist/components/form/elements/FormError.d.ts +11 -0
- package/dist/components/form/elements/FormErrors.d.ts +3 -0
- package/dist/components/form/elements/FormLayout.d.ts +10 -0
- package/dist/components/form/elements/FormSubmit.d.ts +38 -0
- package/dist/components/form/elements/index.d.ts +7 -0
- package/dist/components/form/inputs/AutocompleteMultiple.d.ts +6 -0
- package/dist/components/form/inputs/BasicInputs.d.ts +16 -0
- package/dist/components/form/inputs/Checkboxgroup.d.ts +9 -0
- package/dist/components/form/inputs/FormItem.d.ts +4 -0
- package/dist/components/form/inputs/FormOptionLabel.d.ts +7 -0
- package/dist/components/form/inputs/RadioGroup.d.ts +4 -0
- package/dist/components/form/inputs/SelectInputs.d.ts +5 -0
- package/dist/components/form/inputs/consts.d.ts +9 -0
- package/dist/components/form/inputs/index.d.ts +8 -0
- package/dist/components/form/intl/FormIntl.d.ts +15 -0
- package/dist/components/form/modules/formFragments.d.ts +16 -0
- package/dist/components/form/modules/path_utils.d.ts +6 -0
- package/dist/components/form/modules/schema_utils.d.ts +14 -0
- package/dist/components/form/modules/utils.d.ts +17 -0
- package/dist/components/form/nested/FormNestedArray.d.ts +26 -0
- package/dist/components/form/nested/FormNestedArrayLayout.d.ts +18 -0
- package/dist/components/form/nested/FormNestedDivider.d.ts +13 -0
- package/dist/components/form/nested/FormNestedItem.d.ts +52 -0
- package/dist/components/form/nested/FormNestedObject.d.ts +35 -0
- package/dist/components/form/nested/index.d.ts +6 -0
- package/dist/components/form/ui_utils.d.ts +3 -0
- package/dist/components/form/useBlockTransition/block.d.ts +4 -0
- package/dist/components/form/useBlockTransition/useBlockTransition.d.ts +5 -0
- package/dist/components/form/useWarnOnUnsaved/index.d.ts +2 -0
- package/dist/components/form/useWarnOnUnsaved/useWarnOnUnsaved.d.ts +5 -0
- package/dist/decorators/autocomplete.d.ts +8 -0
- package/dist/decorators/index.d.ts +4 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -59
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
package/dist/index.js
CHANGED
|
@@ -665,11 +665,14 @@ var LoadingButton = /* @__PURE__ */ __name((_a) => {
|
|
|
665
665
|
className: `loading-button ${loading ? "loading-button-loading" : "loading-button-notloading"} ${className}`,
|
|
666
666
|
onClick
|
|
667
667
|
}, rest), /* @__PURE__ */ React4.createElement("span", {
|
|
668
|
-
style: wrapperStyle
|
|
668
|
+
style: wrapperStyle,
|
|
669
|
+
className: "loading-button-inner"
|
|
669
670
|
}, /* @__PURE__ */ React4.createElement("span", {
|
|
670
|
-
style: labelStyle
|
|
671
|
+
style: labelStyle,
|
|
672
|
+
className: "loading-button-label"
|
|
671
673
|
}, label || children), /* @__PURE__ */ React4.createElement("span", {
|
|
672
|
-
style: loadingStyle
|
|
674
|
+
style: loadingStyle,
|
|
675
|
+
className: "loading-button-loader"
|
|
673
676
|
}, /* @__PURE__ */ React4.createElement(Components2.Loading, null))));
|
|
674
677
|
}, "LoadingButton");
|
|
675
678
|
|
|
@@ -1774,8 +1777,8 @@ var Form = /* @__PURE__ */ __name((props) => {
|
|
|
1774
1777
|
});
|
|
1775
1778
|
}, "clearFormCallbacks");
|
|
1776
1779
|
const [currentValues, setCurrentValues] = useState2({});
|
|
1777
|
-
const submitFormContext = /* @__PURE__ */ __name(
|
|
1778
|
-
submitForm(
|
|
1780
|
+
const submitFormContext = /* @__PURE__ */ __name(async (event) => {
|
|
1781
|
+
await submitForm(event);
|
|
1779
1782
|
}, "submitFormContext");
|
|
1780
1783
|
const [currentDocument, setCurrentDocument] = useState2(initialDocument);
|
|
1781
1784
|
const updateCurrentValues = /* @__PURE__ */ __name((newValues, options = {}) => {
|
|
@@ -1883,16 +1886,7 @@ var Form = /* @__PURE__ */ __name((props) => {
|
|
|
1883
1886
|
form: void 0
|
|
1884
1887
|
});
|
|
1885
1888
|
}, "mutationErrorCallback");
|
|
1886
|
-
const
|
|
1887
|
-
var _a, _b;
|
|
1888
|
-
event && event.preventDefault();
|
|
1889
|
-
event && event.stopPropagation();
|
|
1890
|
-
const { contextName } = props;
|
|
1891
|
-
if (disabled) {
|
|
1892
|
-
return;
|
|
1893
|
-
}
|
|
1894
|
-
setErrors([]);
|
|
1895
|
-
setDisabled(true);
|
|
1889
|
+
const getSubmitData = /* @__PURE__ */ __name(() => {
|
|
1896
1890
|
let data = getData({
|
|
1897
1891
|
replaceIntlFields: true,
|
|
1898
1892
|
addExtraFields: false,
|
|
@@ -1907,42 +1901,64 @@ var Form = /* @__PURE__ */ __name((props) => {
|
|
|
1907
1901
|
if (props.submitCallback) {
|
|
1908
1902
|
data = props.submitCallback(data) || data;
|
|
1909
1903
|
}
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1904
|
+
return data;
|
|
1905
|
+
}, "getSubmitData");
|
|
1906
|
+
const submitFormCreate = /* @__PURE__ */ __name(async (event) => {
|
|
1907
|
+
var _a;
|
|
1908
|
+
event && event.preventDefault();
|
|
1909
|
+
event && event.stopPropagation();
|
|
1910
|
+
const { contextName } = props;
|
|
1911
|
+
if (disabled) {
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
setErrors([]);
|
|
1915
|
+
setDisabled(true);
|
|
1916
|
+
const data = getSubmitData();
|
|
1917
|
+
try {
|
|
1918
|
+
const result = await createDocument({
|
|
1919
|
+
input: {
|
|
1920
|
+
data,
|
|
1921
|
+
contextName
|
|
1922
1922
|
}
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1923
|
+
});
|
|
1924
|
+
if ((_a = result.errors) == null ? void 0 : _a.length) {
|
|
1925
|
+
mutationErrorCallback(document1, result.errors[0]);
|
|
1926
|
+
} else {
|
|
1927
|
+
newMutationSuccessCallback(result);
|
|
1925
1928
|
}
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1929
|
+
} catch (error) {
|
|
1930
|
+
mutationErrorCallback(document1, error);
|
|
1931
|
+
}
|
|
1932
|
+
}, "submitFormCreate");
|
|
1933
|
+
const submitFormUpdate = /* @__PURE__ */ __name(async (event) => {
|
|
1934
|
+
var _a;
|
|
1935
|
+
event && event.preventDefault();
|
|
1936
|
+
event && event.stopPropagation();
|
|
1937
|
+
const { contextName } = props;
|
|
1938
|
+
if (disabled) {
|
|
1939
|
+
return;
|
|
1940
|
+
}
|
|
1941
|
+
setErrors([]);
|
|
1942
|
+
setDisabled(true);
|
|
1943
|
+
const data = getSubmitData();
|
|
1944
|
+
try {
|
|
1945
|
+
const documentId = currentDocument._id;
|
|
1946
|
+
const result = await updateDocument({
|
|
1947
|
+
input: {
|
|
1948
|
+
id: documentId,
|
|
1949
|
+
data,
|
|
1950
|
+
contextName
|
|
1940
1951
|
}
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1952
|
+
});
|
|
1953
|
+
if ((_a = result.errors) == null ? void 0 : _a.length) {
|
|
1954
|
+
mutationErrorCallback(document1, result.errors[0]);
|
|
1955
|
+
} else {
|
|
1956
|
+
editMutationSuccessCallback(result);
|
|
1943
1957
|
}
|
|
1958
|
+
} catch (error) {
|
|
1959
|
+
mutationErrorCallback(document1, error);
|
|
1944
1960
|
}
|
|
1945
|
-
}, "
|
|
1961
|
+
}, "submitFormUpdate");
|
|
1946
1962
|
const deleteDocumentWithConfirm = /* @__PURE__ */ __name(() => {
|
|
1947
1963
|
const document = currentDocument;
|
|
1948
1964
|
const documentId = props.document._id;
|
|
@@ -1971,13 +1987,14 @@ var Form = /* @__PURE__ */ __name((props) => {
|
|
|
1971
1987
|
}, "deleteDocumentWithConfirm");
|
|
1972
1988
|
const { successComponent, document: document1, currentUser, model, warnUnsavedChanges } = props;
|
|
1973
1989
|
const FormComponents = useVulcanComponents();
|
|
1974
|
-
const
|
|
1975
|
-
const
|
|
1990
|
+
const formType = document1 ? "edit" : "new";
|
|
1991
|
+
const submitForm = formType === "new" ? submitFormCreate : submitFormUpdate;
|
|
1992
|
+
const mutableFields = formType === "edit" ? getEditableFields(schema, currentUser, initialDocument) : getInsertableFields(schema, currentUser);
|
|
1976
1993
|
const { formLayoutProps, formGroupProps } = getChildrenProps(props, {
|
|
1977
1994
|
disabled,
|
|
1978
1995
|
currentDocument
|
|
1979
1996
|
}, {
|
|
1980
|
-
formType
|
|
1997
|
+
formType
|
|
1981
1998
|
}, {
|
|
1982
1999
|
deleteDocument: deleteDocumentWithConfirm
|
|
1983
2000
|
});
|
|
@@ -1991,7 +2008,7 @@ var Form = /* @__PURE__ */ __name((props) => {
|
|
|
1991
2008
|
clearForm,
|
|
1992
2009
|
refetchForm,
|
|
1993
2010
|
isChanged,
|
|
1994
|
-
submitForm: submitFormContext
|
|
2011
|
+
submitForm: submitFormContext,
|
|
1995
2012
|
addToDeletedValues,
|
|
1996
2013
|
updateCurrentValues,
|
|
1997
2014
|
getDocument: () => currentDocument,
|
|
@@ -2446,9 +2463,6 @@ var VulcanComponentsProvider = /* @__PURE__ */ __name((_a) => {
|
|
|
2446
2463
|
}, props));
|
|
2447
2464
|
}, "VulcanComponentsProvider");
|
|
2448
2465
|
|
|
2449
|
-
// components/VulcanComponents/typings.ts
|
|
2450
|
-
import React12 from "react";
|
|
2451
|
-
|
|
2452
2466
|
// components/VulcanComponents/defaultVulcanComponents/index.ts
|
|
2453
2467
|
var defaultFormComponents = {
|
|
2454
2468
|
Form,
|
|
@@ -2462,7 +2476,7 @@ var defaultCoreComponents = {
|
|
|
2462
2476
|
};
|
|
2463
2477
|
|
|
2464
2478
|
// componentsHelpers.tsx
|
|
2465
|
-
import
|
|
2479
|
+
import React12 from "react";
|
|
2466
2480
|
function _extends8() {
|
|
2467
2481
|
_extends8 = Object.assign || function(target) {
|
|
2468
2482
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -2516,16 +2530,16 @@ var getRawComponent = /* @__PURE__ */ __name((name) => {
|
|
|
2516
2530
|
var instantiateComponent = /* @__PURE__ */ __name((component, props) => {
|
|
2517
2531
|
if (!component) {
|
|
2518
2532
|
return null;
|
|
2519
|
-
} else if (/* @__PURE__ */
|
|
2520
|
-
return /* @__PURE__ */
|
|
2533
|
+
} else if (/* @__PURE__ */ React12.isValidElement(component)) {
|
|
2534
|
+
return /* @__PURE__ */ React12.cloneElement(component, props);
|
|
2521
2535
|
} else if (typeof component === "function" && component.prototype && component.prototype.isReactComponent) {
|
|
2522
2536
|
const Component = component;
|
|
2523
|
-
return /* @__PURE__ */
|
|
2537
|
+
return /* @__PURE__ */ React12.createElement(Component, _extends8({}, props));
|
|
2524
2538
|
} else if (typeof component === "function") {
|
|
2525
2539
|
return component(props);
|
|
2526
2540
|
} else if (typeof component === "object" && component.$$typeof && component.render) {
|
|
2527
2541
|
const Component = component;
|
|
2528
|
-
return /* @__PURE__ */
|
|
2542
|
+
return /* @__PURE__ */ React12.createElement(Component, _extends8({}, props));
|
|
2529
2543
|
} else {
|
|
2530
2544
|
return component;
|
|
2531
2545
|
}
|
|
@@ -2533,7 +2547,7 @@ var instantiateComponent = /* @__PURE__ */ __name((component, props) => {
|
|
|
2533
2547
|
var delayedComponent = /* @__PURE__ */ __name((name) => {
|
|
2534
2548
|
return (props) => {
|
|
2535
2549
|
const Component = Components[name] || null;
|
|
2536
|
-
return Component && /* @__PURE__ */
|
|
2550
|
+
return Component && /* @__PURE__ */ React12.createElement(Component, _extends8({}, props));
|
|
2537
2551
|
};
|
|
2538
2552
|
}, "delayedComponent");
|
|
2539
2553
|
var mergeWithComponents = /* @__PURE__ */ __name((myComponents) => myComponents ? __spreadValues(__spreadValues({}, Components), myComponents) : Components, "mergeWithComponents");
|