@carbonorm/carbonreact 1.0.4 → 1.0.6
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/{CarbonReact.cjs.css → CarbonReact.esm.css} +1 -1
- package/dist/{CarbonReact.cjs.css.map → CarbonReact.esm.css.map} +1 -1
- package/dist/{CarbonReact.cjs.js → CarbonReact.esm.js} +45 -113
- package/dist/CarbonReact.esm.js.map +1 -0
- package/package.json +2 -2
- package/dist/CarbonReact.cjs.js.map +0 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/_react.js +0 -3
- package/dist/_virtual/_react.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.development.js +0 -6
- package/dist/_virtual/react-jsx-runtime.development.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.production.min.js +0 -6
- package/dist/_virtual/react-jsx-runtime.production.min.js.map +0 -1
- package/dist/index.css +0 -13298
- package/dist/index.css.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -1313
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +0 -1
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -13
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.min.js.map +0 -1
- package/dist/node_modules/react/jsx-runtime.js +0 -18
- package/dist/node_modules/react/jsx-runtime.js.map +0 -1
- package/dist/node_modules/tslib/tslib.es6.js +0 -34
- package/dist/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/src/CarbonReact.js +0 -68
- package/dist/src/CarbonReact.js.map +0 -1
- package/dist/src/components/Alert/Alert.js +0 -124
- package/dist/src/components/Alert/Alert.js.map +0 -1
- package/dist/src/components/Errors/AccessDenied.js +0 -20
- package/dist/src/components/Errors/AccessDenied.js.map +0 -1
- package/dist/src/components/Errors/BackendThrowable.js +0 -24
- package/dist/src/components/Errors/BackendThrowable.js.map +0 -1
- package/dist/src/components/Errors/ErrorHttpCode.js +0 -9
- package/dist/src/components/Errors/ErrorHttpCode.js.map +0 -1
- package/dist/src/components/Errors/Localhost.js +0 -28
- package/dist/src/components/Errors/Localhost.js.map +0 -1
- package/dist/src/components/Errors/PageNotFound.js +0 -9
- package/dist/src/components/Errors/PageNotFound.js.map +0 -1
- package/dist/src/components/Errors/style.module.scss.js +0 -4
- package/dist/src/components/Errors/style.module.scss.js.map +0 -1
- package/dist/src/components/Loading/Loading.js +0 -18
- package/dist/src/components/Loading/Loading.js.map +0 -1
- package/dist/src/components/Nest/Nest.js +0 -136
- package/dist/src/components/Nest/Nest.js.map +0 -1
- package/dist/src/components/Popup/Popup.js +0 -16
- package/dist/src/components/Popup/Popup.js.map +0 -1
- package/dist/src/hoc/GlobalHistory.js +0 -11
- package/dist/src/hoc/GlobalHistory.js.map +0 -1
- package/dist/src/hoc/addValidSQL.js +0 -8
- package/dist/src/hoc/addValidSQL.js.map +0 -1
- package/dist/src/hoc/axiosInstance.js +0 -317
- package/dist/src/hoc/axiosInstance.js.map +0 -1
- package/dist/src/hoc/changed.js +0 -32
- package/dist/src/hoc/changed.js.map +0 -1
- package/dist/src/hoc/deleteRestfulObjectArrays.js +0 -17
- package/dist/src/hoc/deleteRestfulObjectArrays.js.map +0 -1
- package/dist/src/hoc/getStyles.js +0 -26
- package/dist/src/hoc/getStyles.js.map +0 -1
- package/dist/src/hoc/hexToRgb.js +0 -11
- package/dist/src/hoc/hexToRgb.js.map +0 -1
- package/dist/src/hoc/isEdgeBrowser.js +0 -7
- package/dist/src/hoc/isEdgeBrowser.js.map +0 -1
- package/dist/src/hoc/parseMultipleJson.js +0 -29
- package/dist/src/hoc/parseMultipleJson.js.map +0 -1
- package/dist/src/hoc/scrollIntoView.js +0 -6
- package/dist/src/hoc/scrollIntoView.js.map +0 -1
- package/dist/src/hoc/setUrl.js +0 -41
- package/dist/src/hoc/setUrl.js.map +0 -1
- package/dist/src/hoc/updateRestfulObjectArrays.js +0 -64
- package/dist/src/hoc/updateRestfulObjectArrays.js.map +0 -1
- package/dist/src/hoc/uploadImage.js +0 -59
- package/dist/src/hoc/uploadImage.js.map +0 -1
- package/dist/src/hoc/windowDimensions.js +0 -23
- package/dist/src/hoc/windowDimensions.js.map +0 -1
- package/dist/src/index.js +0 -27
- package/dist/src/index.js.map +0 -1
- package/dist/src/style.module.css.js +0 -4
- package/dist/src/style.module.css.js.map +0 -1
- package/dist/src/variables/C6.js +0 -2227
- package/dist/src/variables/C6.js.map +0 -1
- package/dist/src/variables/bootstrap.module.css.js +0 -4
- package/dist/src/variables/bootstrap.module.css.js.map +0 -1
- package/dist/src/variables/isProduction.js +0 -4
- package/dist/src/variables/isProduction.js.map +0 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var axios = require('axios');
|
|
13
|
-
var Qs = require('qs');
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { toastOptions, clearCache, isTest, isVerbose } from '@carbonorm/carbonnode';
|
|
3
|
+
import { useNavigate, BrowserRouter } from 'react-router-dom';
|
|
4
|
+
import { toast, ToastContainer } from 'react-toastify';
|
|
5
|
+
import OutsideClickHandler from 'react-outside-click-handler';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { faClose } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
9
|
+
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import Qs from 'qs';
|
|
14
12
|
|
|
15
13
|
function createCommonjsModule(fn, module) {
|
|
16
14
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -1375,9 +1373,9 @@ const changed = (name, context, old, v) => {
|
|
|
1375
1373
|
}
|
|
1376
1374
|
};
|
|
1377
1375
|
|
|
1378
|
-
|
|
1376
|
+
let globalNavigate;
|
|
1379
1377
|
const GlobalHistory = () => {
|
|
1380
|
-
|
|
1378
|
+
globalNavigate = useNavigate();
|
|
1381
1379
|
return null;
|
|
1382
1380
|
};
|
|
1383
1381
|
GlobalHistory.displayName = "GlobalHistory";
|
|
@@ -1491,13 +1489,13 @@ class Nest extends React.Component {
|
|
|
1491
1489
|
this.canvas = document.getElementById('2d');
|
|
1492
1490
|
this.canvasContext = this.canvas.getContext('2d') || undefined;
|
|
1493
1491
|
if (undefined === this.canvasContext) {
|
|
1494
|
-
|
|
1492
|
+
toast.warn('Your browser does not support Canvas! Some features may not work as expected.', toastOptions);
|
|
1495
1493
|
return;
|
|
1496
1494
|
}
|
|
1497
1495
|
this.points = this.randomPoints();
|
|
1498
1496
|
this.all = (_a = this.all) === null || _a === void 0 ? void 0 : _a.concat(this.points, [this.current]);
|
|
1499
1497
|
if (undefined === this.canvas) {
|
|
1500
|
-
|
|
1498
|
+
toast.error('Failed to load Canvas! Some features may not work as expected.', toastOptions);
|
|
1501
1499
|
return;
|
|
1502
1500
|
}
|
|
1503
1501
|
document.onmousemove = e => {
|
|
@@ -1554,7 +1552,7 @@ class CarbonReact extends React.Component {
|
|
|
1554
1552
|
this.websocketTimeout = 5000;
|
|
1555
1553
|
CarbonReact.instance = this;
|
|
1556
1554
|
// This should only ever be done here, when the full state is being trashed.
|
|
1557
|
-
|
|
1555
|
+
clearCache({
|
|
1558
1556
|
ignoreWarning: true
|
|
1559
1557
|
});
|
|
1560
1558
|
/** We can think of our app as having one state; this state.
|
|
@@ -1587,7 +1585,7 @@ class CarbonReact extends React.Component {
|
|
|
1587
1585
|
if (this.state.backendThrowable.length > 0) {
|
|
1588
1586
|
return jsxRuntime_2(jsxRuntime_3, { children: [nest, jsxRuntime_1(BackendThrowable, {})] });
|
|
1589
1587
|
}
|
|
1590
|
-
return jsxRuntime_2(
|
|
1588
|
+
return jsxRuntime_2(BrowserRouter, { children: [jsxRuntime_1(GlobalHistory, {}), this.props.children, jsxRuntime_1(ToastContainer, {})] });
|
|
1591
1589
|
}
|
|
1592
1590
|
}
|
|
1593
1591
|
CarbonReact.lastLocation = window.location.pathname;
|
|
@@ -1727,7 +1725,7 @@ function Alert() {
|
|
|
1727
1725
|
[dig.bg_warning]: "warning" === alert.icon,
|
|
1728
1726
|
[dig.bg_danger]: "error" === alert.icon,
|
|
1729
1727
|
[dig.bgPrimary]: "question" === alert.icon,
|
|
1730
|
-
}), children: [jsxRuntime_2("h3", { className: classNames(dig.modalTitle, dig.textDark), id: "staticBackdropLabel", children: ["#", alertWaiting, " ", alert.title] }), jsxRuntime_1("div", { onClick: handleClose, children: jsxRuntime_1(
|
|
1728
|
+
}), children: [jsxRuntime_2("h3", { className: classNames(dig.modalTitle, dig.textDark), id: "staticBackdropLabel", children: ["#", alertWaiting, " ", alert.title] }), jsxRuntime_1("div", { onClick: handleClose, children: jsxRuntime_1(FontAwesomeIcon, { icon: faClose, size: 'xl' }) })] }), jsxRuntime_1("div", { className: classNames(dig.modalBody, dig.border0, dig.textWhite), children: jsxRuntime_2("div", { className: dig.textCenter, children: [alert.text, alert.component] }) }), undefined !== alert.buttons &&
|
|
1731
1729
|
jsxRuntime_2("div", { className: classNames(dig.modalFooter, dig.border0, dig.rounded0), children: [alert.footerText && jsxRuntime_1("div", { className: classNames(dig.textCenter, dig.textWhite), children: alert.footerText }), (_b = alert.buttons) === null || _b === void 0 ? void 0 : _b.map((button, index) => {
|
|
1732
1730
|
return jsxRuntime_1("button", { className: classNames(dig.btn, dig.btnLg, {
|
|
1733
1731
|
// todo - color: "default" | "primary" | "secondary" | "inherit" | "danger" | "info" | "success" | "warning" | undefined,
|
|
@@ -1792,7 +1790,7 @@ function PageNotFound() {
|
|
|
1792
1790
|
function Loading(props) {
|
|
1793
1791
|
const dig = getStyles();
|
|
1794
1792
|
const primaryColor = getRootStyleValue();
|
|
1795
|
-
return jsxRuntime_1("div", { className: classNames(dig.my5, dig.px3, dig.pb5, dig.container), style: { lineHeight: props.lineHeight || 4 }, children: jsxRuntime_2(
|
|
1793
|
+
return jsxRuntime_1("div", { className: classNames(dig.my5, dig.px3, dig.pb5, dig.container), style: { lineHeight: props.lineHeight || 4 }, children: jsxRuntime_2(SkeletonTheme, { baseColor: primaryColor, highlightColor: "#444", children: [jsxRuntime_1(Skeleton, { className: classNames(dig.row, dig.my3, dig.justifyContentCenter, dig.mAuto), count: props.count || 1, height: 60, inline: true }), props.children, undefined !== (props === null || props === void 0 ? void 0 : props.message) && jsxRuntime_1("h2", { style: {
|
|
1796
1794
|
display: 'flex',
|
|
1797
1795
|
alignItems: 'center',
|
|
1798
1796
|
justifyContent: 'center',
|
|
@@ -1906,7 +1904,7 @@ function setCookies(cookies, req = undefined) {
|
|
|
1906
1904
|
});
|
|
1907
1905
|
}
|
|
1908
1906
|
function axiosInterceptors(axios) {
|
|
1909
|
-
if (
|
|
1907
|
+
if (isTest) {
|
|
1910
1908
|
axios.defaults.adapter = require('axios/lib/adapters/http');
|
|
1911
1909
|
}
|
|
1912
1910
|
axios.interceptors.request.use(req => {
|
|
@@ -1914,7 +1912,7 @@ function axiosInterceptors(axios) {
|
|
|
1914
1912
|
setCookies([
|
|
1915
1913
|
'github_revision=' + process.env.REACT_APP_GITHUB_REVISION + '; path=/',
|
|
1916
1914
|
]);
|
|
1917
|
-
if (
|
|
1915
|
+
if (isTest) {
|
|
1918
1916
|
setCookies([
|
|
1919
1917
|
'dropDeveloper=554378!@#$(K-asSfdsf-fd!@#$439; path=/',
|
|
1920
1918
|
'XDEBUG_SESSION=start; path=/'
|
|
@@ -1922,7 +1920,7 @@ function axiosInterceptors(axios) {
|
|
|
1922
1920
|
(_a = req.headers) !== null && _a !== void 0 ? _a : (req.headers = {});
|
|
1923
1921
|
req.headers['Cookie'] = document.cookie;
|
|
1924
1922
|
}
|
|
1925
|
-
if (true ===
|
|
1923
|
+
if (true === isVerbose) {
|
|
1926
1924
|
console.log(req.method, req.url, req.data);
|
|
1927
1925
|
const log = {
|
|
1928
1926
|
baseURL: req.baseURL,
|
|
@@ -1941,15 +1939,15 @@ function axiosInterceptors(axios) {
|
|
|
1941
1939
|
function logResponseSetCookiesForTests(response) {
|
|
1942
1940
|
var _a, _b, _c;
|
|
1943
1941
|
// axios sets cookies correctly; just not in jest tests
|
|
1944
|
-
if (
|
|
1942
|
+
if (isTest && ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a['set-cookie'])) {
|
|
1945
1943
|
setCookies((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b['set-cookie'], response);
|
|
1946
1944
|
}
|
|
1947
|
-
if (true ===
|
|
1945
|
+
if (true === isVerbose) {
|
|
1948
1946
|
if (response === null || response === void 0 ? void 0 : response.response) {
|
|
1949
1947
|
response = response.response;
|
|
1950
1948
|
}
|
|
1951
1949
|
// JSON is so it prints completely in intellij run console
|
|
1952
|
-
if (
|
|
1950
|
+
if (isTest && isVerbose) {
|
|
1953
1951
|
console.debug("Every Axios response is logged in axiosInterceptors.tsx :: ", JSON.stringify({
|
|
1954
1952
|
baseURL: response.config.baseURL,
|
|
1955
1953
|
uri: (_c = response.config) === null || _c === void 0 ? void 0 : _c.url,
|
|
@@ -1965,7 +1963,7 @@ function axiosInterceptors(axios) {
|
|
|
1965
1963
|
var _a, _b, _c;
|
|
1966
1964
|
logResponseSetCookiesForTests(response);
|
|
1967
1965
|
if (undefined !== ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.TRACE)) {
|
|
1968
|
-
if (
|
|
1966
|
+
if (isTest) {
|
|
1969
1967
|
throw new Error(JSON.stringify(response.data, undefined, 4));
|
|
1970
1968
|
}
|
|
1971
1969
|
CarbonReact.instance.setState((previous) => ({
|
|
@@ -1976,7 +1974,7 @@ function axiosInterceptors(axios) {
|
|
|
1976
1974
|
}));
|
|
1977
1975
|
return response;
|
|
1978
1976
|
}
|
|
1979
|
-
if (
|
|
1977
|
+
if (isTest) {
|
|
1980
1978
|
if (Array.isArray((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.sql)) {
|
|
1981
1979
|
addValidSQL$1(response.data.sql);
|
|
1982
1980
|
}
|
|
@@ -1994,7 +1992,7 @@ function axiosInterceptors(axios) {
|
|
|
1994
1992
|
// @link https://stackoverflow.com/questions/56074531/how-to-retry-5xx-requests-using-axios/75956421#75956421
|
|
1995
1993
|
if (((_b = (_a = error === null || error === void 0 ? void 0 : error.config) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b['X-Retry-Count']) !== undefined) {
|
|
1996
1994
|
console.log('X-Retry-Count', (_d = (_c = error === null || error === void 0 ? void 0 : error.config) === null || _c === void 0 ? void 0 : _c.headers) === null || _d === void 0 ? void 0 : _d['X-Retry-Count']);
|
|
1997
|
-
if (false ===
|
|
1995
|
+
if (false === isTest || true === isVerbose) {
|
|
1998
1996
|
console.log(error);
|
|
1999
1997
|
}
|
|
2000
1998
|
return error;
|
|
@@ -2004,12 +2002,12 @@ function axiosInterceptors(axios) {
|
|
|
2004
2002
|
(_f = (_8 = error.response).status) !== null && _f !== void 0 ? _f : (_8.status = 520);
|
|
2005
2003
|
const shouldRetry = (error) => { var _a, _b; return undefined !== error.config && ((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) >= 500 && ((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) < 600; };
|
|
2006
2004
|
const firstRetry = shouldRetry(error);
|
|
2007
|
-
if (false ===
|
|
2005
|
+
if (false === isTest || true === isVerbose) {
|
|
2008
2006
|
console.group("Retrying request ", (_h = (_g = error.config) === null || _g === void 0 ? void 0 : _g.url) !== null && _h !== void 0 ? _h : error.config);
|
|
2009
2007
|
console.log(error);
|
|
2010
2008
|
console.groupEnd();
|
|
2011
2009
|
}
|
|
2012
|
-
else if (
|
|
2010
|
+
else if (isTest) {
|
|
2013
2011
|
console.log('AXIOS ERROR', error.code, error.baseURL, (_j = error.config) === null || _j === void 0 ? void 0 : _j.url, error.headers, error.data, error.params, error.path, (_k = error.response) === null || _k === void 0 ? void 0 : _k.status, (_l = error.response) === null || _l === void 0 ? void 0 : _l.statusText, (_m = error.response) === null || _m === void 0 ? void 0 : _m.headers, (_o = error.response) === null || _o === void 0 ? void 0 : _o.data);
|
|
2014
2012
|
if (false === firstRetry) {
|
|
2015
2013
|
throw new Error(((_p = error === null || error === void 0 ? void 0 : error.response) === null || _p === void 0 ? void 0 : _p.status) + ' ' + JSON.stringify((_q = error === null || error === void 0 ? void 0 : error.response) === null || _q === void 0 ? void 0 : _q.data, undefined, 4));
|
|
@@ -2019,7 +2017,7 @@ function axiosInterceptors(axios) {
|
|
|
2019
2017
|
console.error("Error in axiosInterceptors.tsx (Not attempting retry)", error);
|
|
2020
2018
|
if (undefined !== ((_s = (_r = error === null || error === void 0 ? void 0 : error.response) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.TRACE) ||
|
|
2021
2019
|
undefined === ((_u = (_t = error === null || error === void 0 ? void 0 : error.response) === null || _t === void 0 ? void 0 : _t.data) === null || _u === void 0 ? void 0 : _u.alert)) {
|
|
2022
|
-
if (
|
|
2020
|
+
if (isTest) {
|
|
2023
2021
|
throw new Error((_w = (_v = error === null || error === void 0 ? void 0 : error.response.data['CarbonPHP\\Error\\PublicAlert']) !== null && _v !== void 0 ? _v : error === null || error === void 0 ? void 0 : error.response.data['DropInGaming\\PHP\\Errors\\DropException']) !== null && _w !== void 0 ? _w : JSON.stringify(error === null || error === void 0 ? void 0 : error.response.data, undefined, 4));
|
|
2024
2022
|
}
|
|
2025
2023
|
console.log('backend throwable', ((_x = error === null || error === void 0 ? void 0 : error.response) === null || _x === void 0 ? void 0 : _x.data) || (error === null || error === void 0 ? void 0 : error.response));
|
|
@@ -2049,7 +2047,7 @@ function axiosInterceptors(axios) {
|
|
|
2049
2047
|
const config = error.config;
|
|
2050
2048
|
// @link https://stackoverflow.com/questions/3561381/custom-http-headers-naming-conventions
|
|
2051
2049
|
let retries = parseInt((_2 = (_1 = config.headers) === null || _1 === void 0 ? void 0 : _1['X-Retry-Count']) !== null && _2 !== void 0 ? _2 : '0');
|
|
2052
|
-
const maxRetries =
|
|
2050
|
+
const maxRetries = isTest ? 5 : 3;
|
|
2053
2051
|
// todo - handle retries better
|
|
2054
2052
|
while (retries < maxRetries) {
|
|
2055
2053
|
config.headers = Object.assign(Object.assign({}, config.headers), { 'X-Retry-Count': `${++retries}` });
|
|
@@ -2118,7 +2116,7 @@ const axiosInstance = axios.create({
|
|
|
2118
2116
|
withCredentials: false,
|
|
2119
2117
|
// `adapter` allows custom handling of requests which makes testing easier.
|
|
2120
2118
|
// Return a promise and supply a valid response (see lib/adapters/README.md).
|
|
2121
|
-
adapter:
|
|
2119
|
+
adapter: isTest ? 'http' : 'xhr',
|
|
2122
2120
|
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
|
2123
2121
|
// This will set an `Authorization` header, overwriting any existing
|
|
2124
2122
|
// `Authorization` custom headers you have set using `headers`.
|
|
@@ -2231,12 +2229,12 @@ function setUrl() {
|
|
|
2231
2229
|
console.log(global.window.location);
|
|
2232
2230
|
}
|
|
2233
2231
|
|
|
2234
|
-
|
|
2232
|
+
var eUpdateInsertMethod;
|
|
2235
2233
|
(function (eUpdateInsertMethod) {
|
|
2236
2234
|
eUpdateInsertMethod[eUpdateInsertMethod["REPLACE"] = 0] = "REPLACE";
|
|
2237
2235
|
eUpdateInsertMethod[eUpdateInsertMethod["FIRST"] = 1] = "FIRST";
|
|
2238
2236
|
eUpdateInsertMethod[eUpdateInsertMethod["LAST"] = 2] = "LAST";
|
|
2239
|
-
})(
|
|
2237
|
+
})(eUpdateInsertMethod || (eUpdateInsertMethod = {}));
|
|
2240
2238
|
/**
|
|
2241
2239
|
*
|
|
2242
2240
|
* merged with existing objects.uniqueObjectId || {}.
|
|
@@ -2247,7 +2245,7 @@ exports.eUpdateInsertMethod = void 0;
|
|
|
2247
2245
|
* @param callback - if you want to do something with the updated state, you can pass a callback here. Run as the second
|
|
2248
2246
|
* parameter of setState.
|
|
2249
2247
|
*/
|
|
2250
|
-
function updateRestfulObjectArray(dataOrCallback, uniqueObjectId, stateKey, insertUpdateOrder =
|
|
2248
|
+
function updateRestfulObjectArray(dataOrCallback, uniqueObjectId, stateKey, insertUpdateOrder = eUpdateInsertMethod.LAST, callback) {
|
|
2251
2249
|
const bootstrap = CarbonReact.instance;
|
|
2252
2250
|
return bootstrap.setState((previousBootstrapState) => {
|
|
2253
2251
|
var _a, _b, _c;
|
|
@@ -2259,21 +2257,21 @@ function updateRestfulObjectArray(dataOrCallback, uniqueObjectId, stateKey, inse
|
|
|
2259
2257
|
switch (insertUpdateOrder) {
|
|
2260
2258
|
default:
|
|
2261
2259
|
throw Error('The insertUpdateOrder (eUpdateInsertMethod) was not implemented');
|
|
2262
|
-
case
|
|
2260
|
+
case eUpdateInsertMethod.LAST:
|
|
2263
2261
|
return {
|
|
2264
2262
|
[stateKey]: null === newOrReplacementData ? null : [
|
|
2265
2263
|
...updatedData,
|
|
2266
2264
|
...((_a = previousStateProperty === null || previousStateProperty === void 0 ? void 0 : previousStateProperty.filter(item => false === ((newOrReplacementData === null || newOrReplacementData === void 0 ? void 0 : newOrReplacementData.find(value => value[uniqueObjectId] === item[uniqueObjectId])) || false))) !== null && _a !== void 0 ? _a : [])
|
|
2267
2265
|
]
|
|
2268
2266
|
};
|
|
2269
|
-
case
|
|
2267
|
+
case eUpdateInsertMethod.FIRST:
|
|
2270
2268
|
return {
|
|
2271
2269
|
[stateKey]: null === newOrReplacementData ? null : [
|
|
2272
2270
|
...((_b = previousStateProperty === null || previousStateProperty === void 0 ? void 0 : previousStateProperty.filter(item => false === ((newOrReplacementData === null || newOrReplacementData === void 0 ? void 0 : newOrReplacementData.find(value => value[uniqueObjectId] === item[uniqueObjectId])) || false))) !== null && _b !== void 0 ? _b : []),
|
|
2273
2271
|
...updatedData,
|
|
2274
2272
|
]
|
|
2275
2273
|
};
|
|
2276
|
-
case
|
|
2274
|
+
case eUpdateInsertMethod.REPLACE: {
|
|
2277
2275
|
return {
|
|
2278
2276
|
[stateKey]: [
|
|
2279
2277
|
...((_c = previousStateProperty === null || previousStateProperty === void 0 ? void 0 : previousStateProperty.map(oldObject => {
|
|
@@ -2301,7 +2299,7 @@ function toDataURL(src, fileType, callback) {
|
|
|
2301
2299
|
canvas.height = image.naturalHeight;
|
|
2302
2300
|
canvas.width = image.naturalWidth;
|
|
2303
2301
|
if (context === null) {
|
|
2304
|
-
|
|
2302
|
+
toast.error('Unable to upload image. Please try another image or bowser. If issues persist, please contact support.');
|
|
2305
2303
|
return;
|
|
2306
2304
|
}
|
|
2307
2305
|
context === null || context === void 0 ? void 0 : context.drawImage(image, 0, 0);
|
|
@@ -2322,7 +2320,7 @@ function uploadImageChange(event, uploadCallback) {
|
|
|
2322
2320
|
const fileExtension = file.name.split('.').pop();
|
|
2323
2321
|
// check file extension is valid data uri
|
|
2324
2322
|
if (fileExtension !== 'jpg' && fileExtension !== 'jpeg' && fileExtension !== 'png' && fileExtension !== 'gif') {
|
|
2325
|
-
|
|
2323
|
+
toast.error('Please upload a valid image file type (jpg, jpeg, png, gif).');
|
|
2326
2324
|
return;
|
|
2327
2325
|
}
|
|
2328
2326
|
// @link https://github.com/palantir/tslint/issues/4653
|
|
@@ -2353,8 +2351,8 @@ function getWindowDimensions() {
|
|
|
2353
2351
|
};
|
|
2354
2352
|
}
|
|
2355
2353
|
function useWindowDimensions() {
|
|
2356
|
-
const [windowDimensions, setWindowDimensions] =
|
|
2357
|
-
|
|
2354
|
+
const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions());
|
|
2355
|
+
useEffect(() => {
|
|
2358
2356
|
function handleResize() {
|
|
2359
2357
|
setWindowDimensions(getWindowDimensions());
|
|
2360
2358
|
}
|
|
@@ -4589,71 +4587,5 @@ const convertForRequestBody = function (restfulObject, tableName, regexErrorHand
|
|
|
4589
4587
|
.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: payload[key] })), {});
|
|
4590
4588
|
};
|
|
4591
4589
|
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
exports.BackendThrowable = BackendThrowable;
|
|
4595
|
-
exports.C6 = C6;
|
|
4596
|
-
exports.COLUMNS = COLUMNS;
|
|
4597
|
-
exports.CarbonReact = CarbonReact;
|
|
4598
|
-
exports.ErrorHttpCode = ErrorHttpCode;
|
|
4599
|
-
exports.GlobalHistory = GlobalHistory;
|
|
4600
|
-
exports.HandleResponseCodes = HandleResponseCodes;
|
|
4601
|
-
exports.Loading = Loading;
|
|
4602
|
-
exports.Localhost = Localhost;
|
|
4603
|
-
exports.Nest = Nest;
|
|
4604
|
-
exports.PageNotFound = PageNotFound;
|
|
4605
|
-
exports.Popup = Popup;
|
|
4606
|
-
exports.TABLES = TABLES;
|
|
4607
|
-
exports.addAlert = addAlert;
|
|
4608
|
-
exports.addValidSQL = addValidSQL$1;
|
|
4609
|
-
exports.axiosInstance = axiosInstance;
|
|
4610
|
-
exports.carbons = carbons;
|
|
4611
|
-
exports.changed = changed;
|
|
4612
|
-
exports.comments = comments;
|
|
4613
|
-
exports.convertForRequestBody = convertForRequestBody;
|
|
4614
|
-
exports.deleteRestfulObjectArrays = deleteRestfulObjectArrays;
|
|
4615
|
-
exports.documentation = documentation;
|
|
4616
|
-
exports.feature_group_references = feature_group_references;
|
|
4617
|
-
exports.features = features;
|
|
4618
|
-
exports.getRootStyleValue = getRootStyleValue;
|
|
4619
|
-
exports.getStyles = getStyles;
|
|
4620
|
-
exports.group_references = group_references;
|
|
4621
|
-
exports.groups = groups;
|
|
4622
|
-
exports.hexToRgb = hexToRgb;
|
|
4623
|
-
exports.history_logs = history_logs;
|
|
4624
|
-
exports.isEdgeBrowser = isEdgeBrowser;
|
|
4625
|
-
exports.isProduction = isProduction;
|
|
4626
|
-
exports.location_references = location_references;
|
|
4627
|
-
exports.locations = locations;
|
|
4628
|
-
exports.parseMultipleJson = parseMultipleJson;
|
|
4629
|
-
exports.photos = photos;
|
|
4630
|
-
exports.range = range;
|
|
4631
|
-
exports.reports = reports;
|
|
4632
|
-
exports.scrollIntoView = ScrollIntoViewDirective;
|
|
4633
|
-
exports.sessions = sessions;
|
|
4634
|
-
exports.setCookies = setCookies;
|
|
4635
|
-
exports.setUrl = setUrl;
|
|
4636
|
-
exports.toDataURL = toDataURL;
|
|
4637
|
-
exports.updateRestfulObjectArrays = updateRestfulObjectArray;
|
|
4638
|
-
exports.uploadImage = uploadImage;
|
|
4639
|
-
exports.uploadImageChange = uploadImageChange;
|
|
4640
|
-
exports.user_followers = user_followers;
|
|
4641
|
-
exports.user_groups = user_groups;
|
|
4642
|
-
exports.user_messages = user_messages;
|
|
4643
|
-
exports.user_sessions = user_sessions;
|
|
4644
|
-
exports.user_tasks = user_tasks;
|
|
4645
|
-
exports.users = users;
|
|
4646
|
-
exports.windowDimensions = useWindowDimensions;
|
|
4647
|
-
exports.wp_commentmeta = wp_commentmeta;
|
|
4648
|
-
exports.wp_comments = wp_comments;
|
|
4649
|
-
exports.wp_links = wp_links;
|
|
4650
|
-
exports.wp_options = wp_options;
|
|
4651
|
-
exports.wp_postmeta = wp_postmeta;
|
|
4652
|
-
exports.wp_posts = wp_posts;
|
|
4653
|
-
exports.wp_term_relationships = wp_term_relationships;
|
|
4654
|
-
exports.wp_term_taxonomy = wp_term_taxonomy;
|
|
4655
|
-
exports.wp_termmeta = wp_termmeta;
|
|
4656
|
-
exports.wp_terms = wp_terms;
|
|
4657
|
-
exports.wp_usermeta = wp_usermeta;
|
|
4658
|
-
exports.wp_users = wp_users;
|
|
4659
|
-
//# sourceMappingURL=CarbonReact.cjs.js.map
|
|
4590
|
+
export { AccessDenied, Alert, BackendThrowable, C6, COLUMNS, CarbonReact, ErrorHttpCode, GlobalHistory, HandleResponseCodes, Loading, Localhost, Nest, PageNotFound, Popup, TABLES, addAlert, addValidSQL$1 as addValidSQL, axiosInstance, carbons, changed, comments, convertForRequestBody, deleteRestfulObjectArrays, documentation, eUpdateInsertMethod, feature_group_references, features, getRootStyleValue, getStyles, globalNavigate, group_references, groups, hexToRgb, history_logs, isEdgeBrowser, isProduction, location_references, locations, parseMultipleJson, photos, range, reports, ScrollIntoViewDirective as scrollIntoView, sessions, setCookies, setUrl, toDataURL, updateRestfulObjectArray as updateRestfulObjectArrays, uploadImage, uploadImageChange, user_followers, user_groups, user_messages, user_sessions, user_tasks, users, useWindowDimensions as windowDimensions, wp_commentmeta, wp_comments, wp_links, wp_options, wp_postmeta, wp_posts, wp_term_relationships, wp_term_taxonomy, wp_termmeta, wp_terms, wp_usermeta, wp_users };
|
|
4591
|
+
//# sourceMappingURL=CarbonReact.esm.js.map
|