@devtron-labs/devtron-fe-common-lib 0.0.50 → 0.0.51-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Common/ChartVersionAndTypeSelector.d.ts +4 -0
- package/dist/Common/Common.service.d.ts +1 -0
- package/dist/Common/Constants.d.ts +2 -0
- package/dist/Common/DraggableWrapper/DraggableButton.d.ts +3 -0
- package/dist/Common/DraggableWrapper/DraggableWrapper.d.ts +9 -0
- package/dist/Common/DraggableWrapper/index.d.ts +3 -0
- package/dist/Common/DraggableWrapper/types.d.ts +19 -0
- package/dist/Common/Grid/Grid.d.ts +1 -1
- package/dist/Common/Grid/types.d.ts +2 -2
- package/dist/Common/Helper.d.ts +9 -0
- package/dist/Common/Hooks/UseWindowSize/UseWindowSize.d.ts +4 -0
- package/dist/Common/Hooks/index.d.ts +1 -0
- package/dist/Common/Types.d.ts +64 -0
- package/dist/Common/index.d.ts +2 -0
- package/dist/index.js +1920 -157
- package/package.json +5 -2
- package/src/Assets/Icon/ic-drag.svg +8 -0
- package/src/Common/ChartVersionAndTypeSelector.tsx +78 -0
- package/src/Common/Common.service.ts +4 -0
- package/src/Common/Constants.ts +5 -2
- package/src/Common/DraggableWrapper/DraggableButton.tsx +11 -0
- package/src/Common/DraggableWrapper/DraggableWrapper.tsx +109 -0
- package/src/Common/DraggableWrapper/index.ts +3 -0
- package/src/Common/DraggableWrapper/types.ts +22 -0
- package/src/Common/Grid/Grid.tsx +7 -2
- package/src/Common/Grid/types.ts +3 -1
- package/src/Common/Helper.tsx +101 -0
- package/src/Common/Hooks/UseWindowSize/UseWindowSize.tsx +30 -0
- package/src/Common/Hooks/index.ts +1 -0
- package/src/Common/Types.ts +69 -0
- package/src/Common/index.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -4,9 +4,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var ReactDOM = require('react-dom');
|
|
6
6
|
var reactRouterDom = require('react-router-dom');
|
|
7
|
+
var vm = require('vm');
|
|
7
8
|
var RJSF = require('@rjsf/core');
|
|
8
9
|
var RJSFValidator = require('@rjsf/validator-ajv8');
|
|
9
10
|
var utils = require('@rjsf/utils');
|
|
11
|
+
var Draggable = require('react-draggable');
|
|
10
12
|
|
|
11
13
|
function _interopNamespaceDefault(e) {
|
|
12
14
|
var n = Object.create(null);
|
|
@@ -47,7 +49,8 @@ var ROUTES = {
|
|
|
47
49
|
PROJECT_LIST_MIN: 'team/autocomplete',
|
|
48
50
|
USER_CHECK_ROLE: 'user/check/roles',
|
|
49
51
|
IMAGE_TAGGING: 'app/image-tagging',
|
|
50
|
-
CD_MATERIAL_GET: 'app/cd-pipeline'
|
|
52
|
+
CD_MATERIAL_GET: 'app/cd-pipeline',
|
|
53
|
+
DEPLOYMENT_TEMPLATE_LIST: 'app/template/list'
|
|
51
54
|
};
|
|
52
55
|
exports.KEY_VALUE = void 0;
|
|
53
56
|
(function (KEY_VALUE) {
|
|
@@ -254,7 +257,8 @@ var RepositoryAction = {
|
|
|
254
257
|
CONTAINER: "CONTAINER",
|
|
255
258
|
CHART_PULL: "CHART_PULL",
|
|
256
259
|
CHART_PUSH: "CHART_PUSH"
|
|
257
|
-
};
|
|
260
|
+
};
|
|
261
|
+
var MAX_Z_INDEX = 2147483647;
|
|
258
262
|
|
|
259
263
|
/******************************************************************************
|
|
260
264
|
Copyright (c) Microsoft Corporation.
|
|
@@ -279,7 +283,7 @@ var extendStatics = function(d, b) {
|
|
|
279
283
|
return extendStatics(d, b);
|
|
280
284
|
};
|
|
281
285
|
|
|
282
|
-
function __extends(d, b) {
|
|
286
|
+
function __extends$1(d, b) {
|
|
283
287
|
if (typeof b !== "function" && b !== null)
|
|
284
288
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
285
289
|
extendStatics(d, b);
|
|
@@ -385,7 +389,7 @@ var ServerError = /** @class */ (function () {
|
|
|
385
389
|
return ServerError;
|
|
386
390
|
}());
|
|
387
391
|
var ServerErrors = /** @class */ (function (_super) {
|
|
388
|
-
__extends(ServerErrors, _super);
|
|
392
|
+
__extends$1(ServerErrors, _super);
|
|
389
393
|
function ServerErrors(obj) {
|
|
390
394
|
var _this = _super.call(this) || this;
|
|
391
395
|
_this.code = obj.code;
|
|
@@ -747,9 +751,9 @@ var css_248z$7 = ".empty-state {\n height: 100%;\n}\n.empty-state img {\n heig
|
|
|
747
751
|
styleInject(css_248z$7);
|
|
748
752
|
|
|
749
753
|
var _g$6;
|
|
750
|
-
function _extends$
|
|
754
|
+
function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
|
|
751
755
|
var SvgIcProgressing = function SvgIcProgressing(props) {
|
|
752
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
756
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
|
|
753
757
|
xmlns: "http://www.w3.org/2000/svg",
|
|
754
758
|
viewBox: "0 0 24 24",
|
|
755
759
|
width: "1em",
|
|
@@ -801,8 +805,8 @@ EmptyState.Loading = Loading;
|
|
|
801
805
|
|
|
802
806
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
803
807
|
|
|
804
|
-
function _extends$
|
|
805
|
-
_extends$
|
|
808
|
+
function _extends$m() {
|
|
809
|
+
_extends$m = Object.assign || function (target) {
|
|
806
810
|
for (var i = 1; i < arguments.length; i++) {
|
|
807
811
|
var source = arguments[i];
|
|
808
812
|
|
|
@@ -816,7 +820,7 @@ function _extends$l() {
|
|
|
816
820
|
return target;
|
|
817
821
|
};
|
|
818
822
|
|
|
819
|
-
return _extends$
|
|
823
|
+
return _extends$m.apply(this, arguments);
|
|
820
824
|
}
|
|
821
825
|
|
|
822
826
|
function _objectWithoutPropertiesLoose$2(source, excluded) {
|
|
@@ -1542,7 +1546,7 @@ function ProgressBar(_ref) {
|
|
|
1542
1546
|
isIn = _ref.isIn,
|
|
1543
1547
|
theme = _ref.theme;
|
|
1544
1548
|
|
|
1545
|
-
var style = _extends$
|
|
1549
|
+
var style = _extends$m({}, userStyle, {
|
|
1546
1550
|
animationDuration: delay + "ms",
|
|
1547
1551
|
animationPlayState: isRunning ? 'running' : 'paused',
|
|
1548
1552
|
opacity: hide ? 0 : 1
|
|
@@ -1819,9 +1823,9 @@ var ToastContainer = function ToastContainer(props) {
|
|
|
1819
1823
|
,
|
|
1820
1824
|
id: containerId
|
|
1821
1825
|
}, getToastToRender(function (position, toastList) {
|
|
1822
|
-
var containerStyle = !toastList.length ? _extends$
|
|
1826
|
+
var containerStyle = !toastList.length ? _extends$m({}, style, {
|
|
1823
1827
|
pointerEvents: 'none'
|
|
1824
|
-
}) : _extends$
|
|
1828
|
+
}) : _extends$m({}, style);
|
|
1825
1829
|
return React.createElement("div", {
|
|
1826
1830
|
className: getClassName(position),
|
|
1827
1831
|
style: containerStyle,
|
|
@@ -1928,7 +1932,7 @@ function dispatchToast(content, options) {
|
|
|
1928
1932
|
|
|
1929
1933
|
|
|
1930
1934
|
function mergeOptions(type, options) {
|
|
1931
|
-
return _extends$
|
|
1935
|
+
return _extends$m({}, options, {
|
|
1932
1936
|
type: options && options.type || type,
|
|
1933
1937
|
toastId: getToastId(options)
|
|
1934
1938
|
});
|
|
@@ -1945,7 +1949,7 @@ function toast(content, options) {
|
|
|
1945
1949
|
}
|
|
1946
1950
|
|
|
1947
1951
|
toast.loading = function (content, options) {
|
|
1948
|
-
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$
|
|
1952
|
+
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$m({
|
|
1949
1953
|
isLoading: true,
|
|
1950
1954
|
autoClose: false,
|
|
1951
1955
|
closeOnClick: false,
|
|
@@ -1961,7 +1965,7 @@ function handlePromise(promise, _ref2, options) {
|
|
|
1961
1965
|
var id;
|
|
1962
1966
|
|
|
1963
1967
|
if (pending) {
|
|
1964
|
-
id = isStr(pending) ? toast.loading(pending, options) : toast.loading(pending.render, _extends$
|
|
1968
|
+
id = isStr(pending) ? toast.loading(pending, options) : toast.loading(pending.render, _extends$m({}, options, pending));
|
|
1965
1969
|
}
|
|
1966
1970
|
|
|
1967
1971
|
var resetParams = {
|
|
@@ -1980,7 +1984,7 @@ function handlePromise(promise, _ref2, options) {
|
|
|
1980
1984
|
return;
|
|
1981
1985
|
}
|
|
1982
1986
|
|
|
1983
|
-
var baseParams = _extends$
|
|
1987
|
+
var baseParams = _extends$m({
|
|
1984
1988
|
type: type
|
|
1985
1989
|
}, resetParams, options, {
|
|
1986
1990
|
data: result
|
|
@@ -1991,10 +1995,10 @@ function handlePromise(promise, _ref2, options) {
|
|
|
1991
1995
|
} : input; // if the id is set we know that it's an update
|
|
1992
1996
|
|
|
1993
1997
|
if (id) {
|
|
1994
|
-
toast.update(id, _extends$
|
|
1998
|
+
toast.update(id, _extends$m({}, baseParams, params));
|
|
1995
1999
|
} else {
|
|
1996
2000
|
// using toast.promise without loading
|
|
1997
|
-
toast(params.render, _extends$
|
|
2001
|
+
toast(params.render, _extends$m({}, baseParams, params));
|
|
1998
2002
|
}
|
|
1999
2003
|
|
|
2000
2004
|
return result;
|
|
@@ -2018,7 +2022,7 @@ toast.warning = /*#__PURE__*/createToastByType(TYPE.WARNING);
|
|
|
2018
2022
|
toast.warn = toast.warning;
|
|
2019
2023
|
|
|
2020
2024
|
toast.dark = function (content, options) {
|
|
2021
|
-
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$
|
|
2025
|
+
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends$m({
|
|
2022
2026
|
theme: 'dark'
|
|
2023
2027
|
}, options)));
|
|
2024
2028
|
};
|
|
@@ -2075,7 +2079,7 @@ toast.update = function (toastId, options) {
|
|
|
2075
2079
|
var oldOptions = toast.props,
|
|
2076
2080
|
oldContent = toast.content;
|
|
2077
2081
|
|
|
2078
|
-
var nextOptions = _extends$
|
|
2082
|
+
var nextOptions = _extends$m({}, oldOptions, options, {
|
|
2079
2083
|
toastId: options.toastId || toastId,
|
|
2080
2084
|
updateId: generateToastId()
|
|
2081
2085
|
});
|
|
@@ -2175,7 +2179,7 @@ eventManager.on(2
|
|
|
2175
2179
|
});
|
|
2176
2180
|
|
|
2177
2181
|
var ToastBody = /** @class */ (function (_super) {
|
|
2178
|
-
__extends(ToastBody, _super);
|
|
2182
|
+
__extends$1(ToastBody, _super);
|
|
2179
2183
|
function ToastBody() {
|
|
2180
2184
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2181
2185
|
}
|
|
@@ -2185,7 +2189,7 @@ var ToastBody = /** @class */ (function (_super) {
|
|
|
2185
2189
|
return ToastBody;
|
|
2186
2190
|
}(React.Component));
|
|
2187
2191
|
var ToastBody3 = /** @class */ (function (_super) {
|
|
2188
|
-
__extends(ToastBody3, _super);
|
|
2192
|
+
__extends$1(ToastBody3, _super);
|
|
2189
2193
|
function ToastBody3() {
|
|
2190
2194
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2191
2195
|
}
|
|
@@ -2195,7 +2199,7 @@ var ToastBody3 = /** @class */ (function (_super) {
|
|
|
2195
2199
|
return ToastBody3;
|
|
2196
2200
|
}(React.Component));
|
|
2197
2201
|
var ToastBodyWithButton = /** @class */ (function (_super) {
|
|
2198
|
-
__extends(ToastBodyWithButton, _super);
|
|
2202
|
+
__extends$1(ToastBodyWithButton, _super);
|
|
2199
2203
|
function ToastBodyWithButton() {
|
|
2200
2204
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2201
2205
|
}
|
|
@@ -2244,7 +2248,7 @@ function ErrorScreenNotFound() {
|
|
|
2244
2248
|
}
|
|
2245
2249
|
|
|
2246
2250
|
var ErrorScreenManager = /** @class */ (function (_super) {
|
|
2247
|
-
__extends(ErrorScreenManager, _super);
|
|
2251
|
+
__extends$1(ErrorScreenManager, _super);
|
|
2248
2252
|
function ErrorScreenManager() {
|
|
2249
2253
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2250
2254
|
}
|
|
@@ -2275,7 +2279,7 @@ var ErrorScreenManager = /** @class */ (function (_super) {
|
|
|
2275
2279
|
return ErrorScreenManager;
|
|
2276
2280
|
}(React.Component));
|
|
2277
2281
|
var ErrorScreenNotAuthorized = /** @class */ (function (_super) {
|
|
2278
|
-
__extends(ErrorScreenNotAuthorized, _super);
|
|
2282
|
+
__extends$1(ErrorScreenNotAuthorized, _super);
|
|
2279
2283
|
function ErrorScreenNotAuthorized() {
|
|
2280
2284
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2281
2285
|
}
|
|
@@ -9857,12 +9861,1512 @@ var moment$1 = {
|
|
|
9857
9861
|
MONTH: 'YYYY-MM', // <input type="month" />
|
|
9858
9862
|
};
|
|
9859
9863
|
|
|
9860
|
-
return hooks;
|
|
9864
|
+
return hooks;
|
|
9865
|
+
|
|
9866
|
+
})));
|
|
9867
|
+
} (moment$1));
|
|
9868
|
+
|
|
9869
|
+
var moment = momentExports;
|
|
9870
|
+
|
|
9871
|
+
const {
|
|
9872
|
+
hasOwnProperty: hasOwnProp
|
|
9873
|
+
} = Object.prototype;
|
|
9874
|
+
/**
|
|
9875
|
+
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
|
|
9876
|
+
*/
|
|
9877
|
+
|
|
9878
|
+
/**
|
|
9879
|
+
* @typedef {any} AnyItem
|
|
9880
|
+
*/
|
|
9881
|
+
|
|
9882
|
+
/**
|
|
9883
|
+
* @typedef {any} AnyResult
|
|
9884
|
+
*/
|
|
9885
|
+
|
|
9886
|
+
/**
|
|
9887
|
+
* Copies array and then pushes item into it.
|
|
9888
|
+
* @param {GenericArray} arr Array to copy and into which to push
|
|
9889
|
+
* @param {AnyItem} item Array item to add (to end)
|
|
9890
|
+
* @returns {GenericArray} Copy of the original array
|
|
9891
|
+
*/
|
|
9892
|
+
|
|
9893
|
+
function push(arr, item) {
|
|
9894
|
+
arr = arr.slice();
|
|
9895
|
+
arr.push(item);
|
|
9896
|
+
return arr;
|
|
9897
|
+
}
|
|
9898
|
+
/**
|
|
9899
|
+
* Copies array and then unshifts item into it.
|
|
9900
|
+
* @param {AnyItem} item Array item to add (to beginning)
|
|
9901
|
+
* @param {GenericArray} arr Array to copy and into which to unshift
|
|
9902
|
+
* @returns {GenericArray} Copy of the original array
|
|
9903
|
+
*/
|
|
9904
|
+
|
|
9905
|
+
|
|
9906
|
+
function unshift(item, arr) {
|
|
9907
|
+
arr = arr.slice();
|
|
9908
|
+
arr.unshift(item);
|
|
9909
|
+
return arr;
|
|
9910
|
+
}
|
|
9911
|
+
/**
|
|
9912
|
+
* Caught when JSONPath is used without `new` but rethrown if with `new`
|
|
9913
|
+
* @extends Error
|
|
9914
|
+
*/
|
|
9915
|
+
|
|
9916
|
+
|
|
9917
|
+
class NewError extends Error {
|
|
9918
|
+
/**
|
|
9919
|
+
* @param {AnyResult} value The evaluated scalar value
|
|
9920
|
+
*/
|
|
9921
|
+
constructor(value) {
|
|
9922
|
+
super('JSONPath should not be called with "new" (it prevents return ' + 'of (unwrapped) scalar values)');
|
|
9923
|
+
this.avoidNew = true;
|
|
9924
|
+
this.value = value;
|
|
9925
|
+
this.name = 'NewError';
|
|
9926
|
+
}
|
|
9927
|
+
|
|
9928
|
+
}
|
|
9929
|
+
/**
|
|
9930
|
+
* @typedef {PlainObject} ReturnObject
|
|
9931
|
+
* @property {string} path
|
|
9932
|
+
* @property {JSONObject} value
|
|
9933
|
+
* @property {PlainObject|GenericArray} parent
|
|
9934
|
+
* @property {string} parentProperty
|
|
9935
|
+
*/
|
|
9936
|
+
|
|
9937
|
+
/**
|
|
9938
|
+
* @callback JSONPathCallback
|
|
9939
|
+
* @param {string|PlainObject} preferredOutput
|
|
9940
|
+
* @param {"value"|"property"} type
|
|
9941
|
+
* @param {ReturnObject} fullRetObj
|
|
9942
|
+
* @returns {void}
|
|
9943
|
+
*/
|
|
9944
|
+
|
|
9945
|
+
/**
|
|
9946
|
+
* @callback OtherTypeCallback
|
|
9947
|
+
* @param {JSONObject} val
|
|
9948
|
+
* @param {string} path
|
|
9949
|
+
* @param {PlainObject|GenericArray} parent
|
|
9950
|
+
* @param {string} parentPropName
|
|
9951
|
+
* @returns {boolean}
|
|
9952
|
+
*/
|
|
9953
|
+
|
|
9954
|
+
/* eslint-disable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */
|
|
9955
|
+
|
|
9956
|
+
/**
|
|
9957
|
+
* @typedef {PlainObject} JSONPathOptions
|
|
9958
|
+
* @property {JSON} json
|
|
9959
|
+
* @property {string|string[]} path
|
|
9960
|
+
* @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|"all"} [resultType="value"]
|
|
9961
|
+
* @property {boolean} [flatten=false]
|
|
9962
|
+
* @property {boolean} [wrap=true]
|
|
9963
|
+
* @property {PlainObject} [sandbox={}]
|
|
9964
|
+
* @property {boolean} [preventEval=false]
|
|
9965
|
+
* @property {PlainObject|GenericArray|null} [parent=null]
|
|
9966
|
+
* @property {string|null} [parentProperty=null]
|
|
9967
|
+
* @property {JSONPathCallback} [callback]
|
|
9968
|
+
* @property {OtherTypeCallback} [otherTypeCallback] Defaults to
|
|
9969
|
+
* function which throws on encountering `@other`
|
|
9970
|
+
* @property {boolean} [autostart=true]
|
|
9971
|
+
*/
|
|
9972
|
+
|
|
9973
|
+
/* eslint-enable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */
|
|
9974
|
+
|
|
9975
|
+
/**
|
|
9976
|
+
* @param {string|JSONPathOptions} opts If a string, will be treated as `expr`
|
|
9977
|
+
* @param {string} [expr] JSON path to evaluate
|
|
9978
|
+
* @param {JSON} [obj] JSON object to evaluate against
|
|
9979
|
+
* @param {JSONPathCallback} [callback] Passed 3 arguments: 1) desired payload
|
|
9980
|
+
* per `resultType`, 2) `"value"|"property"`, 3) Full returned object with
|
|
9981
|
+
* all payloads
|
|
9982
|
+
* @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end
|
|
9983
|
+
* of one's query, this will be invoked with the value of the item, its
|
|
9984
|
+
* path, its parent, and its parent's property name, and it should return
|
|
9985
|
+
* a boolean indicating whether the supplied value belongs to the "other"
|
|
9986
|
+
* type or not (or it may handle transformations and return `false`).
|
|
9987
|
+
* @returns {JSONPath}
|
|
9988
|
+
* @class
|
|
9989
|
+
*/
|
|
9990
|
+
|
|
9991
|
+
|
|
9992
|
+
function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
|
|
9993
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
9994
|
+
if (!(this instanceof JSONPath)) {
|
|
9995
|
+
try {
|
|
9996
|
+
return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
|
|
9997
|
+
} catch (e) {
|
|
9998
|
+
if (!e.avoidNew) {
|
|
9999
|
+
throw e;
|
|
10000
|
+
}
|
|
10001
|
+
|
|
10002
|
+
return e.value;
|
|
10003
|
+
}
|
|
10004
|
+
}
|
|
10005
|
+
|
|
10006
|
+
if (typeof opts === 'string') {
|
|
10007
|
+
otherTypeCallback = callback;
|
|
10008
|
+
callback = obj;
|
|
10009
|
+
obj = expr;
|
|
10010
|
+
expr = opts;
|
|
10011
|
+
opts = null;
|
|
10012
|
+
}
|
|
10013
|
+
|
|
10014
|
+
const optObj = opts && typeof opts === 'object';
|
|
10015
|
+
opts = opts || {};
|
|
10016
|
+
this.json = opts.json || obj;
|
|
10017
|
+
this.path = opts.path || expr;
|
|
10018
|
+
this.resultType = opts.resultType || 'value';
|
|
10019
|
+
this.flatten = opts.flatten || false;
|
|
10020
|
+
this.wrap = hasOwnProp.call(opts, 'wrap') ? opts.wrap : true;
|
|
10021
|
+
this.sandbox = opts.sandbox || {};
|
|
10022
|
+
this.preventEval = opts.preventEval || false;
|
|
10023
|
+
this.parent = opts.parent || null;
|
|
10024
|
+
this.parentProperty = opts.parentProperty || null;
|
|
10025
|
+
this.callback = opts.callback || callback || null;
|
|
10026
|
+
|
|
10027
|
+
this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function () {
|
|
10028
|
+
throw new TypeError('You must supply an otherTypeCallback callback option ' + 'with the @other() operator.');
|
|
10029
|
+
};
|
|
10030
|
+
|
|
10031
|
+
if (opts.autostart !== false) {
|
|
10032
|
+
const args = {
|
|
10033
|
+
path: optObj ? opts.path : expr
|
|
10034
|
+
};
|
|
10035
|
+
|
|
10036
|
+
if (!optObj) {
|
|
10037
|
+
args.json = obj;
|
|
10038
|
+
} else if ('json' in opts) {
|
|
10039
|
+
args.json = opts.json;
|
|
10040
|
+
}
|
|
10041
|
+
|
|
10042
|
+
const ret = this.evaluate(args);
|
|
10043
|
+
|
|
10044
|
+
if (!ret || typeof ret !== 'object') {
|
|
10045
|
+
throw new NewError(ret);
|
|
10046
|
+
}
|
|
10047
|
+
|
|
10048
|
+
return ret;
|
|
10049
|
+
}
|
|
10050
|
+
} // PUBLIC METHODS
|
|
10051
|
+
|
|
10052
|
+
|
|
10053
|
+
JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
|
|
10054
|
+
let currParent = this.parent,
|
|
10055
|
+
currParentProperty = this.parentProperty;
|
|
10056
|
+
let {
|
|
10057
|
+
flatten,
|
|
10058
|
+
wrap
|
|
10059
|
+
} = this;
|
|
10060
|
+
this.currResultType = this.resultType;
|
|
10061
|
+
this.currPreventEval = this.preventEval;
|
|
10062
|
+
this.currSandbox = this.sandbox;
|
|
10063
|
+
callback = callback || this.callback;
|
|
10064
|
+
this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
|
|
10065
|
+
json = json || this.json;
|
|
10066
|
+
expr = expr || this.path;
|
|
10067
|
+
|
|
10068
|
+
if (expr && typeof expr === 'object' && !Array.isArray(expr)) {
|
|
10069
|
+
if (!expr.path && expr.path !== '') {
|
|
10070
|
+
throw new TypeError('You must supply a "path" property when providing an object ' + 'argument to JSONPath.evaluate().');
|
|
10071
|
+
}
|
|
10072
|
+
|
|
10073
|
+
if (!hasOwnProp.call(expr, 'json')) {
|
|
10074
|
+
throw new TypeError('You must supply a "json" property when providing an object ' + 'argument to JSONPath.evaluate().');
|
|
10075
|
+
}
|
|
10076
|
+
|
|
10077
|
+
({
|
|
10078
|
+
json
|
|
10079
|
+
} = expr);
|
|
10080
|
+
flatten = hasOwnProp.call(expr, 'flatten') ? expr.flatten : flatten;
|
|
10081
|
+
this.currResultType = hasOwnProp.call(expr, 'resultType') ? expr.resultType : this.currResultType;
|
|
10082
|
+
this.currSandbox = hasOwnProp.call(expr, 'sandbox') ? expr.sandbox : this.currSandbox;
|
|
10083
|
+
wrap = hasOwnProp.call(expr, 'wrap') ? expr.wrap : wrap;
|
|
10084
|
+
this.currPreventEval = hasOwnProp.call(expr, 'preventEval') ? expr.preventEval : this.currPreventEval;
|
|
10085
|
+
callback = hasOwnProp.call(expr, 'callback') ? expr.callback : callback;
|
|
10086
|
+
this.currOtherTypeCallback = hasOwnProp.call(expr, 'otherTypeCallback') ? expr.otherTypeCallback : this.currOtherTypeCallback;
|
|
10087
|
+
currParent = hasOwnProp.call(expr, 'parent') ? expr.parent : currParent;
|
|
10088
|
+
currParentProperty = hasOwnProp.call(expr, 'parentProperty') ? expr.parentProperty : currParentProperty;
|
|
10089
|
+
expr = expr.path;
|
|
10090
|
+
}
|
|
10091
|
+
|
|
10092
|
+
currParent = currParent || null;
|
|
10093
|
+
currParentProperty = currParentProperty || null;
|
|
10094
|
+
|
|
10095
|
+
if (Array.isArray(expr)) {
|
|
10096
|
+
expr = JSONPath.toPathString(expr);
|
|
10097
|
+
}
|
|
10098
|
+
|
|
10099
|
+
if (!expr && expr !== '' || !json) {
|
|
10100
|
+
return undefined;
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
const exprList = JSONPath.toPathArray(expr);
|
|
10104
|
+
|
|
10105
|
+
if (exprList[0] === '$' && exprList.length > 1) {
|
|
10106
|
+
exprList.shift();
|
|
10107
|
+
}
|
|
10108
|
+
|
|
10109
|
+
this._hasParentSelector = null;
|
|
10110
|
+
|
|
10111
|
+
const result = this._trace(exprList, json, ['$'], currParent, currParentProperty, callback).filter(function (ea) {
|
|
10112
|
+
return ea && !ea.isParentSelector;
|
|
10113
|
+
});
|
|
10114
|
+
|
|
10115
|
+
if (!result.length) {
|
|
10116
|
+
return wrap ? [] : undefined;
|
|
10117
|
+
}
|
|
10118
|
+
|
|
10119
|
+
if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
|
|
10120
|
+
return this._getPreferredOutput(result[0]);
|
|
10121
|
+
}
|
|
10122
|
+
|
|
10123
|
+
return result.reduce((rslt, ea) => {
|
|
10124
|
+
const valOrPath = this._getPreferredOutput(ea);
|
|
10125
|
+
|
|
10126
|
+
if (flatten && Array.isArray(valOrPath)) {
|
|
10127
|
+
rslt = rslt.concat(valOrPath);
|
|
10128
|
+
} else {
|
|
10129
|
+
rslt.push(valOrPath);
|
|
10130
|
+
}
|
|
10131
|
+
|
|
10132
|
+
return rslt;
|
|
10133
|
+
}, []);
|
|
10134
|
+
}; // PRIVATE METHODS
|
|
10135
|
+
|
|
10136
|
+
|
|
10137
|
+
JSONPath.prototype._getPreferredOutput = function (ea) {
|
|
10138
|
+
const resultType = this.currResultType;
|
|
10139
|
+
|
|
10140
|
+
switch (resultType) {
|
|
10141
|
+
case 'all':
|
|
10142
|
+
{
|
|
10143
|
+
const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
|
|
10144
|
+
ea.pointer = JSONPath.toPointer(path);
|
|
10145
|
+
ea.path = typeof ea.path === 'string' ? ea.path : JSONPath.toPathString(ea.path);
|
|
10146
|
+
return ea;
|
|
10147
|
+
}
|
|
10148
|
+
|
|
10149
|
+
case 'value':
|
|
10150
|
+
case 'parent':
|
|
10151
|
+
case 'parentProperty':
|
|
10152
|
+
return ea[resultType];
|
|
10153
|
+
|
|
10154
|
+
case 'path':
|
|
10155
|
+
return JSONPath.toPathString(ea[resultType]);
|
|
10156
|
+
|
|
10157
|
+
case 'pointer':
|
|
10158
|
+
return JSONPath.toPointer(ea.path);
|
|
10159
|
+
|
|
10160
|
+
default:
|
|
10161
|
+
throw new TypeError('Unknown result type');
|
|
10162
|
+
}
|
|
10163
|
+
};
|
|
10164
|
+
|
|
10165
|
+
JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
|
|
10166
|
+
if (callback) {
|
|
10167
|
+
const preferredOutput = this._getPreferredOutput(fullRetObj);
|
|
10168
|
+
|
|
10169
|
+
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line n/callback-return
|
|
10170
|
+
|
|
10171
|
+
callback(preferredOutput, type, fullRetObj);
|
|
10172
|
+
}
|
|
10173
|
+
};
|
|
10174
|
+
/**
|
|
10175
|
+
*
|
|
10176
|
+
* @param {string} expr
|
|
10177
|
+
* @param {JSONObject} val
|
|
10178
|
+
* @param {string} path
|
|
10179
|
+
* @param {PlainObject|GenericArray} parent
|
|
10180
|
+
* @param {string} parentPropName
|
|
10181
|
+
* @param {JSONPathCallback} callback
|
|
10182
|
+
* @param {boolean} hasArrExpr
|
|
10183
|
+
* @param {boolean} literalPriority
|
|
10184
|
+
* @returns {ReturnObject|ReturnObject[]}
|
|
10185
|
+
*/
|
|
10186
|
+
|
|
10187
|
+
|
|
10188
|
+
JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
|
|
10189
|
+
// No expr to follow? return path and value as the result of
|
|
10190
|
+
// this trace branch
|
|
10191
|
+
let retObj;
|
|
10192
|
+
|
|
10193
|
+
if (!expr.length) {
|
|
10194
|
+
retObj = {
|
|
10195
|
+
path,
|
|
10196
|
+
value: val,
|
|
10197
|
+
parent,
|
|
10198
|
+
parentProperty: parentPropName,
|
|
10199
|
+
hasArrExpr
|
|
10200
|
+
};
|
|
10201
|
+
|
|
10202
|
+
this._handleCallback(retObj, callback, 'value');
|
|
10203
|
+
|
|
10204
|
+
return retObj;
|
|
10205
|
+
}
|
|
10206
|
+
|
|
10207
|
+
const loc = expr[0],
|
|
10208
|
+
x = expr.slice(1); // We need to gather the return value of recursive trace calls in order to
|
|
10209
|
+
// do the parent sel computation.
|
|
10210
|
+
|
|
10211
|
+
const ret = [];
|
|
10212
|
+
/**
|
|
10213
|
+
*
|
|
10214
|
+
* @param {ReturnObject|ReturnObject[]} elems
|
|
10215
|
+
* @returns {void}
|
|
10216
|
+
*/
|
|
10217
|
+
|
|
10218
|
+
function addRet(elems) {
|
|
10219
|
+
if (Array.isArray(elems)) {
|
|
10220
|
+
// This was causing excessive stack size in Node (with or
|
|
10221
|
+
// without Babel) against our performance test:
|
|
10222
|
+
// `ret.push(...elems);`
|
|
10223
|
+
elems.forEach(t => {
|
|
10224
|
+
ret.push(t);
|
|
10225
|
+
});
|
|
10226
|
+
} else {
|
|
10227
|
+
ret.push(elems);
|
|
10228
|
+
}
|
|
10229
|
+
}
|
|
10230
|
+
|
|
10231
|
+
if ((typeof loc !== 'string' || literalPriority) && val && hasOwnProp.call(val, loc)) {
|
|
10232
|
+
// simple case--directly follow property
|
|
10233
|
+
addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr)); // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`
|
|
10234
|
+
} else if (loc === '*') {
|
|
10235
|
+
// all child properties
|
|
10236
|
+
this._walk(val, m => {
|
|
10237
|
+
addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
|
|
10238
|
+
});
|
|
10239
|
+
} else if (loc === '..') {
|
|
10240
|
+
// all descendent parent properties
|
|
10241
|
+
// Check remaining expression with val's immediate children
|
|
10242
|
+
addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
|
|
10243
|
+
|
|
10244
|
+
this._walk(val, m => {
|
|
10245
|
+
// We don't join m and x here because we only want parents,
|
|
10246
|
+
// not scalar values
|
|
10247
|
+
if (typeof val[m] === 'object') {
|
|
10248
|
+
// Keep going with recursive descent on val's
|
|
10249
|
+
// object children
|
|
10250
|
+
addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
|
|
10251
|
+
}
|
|
10252
|
+
}); // The parent sel computation is handled in the frame above using the
|
|
10253
|
+
// ancestor object of val
|
|
10254
|
+
|
|
10255
|
+
} else if (loc === '^') {
|
|
10256
|
+
// This is not a final endpoint, so we do not invoke the callback here
|
|
10257
|
+
this._hasParentSelector = true;
|
|
10258
|
+
return {
|
|
10259
|
+
path: path.slice(0, -1),
|
|
10260
|
+
expr: x,
|
|
10261
|
+
isParentSelector: true
|
|
10262
|
+
};
|
|
10263
|
+
} else if (loc === '~') {
|
|
10264
|
+
// property name
|
|
10265
|
+
retObj = {
|
|
10266
|
+
path: push(path, loc),
|
|
10267
|
+
value: parentPropName,
|
|
10268
|
+
parent,
|
|
10269
|
+
parentProperty: null
|
|
10270
|
+
};
|
|
10271
|
+
|
|
10272
|
+
this._handleCallback(retObj, callback, 'property');
|
|
10273
|
+
|
|
10274
|
+
return retObj;
|
|
10275
|
+
} else if (loc === '$') {
|
|
10276
|
+
// root only
|
|
10277
|
+
addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
|
|
10278
|
+
} else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
|
|
10279
|
+
// [start:end:step] Python slice syntax
|
|
10280
|
+
addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
|
|
10281
|
+
} else if (loc.indexOf('?(') === 0) {
|
|
10282
|
+
// [?(expr)] (filtering)
|
|
10283
|
+
if (this.currPreventEval) {
|
|
10284
|
+
throw new Error('Eval [?(expr)] prevented in JSONPath expression.');
|
|
10285
|
+
}
|
|
10286
|
+
|
|
10287
|
+
const safeLoc = loc.replace(/^\?\((.*?)\)$/u, '$1');
|
|
10288
|
+
|
|
10289
|
+
this._walk(val, m => {
|
|
10290
|
+
if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {
|
|
10291
|
+
addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
|
|
10292
|
+
}
|
|
10293
|
+
});
|
|
10294
|
+
} else if (loc[0] === '(') {
|
|
10295
|
+
// [(expr)] (dynamic property/index)
|
|
10296
|
+
if (this.currPreventEval) {
|
|
10297
|
+
throw new Error('Eval [(expr)] prevented in JSONPath expression.');
|
|
10298
|
+
} // As this will resolve to a property name (but we don't know it
|
|
10299
|
+
// yet), property and parent information is relative to the
|
|
10300
|
+
// parent of the property to which this expression will resolve
|
|
10301
|
+
|
|
10302
|
+
|
|
10303
|
+
addRet(this._trace(unshift(this._eval(loc, val, path[path.length - 1], path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));
|
|
10304
|
+
} else if (loc[0] === '@') {
|
|
10305
|
+
// value type: @boolean(), etc.
|
|
10306
|
+
let addType = false;
|
|
10307
|
+
const valueType = loc.slice(1, -2);
|
|
10308
|
+
|
|
10309
|
+
switch (valueType) {
|
|
10310
|
+
case 'scalar':
|
|
10311
|
+
if (!val || !['object', 'function'].includes(typeof val)) {
|
|
10312
|
+
addType = true;
|
|
10313
|
+
}
|
|
10314
|
+
|
|
10315
|
+
break;
|
|
10316
|
+
|
|
10317
|
+
case 'boolean':
|
|
10318
|
+
case 'string':
|
|
10319
|
+
case 'undefined':
|
|
10320
|
+
case 'function':
|
|
10321
|
+
// eslint-disable-next-line valid-typeof
|
|
10322
|
+
if (typeof val === valueType) {
|
|
10323
|
+
addType = true;
|
|
10324
|
+
}
|
|
10325
|
+
|
|
10326
|
+
break;
|
|
10327
|
+
|
|
10328
|
+
case 'integer':
|
|
10329
|
+
if (Number.isFinite(val) && !(val % 1)) {
|
|
10330
|
+
addType = true;
|
|
10331
|
+
}
|
|
10332
|
+
|
|
10333
|
+
break;
|
|
10334
|
+
|
|
10335
|
+
case 'number':
|
|
10336
|
+
if (Number.isFinite(val)) {
|
|
10337
|
+
addType = true;
|
|
10338
|
+
}
|
|
10339
|
+
|
|
10340
|
+
break;
|
|
10341
|
+
|
|
10342
|
+
case 'nonFinite':
|
|
10343
|
+
if (typeof val === 'number' && !Number.isFinite(val)) {
|
|
10344
|
+
addType = true;
|
|
10345
|
+
}
|
|
10346
|
+
|
|
10347
|
+
break;
|
|
10348
|
+
|
|
10349
|
+
case 'object':
|
|
10350
|
+
// eslint-disable-next-line valid-typeof
|
|
10351
|
+
if (val && typeof val === valueType) {
|
|
10352
|
+
addType = true;
|
|
10353
|
+
}
|
|
10354
|
+
|
|
10355
|
+
break;
|
|
10356
|
+
|
|
10357
|
+
case 'array':
|
|
10358
|
+
if (Array.isArray(val)) {
|
|
10359
|
+
addType = true;
|
|
10360
|
+
}
|
|
10361
|
+
|
|
10362
|
+
break;
|
|
10363
|
+
|
|
10364
|
+
case 'other':
|
|
10365
|
+
addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
|
|
10366
|
+
break;
|
|
10367
|
+
|
|
10368
|
+
case 'null':
|
|
10369
|
+
if (val === null) {
|
|
10370
|
+
addType = true;
|
|
10371
|
+
}
|
|
10372
|
+
|
|
10373
|
+
break;
|
|
10374
|
+
|
|
10375
|
+
/* c8 ignore next 2 */
|
|
10376
|
+
|
|
10377
|
+
default:
|
|
10378
|
+
throw new TypeError('Unknown value type ' + valueType);
|
|
10379
|
+
}
|
|
10380
|
+
|
|
10381
|
+
if (addType) {
|
|
10382
|
+
retObj = {
|
|
10383
|
+
path,
|
|
10384
|
+
value: val,
|
|
10385
|
+
parent,
|
|
10386
|
+
parentProperty: parentPropName
|
|
10387
|
+
};
|
|
10388
|
+
|
|
10389
|
+
this._handleCallback(retObj, callback, 'value');
|
|
10390
|
+
|
|
10391
|
+
return retObj;
|
|
10392
|
+
} // `-escaped property
|
|
10393
|
+
|
|
10394
|
+
} else if (loc[0] === '`' && val && hasOwnProp.call(val, loc.slice(1))) {
|
|
10395
|
+
const locProp = loc.slice(1);
|
|
10396
|
+
addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
|
|
10397
|
+
} else if (loc.includes(',')) {
|
|
10398
|
+
// [name1,name2,...]
|
|
10399
|
+
const parts = loc.split(',');
|
|
10400
|
+
|
|
10401
|
+
for (const part of parts) {
|
|
10402
|
+
addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
|
|
10403
|
+
} // simple case--directly follow property
|
|
10404
|
+
|
|
10405
|
+
} else if (!literalPriority && val && hasOwnProp.call(val, loc)) {
|
|
10406
|
+
addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
|
|
10407
|
+
} // We check the resulting values for parent selections. For parent
|
|
10408
|
+
// selections we discard the value object and continue the trace with the
|
|
10409
|
+
// current val object
|
|
10410
|
+
|
|
10411
|
+
|
|
10412
|
+
if (this._hasParentSelector) {
|
|
10413
|
+
for (let t = 0; t < ret.length; t++) {
|
|
10414
|
+
const rett = ret[t];
|
|
10415
|
+
|
|
10416
|
+
if (rett && rett.isParentSelector) {
|
|
10417
|
+
const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
|
|
10418
|
+
|
|
10419
|
+
if (Array.isArray(tmp)) {
|
|
10420
|
+
ret[t] = tmp[0];
|
|
10421
|
+
const tl = tmp.length;
|
|
10422
|
+
|
|
10423
|
+
for (let tt = 1; tt < tl; tt++) {
|
|
10424
|
+
t++;
|
|
10425
|
+
ret.splice(t, 0, tmp[tt]);
|
|
10426
|
+
}
|
|
10427
|
+
} else {
|
|
10428
|
+
ret[t] = tmp;
|
|
10429
|
+
}
|
|
10430
|
+
}
|
|
10431
|
+
}
|
|
10432
|
+
}
|
|
10433
|
+
|
|
10434
|
+
return ret;
|
|
10435
|
+
};
|
|
10436
|
+
|
|
10437
|
+
JSONPath.prototype._walk = function (val, f) {
|
|
10438
|
+
if (Array.isArray(val)) {
|
|
10439
|
+
const n = val.length;
|
|
10440
|
+
|
|
10441
|
+
for (let i = 0; i < n; i++) {
|
|
10442
|
+
f(i);
|
|
10443
|
+
}
|
|
10444
|
+
} else if (val && typeof val === 'object') {
|
|
10445
|
+
Object.keys(val).forEach(m => {
|
|
10446
|
+
f(m);
|
|
10447
|
+
});
|
|
10448
|
+
}
|
|
10449
|
+
};
|
|
10450
|
+
|
|
10451
|
+
JSONPath.prototype._slice = function (loc, expr, val, path, parent, parentPropName, callback) {
|
|
10452
|
+
if (!Array.isArray(val)) {
|
|
10453
|
+
return undefined;
|
|
10454
|
+
}
|
|
10455
|
+
|
|
10456
|
+
const len = val.length,
|
|
10457
|
+
parts = loc.split(':'),
|
|
10458
|
+
step = parts[2] && Number.parseInt(parts[2]) || 1;
|
|
10459
|
+
let start = parts[0] && Number.parseInt(parts[0]) || 0,
|
|
10460
|
+
end = parts[1] && Number.parseInt(parts[1]) || len;
|
|
10461
|
+
start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
|
|
10462
|
+
end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
|
|
10463
|
+
const ret = [];
|
|
10464
|
+
|
|
10465
|
+
for (let i = start; i < end; i += step) {
|
|
10466
|
+
const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true); // Should only be possible to be an array here since first part of
|
|
10467
|
+
// ``unshift(i, expr)` passed in above would not be empty, nor `~`,
|
|
10468
|
+
// nor begin with `@` (as could return objects)
|
|
10469
|
+
// This was causing excessive stack size in Node (with or
|
|
10470
|
+
// without Babel) against our performance test: `ret.push(...tmp);`
|
|
10471
|
+
|
|
10472
|
+
|
|
10473
|
+
tmp.forEach(t => {
|
|
10474
|
+
ret.push(t);
|
|
10475
|
+
});
|
|
10476
|
+
}
|
|
10477
|
+
|
|
10478
|
+
return ret;
|
|
10479
|
+
};
|
|
10480
|
+
|
|
10481
|
+
JSONPath.prototype._eval = function (code, _v, _vname, path, parent, parentPropName) {
|
|
10482
|
+
this.currSandbox._$_parentProperty = parentPropName;
|
|
10483
|
+
this.currSandbox._$_parent = parent;
|
|
10484
|
+
this.currSandbox._$_property = _vname;
|
|
10485
|
+
this.currSandbox._$_root = this.json;
|
|
10486
|
+
this.currSandbox._$_v = _v;
|
|
10487
|
+
const containsPath = code.includes('@path');
|
|
10488
|
+
|
|
10489
|
+
if (containsPath) {
|
|
10490
|
+
this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
|
|
10491
|
+
}
|
|
10492
|
+
|
|
10493
|
+
const scriptCacheKey = 'script:' + code;
|
|
10494
|
+
|
|
10495
|
+
if (!JSONPath.cache[scriptCacheKey]) {
|
|
10496
|
+
let script = code.replace(/@parentProperty/gu, '_$_parentProperty').replace(/@parent/gu, '_$_parent').replace(/@property/gu, '_$_property').replace(/@root/gu, '_$_root').replace(/@([.\s)[])/gu, '_$_v$1');
|
|
10497
|
+
|
|
10498
|
+
if (containsPath) {
|
|
10499
|
+
script = script.replace(/@path/gu, '_$_path');
|
|
10500
|
+
}
|
|
10501
|
+
|
|
10502
|
+
JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
|
|
10503
|
+
}
|
|
10504
|
+
|
|
10505
|
+
try {
|
|
10506
|
+
return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
|
|
10507
|
+
} catch (e) {
|
|
10508
|
+
throw new Error('jsonPath: ' + e.message + ': ' + code);
|
|
10509
|
+
}
|
|
10510
|
+
}; // PUBLIC CLASS PROPERTIES AND METHODS
|
|
10511
|
+
// Could store the cache object itself
|
|
10512
|
+
|
|
10513
|
+
|
|
10514
|
+
JSONPath.cache = {};
|
|
10515
|
+
/**
|
|
10516
|
+
* @param {string[]} pathArr Array to convert
|
|
10517
|
+
* @returns {string} The path string
|
|
10518
|
+
*/
|
|
10519
|
+
|
|
10520
|
+
JSONPath.toPathString = function (pathArr) {
|
|
10521
|
+
const x = pathArr,
|
|
10522
|
+
n = x.length;
|
|
10523
|
+
let p = '$';
|
|
10524
|
+
|
|
10525
|
+
for (let i = 1; i < n; i++) {
|
|
10526
|
+
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
10527
|
+
p += /^[0-9*]+$/u.test(x[i]) ? '[' + x[i] + ']' : "['" + x[i] + "']";
|
|
10528
|
+
}
|
|
10529
|
+
}
|
|
10530
|
+
|
|
10531
|
+
return p;
|
|
10532
|
+
};
|
|
10533
|
+
/**
|
|
10534
|
+
* @param {string} pointer JSON Path
|
|
10535
|
+
* @returns {string} JSON Pointer
|
|
10536
|
+
*/
|
|
10537
|
+
|
|
10538
|
+
|
|
10539
|
+
JSONPath.toPointer = function (pointer) {
|
|
10540
|
+
const x = pointer,
|
|
10541
|
+
n = x.length;
|
|
10542
|
+
let p = '';
|
|
10543
|
+
|
|
10544
|
+
for (let i = 1; i < n; i++) {
|
|
10545
|
+
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
10546
|
+
p += '/' + x[i].toString().replace(/~/gu, '~0').replace(/\//gu, '~1');
|
|
10547
|
+
}
|
|
10548
|
+
}
|
|
10549
|
+
|
|
10550
|
+
return p;
|
|
10551
|
+
};
|
|
10552
|
+
/**
|
|
10553
|
+
* @param {string} expr Expression to convert
|
|
10554
|
+
* @returns {string[]}
|
|
10555
|
+
*/
|
|
10556
|
+
|
|
10557
|
+
|
|
10558
|
+
JSONPath.toPathArray = function (expr) {
|
|
10559
|
+
const {
|
|
10560
|
+
cache
|
|
10561
|
+
} = JSONPath;
|
|
10562
|
+
|
|
10563
|
+
if (cache[expr]) {
|
|
10564
|
+
return cache[expr].concat();
|
|
10565
|
+
}
|
|
10566
|
+
|
|
10567
|
+
const subx = [];
|
|
10568
|
+
const normalized = expr // Properties
|
|
10569
|
+
.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ';$&;') // Parenthetical evaluations (filtering and otherwise), directly
|
|
10570
|
+
// within brackets or single quotes
|
|
10571
|
+
.replace(/[['](\??\(.*?\))[\]']/gu, function ($0, $1) {
|
|
10572
|
+
return '[#' + (subx.push($1) - 1) + ']';
|
|
10573
|
+
}) // Escape periods and tildes within properties
|
|
10574
|
+
.replace(/\[['"]([^'\]]*)['"]\]/gu, function ($0, prop) {
|
|
10575
|
+
return "['" + prop.replace(/\./gu, '%@%').replace(/~/gu, '%%@@%%') + "']";
|
|
10576
|
+
}) // Properties operator
|
|
10577
|
+
.replace(/~/gu, ';~;') // Split by property boundaries
|
|
10578
|
+
.replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ';') // Reinsert periods within properties
|
|
10579
|
+
.replace(/%@%/gu, '.') // Reinsert tildes within properties
|
|
10580
|
+
.replace(/%%@@%%/gu, '~') // Parent
|
|
10581
|
+
.replace(/(?:;)?(\^+)(?:;)?/gu, function ($0, ups) {
|
|
10582
|
+
return ';' + ups.split('').join(';') + ';';
|
|
10583
|
+
}) // Descendents
|
|
10584
|
+
.replace(/;;;|;;/gu, ';..;') // Remove trailing
|
|
10585
|
+
.replace(/;$|'?\]|'$/gu, '');
|
|
10586
|
+
const exprList = normalized.split(';').map(function (exp) {
|
|
10587
|
+
const match = exp.match(/#(\d+)/u);
|
|
10588
|
+
return !match || !match[1] ? exp : subx[match[1]];
|
|
10589
|
+
});
|
|
10590
|
+
cache[expr] = exprList;
|
|
10591
|
+
return cache[expr].concat();
|
|
10592
|
+
};
|
|
10593
|
+
|
|
10594
|
+
JSONPath.prototype.vm = vm;
|
|
10595
|
+
|
|
10596
|
+
/*!
|
|
10597
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
10598
|
+
* (c) 2017-2022 Joachim Wester
|
|
10599
|
+
* MIT licensed
|
|
10600
|
+
*/
|
|
10601
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
10602
|
+
var extendStatics = function (d, b) {
|
|
10603
|
+
extendStatics = Object.setPrototypeOf ||
|
|
10604
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10605
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
10606
|
+
return extendStatics(d, b);
|
|
10607
|
+
};
|
|
10608
|
+
return function (d, b) {
|
|
10609
|
+
extendStatics(d, b);
|
|
10610
|
+
function __() { this.constructor = d; }
|
|
10611
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10612
|
+
};
|
|
10613
|
+
})();
|
|
10614
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
10615
|
+
function hasOwnProperty$b(obj, key) {
|
|
10616
|
+
return _hasOwnProperty.call(obj, key);
|
|
10617
|
+
}
|
|
10618
|
+
function _objectKeys(obj) {
|
|
10619
|
+
if (Array.isArray(obj)) {
|
|
10620
|
+
var keys_1 = new Array(obj.length);
|
|
10621
|
+
for (var k = 0; k < keys_1.length; k++) {
|
|
10622
|
+
keys_1[k] = "" + k;
|
|
10623
|
+
}
|
|
10624
|
+
return keys_1;
|
|
10625
|
+
}
|
|
10626
|
+
if (Object.keys) {
|
|
10627
|
+
return Object.keys(obj);
|
|
10628
|
+
}
|
|
10629
|
+
var keys = [];
|
|
10630
|
+
for (var i in obj) {
|
|
10631
|
+
if (hasOwnProperty$b(obj, i)) {
|
|
10632
|
+
keys.push(i);
|
|
10633
|
+
}
|
|
10634
|
+
}
|
|
10635
|
+
return keys;
|
|
10636
|
+
}
|
|
10637
|
+
/**
|
|
10638
|
+
* Deeply clone the object.
|
|
10639
|
+
* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
|
|
10640
|
+
* @param {any} obj value to clone
|
|
10641
|
+
* @return {any} cloned obj
|
|
10642
|
+
*/
|
|
10643
|
+
function _deepClone(obj) {
|
|
10644
|
+
switch (typeof obj) {
|
|
10645
|
+
case "object":
|
|
10646
|
+
return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
|
|
10647
|
+
case "undefined":
|
|
10648
|
+
return null; //this is how JSON.stringify behaves for array items
|
|
10649
|
+
default:
|
|
10650
|
+
return obj; //no need to clone primitives
|
|
10651
|
+
}
|
|
10652
|
+
}
|
|
10653
|
+
//3x faster than cached /^\d+$/.test(str)
|
|
10654
|
+
function isInteger(str) {
|
|
10655
|
+
var i = 0;
|
|
10656
|
+
var len = str.length;
|
|
10657
|
+
var charCode;
|
|
10658
|
+
while (i < len) {
|
|
10659
|
+
charCode = str.charCodeAt(i);
|
|
10660
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
10661
|
+
i++;
|
|
10662
|
+
continue;
|
|
10663
|
+
}
|
|
10664
|
+
return false;
|
|
10665
|
+
}
|
|
10666
|
+
return true;
|
|
10667
|
+
}
|
|
10668
|
+
/**
|
|
10669
|
+
* Escapes a json pointer path
|
|
10670
|
+
* @param path The raw pointer
|
|
10671
|
+
* @return the Escaped path
|
|
10672
|
+
*/
|
|
10673
|
+
function escapePathComponent(path) {
|
|
10674
|
+
if (path.indexOf('/') === -1 && path.indexOf('~') === -1)
|
|
10675
|
+
return path;
|
|
10676
|
+
return path.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
10677
|
+
}
|
|
10678
|
+
/**
|
|
10679
|
+
* Unescapes a json pointer path
|
|
10680
|
+
* @param path The escaped pointer
|
|
10681
|
+
* @return The unescaped path
|
|
10682
|
+
*/
|
|
10683
|
+
function unescapePathComponent(path) {
|
|
10684
|
+
return path.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
10685
|
+
}
|
|
10686
|
+
/**
|
|
10687
|
+
* Recursively checks whether an object has any undefined values inside.
|
|
10688
|
+
*/
|
|
10689
|
+
function hasUndefined(obj) {
|
|
10690
|
+
if (obj === undefined) {
|
|
10691
|
+
return true;
|
|
10692
|
+
}
|
|
10693
|
+
if (obj) {
|
|
10694
|
+
if (Array.isArray(obj)) {
|
|
10695
|
+
for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
|
|
10696
|
+
if (hasUndefined(obj[i_1])) {
|
|
10697
|
+
return true;
|
|
10698
|
+
}
|
|
10699
|
+
}
|
|
10700
|
+
}
|
|
10701
|
+
else if (typeof obj === "object") {
|
|
10702
|
+
var objKeys = _objectKeys(obj);
|
|
10703
|
+
var objKeysLength = objKeys.length;
|
|
10704
|
+
for (var i = 0; i < objKeysLength; i++) {
|
|
10705
|
+
if (hasUndefined(obj[objKeys[i]])) {
|
|
10706
|
+
return true;
|
|
10707
|
+
}
|
|
10708
|
+
}
|
|
10709
|
+
}
|
|
10710
|
+
}
|
|
10711
|
+
return false;
|
|
10712
|
+
}
|
|
10713
|
+
function patchErrorMessageFormatter(message, args) {
|
|
10714
|
+
var messageParts = [message];
|
|
10715
|
+
for (var key in args) {
|
|
10716
|
+
var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
|
|
10717
|
+
if (typeof value !== 'undefined') {
|
|
10718
|
+
messageParts.push(key + ": " + value);
|
|
10719
|
+
}
|
|
10720
|
+
}
|
|
10721
|
+
return messageParts.join('\n');
|
|
10722
|
+
}
|
|
10723
|
+
var PatchError = /** @class */ (function (_super) {
|
|
10724
|
+
__extends(PatchError, _super);
|
|
10725
|
+
function PatchError(message, name, index, operation, tree) {
|
|
10726
|
+
var _newTarget = this.constructor;
|
|
10727
|
+
var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;
|
|
10728
|
+
_this.name = name;
|
|
10729
|
+
_this.index = index;
|
|
10730
|
+
_this.operation = operation;
|
|
10731
|
+
_this.tree = tree;
|
|
10732
|
+
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359
|
|
10733
|
+
_this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });
|
|
10734
|
+
return _this;
|
|
10735
|
+
}
|
|
10736
|
+
return PatchError;
|
|
10737
|
+
}(Error));
|
|
10738
|
+
|
|
10739
|
+
var JsonPatchError = PatchError;
|
|
10740
|
+
var deepClone = _deepClone;
|
|
10741
|
+
/* We use a Javascript hash to store each
|
|
10742
|
+
function. Each hash entry (property) uses
|
|
10743
|
+
the operation identifiers specified in rfc6902.
|
|
10744
|
+
In this way, we can map each patch operation
|
|
10745
|
+
to its dedicated function in efficient way.
|
|
10746
|
+
*/
|
|
10747
|
+
/* The operations applicable to an object */
|
|
10748
|
+
var objOps = {
|
|
10749
|
+
add: function (obj, key, document) {
|
|
10750
|
+
obj[key] = this.value;
|
|
10751
|
+
return { newDocument: document };
|
|
10752
|
+
},
|
|
10753
|
+
remove: function (obj, key, document) {
|
|
10754
|
+
var removed = obj[key];
|
|
10755
|
+
delete obj[key];
|
|
10756
|
+
return { newDocument: document, removed: removed };
|
|
10757
|
+
},
|
|
10758
|
+
replace: function (obj, key, document) {
|
|
10759
|
+
var removed = obj[key];
|
|
10760
|
+
obj[key] = this.value;
|
|
10761
|
+
return { newDocument: document, removed: removed };
|
|
10762
|
+
},
|
|
10763
|
+
move: function (obj, key, document) {
|
|
10764
|
+
/* in case move target overwrites an existing value,
|
|
10765
|
+
return the removed value, this can be taxing performance-wise,
|
|
10766
|
+
and is potentially unneeded */
|
|
10767
|
+
var removed = getValueByPointer(document, this.path);
|
|
10768
|
+
if (removed) {
|
|
10769
|
+
removed = _deepClone(removed);
|
|
10770
|
+
}
|
|
10771
|
+
var originalValue = applyOperation(document, { op: "remove", path: this.from }).removed;
|
|
10772
|
+
applyOperation(document, { op: "add", path: this.path, value: originalValue });
|
|
10773
|
+
return { newDocument: document, removed: removed };
|
|
10774
|
+
},
|
|
10775
|
+
copy: function (obj, key, document) {
|
|
10776
|
+
var valueToCopy = getValueByPointer(document, this.from);
|
|
10777
|
+
// enforce copy by value so further operations don't affect source (see issue #177)
|
|
10778
|
+
applyOperation(document, { op: "add", path: this.path, value: _deepClone(valueToCopy) });
|
|
10779
|
+
return { newDocument: document };
|
|
10780
|
+
},
|
|
10781
|
+
test: function (obj, key, document) {
|
|
10782
|
+
return { newDocument: document, test: _areEquals(obj[key], this.value) };
|
|
10783
|
+
},
|
|
10784
|
+
_get: function (obj, key, document) {
|
|
10785
|
+
this.value = obj[key];
|
|
10786
|
+
return { newDocument: document };
|
|
10787
|
+
}
|
|
10788
|
+
};
|
|
10789
|
+
/* The operations applicable to an array. Many are the same as for the object */
|
|
10790
|
+
var arrOps = {
|
|
10791
|
+
add: function (arr, i, document) {
|
|
10792
|
+
if (isInteger(i)) {
|
|
10793
|
+
arr.splice(i, 0, this.value);
|
|
10794
|
+
}
|
|
10795
|
+
else { // array props
|
|
10796
|
+
arr[i] = this.value;
|
|
10797
|
+
}
|
|
10798
|
+
// this may be needed when using '-' in an array
|
|
10799
|
+
return { newDocument: document, index: i };
|
|
10800
|
+
},
|
|
10801
|
+
remove: function (arr, i, document) {
|
|
10802
|
+
var removedList = arr.splice(i, 1);
|
|
10803
|
+
return { newDocument: document, removed: removedList[0] };
|
|
10804
|
+
},
|
|
10805
|
+
replace: function (arr, i, document) {
|
|
10806
|
+
var removed = arr[i];
|
|
10807
|
+
arr[i] = this.value;
|
|
10808
|
+
return { newDocument: document, removed: removed };
|
|
10809
|
+
},
|
|
10810
|
+
move: objOps.move,
|
|
10811
|
+
copy: objOps.copy,
|
|
10812
|
+
test: objOps.test,
|
|
10813
|
+
_get: objOps._get
|
|
10814
|
+
};
|
|
10815
|
+
/**
|
|
10816
|
+
* Retrieves a value from a JSON document by a JSON pointer.
|
|
10817
|
+
* Returns the value.
|
|
10818
|
+
*
|
|
10819
|
+
* @param document The document to get the value from
|
|
10820
|
+
* @param pointer an escaped JSON pointer
|
|
10821
|
+
* @return The retrieved value
|
|
10822
|
+
*/
|
|
10823
|
+
function getValueByPointer(document, pointer) {
|
|
10824
|
+
if (pointer == '') {
|
|
10825
|
+
return document;
|
|
10826
|
+
}
|
|
10827
|
+
var getOriginalDestination = { op: "_get", path: pointer };
|
|
10828
|
+
applyOperation(document, getOriginalDestination);
|
|
10829
|
+
return getOriginalDestination.value;
|
|
10830
|
+
}
|
|
10831
|
+
/**
|
|
10832
|
+
* Apply a single JSON Patch Operation on a JSON document.
|
|
10833
|
+
* Returns the {newDocument, result} of the operation.
|
|
10834
|
+
* It modifies the `document` and `operation` objects - it gets the values by reference.
|
|
10835
|
+
* If you would like to avoid touching your values, clone them:
|
|
10836
|
+
* `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.
|
|
10837
|
+
*
|
|
10838
|
+
* @param document The document to patch
|
|
10839
|
+
* @param operation The operation to apply
|
|
10840
|
+
* @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
|
|
10841
|
+
* @param mutateDocument Whether to mutate the original document or clone it before applying
|
|
10842
|
+
* @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
|
|
10843
|
+
* @return `{newDocument, result}` after the operation
|
|
10844
|
+
*/
|
|
10845
|
+
function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
|
|
10846
|
+
if (validateOperation === void 0) { validateOperation = false; }
|
|
10847
|
+
if (mutateDocument === void 0) { mutateDocument = true; }
|
|
10848
|
+
if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
|
|
10849
|
+
if (index === void 0) { index = 0; }
|
|
10850
|
+
if (validateOperation) {
|
|
10851
|
+
if (typeof validateOperation == 'function') {
|
|
10852
|
+
validateOperation(operation, 0, document, operation.path);
|
|
10853
|
+
}
|
|
10854
|
+
else {
|
|
10855
|
+
validator$1(operation, 0);
|
|
10856
|
+
}
|
|
10857
|
+
}
|
|
10858
|
+
/* ROOT OPERATIONS */
|
|
10859
|
+
if (operation.path === "") {
|
|
10860
|
+
var returnValue = { newDocument: document };
|
|
10861
|
+
if (operation.op === 'add') {
|
|
10862
|
+
returnValue.newDocument = operation.value;
|
|
10863
|
+
return returnValue;
|
|
10864
|
+
}
|
|
10865
|
+
else if (operation.op === 'replace') {
|
|
10866
|
+
returnValue.newDocument = operation.value;
|
|
10867
|
+
returnValue.removed = document; //document we removed
|
|
10868
|
+
return returnValue;
|
|
10869
|
+
}
|
|
10870
|
+
else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root
|
|
10871
|
+
returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field
|
|
10872
|
+
if (operation.op === 'move') { // report removed item
|
|
10873
|
+
returnValue.removed = document;
|
|
10874
|
+
}
|
|
10875
|
+
return returnValue;
|
|
10876
|
+
}
|
|
10877
|
+
else if (operation.op === 'test') {
|
|
10878
|
+
returnValue.test = _areEquals(document, operation.value);
|
|
10879
|
+
if (returnValue.test === false) {
|
|
10880
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10881
|
+
}
|
|
10882
|
+
returnValue.newDocument = document;
|
|
10883
|
+
return returnValue;
|
|
10884
|
+
}
|
|
10885
|
+
else if (operation.op === 'remove') { // a remove on root
|
|
10886
|
+
returnValue.removed = document;
|
|
10887
|
+
returnValue.newDocument = null;
|
|
10888
|
+
return returnValue;
|
|
10889
|
+
}
|
|
10890
|
+
else if (operation.op === '_get') {
|
|
10891
|
+
operation.value = document;
|
|
10892
|
+
return returnValue;
|
|
10893
|
+
}
|
|
10894
|
+
else { /* bad operation */
|
|
10895
|
+
if (validateOperation) {
|
|
10896
|
+
throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
|
|
10897
|
+
}
|
|
10898
|
+
else {
|
|
10899
|
+
return returnValue;
|
|
10900
|
+
}
|
|
10901
|
+
}
|
|
10902
|
+
} /* END ROOT OPERATIONS */
|
|
10903
|
+
else {
|
|
10904
|
+
if (!mutateDocument) {
|
|
10905
|
+
document = _deepClone(document);
|
|
10906
|
+
}
|
|
10907
|
+
var path = operation.path || "";
|
|
10908
|
+
var keys = path.split('/');
|
|
10909
|
+
var obj = document;
|
|
10910
|
+
var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift
|
|
10911
|
+
var len = keys.length;
|
|
10912
|
+
var existingPathFragment = undefined;
|
|
10913
|
+
var key = void 0;
|
|
10914
|
+
var validateFunction = void 0;
|
|
10915
|
+
if (typeof validateOperation == 'function') {
|
|
10916
|
+
validateFunction = validateOperation;
|
|
10917
|
+
}
|
|
10918
|
+
else {
|
|
10919
|
+
validateFunction = validator$1;
|
|
10920
|
+
}
|
|
10921
|
+
while (true) {
|
|
10922
|
+
key = keys[t];
|
|
10923
|
+
if (key && key.indexOf('~') != -1) {
|
|
10924
|
+
key = unescapePathComponent(key);
|
|
10925
|
+
}
|
|
10926
|
+
if (banPrototypeModifications &&
|
|
10927
|
+
(key == '__proto__' ||
|
|
10928
|
+
(key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {
|
|
10929
|
+
throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
|
|
10930
|
+
}
|
|
10931
|
+
if (validateOperation) {
|
|
10932
|
+
if (existingPathFragment === undefined) {
|
|
10933
|
+
if (obj[key] === undefined) {
|
|
10934
|
+
existingPathFragment = keys.slice(0, t).join('/');
|
|
10935
|
+
}
|
|
10936
|
+
else if (t == len - 1) {
|
|
10937
|
+
existingPathFragment = operation.path;
|
|
10938
|
+
}
|
|
10939
|
+
if (existingPathFragment !== undefined) {
|
|
10940
|
+
validateFunction(operation, 0, document, existingPathFragment);
|
|
10941
|
+
}
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
t++;
|
|
10945
|
+
if (Array.isArray(obj)) {
|
|
10946
|
+
if (key === '-') {
|
|
10947
|
+
key = obj.length;
|
|
10948
|
+
}
|
|
10949
|
+
else {
|
|
10950
|
+
if (validateOperation && !isInteger(key)) {
|
|
10951
|
+
throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document);
|
|
10952
|
+
} // only parse key when it's an integer for `arr.prop` to work
|
|
10953
|
+
else if (isInteger(key)) {
|
|
10954
|
+
key = ~~key;
|
|
10955
|
+
}
|
|
10956
|
+
}
|
|
10957
|
+
if (t >= len) {
|
|
10958
|
+
if (validateOperation && operation.op === "add" && key > obj.length) {
|
|
10959
|
+
throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document);
|
|
10960
|
+
}
|
|
10961
|
+
var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
10962
|
+
if (returnValue.test === false) {
|
|
10963
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10964
|
+
}
|
|
10965
|
+
return returnValue;
|
|
10966
|
+
}
|
|
10967
|
+
}
|
|
10968
|
+
else {
|
|
10969
|
+
if (t >= len) {
|
|
10970
|
+
var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
10971
|
+
if (returnValue.test === false) {
|
|
10972
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10973
|
+
}
|
|
10974
|
+
return returnValue;
|
|
10975
|
+
}
|
|
10976
|
+
}
|
|
10977
|
+
obj = obj[key];
|
|
10978
|
+
// If we have more keys in the path, but the next value isn't a non-null object,
|
|
10979
|
+
// throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
|
|
10980
|
+
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
|
|
10981
|
+
throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
10982
|
+
}
|
|
10983
|
+
}
|
|
10984
|
+
}
|
|
10985
|
+
}
|
|
10986
|
+
/**
|
|
10987
|
+
* Apply a full JSON Patch array on a JSON document.
|
|
10988
|
+
* Returns the {newDocument, result} of the patch.
|
|
10989
|
+
* It modifies the `document` object and `patch` - it gets the values by reference.
|
|
10990
|
+
* If you would like to avoid touching your values, clone them:
|
|
10991
|
+
* `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.
|
|
10992
|
+
*
|
|
10993
|
+
* @param document The document to patch
|
|
10994
|
+
* @param patch The patch to apply
|
|
10995
|
+
* @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
|
|
10996
|
+
* @param mutateDocument Whether to mutate the original document or clone it before applying
|
|
10997
|
+
* @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
|
|
10998
|
+
* @return An array of `{newDocument, result}` after the patch
|
|
10999
|
+
*/
|
|
11000
|
+
function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {
|
|
11001
|
+
if (mutateDocument === void 0) { mutateDocument = true; }
|
|
11002
|
+
if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
|
|
11003
|
+
if (validateOperation) {
|
|
11004
|
+
if (!Array.isArray(patch)) {
|
|
11005
|
+
throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
|
|
11006
|
+
}
|
|
11007
|
+
}
|
|
11008
|
+
if (!mutateDocument) {
|
|
11009
|
+
document = _deepClone(document);
|
|
11010
|
+
}
|
|
11011
|
+
var results = new Array(patch.length);
|
|
11012
|
+
for (var i = 0, length_1 = patch.length; i < length_1; i++) {
|
|
11013
|
+
// we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`
|
|
11014
|
+
results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
|
|
11015
|
+
document = results[i].newDocument; // in case root was replaced
|
|
11016
|
+
}
|
|
11017
|
+
results.newDocument = document;
|
|
11018
|
+
return results;
|
|
11019
|
+
}
|
|
11020
|
+
/**
|
|
11021
|
+
* Apply a single JSON Patch Operation on a JSON document.
|
|
11022
|
+
* Returns the updated document.
|
|
11023
|
+
* Suitable as a reducer.
|
|
11024
|
+
*
|
|
11025
|
+
* @param document The document to patch
|
|
11026
|
+
* @param operation The operation to apply
|
|
11027
|
+
* @return The updated document
|
|
11028
|
+
*/
|
|
11029
|
+
function applyReducer(document, operation, index) {
|
|
11030
|
+
var operationResult = applyOperation(document, operation);
|
|
11031
|
+
if (operationResult.test === false) { // failed test
|
|
11032
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
11033
|
+
}
|
|
11034
|
+
return operationResult.newDocument;
|
|
11035
|
+
}
|
|
11036
|
+
/**
|
|
11037
|
+
* Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
|
|
11038
|
+
* @param {object} operation - operation object (patch)
|
|
11039
|
+
* @param {number} index - index of operation in the sequence
|
|
11040
|
+
* @param {object} [document] - object where the operation is supposed to be applied
|
|
11041
|
+
* @param {string} [existingPathFragment] - comes along with `document`
|
|
11042
|
+
*/
|
|
11043
|
+
function validator$1(operation, index, document, existingPathFragment) {
|
|
11044
|
+
if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {
|
|
11045
|
+
throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);
|
|
11046
|
+
}
|
|
11047
|
+
else if (!objOps[operation.op]) {
|
|
11048
|
+
throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
|
|
11049
|
+
}
|
|
11050
|
+
else if (typeof operation.path !== 'string') {
|
|
11051
|
+
throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);
|
|
11052
|
+
}
|
|
11053
|
+
else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {
|
|
11054
|
+
// paths that aren't empty string should start with "/"
|
|
11055
|
+
throw new JsonPatchError('Operation `path` property must start with "/"', 'OPERATION_PATH_INVALID', index, operation, document);
|
|
11056
|
+
}
|
|
11057
|
+
else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {
|
|
11058
|
+
throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);
|
|
11059
|
+
}
|
|
11060
|
+
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {
|
|
11061
|
+
throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);
|
|
11062
|
+
}
|
|
11063
|
+
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {
|
|
11064
|
+
throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);
|
|
11065
|
+
}
|
|
11066
|
+
else if (document) {
|
|
11067
|
+
if (operation.op == "add") {
|
|
11068
|
+
var pathLen = operation.path.split("/").length;
|
|
11069
|
+
var existingPathLen = existingPathFragment.split("/").length;
|
|
11070
|
+
if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
|
|
11071
|
+
throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);
|
|
11072
|
+
}
|
|
11073
|
+
}
|
|
11074
|
+
else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {
|
|
11075
|
+
if (operation.path !== existingPathFragment) {
|
|
11076
|
+
throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
11077
|
+
}
|
|
11078
|
+
}
|
|
11079
|
+
else if (operation.op === 'move' || operation.op === 'copy') {
|
|
11080
|
+
var existingValue = { op: "_get", path: operation.from, value: undefined };
|
|
11081
|
+
var error = validate([existingValue], document);
|
|
11082
|
+
if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {
|
|
11083
|
+
throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);
|
|
11084
|
+
}
|
|
11085
|
+
}
|
|
11086
|
+
}
|
|
11087
|
+
}
|
|
11088
|
+
/**
|
|
11089
|
+
* Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.
|
|
11090
|
+
* If error is encountered, returns a JsonPatchError object
|
|
11091
|
+
* @param sequence
|
|
11092
|
+
* @param document
|
|
11093
|
+
* @returns {JsonPatchError|undefined}
|
|
11094
|
+
*/
|
|
11095
|
+
function validate(sequence, document, externalValidator) {
|
|
11096
|
+
try {
|
|
11097
|
+
if (!Array.isArray(sequence)) {
|
|
11098
|
+
throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
|
|
11099
|
+
}
|
|
11100
|
+
if (document) {
|
|
11101
|
+
//clone document and sequence so that we can safely try applying operations
|
|
11102
|
+
applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);
|
|
11103
|
+
}
|
|
11104
|
+
else {
|
|
11105
|
+
externalValidator = externalValidator || validator$1;
|
|
11106
|
+
for (var i = 0; i < sequence.length; i++) {
|
|
11107
|
+
externalValidator(sequence[i], i, document, undefined);
|
|
11108
|
+
}
|
|
11109
|
+
}
|
|
11110
|
+
}
|
|
11111
|
+
catch (e) {
|
|
11112
|
+
if (e instanceof JsonPatchError) {
|
|
11113
|
+
return e;
|
|
11114
|
+
}
|
|
11115
|
+
else {
|
|
11116
|
+
throw e;
|
|
11117
|
+
}
|
|
11118
|
+
}
|
|
11119
|
+
}
|
|
11120
|
+
// based on https://github.com/epoberezkin/fast-deep-equal
|
|
11121
|
+
// MIT License
|
|
11122
|
+
// Copyright (c) 2017 Evgeny Poberezkin
|
|
11123
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11124
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
11125
|
+
// in the Software without restriction, including without limitation the rights
|
|
11126
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11127
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
11128
|
+
// furnished to do so, subject to the following conditions:
|
|
11129
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
11130
|
+
// copies or substantial portions of the Software.
|
|
11131
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11132
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11133
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
11134
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
11135
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
11136
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
11137
|
+
// SOFTWARE.
|
|
11138
|
+
function _areEquals(a, b) {
|
|
11139
|
+
if (a === b)
|
|
11140
|
+
return true;
|
|
11141
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
11142
|
+
var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;
|
|
11143
|
+
if (arrA && arrB) {
|
|
11144
|
+
length = a.length;
|
|
11145
|
+
if (length != b.length)
|
|
11146
|
+
return false;
|
|
11147
|
+
for (i = length; i-- !== 0;)
|
|
11148
|
+
if (!_areEquals(a[i], b[i]))
|
|
11149
|
+
return false;
|
|
11150
|
+
return true;
|
|
11151
|
+
}
|
|
11152
|
+
if (arrA != arrB)
|
|
11153
|
+
return false;
|
|
11154
|
+
var keys = Object.keys(a);
|
|
11155
|
+
length = keys.length;
|
|
11156
|
+
if (length !== Object.keys(b).length)
|
|
11157
|
+
return false;
|
|
11158
|
+
for (i = length; i-- !== 0;)
|
|
11159
|
+
if (!b.hasOwnProperty(keys[i]))
|
|
11160
|
+
return false;
|
|
11161
|
+
for (i = length; i-- !== 0;) {
|
|
11162
|
+
key = keys[i];
|
|
11163
|
+
if (!_areEquals(a[key], b[key]))
|
|
11164
|
+
return false;
|
|
11165
|
+
}
|
|
11166
|
+
return true;
|
|
11167
|
+
}
|
|
11168
|
+
return a !== a && b !== b;
|
|
11169
|
+
}
|
|
11170
|
+
|
|
11171
|
+
var core = /*#__PURE__*/Object.freeze({
|
|
11172
|
+
__proto__: null,
|
|
11173
|
+
JsonPatchError: JsonPatchError,
|
|
11174
|
+
_areEquals: _areEquals,
|
|
11175
|
+
applyOperation: applyOperation,
|
|
11176
|
+
applyPatch: applyPatch,
|
|
11177
|
+
applyReducer: applyReducer,
|
|
11178
|
+
deepClone: deepClone,
|
|
11179
|
+
getValueByPointer: getValueByPointer,
|
|
11180
|
+
validate: validate,
|
|
11181
|
+
validator: validator$1
|
|
11182
|
+
});
|
|
9861
11183
|
|
|
9862
|
-
|
|
9863
|
-
|
|
11184
|
+
/*!
|
|
11185
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
11186
|
+
* (c) 2017-2021 Joachim Wester
|
|
11187
|
+
* MIT license
|
|
11188
|
+
*/
|
|
11189
|
+
var beforeDict = new WeakMap();
|
|
11190
|
+
var Mirror = /** @class */ (function () {
|
|
11191
|
+
function Mirror(obj) {
|
|
11192
|
+
this.observers = new Map();
|
|
11193
|
+
this.obj = obj;
|
|
11194
|
+
}
|
|
11195
|
+
return Mirror;
|
|
11196
|
+
}());
|
|
11197
|
+
var ObserverInfo = /** @class */ (function () {
|
|
11198
|
+
function ObserverInfo(callback, observer) {
|
|
11199
|
+
this.callback = callback;
|
|
11200
|
+
this.observer = observer;
|
|
11201
|
+
}
|
|
11202
|
+
return ObserverInfo;
|
|
11203
|
+
}());
|
|
11204
|
+
function getMirror(obj) {
|
|
11205
|
+
return beforeDict.get(obj);
|
|
11206
|
+
}
|
|
11207
|
+
function getObserverFromMirror(mirror, callback) {
|
|
11208
|
+
return mirror.observers.get(callback);
|
|
11209
|
+
}
|
|
11210
|
+
function removeObserverFromMirror(mirror, observer) {
|
|
11211
|
+
mirror.observers.delete(observer.callback);
|
|
11212
|
+
}
|
|
11213
|
+
/**
|
|
11214
|
+
* Detach an observer from an object
|
|
11215
|
+
*/
|
|
11216
|
+
function unobserve(root, observer) {
|
|
11217
|
+
observer.unobserve();
|
|
11218
|
+
}
|
|
11219
|
+
/**
|
|
11220
|
+
* Observes changes made to an object, which can then be retrieved using generate
|
|
11221
|
+
*/
|
|
11222
|
+
function observe(obj, callback) {
|
|
11223
|
+
var patches = [];
|
|
11224
|
+
var observer;
|
|
11225
|
+
var mirror = getMirror(obj);
|
|
11226
|
+
if (!mirror) {
|
|
11227
|
+
mirror = new Mirror(obj);
|
|
11228
|
+
beforeDict.set(obj, mirror);
|
|
11229
|
+
}
|
|
11230
|
+
else {
|
|
11231
|
+
var observerInfo = getObserverFromMirror(mirror, callback);
|
|
11232
|
+
observer = observerInfo && observerInfo.observer;
|
|
11233
|
+
}
|
|
11234
|
+
if (observer) {
|
|
11235
|
+
return observer;
|
|
11236
|
+
}
|
|
11237
|
+
observer = {};
|
|
11238
|
+
mirror.value = _deepClone(obj);
|
|
11239
|
+
if (callback) {
|
|
11240
|
+
observer.callback = callback;
|
|
11241
|
+
observer.next = null;
|
|
11242
|
+
var dirtyCheck = function () {
|
|
11243
|
+
generate(observer);
|
|
11244
|
+
};
|
|
11245
|
+
var fastCheck = function () {
|
|
11246
|
+
clearTimeout(observer.next);
|
|
11247
|
+
observer.next = setTimeout(dirtyCheck);
|
|
11248
|
+
};
|
|
11249
|
+
if (typeof window !== 'undefined') { //not Node
|
|
11250
|
+
window.addEventListener('mouseup', fastCheck);
|
|
11251
|
+
window.addEventListener('keyup', fastCheck);
|
|
11252
|
+
window.addEventListener('mousedown', fastCheck);
|
|
11253
|
+
window.addEventListener('keydown', fastCheck);
|
|
11254
|
+
window.addEventListener('change', fastCheck);
|
|
11255
|
+
}
|
|
11256
|
+
}
|
|
11257
|
+
observer.patches = patches;
|
|
11258
|
+
observer.object = obj;
|
|
11259
|
+
observer.unobserve = function () {
|
|
11260
|
+
generate(observer);
|
|
11261
|
+
clearTimeout(observer.next);
|
|
11262
|
+
removeObserverFromMirror(mirror, observer);
|
|
11263
|
+
if (typeof window !== 'undefined') {
|
|
11264
|
+
window.removeEventListener('mouseup', fastCheck);
|
|
11265
|
+
window.removeEventListener('keyup', fastCheck);
|
|
11266
|
+
window.removeEventListener('mousedown', fastCheck);
|
|
11267
|
+
window.removeEventListener('keydown', fastCheck);
|
|
11268
|
+
window.removeEventListener('change', fastCheck);
|
|
11269
|
+
}
|
|
11270
|
+
};
|
|
11271
|
+
mirror.observers.set(callback, new ObserverInfo(callback, observer));
|
|
11272
|
+
return observer;
|
|
11273
|
+
}
|
|
11274
|
+
/**
|
|
11275
|
+
* Generate an array of patches from an observer
|
|
11276
|
+
*/
|
|
11277
|
+
function generate(observer, invertible) {
|
|
11278
|
+
if (invertible === void 0) { invertible = false; }
|
|
11279
|
+
var mirror = beforeDict.get(observer.object);
|
|
11280
|
+
_generate(mirror.value, observer.object, observer.patches, "", invertible);
|
|
11281
|
+
if (observer.patches.length) {
|
|
11282
|
+
applyPatch(mirror.value, observer.patches);
|
|
11283
|
+
}
|
|
11284
|
+
var temp = observer.patches;
|
|
11285
|
+
if (temp.length > 0) {
|
|
11286
|
+
observer.patches = [];
|
|
11287
|
+
if (observer.callback) {
|
|
11288
|
+
observer.callback(temp);
|
|
11289
|
+
}
|
|
11290
|
+
}
|
|
11291
|
+
return temp;
|
|
11292
|
+
}
|
|
11293
|
+
// Dirty check if obj is different from mirror, generate patches and update mirror
|
|
11294
|
+
function _generate(mirror, obj, patches, path, invertible) {
|
|
11295
|
+
if (obj === mirror) {
|
|
11296
|
+
return;
|
|
11297
|
+
}
|
|
11298
|
+
if (typeof obj.toJSON === "function") {
|
|
11299
|
+
obj = obj.toJSON();
|
|
11300
|
+
}
|
|
11301
|
+
var newKeys = _objectKeys(obj);
|
|
11302
|
+
var oldKeys = _objectKeys(mirror);
|
|
11303
|
+
var deleted = false;
|
|
11304
|
+
//if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
|
|
11305
|
+
for (var t = oldKeys.length - 1; t >= 0; t--) {
|
|
11306
|
+
var key = oldKeys[t];
|
|
11307
|
+
var oldVal = mirror[key];
|
|
11308
|
+
if (hasOwnProperty$b(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
|
|
11309
|
+
var newVal = obj[key];
|
|
11310
|
+
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
|
|
11311
|
+
_generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible);
|
|
11312
|
+
}
|
|
11313
|
+
else {
|
|
11314
|
+
if (oldVal !== newVal) {
|
|
11315
|
+
if (invertible) {
|
|
11316
|
+
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
11317
|
+
}
|
|
11318
|
+
patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: _deepClone(newVal) });
|
|
11319
|
+
}
|
|
11320
|
+
}
|
|
11321
|
+
}
|
|
11322
|
+
else if (Array.isArray(mirror) === Array.isArray(obj)) {
|
|
11323
|
+
if (invertible) {
|
|
11324
|
+
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
11325
|
+
}
|
|
11326
|
+
patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) });
|
|
11327
|
+
deleted = true; // property has been deleted
|
|
11328
|
+
}
|
|
11329
|
+
else {
|
|
11330
|
+
if (invertible) {
|
|
11331
|
+
patches.push({ op: "test", path: path, value: mirror });
|
|
11332
|
+
}
|
|
11333
|
+
patches.push({ op: "replace", path: path, value: obj });
|
|
11334
|
+
}
|
|
11335
|
+
}
|
|
11336
|
+
if (!deleted && newKeys.length == oldKeys.length) {
|
|
11337
|
+
return;
|
|
11338
|
+
}
|
|
11339
|
+
for (var t = 0; t < newKeys.length; t++) {
|
|
11340
|
+
var key = newKeys[t];
|
|
11341
|
+
if (!hasOwnProperty$b(mirror, key) && obj[key] !== undefined) {
|
|
11342
|
+
patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: _deepClone(obj[key]) });
|
|
11343
|
+
}
|
|
11344
|
+
}
|
|
11345
|
+
}
|
|
11346
|
+
/**
|
|
11347
|
+
* Create an array of patches from the differences in two objects
|
|
11348
|
+
*/
|
|
11349
|
+
function compare(tree1, tree2, invertible) {
|
|
11350
|
+
if (invertible === void 0) { invertible = false; }
|
|
11351
|
+
var patches = [];
|
|
11352
|
+
_generate(tree1, tree2, patches, '', invertible);
|
|
11353
|
+
return patches;
|
|
11354
|
+
}
|
|
11355
|
+
|
|
11356
|
+
var duplex = /*#__PURE__*/Object.freeze({
|
|
11357
|
+
__proto__: null,
|
|
11358
|
+
compare: compare,
|
|
11359
|
+
generate: generate,
|
|
11360
|
+
observe: observe,
|
|
11361
|
+
unobserve: unobserve
|
|
11362
|
+
});
|
|
9864
11363
|
|
|
9865
|
-
|
|
11364
|
+
Object.assign({}, core, duplex, {
|
|
11365
|
+
JsonPatchError: PatchError,
|
|
11366
|
+
deepClone: _deepClone,
|
|
11367
|
+
escapePathComponent,
|
|
11368
|
+
unescapePathComponent
|
|
11369
|
+
});
|
|
9866
11370
|
|
|
9867
11371
|
toast.configure({
|
|
9868
11372
|
autoClose: 3000,
|
|
@@ -10261,7 +11765,83 @@ var getUrlWithSearchParams = function (url, params) {
|
|
|
10261
11765
|
/**
|
|
10262
11766
|
* Custom exception logger function for logging errors to sentry
|
|
10263
11767
|
*/
|
|
10264
|
-
var logExceptionToSentry = captureException.bind(window);
|
|
11768
|
+
var logExceptionToSentry = captureException.bind(window);
|
|
11769
|
+
var customStyles = {
|
|
11770
|
+
control: function (base, state) { return (__assign(__assign({}, base), { minHeight: '32px', boxShadow: 'none', border: 'none', cursor: 'pointer', background: 'transparent' })); },
|
|
11771
|
+
indicatorSeparator: function (base, state) { return (__assign(__assign({}, base), { width: 0 })); },
|
|
11772
|
+
valueContainer: function (base, state) { return (__assign(__assign({}, base), { padding: '0', fontSize: '13px', fontWeight: '600' })); },
|
|
11773
|
+
dropdownIndicator: function (base, state) { return (__assign(__assign({}, base), { color: 'var(--N400)', padding: '0 8px', transition: 'all .2s ease', transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)' })); },
|
|
11774
|
+
};
|
|
11775
|
+
var getFilteredChartVersions = function (charts, selectedChartType) {
|
|
11776
|
+
// Filter chart versions based on selected chart type
|
|
11777
|
+
return charts
|
|
11778
|
+
.filter(function (item) { return (item === null || item === void 0 ? void 0 : item.chartType) === selectedChartType.value; })
|
|
11779
|
+
.map(function (item) { return ({
|
|
11780
|
+
value: item === null || item === void 0 ? void 0 : item.chartVersion,
|
|
11781
|
+
label: item === null || item === void 0 ? void 0 : item.chartVersion,
|
|
11782
|
+
chartRefId: item.chartRefId,
|
|
11783
|
+
}); });
|
|
11784
|
+
};
|
|
11785
|
+
function removeEmptyObjectKeysAndNullValues(obj) {
|
|
11786
|
+
// It recursively removes empty object keys and array values that are null
|
|
11787
|
+
for (var key in obj) {
|
|
11788
|
+
if (Array.isArray(obj[key])) {
|
|
11789
|
+
if (obj[key].length === 0)
|
|
11790
|
+
continue;
|
|
11791
|
+
obj[key] = obj[key].filter(function (item) { return item !== null; });
|
|
11792
|
+
// Check if the array is empty
|
|
11793
|
+
if (obj[key].length === 0) {
|
|
11794
|
+
delete obj[key]; // Delete the key if the array is empty
|
|
11795
|
+
}
|
|
11796
|
+
}
|
|
11797
|
+
else if (obj[key] && typeof obj[key] === 'object') {
|
|
11798
|
+
if (removeEmptyObjectKeysAndNullValues(obj[key])) {
|
|
11799
|
+
delete obj[key];
|
|
11800
|
+
}
|
|
11801
|
+
}
|
|
11802
|
+
else if (obj[key] === undefined) {
|
|
11803
|
+
delete obj[key];
|
|
11804
|
+
}
|
|
11805
|
+
}
|
|
11806
|
+
return Object.keys(obj).length === 0;
|
|
11807
|
+
}
|
|
11808
|
+
function getUnlockedJSON(json, jsonPathArray) {
|
|
11809
|
+
var jsonCopy = JSON.parse(JSON.stringify(json));
|
|
11810
|
+
var patches = jsonPathArray.flatMap(function (jsonPath) {
|
|
11811
|
+
var pathsToRemove = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' });
|
|
11812
|
+
return pathsToRemove.map(function (result) {
|
|
11813
|
+
return Array.isArray(result.parent)
|
|
11814
|
+
? { op: 'replace', path: result.pointer, value: null }
|
|
11815
|
+
: { op: 'remove', path: result.pointer };
|
|
11816
|
+
});
|
|
11817
|
+
});
|
|
11818
|
+
var newDocument = applyPatch(jsonCopy, patches).newDocument;
|
|
11819
|
+
removeEmptyObjectKeysAndNullValues(newDocument);
|
|
11820
|
+
return newDocument;
|
|
11821
|
+
}
|
|
11822
|
+
function getLockedJSON(json, jsonPathArray) {
|
|
11823
|
+
var jsonCopy = JSON.parse(JSON.stringify(json));
|
|
11824
|
+
var resultJson = {};
|
|
11825
|
+
jsonPathArray.forEach(function (jsonPath) {
|
|
11826
|
+
var elements = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' });
|
|
11827
|
+
elements.forEach(function (element) {
|
|
11828
|
+
var _a;
|
|
11829
|
+
var pathArray = JSONPath.toPathArray(element.path);
|
|
11830
|
+
var lastPath = pathArray.pop();
|
|
11831
|
+
var current = resultJson;
|
|
11832
|
+
for (var i = 0; i < pathArray.length; i++) {
|
|
11833
|
+
var key_1 = isNaN(Number(pathArray[i])) ? pathArray[i] : parseInt(pathArray[i]);
|
|
11834
|
+
if (!current[key_1]) {
|
|
11835
|
+
current[key_1] = isNaN(Number((_a = pathArray[i + 1]) !== null && _a !== void 0 ? _a : lastPath)) ? {} : [];
|
|
11836
|
+
}
|
|
11837
|
+
current = current[key_1];
|
|
11838
|
+
}
|
|
11839
|
+
var key = isNaN(Number(lastPath)) ? lastPath : parseInt(lastPath);
|
|
11840
|
+
current[key] = element.value;
|
|
11841
|
+
});
|
|
11842
|
+
});
|
|
11843
|
+
return resultJson['$'];
|
|
11844
|
+
}
|
|
10265
11845
|
|
|
10266
11846
|
function Progressing(_a) {
|
|
10267
11847
|
var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles, fillColor = _a.fillColor;
|
|
@@ -10274,7 +11854,7 @@ function DetailsProgressing(_a) {
|
|
|
10274
11854
|
}
|
|
10275
11855
|
|
|
10276
11856
|
var VisibleModal = /** @class */ (function (_super) {
|
|
10277
|
-
__extends(VisibleModal, _super);
|
|
11857
|
+
__extends$1(VisibleModal, _super);
|
|
10278
11858
|
function VisibleModal(props) {
|
|
10279
11859
|
var _this = _super.call(this, props) || this;
|
|
10280
11860
|
_this.modalRef = document.getElementById('visible-modal');
|
|
@@ -10388,16 +11968,16 @@ var Modal = function (_a) {
|
|
|
10388
11968
|
}, id: "popup", className: "".concat(rootClassName, " popup ").concat(modal ? 'modal' : ''), style: __assign({}, style) }, { children: children })), document.getElementById('visible-modal'));
|
|
10389
11969
|
};
|
|
10390
11970
|
|
|
10391
|
-
var _path$
|
|
10392
|
-
function _extends$
|
|
11971
|
+
var _path$d;
|
|
11972
|
+
function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
|
|
10393
11973
|
var SvgIcCross = function SvgIcCross(props) {
|
|
10394
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
11974
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
|
|
10395
11975
|
width: "1em",
|
|
10396
11976
|
height: "1em",
|
|
10397
11977
|
viewBox: "0 0 24 24",
|
|
10398
11978
|
fill: "none",
|
|
10399
11979
|
xmlns: "http://www.w3.org/2000/svg"
|
|
10400
|
-
}, props), _path$
|
|
11980
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
|
|
10401
11981
|
d: "M19.28 5.78a.75.75 0 0 0-1.06-1.06l1.06 1.06ZM4.72 18.22a.75.75 0 1 0 1.06 1.06l-1.06-1.06Zm13.5 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM5.78 4.72a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm12.44 0-6.75 6.75 1.06 1.06 6.75-6.75-1.06-1.06Zm-6.75 6.75-6.75 6.75 1.06 1.06 6.75-6.75-1.06-1.06Zm7.81 6.75-6.75-6.75-1.06 1.06 6.75 6.75 1.06-1.06Zm-6.75-6.75L5.78 4.72 4.72 5.78l6.75 6.75 1.06-1.06Z",
|
|
10402
11982
|
fill: "#596168"
|
|
10403
11983
|
})));
|
|
@@ -10405,7 +11985,7 @@ var SvgIcCross = function SvgIcCross(props) {
|
|
|
10405
11985
|
var close = "data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19.2803%205.78033C19.5732%205.48744%2019.5732%205.01256%2019.2803%204.71967C18.9874%204.42678%2018.5126%204.42678%2018.2197%204.71967L19.2803%205.78033ZM4.71967%2018.2197C4.42678%2018.5126%204.42678%2018.9874%204.71967%2019.2803C5.01256%2019.5732%205.48744%2019.5732%205.78033%2019.2803L4.71967%2018.2197ZM18.2197%2019.2803C18.5126%2019.5732%2018.9874%2019.5732%2019.2803%2019.2803C19.5732%2018.9874%2019.5732%2018.5126%2019.2803%2018.2197L18.2197%2019.2803ZM5.78033%204.71967C5.48744%204.42678%205.01256%204.42678%204.71967%204.71967C4.42678%205.01256%204.42678%205.48744%204.71967%205.78033L5.78033%204.71967ZM18.2197%204.71967L11.4697%2011.4697L12.5303%2012.5303L19.2803%205.78033L18.2197%204.71967ZM11.4697%2011.4697L4.71967%2018.2197L5.78033%2019.2803L12.5303%2012.5303L11.4697%2011.4697ZM19.2803%2018.2197L12.5303%2011.4697L11.4697%2012.5303L18.2197%2019.2803L19.2803%2018.2197ZM12.5303%2011.4697L5.78033%204.71967L4.71967%205.78033L11.4697%2012.5303L12.5303%2011.4697Z%22%20fill%3D%22%23596168%22%2F%3E%3C%2Fsvg%3E";
|
|
10406
11986
|
|
|
10407
11987
|
var OpaqueModal = /** @class */ (function (_super) {
|
|
10408
|
-
__extends(OpaqueModal, _super);
|
|
11988
|
+
__extends$1(OpaqueModal, _super);
|
|
10409
11989
|
function OpaqueModal() {
|
|
10410
11990
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
10411
11991
|
_this.modalRef = document.getElementById('full-screen-modal');
|
|
@@ -10429,7 +12009,7 @@ var OpaqueModal = /** @class */ (function (_super) {
|
|
|
10429
12009
|
}(React.Component));
|
|
10430
12010
|
|
|
10431
12011
|
var VisibleModal2 = /** @class */ (function (_super) {
|
|
10432
|
-
__extends(VisibleModal2, _super);
|
|
12012
|
+
__extends$1(VisibleModal2, _super);
|
|
10433
12013
|
function VisibleModal2(props) {
|
|
10434
12014
|
var _this = _super.call(this, props) || this;
|
|
10435
12015
|
_this.modalRef = document.getElementById('visible-modal-2');
|
|
@@ -10540,7 +12120,7 @@ var BreadCrumb = function (_a) {
|
|
|
10540
12120
|
|
|
10541
12121
|
var RadioGroupContext = React.createContext({ name: '', value: '', disabled: false, onChange: function (event) { } });
|
|
10542
12122
|
var RadioGroupItem = /** @class */ (function (_super) {
|
|
10543
|
-
__extends(RadioGroupItem, _super);
|
|
12123
|
+
__extends$1(RadioGroupItem, _super);
|
|
10544
12124
|
function RadioGroupItem() {
|
|
10545
12125
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
10546
12126
|
}
|
|
@@ -10553,7 +12133,7 @@ var RadioGroupItem = /** @class */ (function (_super) {
|
|
|
10553
12133
|
return RadioGroupItem;
|
|
10554
12134
|
}(React.Component));
|
|
10555
12135
|
var RadioGroup$1 = /** @class */ (function (_super) {
|
|
10556
|
-
__extends(RadioGroup, _super);
|
|
12136
|
+
__extends$1(RadioGroup, _super);
|
|
10557
12137
|
function RadioGroup() {
|
|
10558
12138
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
10559
12139
|
}
|
|
@@ -14696,30 +16276,30 @@ var index = /*#__PURE__*/forwardRef( /*#__PURE__*/TippyGenerator(tippy));
|
|
|
14696
16276
|
|
|
14697
16277
|
var Tippy = index;
|
|
14698
16278
|
|
|
14699
|
-
var _path$
|
|
14700
|
-
function _extends$
|
|
16279
|
+
var _path$c;
|
|
16280
|
+
function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
|
|
14701
16281
|
var SvgIcHelp = function SvgIcHelp(props) {
|
|
14702
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
16282
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
|
|
14703
16283
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14704
16284
|
width: "1em",
|
|
14705
16285
|
height: "1em",
|
|
14706
16286
|
viewBox: "0 0 24 24"
|
|
14707
|
-
}, props), _path$
|
|
16287
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14708
16288
|
fill: "#767D84",
|
|
14709
16289
|
fillRule: "evenodd",
|
|
14710
16290
|
d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm-.205 12.868c-.615 0-1.12.505-1.12 1.12 0 .617.505 1.121 1.12 1.121.615 0 1.12-.504 1.12-1.12 0-.616-.506-1.12-1.12-1.12zM11.863 7c-1.667 0-3.197 1.187-3.196 2.527 0 .546.41.833.888.833 1.325 0 .642-1.803 2.39-1.803.82 0 1.311.438 1.311 1.175 0 1.34-2.39 1.708-2.39 3.334 0 .438.287.915.874.915.902 0 .792-.67 1.12-1.148.438-.642 2.473-1.325 2.473-3.101 0-1.927-1.721-2.732-3.47-2.732z"
|
|
14711
16291
|
})));
|
|
14712
16292
|
};
|
|
14713
16293
|
|
|
14714
|
-
var _path$
|
|
14715
|
-
function _extends$
|
|
16294
|
+
var _path$b;
|
|
16295
|
+
function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
|
|
14716
16296
|
var SvgIcHelpOutline = function SvgIcHelpOutline(props) {
|
|
14717
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
16297
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
|
|
14718
16298
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14719
16299
|
viewBox: "0 0 17 16",
|
|
14720
16300
|
width: "1em",
|
|
14721
16301
|
height: "1em"
|
|
14722
|
-
}, props), _path$
|
|
16302
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14723
16303
|
fill: "#767D84",
|
|
14724
16304
|
fillRule: "evenodd",
|
|
14725
16305
|
d: "M9 1.333a6.667 6.667 0 1 1 0 13.334A6.667 6.667 0 0 1 9 1.333zm0 1.334C6.054 2.667 3.667 5.054 3.667 8S6.054 13.333 9 13.333 14.333 10.946 14.333 8 11.946 2.667 9 2.667zm-.137 7.245c.41 0 .747.337.747.747s-.337.747-.747.747-.747-.336-.747-.747a.75.75 0 0 1 .747-.747zm.046-5.245c1.166 0 2.313.537 2.313 1.82 0 1.185-1.357 1.64-1.648 2.068-.22.319-.146.766-.747.766-.392 0-.583-.319-.583-.61 0-1.085 1.593-1.33 1.593-2.223 0-.492-.327-.783-.873-.783-1.166 0-.711 1.202-1.594 1.202-.319 0-.592-.191-.592-.556 0-.893 1.02-1.684 2.13-1.684z"
|
|
@@ -14771,16 +16351,16 @@ function TippyCustomized(props) {
|
|
|
14771
16351
|
return (jsxRuntime.jsx(Tippy, __assign({ className: "".concat(isWhiteTheme ? 'tippy-white-container default-white' : 'tippy-black-container default-black', " no-content-padding tippy-shadow ").concat(className), arrow: arrow || false, interactive: interactive || false, placement: placement || 'top', content: getTippyContent(), trigger: trigger || 'mouseenter', onMount: onTippyMount, onClickOutside: closeTippy, showOnCreate: showOnCreate || false, animation: animation || 'fade', duration: duration || 300, visible: props.visible }, { children: children })));
|
|
14772
16352
|
}
|
|
14773
16353
|
|
|
14774
|
-
var _path$
|
|
14775
|
-
function _extends$
|
|
16354
|
+
var _path$a, _circle, _path2$1;
|
|
16355
|
+
function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
|
|
14776
16356
|
var SvgInjectTag = function SvgInjectTag(props) {
|
|
14777
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
16357
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
|
|
14778
16358
|
width: "1em",
|
|
14779
16359
|
height: "1em",
|
|
14780
16360
|
viewBox: "0 0 20 20",
|
|
14781
16361
|
fill: "none",
|
|
14782
16362
|
xmlns: "http://www.w3.org/2000/svg"
|
|
14783
|
-
}, props), _path$
|
|
16363
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14784
16364
|
d: "M10 10H3.333",
|
|
14785
16365
|
stroke: "#596168",
|
|
14786
16366
|
strokeWidth: 1.5,
|
|
@@ -14808,15 +16388,15 @@ function PropagateTagInfo(_a) {
|
|
|
14808
16388
|
return (jsxRuntime.jsx(TippyCustomized, __assign({ theme: exports.TippyTheme.white, className: "w-300", placement: "top", Icon: SvgInjectTag, heading: 'Propagate tags to K8s resources', infoText: "", additionalContent: additionalInfo(), showCloseButton: true, trigger: "click", interactive: true, documentationLink: isCreateApp ? DOCUMENTATION.APP_TAGS : DOCUMENTATION.APP_OVERVIEW_TAGS, documentationLinkText: "View Documentation" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flexbox cursor" }, { children: [jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-16 mt-2 mr-4" }), jsxRuntime.jsx("span", { children: "Propagate tags" }), jsxRuntime.jsx(SvgIcHelpOutline, { className: "icon-dim-16 mt-2 ml-4" })] })) })));
|
|
14809
16389
|
}
|
|
14810
16390
|
|
|
14811
|
-
var _path$
|
|
14812
|
-
function _extends$
|
|
16391
|
+
var _path$9;
|
|
16392
|
+
function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
|
|
14813
16393
|
var SvgIcInfoOutlined = function SvgIcInfoOutlined(props) {
|
|
14814
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
16394
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
|
|
14815
16395
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14816
16396
|
width: "1em",
|
|
14817
16397
|
height: "1em",
|
|
14818
16398
|
viewBox: "0 0 20 20"
|
|
14819
|
-
}, props), _path$
|
|
16399
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
14820
16400
|
d: "M10 1.667c4.6 0 8.333 3.733 8.333 8.333S14.6 18.333 10 18.333 1.667 14.6 1.667 10 5.4 1.667 10 1.667zm0 1.666A6.67 6.67 0 0 0 3.333 10 6.67 6.67 0 0 0 10 16.667 6.67 6.67 0 0 0 16.667 10 6.67 6.67 0 0 0 10 3.333zm0 5.834c.46 0 .833.373.833.833v3.333a.834.834 0 1 1-1.666 0V10c0-.46.373-.833.833-.833zm0-3.334A.833.833 0 1 1 10 7.5a.833.833 0 0 1 0-1.667z",
|
|
14821
16401
|
fill: "#06C",
|
|
14822
16402
|
fillRule: "evenodd"
|
|
@@ -15050,15 +16630,15 @@ var TagDetails = function (_a) {
|
|
|
15050
16630
|
return (jsxRuntime.jsxs("div", __assign({ className: "flexbox mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "dc__border h-30 pl-4 pr-4 br-4 mr-8 pointer ".concat(tagData.propagate ? 'bcn-7' : '', " ").concat(tagData.key.startsWith("devtron.ai/") ? 'cursor-not-allowed bcn-1' : ''), onClick: propagateTagToResource, "data-testid": "propagate-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgInjectTag, { className: "icon-dim-20 mt-4 ".concat(tagData.propagate ? 'scn-0' : '') }) })), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.KEY, placeholder: "Enter key", tabIndex: tabIndex - 1, refVar: keyRef, dependentRef: valueRef, tagOptions: suggestedTagsOptions }), jsxRuntime.jsx(TagLabelValueSelector, { selectedTagIndex: index, tagData: tagData, setTagData: setTagData, tagInputType: exports.KEY_VALUE.VALUE, placeholder: "Enter value", tabIndex: tabIndex, refVar: valueRef, dependentRef: keyRef }), jsxRuntime.jsx("div", __assign({ className: "dc__border pl-4 pr-4 dc__right-radius-4 pointer flex top", onClick: deleteTag, "data-testid": "delete-tag-".concat(index) }, { children: jsxRuntime.jsx(SvgIcCross, { className: "icon-dim-20 mt-4" }) }))] })));
|
|
15051
16631
|
};
|
|
15052
16632
|
|
|
15053
|
-
var _path$
|
|
15054
|
-
function _extends$
|
|
16633
|
+
var _path$8;
|
|
16634
|
+
function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
|
|
15055
16635
|
var SvgIcAdd = function SvgIcAdd(props) {
|
|
15056
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
16636
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
|
|
15057
16637
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15058
16638
|
width: "1em",
|
|
15059
16639
|
height: "1em",
|
|
15060
16640
|
viewBox: "0 0 24 24"
|
|
15061
|
-
}, props), _path$
|
|
16641
|
+
}, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
15062
16642
|
className: "ic-add_svg__fill-color",
|
|
15063
16643
|
fill: "#999",
|
|
15064
16644
|
d: "M18 13h-5v5a1 1 0 0 1-2 0v-5H6a1 1 0 0 1 0-2h5V6a1 1 0 0 1 2 0v5h5a1 1 0 0 1 0 2z"
|
|
@@ -15134,7 +16714,7 @@ DeleteDialog.Description = DeleteDialogDescription;
|
|
|
15134
16714
|
//TODO: may not need context
|
|
15135
16715
|
var DialogFormContext = React.createContext({ title: '', isLoading: false, close: function (event) { }, onSave: function (event) { } });
|
|
15136
16716
|
var DialogForm = /** @class */ (function (_super) {
|
|
15137
|
-
__extends(DialogForm, _super);
|
|
16717
|
+
__extends$1(DialogForm, _super);
|
|
15138
16718
|
function DialogForm(props) {
|
|
15139
16719
|
var _this = _super.call(this, props) || this;
|
|
15140
16720
|
_this.escFunction = _this.escFunction.bind(_this);
|
|
@@ -15170,7 +16750,7 @@ var DialogForm = /** @class */ (function (_super) {
|
|
|
15170
16750
|
return DialogForm;
|
|
15171
16751
|
}(React.Component));
|
|
15172
16752
|
var DialogFormSubmit = /** @class */ (function (_super) {
|
|
15173
|
-
__extends(DialogFormSubmit, _super);
|
|
16753
|
+
__extends$1(DialogFormSubmit, _super);
|
|
15174
16754
|
function DialogFormSubmit() {
|
|
15175
16755
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
15176
16756
|
}
|
|
@@ -15188,8 +16768,8 @@ function ForceDeleteDialog(_a) {
|
|
|
15188
16768
|
return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(DeleteDialog, __assign({ title: forceDeleteDialogTitle, delete: onClickDelete, closeDelete: closeDeleteModal, deletePrefix: "Force " }, { children: jsxRuntime.jsxs(DeleteDialog.Description, { children: [jsxRuntime.jsxs("p", __assign({ className: "mt-12 mb-12 p-8 dc__break-word dc__window-bg" }, { children: ["Error: ", forceDeleteDialogMessage] })), jsxRuntime.jsx("p", { children: "Do you want to force delete?" })] }) })) }));
|
|
15189
16769
|
}
|
|
15190
16770
|
|
|
15191
|
-
function _extends$
|
|
15192
|
-
_extends$
|
|
16771
|
+
function _extends$f() {
|
|
16772
|
+
_extends$f = Object.assign ? Object.assign.bind() : function (target) {
|
|
15193
16773
|
for (var i = 1; i < arguments.length; i++) {
|
|
15194
16774
|
var source = arguments[i];
|
|
15195
16775
|
for (var key in source) {
|
|
@@ -15200,7 +16780,7 @@ function _extends$e() {
|
|
|
15200
16780
|
}
|
|
15201
16781
|
return target;
|
|
15202
16782
|
};
|
|
15203
|
-
return _extends$
|
|
16783
|
+
return _extends$f.apply(this, arguments);
|
|
15204
16784
|
}
|
|
15205
16785
|
|
|
15206
16786
|
/*
|
|
@@ -18741,7 +20321,7 @@ var Menu = function Menu(props) {
|
|
|
18741
20321
|
getStyles = props.getStyles,
|
|
18742
20322
|
innerRef = props.innerRef,
|
|
18743
20323
|
innerProps = props.innerProps;
|
|
18744
|
-
return jsx("div", _extends$
|
|
20324
|
+
return jsx("div", _extends$f({
|
|
18745
20325
|
css: getStyles('menu', props),
|
|
18746
20326
|
className: cx({
|
|
18747
20327
|
menu: true
|
|
@@ -18773,7 +20353,7 @@ var MenuList$1 = function MenuList(props) {
|
|
|
18773
20353
|
innerProps = props.innerProps,
|
|
18774
20354
|
innerRef = props.innerRef,
|
|
18775
20355
|
isMulti = props.isMulti;
|
|
18776
|
-
return jsx("div", _extends$
|
|
20356
|
+
return jsx("div", _extends$f({
|
|
18777
20357
|
css: getStyles('menuList', props),
|
|
18778
20358
|
className: cx({
|
|
18779
20359
|
'menu-list': true,
|
|
@@ -18804,7 +20384,7 @@ var NoOptionsMessage = function NoOptionsMessage(props) {
|
|
|
18804
20384
|
cx = props.cx,
|
|
18805
20385
|
getStyles = props.getStyles,
|
|
18806
20386
|
innerProps = props.innerProps;
|
|
18807
|
-
return jsx("div", _extends$
|
|
20387
|
+
return jsx("div", _extends$f({
|
|
18808
20388
|
css: getStyles('noOptionsMessage', props),
|
|
18809
20389
|
className: cx({
|
|
18810
20390
|
'menu-notice': true,
|
|
@@ -18821,7 +20401,7 @@ var LoadingMessage = function LoadingMessage(props) {
|
|
|
18821
20401
|
cx = props.cx,
|
|
18822
20402
|
getStyles = props.getStyles,
|
|
18823
20403
|
innerProps = props.innerProps;
|
|
18824
|
-
return jsx("div", _extends$
|
|
20404
|
+
return jsx("div", _extends$f({
|
|
18825
20405
|
css: getStyles('loadingMessage', props),
|
|
18826
20406
|
className: cx({
|
|
18827
20407
|
'menu-notice': true,
|
|
@@ -18909,7 +20489,7 @@ var MenuPortal = /*#__PURE__*/function (_Component2) {
|
|
|
18909
20489
|
rect: rect
|
|
18910
20490
|
}; // same wrapper element whether fixed or portalled
|
|
18911
20491
|
|
|
18912
|
-
var menuWrapper = jsx("div", _extends$
|
|
20492
|
+
var menuWrapper = jsx("div", _extends$f({
|
|
18913
20493
|
css: getStyles('menuPortal', state),
|
|
18914
20494
|
className: cx({
|
|
18915
20495
|
'menu-portal': true
|
|
@@ -18945,7 +20525,7 @@ var SelectContainer = function SelectContainer(props) {
|
|
|
18945
20525
|
innerProps = props.innerProps,
|
|
18946
20526
|
isDisabled = props.isDisabled,
|
|
18947
20527
|
isRtl = props.isRtl;
|
|
18948
|
-
return jsx("div", _extends$
|
|
20528
|
+
return jsx("div", _extends$f({
|
|
18949
20529
|
css: getStyles('container', props),
|
|
18950
20530
|
className: cx({
|
|
18951
20531
|
'--is-disabled': isDisabled,
|
|
@@ -18980,7 +20560,7 @@ var ValueContainer = function ValueContainer(props) {
|
|
|
18980
20560
|
isMulti = props.isMulti,
|
|
18981
20561
|
getStyles = props.getStyles,
|
|
18982
20562
|
hasValue = props.hasValue;
|
|
18983
|
-
return jsx("div", _extends$
|
|
20563
|
+
return jsx("div", _extends$f({
|
|
18984
20564
|
css: getStyles('valueContainer', props),
|
|
18985
20565
|
className: cx({
|
|
18986
20566
|
'value-container': true,
|
|
@@ -19006,7 +20586,7 @@ var IndicatorsContainer = function IndicatorsContainer(props) {
|
|
|
19006
20586
|
cx = props.cx,
|
|
19007
20587
|
innerProps = props.innerProps,
|
|
19008
20588
|
getStyles = props.getStyles;
|
|
19009
|
-
return jsx("div", _extends$
|
|
20589
|
+
return jsx("div", _extends$f({
|
|
19010
20590
|
css: getStyles('indicatorsContainer', props),
|
|
19011
20591
|
className: cx({
|
|
19012
20592
|
indicators: true
|
|
@@ -19037,7 +20617,7 @@ var Svg = function Svg(_ref) {
|
|
|
19037
20617
|
var size = _ref.size,
|
|
19038
20618
|
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
19039
20619
|
|
|
19040
|
-
return jsx("svg", _extends$
|
|
20620
|
+
return jsx("svg", _extends$f({
|
|
19041
20621
|
height: size,
|
|
19042
20622
|
width: size,
|
|
19043
20623
|
viewBox: "0 0 20 20",
|
|
@@ -19048,14 +20628,14 @@ var Svg = function Svg(_ref) {
|
|
|
19048
20628
|
};
|
|
19049
20629
|
|
|
19050
20630
|
var CrossIcon = function CrossIcon(props) {
|
|
19051
|
-
return jsx(Svg, _extends$
|
|
20631
|
+
return jsx(Svg, _extends$f({
|
|
19052
20632
|
size: 20
|
|
19053
20633
|
}, props), jsx("path", {
|
|
19054
20634
|
d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
|
|
19055
20635
|
}));
|
|
19056
20636
|
};
|
|
19057
20637
|
var DownChevron = function DownChevron(props) {
|
|
19058
|
-
return jsx(Svg, _extends$
|
|
20638
|
+
return jsx(Svg, _extends$f({
|
|
19059
20639
|
size: 20
|
|
19060
20640
|
}, props), jsx("path", {
|
|
19061
20641
|
d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
|
@@ -19088,7 +20668,7 @@ var DropdownIndicator$1 = function DropdownIndicator(props) {
|
|
|
19088
20668
|
cx = props.cx,
|
|
19089
20669
|
getStyles = props.getStyles,
|
|
19090
20670
|
innerProps = props.innerProps;
|
|
19091
|
-
return jsx("div", _extends$
|
|
20671
|
+
return jsx("div", _extends$f({
|
|
19092
20672
|
css: getStyles('dropdownIndicator', props),
|
|
19093
20673
|
className: cx({
|
|
19094
20674
|
indicator: true,
|
|
@@ -19103,7 +20683,7 @@ var ClearIndicator$1 = function ClearIndicator(props) {
|
|
|
19103
20683
|
cx = props.cx,
|
|
19104
20684
|
getStyles = props.getStyles,
|
|
19105
20685
|
innerProps = props.innerProps;
|
|
19106
|
-
return jsx("div", _extends$
|
|
20686
|
+
return jsx("div", _extends$f({
|
|
19107
20687
|
css: getStyles('clearIndicator', props),
|
|
19108
20688
|
className: cx({
|
|
19109
20689
|
indicator: true,
|
|
@@ -19133,7 +20713,7 @@ var IndicatorSeparator = function IndicatorSeparator(props) {
|
|
|
19133
20713
|
cx = props.cx,
|
|
19134
20714
|
getStyles = props.getStyles,
|
|
19135
20715
|
innerProps = props.innerProps;
|
|
19136
|
-
return jsx("span", _extends$
|
|
20716
|
+
return jsx("span", _extends$f({}, innerProps, {
|
|
19137
20717
|
css: getStyles('indicatorSeparator', props),
|
|
19138
20718
|
className: cx({
|
|
19139
20719
|
'indicator-separator': true
|
|
@@ -19188,7 +20768,7 @@ var LoadingIndicator = function LoadingIndicator(props) {
|
|
|
19188
20768
|
getStyles = props.getStyles,
|
|
19189
20769
|
innerProps = props.innerProps,
|
|
19190
20770
|
isRtl = props.isRtl;
|
|
19191
|
-
return jsx("div", _extends$
|
|
20771
|
+
return jsx("div", _extends$f({
|
|
19192
20772
|
css: getStyles('loadingIndicator', props),
|
|
19193
20773
|
className: cx({
|
|
19194
20774
|
indicator: true,
|
|
@@ -19249,7 +20829,7 @@ var Control = function Control(props) {
|
|
|
19249
20829
|
innerRef = props.innerRef,
|
|
19250
20830
|
innerProps = props.innerProps,
|
|
19251
20831
|
menuIsOpen = props.menuIsOpen;
|
|
19252
|
-
return jsx("div", _extends$
|
|
20832
|
+
return jsx("div", _extends$f({
|
|
19253
20833
|
ref: innerRef,
|
|
19254
20834
|
css: getStyles('control', props),
|
|
19255
20835
|
className: cx({
|
|
@@ -19281,12 +20861,12 @@ var Group = function Group(props) {
|
|
|
19281
20861
|
label = props.label,
|
|
19282
20862
|
theme = props.theme,
|
|
19283
20863
|
selectProps = props.selectProps;
|
|
19284
|
-
return jsx("div", _extends$
|
|
20864
|
+
return jsx("div", _extends$f({
|
|
19285
20865
|
css: getStyles('group', props),
|
|
19286
20866
|
className: cx({
|
|
19287
20867
|
group: true
|
|
19288
20868
|
}, className)
|
|
19289
|
-
}, innerProps), jsx(Heading, _extends$
|
|
20869
|
+
}, innerProps), jsx(Heading, _extends$f({}, headingProps, {
|
|
19290
20870
|
selectProps: selectProps,
|
|
19291
20871
|
theme: theme,
|
|
19292
20872
|
getStyles: getStyles,
|
|
@@ -19318,7 +20898,7 @@ var GroupHeading = function GroupHeading(props) {
|
|
|
19318
20898
|
_cleanCommonProps.data;
|
|
19319
20899
|
var innerProps = _objectWithoutProperties(_cleanCommonProps, _excluded$1$1);
|
|
19320
20900
|
|
|
19321
|
-
return jsx("div", _extends$
|
|
20901
|
+
return jsx("div", _extends$f({
|
|
19322
20902
|
css: getStyles('groupHeading', props),
|
|
19323
20903
|
className: cx({
|
|
19324
20904
|
'group-heading': true
|
|
@@ -19394,7 +20974,7 @@ var Input = function Input(props) {
|
|
|
19394
20974
|
}, className),
|
|
19395
20975
|
css: getStyles('input', props),
|
|
19396
20976
|
"data-value": value || ''
|
|
19397
|
-
}, jsx("input", _extends$
|
|
20977
|
+
}, jsx("input", _extends$f({
|
|
19398
20978
|
className: cx({
|
|
19399
20979
|
input: true
|
|
19400
20980
|
}, inputClassName),
|
|
@@ -19464,7 +21044,7 @@ var MultiValueLabel = MultiValueGeneric;
|
|
|
19464
21044
|
function MultiValueRemove$1(_ref5) {
|
|
19465
21045
|
var children = _ref5.children,
|
|
19466
21046
|
innerProps = _ref5.innerProps;
|
|
19467
|
-
return jsx("div", _extends$
|
|
21047
|
+
return jsx("div", _extends$f({
|
|
19468
21048
|
role: "button"
|
|
19469
21049
|
}, innerProps), children || jsx(CrossIcon, {
|
|
19470
21050
|
size: 14
|
|
@@ -19553,7 +21133,7 @@ var Option$1 = function Option(props) {
|
|
|
19553
21133
|
isSelected = props.isSelected,
|
|
19554
21134
|
innerRef = props.innerRef,
|
|
19555
21135
|
innerProps = props.innerProps;
|
|
19556
|
-
return jsx("div", _extends$
|
|
21136
|
+
return jsx("div", _extends$f({
|
|
19557
21137
|
css: getStyles('option', props),
|
|
19558
21138
|
className: cx({
|
|
19559
21139
|
option: true,
|
|
@@ -19585,7 +21165,7 @@ var Placeholder = function Placeholder(props) {
|
|
|
19585
21165
|
cx = props.cx,
|
|
19586
21166
|
getStyles = props.getStyles,
|
|
19587
21167
|
innerProps = props.innerProps;
|
|
19588
|
-
return jsx("div", _extends$
|
|
21168
|
+
return jsx("div", _extends$f({
|
|
19589
21169
|
css: getStyles('placeholder', props),
|
|
19590
21170
|
className: cx({
|
|
19591
21171
|
placeholder: true
|
|
@@ -19618,7 +21198,7 @@ var SingleValue = function SingleValue(props) {
|
|
|
19618
21198
|
getStyles = props.getStyles,
|
|
19619
21199
|
isDisabled = props.isDisabled,
|
|
19620
21200
|
innerProps = props.innerProps;
|
|
19621
|
-
return jsx("div", _extends$
|
|
21201
|
+
return jsx("div", _extends$f({
|
|
19622
21202
|
css: getStyles('singleValue', props),
|
|
19623
21203
|
className: cx({
|
|
19624
21204
|
'single-value': true,
|
|
@@ -19866,7 +21446,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
19866
21446
|
};
|
|
19867
21447
|
|
|
19868
21448
|
var A11yText = function A11yText(props) {
|
|
19869
|
-
return jsx("span", _extends$
|
|
21449
|
+
return jsx("span", _extends$f({
|
|
19870
21450
|
css: _ref
|
|
19871
21451
|
}, props));
|
|
19872
21452
|
};
|
|
@@ -20402,7 +21982,7 @@ function DummyInput(_ref) {
|
|
|
20402
21982
|
var innerRef = _ref.innerRef,
|
|
20403
21983
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20404
21984
|
|
|
20405
|
-
return jsx("input", _extends$
|
|
21985
|
+
return jsx("input", _extends$f({
|
|
20406
21986
|
ref: innerRef
|
|
20407
21987
|
}, props, {
|
|
20408
21988
|
css: /*#__PURE__*/css$2({
|
|
@@ -22037,7 +23617,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22037
23617
|
|
|
22038
23618
|
if (!isSearchable) {
|
|
22039
23619
|
// use a dummy input to maintain focus/blur functionality
|
|
22040
|
-
return /*#__PURE__*/React__namespace.createElement(DummyInput, _extends$
|
|
23620
|
+
return /*#__PURE__*/React__namespace.createElement(DummyInput, _extends$f({
|
|
22041
23621
|
id: id,
|
|
22042
23622
|
innerRef: this.getInputRef,
|
|
22043
23623
|
onBlur: this.onInputBlur,
|
|
@@ -22051,7 +23631,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22051
23631
|
}, ariaAttributes));
|
|
22052
23632
|
}
|
|
22053
23633
|
|
|
22054
|
-
return /*#__PURE__*/React__namespace.createElement(Input, _extends$
|
|
23634
|
+
return /*#__PURE__*/React__namespace.createElement(Input, _extends$f({}, commonProps, {
|
|
22055
23635
|
autoCapitalize: "none",
|
|
22056
23636
|
autoComplete: "off",
|
|
22057
23637
|
autoCorrect: "off",
|
|
@@ -22095,7 +23675,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22095
23675
|
isFocused = _this$state5.isFocused;
|
|
22096
23676
|
|
|
22097
23677
|
if (!this.hasValue() || !controlShouldRenderValue) {
|
|
22098
|
-
return inputValue ? null : /*#__PURE__*/React__namespace.createElement(Placeholder, _extends$
|
|
23678
|
+
return inputValue ? null : /*#__PURE__*/React__namespace.createElement(Placeholder, _extends$f({}, commonProps, {
|
|
22099
23679
|
key: "placeholder",
|
|
22100
23680
|
isDisabled: isDisabled,
|
|
22101
23681
|
isFocused: isFocused,
|
|
@@ -22109,7 +23689,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22109
23689
|
return selectValue.map(function (opt, index) {
|
|
22110
23690
|
var isOptionFocused = opt === focusedValue;
|
|
22111
23691
|
var key = "".concat(_this3.getOptionLabel(opt), "-").concat(_this3.getOptionValue(opt));
|
|
22112
|
-
return /*#__PURE__*/React__namespace.createElement(MultiValue, _extends$
|
|
23692
|
+
return /*#__PURE__*/React__namespace.createElement(MultiValue, _extends$f({}, commonProps, {
|
|
22113
23693
|
components: {
|
|
22114
23694
|
Container: MultiValueContainer,
|
|
22115
23695
|
Label: MultiValueLabel,
|
|
@@ -22141,7 +23721,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22141
23721
|
}
|
|
22142
23722
|
|
|
22143
23723
|
var singleValue = selectValue[0];
|
|
22144
|
-
return /*#__PURE__*/React__namespace.createElement(SingleValue, _extends$
|
|
23724
|
+
return /*#__PURE__*/React__namespace.createElement(SingleValue, _extends$f({}, commonProps, {
|
|
22145
23725
|
data: singleValue,
|
|
22146
23726
|
isDisabled: isDisabled
|
|
22147
23727
|
}), this.formatOptionLabel(singleValue, 'value'));
|
|
@@ -22167,7 +23747,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22167
23747
|
onTouchEnd: this.onClearIndicatorTouchEnd,
|
|
22168
23748
|
'aria-hidden': 'true'
|
|
22169
23749
|
};
|
|
22170
|
-
return /*#__PURE__*/React__namespace.createElement(ClearIndicator, _extends$
|
|
23750
|
+
return /*#__PURE__*/React__namespace.createElement(ClearIndicator, _extends$f({}, commonProps, {
|
|
22171
23751
|
innerProps: innerProps,
|
|
22172
23752
|
isFocused: isFocused
|
|
22173
23753
|
}));
|
|
@@ -22187,7 +23767,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22187
23767
|
var innerProps = {
|
|
22188
23768
|
'aria-hidden': 'true'
|
|
22189
23769
|
};
|
|
22190
|
-
return /*#__PURE__*/React__namespace.createElement(LoadingIndicator, _extends$
|
|
23770
|
+
return /*#__PURE__*/React__namespace.createElement(LoadingIndicator, _extends$f({}, commonProps, {
|
|
22191
23771
|
innerProps: innerProps,
|
|
22192
23772
|
isDisabled: isDisabled,
|
|
22193
23773
|
isFocused: isFocused
|
|
@@ -22205,7 +23785,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22205
23785
|
var commonProps = this.commonProps;
|
|
22206
23786
|
var isDisabled = this.props.isDisabled;
|
|
22207
23787
|
var isFocused = this.state.isFocused;
|
|
22208
|
-
return /*#__PURE__*/React__namespace.createElement(IndicatorSeparator, _extends$
|
|
23788
|
+
return /*#__PURE__*/React__namespace.createElement(IndicatorSeparator, _extends$f({}, commonProps, {
|
|
22209
23789
|
isDisabled: isDisabled,
|
|
22210
23790
|
isFocused: isFocused
|
|
22211
23791
|
}));
|
|
@@ -22225,7 +23805,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22225
23805
|
onTouchEnd: this.onDropdownIndicatorTouchEnd,
|
|
22226
23806
|
'aria-hidden': 'true'
|
|
22227
23807
|
};
|
|
22228
|
-
return /*#__PURE__*/React__namespace.createElement(DropdownIndicator, _extends$
|
|
23808
|
+
return /*#__PURE__*/React__namespace.createElement(DropdownIndicator, _extends$f({}, commonProps, {
|
|
22229
23809
|
innerProps: innerProps,
|
|
22230
23810
|
isDisabled: isDisabled,
|
|
22231
23811
|
isFocused: isFocused
|
|
@@ -22288,7 +23868,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22288
23868
|
onMouseOver: onHover,
|
|
22289
23869
|
tabIndex: -1
|
|
22290
23870
|
};
|
|
22291
|
-
return /*#__PURE__*/React__namespace.createElement(Option, _extends$
|
|
23871
|
+
return /*#__PURE__*/React__namespace.createElement(Option, _extends$f({}, commonProps, {
|
|
22292
23872
|
innerProps: innerProps,
|
|
22293
23873
|
data: data,
|
|
22294
23874
|
isDisabled: isDisabled,
|
|
@@ -22312,7 +23892,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22312
23892
|
groupIndex = item.index;
|
|
22313
23893
|
var groupId = "".concat(_this4.getElementId('group'), "-").concat(groupIndex);
|
|
22314
23894
|
var headingId = "".concat(groupId, "-heading");
|
|
22315
|
-
return /*#__PURE__*/React__namespace.createElement(Group, _extends$
|
|
23895
|
+
return /*#__PURE__*/React__namespace.createElement(Group, _extends$f({}, commonProps, {
|
|
22316
23896
|
key: groupId,
|
|
22317
23897
|
data: _data,
|
|
22318
23898
|
options: options,
|
|
@@ -22351,12 +23931,12 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22351
23931
|
menuPosition: menuPosition,
|
|
22352
23932
|
menuShouldScrollIntoView: menuShouldScrollIntoView
|
|
22353
23933
|
};
|
|
22354
|
-
var menuElement = /*#__PURE__*/React__namespace.createElement(MenuPlacer, _extends$
|
|
23934
|
+
var menuElement = /*#__PURE__*/React__namespace.createElement(MenuPlacer, _extends$f({}, commonProps, menuPlacementProps), function (_ref4) {
|
|
22355
23935
|
var ref = _ref4.ref,
|
|
22356
23936
|
_ref4$placerProps = _ref4.placerProps,
|
|
22357
23937
|
placement = _ref4$placerProps.placement,
|
|
22358
23938
|
maxHeight = _ref4$placerProps.maxHeight;
|
|
22359
|
-
return /*#__PURE__*/React__namespace.createElement(Menu, _extends$
|
|
23939
|
+
return /*#__PURE__*/React__namespace.createElement(Menu, _extends$f({}, commonProps, menuPlacementProps, {
|
|
22360
23940
|
innerRef: ref,
|
|
22361
23941
|
innerProps: {
|
|
22362
23942
|
onMouseDown: _this4.onMenuMouseDown,
|
|
@@ -22371,7 +23951,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22371
23951
|
onBottomArrive: onMenuScrollToBottom,
|
|
22372
23952
|
lockEnabled: menuShouldBlockScroll
|
|
22373
23953
|
}, function (scrollTargetRef) {
|
|
22374
|
-
return /*#__PURE__*/React__namespace.createElement(MenuList, _extends$
|
|
23954
|
+
return /*#__PURE__*/React__namespace.createElement(MenuList, _extends$f({}, commonProps, {
|
|
22375
23955
|
innerRef: function innerRef(instance) {
|
|
22376
23956
|
_this4.getMenuListRef(instance);
|
|
22377
23957
|
|
|
@@ -22386,7 +23966,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22386
23966
|
// so we use the same component. the actual portalling logic is forked
|
|
22387
23967
|
// within the component based on `menuPosition`
|
|
22388
23968
|
|
|
22389
|
-
return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React__namespace.createElement(MenuPortal, _extends$
|
|
23969
|
+
return menuPortalTarget || menuPosition === 'fixed' ? /*#__PURE__*/React__namespace.createElement(MenuPortal, _extends$f({}, commonProps, {
|
|
22390
23970
|
appendTo: menuPortalTarget,
|
|
22391
23971
|
controlElement: this.controlRef,
|
|
22392
23972
|
menuPlacement: menuPlacement,
|
|
@@ -22451,7 +24031,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22451
24031
|
isFocused = _this$state6.isFocused,
|
|
22452
24032
|
selectValue = _this$state6.selectValue;
|
|
22453
24033
|
var focusableOptions = this.getFocusableOptions();
|
|
22454
|
-
return /*#__PURE__*/React__namespace.createElement(LiveRegion, _extends$
|
|
24034
|
+
return /*#__PURE__*/React__namespace.createElement(LiveRegion, _extends$f({}, commonProps, {
|
|
22455
24035
|
id: this.getElementId('live-region'),
|
|
22456
24036
|
ariaSelection: ariaSelection,
|
|
22457
24037
|
focusedOption: focusedOption,
|
|
@@ -22477,7 +24057,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22477
24057
|
menuIsOpen = _this$props14.menuIsOpen;
|
|
22478
24058
|
var isFocused = this.state.isFocused;
|
|
22479
24059
|
var commonProps = this.commonProps = this.getCommonProps();
|
|
22480
|
-
return /*#__PURE__*/React__namespace.createElement(SelectContainer, _extends$
|
|
24060
|
+
return /*#__PURE__*/React__namespace.createElement(SelectContainer, _extends$f({}, commonProps, {
|
|
22481
24061
|
className: className,
|
|
22482
24062
|
innerProps: {
|
|
22483
24063
|
id: id,
|
|
@@ -22485,7 +24065,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22485
24065
|
},
|
|
22486
24066
|
isDisabled: isDisabled,
|
|
22487
24067
|
isFocused: isFocused
|
|
22488
|
-
}), this.renderLiveRegion(), /*#__PURE__*/React__namespace.createElement(Control, _extends$
|
|
24068
|
+
}), this.renderLiveRegion(), /*#__PURE__*/React__namespace.createElement(Control, _extends$f({}, commonProps, {
|
|
22489
24069
|
innerRef: this.getControlRef,
|
|
22490
24070
|
innerProps: {
|
|
22491
24071
|
onMouseDown: this.onControlMouseDown,
|
|
@@ -22494,9 +24074,9 @@ var Select$1 = /*#__PURE__*/function (_Component) {
|
|
|
22494
24074
|
isDisabled: isDisabled,
|
|
22495
24075
|
isFocused: isFocused,
|
|
22496
24076
|
menuIsOpen: menuIsOpen
|
|
22497
|
-
}), /*#__PURE__*/React__namespace.createElement(ValueContainer, _extends$
|
|
24077
|
+
}), /*#__PURE__*/React__namespace.createElement(ValueContainer, _extends$f({}, commonProps, {
|
|
22498
24078
|
isDisabled: isDisabled
|
|
22499
|
-
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React__namespace.createElement(IndicatorsContainer, _extends$
|
|
24079
|
+
}), this.renderPlaceholderOrValue(), this.renderInput()), /*#__PURE__*/React__namespace.createElement(IndicatorsContainer, _extends$f({}, commonProps, {
|
|
22500
24080
|
isDisabled: isDisabled
|
|
22501
24081
|
}), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|
|
22502
24082
|
}
|
|
@@ -22569,7 +24149,7 @@ Select$1.defaultProps = defaultProps;
|
|
|
22569
24149
|
|
|
22570
24150
|
var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
22571
24151
|
var baseSelectProps = useStateManager(props);
|
|
22572
|
-
return /*#__PURE__*/React__namespace.createElement(Select$1, _extends$
|
|
24152
|
+
return /*#__PURE__*/React__namespace.createElement(Select$1, _extends$f({
|
|
22573
24153
|
ref: ref
|
|
22574
24154
|
}, baseSelectProps));
|
|
22575
24155
|
});
|
|
@@ -22577,9 +24157,9 @@ var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
22577
24157
|
var ReactSelect = StateManagedSelect;
|
|
22578
24158
|
|
|
22579
24159
|
var _g$5;
|
|
22580
|
-
function _extends$
|
|
24160
|
+
function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
|
|
22581
24161
|
var SvgIcAppstatusCancelled = function SvgIcAppstatusCancelled(props) {
|
|
22582
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24162
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
|
|
22583
24163
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22584
24164
|
viewBox: "0 0 28 28",
|
|
22585
24165
|
width: "1em",
|
|
@@ -22600,15 +24180,15 @@ var SvgIcAppstatusCancelled = function SvgIcAppstatusCancelled(props) {
|
|
|
22600
24180
|
}))));
|
|
22601
24181
|
};
|
|
22602
24182
|
|
|
22603
|
-
var _path$
|
|
22604
|
-
function _extends$
|
|
24183
|
+
var _path$7;
|
|
24184
|
+
function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
|
|
22605
24185
|
var SvgIcCheck = function SvgIcCheck(props) {
|
|
22606
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24186
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
22607
24187
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22608
24188
|
width: "1em",
|
|
22609
24189
|
height: "1em",
|
|
22610
24190
|
viewBox: "0 0 24 24"
|
|
22611
|
-
}, props), _path$
|
|
24191
|
+
}, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
22612
24192
|
stroke: "#06C",
|
|
22613
24193
|
strokeLinecap: "round",
|
|
22614
24194
|
strokeLinejoin: "round",
|
|
@@ -22620,9 +24200,9 @@ var SvgIcCheck = function SvgIcCheck(props) {
|
|
|
22620
24200
|
};
|
|
22621
24201
|
|
|
22622
24202
|
var _g$4;
|
|
22623
|
-
function _extends$
|
|
24203
|
+
function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
|
|
22624
24204
|
var SvgIcErrorMedium = function SvgIcErrorMedium(props) {
|
|
22625
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24205
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
|
|
22626
24206
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22627
24207
|
width: "1em",
|
|
22628
24208
|
height: "1em",
|
|
@@ -22937,6 +24517,9 @@ function createGitCommitUrl(url, revision) {
|
|
|
22937
24517
|
}
|
|
22938
24518
|
}
|
|
22939
24519
|
return "NA";
|
|
24520
|
+
}
|
|
24521
|
+
function fetchChartTemplateVersions() {
|
|
24522
|
+
return get("".concat(ROUTES.DEPLOYMENT_TEMPLATE_LIST, "?appId=-1&envId=-1"));
|
|
22940
24523
|
}
|
|
22941
24524
|
|
|
22942
24525
|
/*
|
|
@@ -22949,7 +24532,7 @@ Valid States of Checkbox:
|
|
|
22949
24532
|
6. disabled: false, checked: true, value: CHECKED
|
|
22950
24533
|
*/
|
|
22951
24534
|
var Checkbox$1 = /** @class */ (function (_super) {
|
|
22952
|
-
__extends(Checkbox, _super);
|
|
24535
|
+
__extends$1(Checkbox, _super);
|
|
22953
24536
|
function Checkbox() {
|
|
22954
24537
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
22955
24538
|
}
|
|
@@ -23097,9 +24680,9 @@ exports.ConsequenceAction = void 0;
|
|
|
23097
24680
|
})(exports.ConsequenceAction || (exports.ConsequenceAction = {}));
|
|
23098
24681
|
|
|
23099
24682
|
var _g$3;
|
|
23100
|
-
function _extends$
|
|
24683
|
+
function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
|
|
23101
24684
|
var SvgIcInfoFilled = function SvgIcInfoFilled(props) {
|
|
23102
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24685
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
|
|
23103
24686
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23104
24687
|
width: "1em",
|
|
23105
24688
|
height: "1em",
|
|
@@ -23178,16 +24761,16 @@ function DeleteComponent(_a) {
|
|
|
23178
24761
|
return (jsxRuntime.jsxs("div", { children: [!showCannotDeleteDialogModal && renderDeleteDialog(), showCannotDeleteDialogModal && renderCannotDeleteDialogModal()] }));
|
|
23179
24762
|
}
|
|
23180
24763
|
|
|
23181
|
-
var _path$
|
|
23182
|
-
function _extends$
|
|
24764
|
+
var _path$6;
|
|
24765
|
+
function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
|
|
23183
24766
|
var SvgIcPencil = function SvgIcPencil(props) {
|
|
23184
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24767
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
23185
24768
|
width: "1em",
|
|
23186
24769
|
height: "1em",
|
|
23187
24770
|
viewBox: "0 0 20 20",
|
|
23188
24771
|
fill: "none",
|
|
23189
24772
|
xmlns: "http://www.w3.org/2000/svg"
|
|
23190
|
-
}, props), _path$
|
|
24773
|
+
}, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
23191
24774
|
d: "M10.625 5 15 9.375m-7.5 7.5H3.75a.625.625 0 0 1-.625-.625v-3.491a.625.625 0 0 1 .183-.442l9.375-9.375a.625.625 0 0 1 .884 0l3.491 3.491a.625.625 0 0 1 0 .884L7.5 16.875Z",
|
|
23192
24775
|
stroke: "#596168",
|
|
23193
24776
|
strokeWidth: 1.5,
|
|
@@ -23196,16 +24779,16 @@ var SvgIcPencil = function SvgIcPencil(props) {
|
|
|
23196
24779
|
})));
|
|
23197
24780
|
};
|
|
23198
24781
|
|
|
23199
|
-
var _path$
|
|
23200
|
-
function _extends$
|
|
24782
|
+
var _path$5, _path2, _path3;
|
|
24783
|
+
function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
|
|
23201
24784
|
var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
|
|
23202
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24785
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
23203
24786
|
width: "1em",
|
|
23204
24787
|
height: "1em",
|
|
23205
24788
|
viewBox: "0 0 12 12",
|
|
23206
24789
|
fill: "none",
|
|
23207
24790
|
xmlns: "http://www.w3.org/2000/svg"
|
|
23208
|
-
}, props), _path$
|
|
24791
|
+
}, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
23209
24792
|
d: "M3.742 4.674h-2.25v-2.25",
|
|
23210
24793
|
fill: "#767D84"
|
|
23211
24794
|
})), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
@@ -23223,15 +24806,15 @@ var SvgIcArrowCounterClockwise = function SvgIcArrowCounterClockwise(props) {
|
|
|
23223
24806
|
})));
|
|
23224
24807
|
};
|
|
23225
24808
|
|
|
23226
|
-
var _path$
|
|
23227
|
-
function _extends$
|
|
24809
|
+
var _path$4;
|
|
24810
|
+
function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
|
|
23228
24811
|
var SvgIcMinus = function SvgIcMinus(props) {
|
|
23229
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24812
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
|
|
23230
24813
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23231
24814
|
width: "1em",
|
|
23232
24815
|
height: "1em",
|
|
23233
24816
|
viewBox: "0 0 14 14"
|
|
23234
|
-
}, props), _path$
|
|
24817
|
+
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
23235
24818
|
fill: "#959BA1",
|
|
23236
24819
|
className: "ic-minus_svg__fill-color",
|
|
23237
24820
|
fillRule: "evenodd",
|
|
@@ -23240,9 +24823,9 @@ var SvgIcMinus = function SvgIcMinus(props) {
|
|
|
23240
24823
|
};
|
|
23241
24824
|
|
|
23242
24825
|
var _g$2;
|
|
23243
|
-
function _extends$
|
|
24826
|
+
function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
|
|
23244
24827
|
var SvgIcWarning = function SvgIcWarning(props) {
|
|
23245
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24828
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
|
|
23246
24829
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23247
24830
|
width: "1em",
|
|
23248
24831
|
height: "1em",
|
|
@@ -23262,9 +24845,9 @@ var SvgIcWarning = function SvgIcWarning(props) {
|
|
|
23262
24845
|
};
|
|
23263
24846
|
|
|
23264
24847
|
var _g$1;
|
|
23265
|
-
function _extends$
|
|
24848
|
+
function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
|
|
23266
24849
|
var SvgIcErrorExclamation = function SvgIcErrorExclamation(props) {
|
|
23267
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24850
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
|
|
23268
24851
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23269
24852
|
width: "1em",
|
|
23270
24853
|
height: "1em",
|
|
@@ -23281,16 +24864,16 @@ var SvgIcErrorExclamation = function SvgIcErrorExclamation(props) {
|
|
|
23281
24864
|
}))));
|
|
23282
24865
|
};
|
|
23283
24866
|
|
|
23284
|
-
var _path$
|
|
23285
|
-
function _extends$
|
|
24867
|
+
var _path$3;
|
|
24868
|
+
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
23286
24869
|
var SvgIcEnter = function SvgIcEnter(props) {
|
|
23287
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
24870
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
23288
24871
|
width: "1em",
|
|
23289
24872
|
height: "1em",
|
|
23290
24873
|
viewBox: "0 0 16 16",
|
|
23291
24874
|
fill: "none",
|
|
23292
24875
|
xmlns: "http://www.w3.org/2000/svg"
|
|
23293
|
-
}, props), _path$
|
|
24876
|
+
}, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
23294
24877
|
d: "M12.667 4a.667.667 0 0 0-.667.667v2.666a.667.667 0 0 1-.667.667H4.94l.867-.86a.67.67 0 1 0-.947-.947l-2 2a.667.667 0 0 0-.14.22.667.667 0 0 0 0 .507c.032.082.08.157.14.22l2 2a.666.666 0 0 0 .947 0 .667.667 0 0 0 0-.947l-.867-.86h6.393a2 2 0 0 0 2-2V4.667A.667.667 0 0 0 12.667 4Z",
|
|
23295
24878
|
fill: "#3B444C"
|
|
23296
24879
|
})));
|
|
@@ -23649,9 +25232,9 @@ function useDebouncedEffect(callback, delay, deps) {
|
|
|
23649
25232
|
}
|
|
23650
25233
|
|
|
23651
25234
|
var _g;
|
|
23652
|
-
function _extends$
|
|
25235
|
+
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
23653
25236
|
var SvgIcErrorCross = function SvgIcErrorCross(props) {
|
|
23654
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
25237
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
23655
25238
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23656
25239
|
width: "1em",
|
|
23657
25240
|
height: "1em",
|
|
@@ -23703,7 +25286,7 @@ function DebouncedSearch(_a) {
|
|
|
23703
25286
|
|
|
23704
25287
|
// This is meant to be a reusable component that will provide a grid like dynamic layout where xs is the number of columns out of 12 that the item will take up
|
|
23705
25288
|
function Grid(_a) {
|
|
23706
|
-
var container = _a.container, _b = _a.spacing, spacing = _b === void 0 ? 0 : _b, item = _a.item, xs = _a.xs, _c = _a.containerClass, containerClass = _c === void 0 ? '' : _c, _d = _a.itemClass, itemClass = _d === void 0 ? '' : _d, children = _a.children;
|
|
25289
|
+
var container = _a.container, _b = _a.spacing, spacing = _b === void 0 ? 0 : _b, item = _a.item, xs = _a.xs, _c = _a.containerClass, containerClass = _c === void 0 ? '' : _c, _d = _a.itemClass, itemClass = _d === void 0 ? '' : _d, children = _a.children, containerDivProps = __rest(_a, ["container", "spacing", "item", "xs", "containerClass", "itemClass", "children"]);
|
|
23707
25290
|
var containerStyles = container ? { gap: spacing + 'px' } : {};
|
|
23708
25291
|
if (item) {
|
|
23709
25292
|
var getColumnWidth = function () {
|
|
@@ -23714,20 +25297,20 @@ function Grid(_a) {
|
|
|
23714
25297
|
var itemStyles = {
|
|
23715
25298
|
flex: "1 1 ".concat(getColumnWidth()),
|
|
23716
25299
|
};
|
|
23717
|
-
return (jsxRuntime.jsx("div", __assign({ className: "p-0 ".concat(itemClass), style: itemStyles }, { children: children })));
|
|
25300
|
+
return (jsxRuntime.jsx("div", __assign({ className: "p-0 ".concat(itemClass), style: itemStyles }, containerDivProps, { children: children })));
|
|
23718
25301
|
}
|
|
23719
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex-wrap flexbox ".concat(container ? containerClass : ''), style: containerStyles }, { children: children })));
|
|
25302
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex-wrap flexbox ".concat(container ? containerClass : ''), style: containerStyles }, containerDivProps, { children: children })));
|
|
23720
25303
|
}
|
|
23721
25304
|
|
|
23722
|
-
var _path$
|
|
23723
|
-
function _extends$
|
|
25305
|
+
var _path$2;
|
|
25306
|
+
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
23724
25307
|
var SvgIcCopy = function SvgIcCopy(props) {
|
|
23725
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
25308
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
|
|
23726
25309
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23727
25310
|
width: "1em",
|
|
23728
25311
|
height: "1em",
|
|
23729
25312
|
viewBox: "0 0 20 20"
|
|
23730
|
-
}, props), _path$
|
|
25313
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
23731
25314
|
fill: "#767D84",
|
|
23732
25315
|
fillRule: "evenodd",
|
|
23733
25316
|
d: "M15.833 6.917a2.5 2.5 0 0 1 2.5 2.5v6.416a2.5 2.5 0 0 1-2.5 2.5H9.417a2.5 2.5 0 0 1-2.5-2.5V9.417a2.5 2.5 0 0 1 2.5-2.5zm0 1.666H9.417a.833.833 0 0 0-.834.834v6.416c0 .46.373.834.834.834h6.416c.46 0 .834-.373.834-.834V9.417a.833.833 0 0 0-.834-.834zM10.75 1.667c1.24 0 2.256.968 2.33 2.19l.003.143v.75a.833.833 0 0 1-1.66.097l-.006-.097V4c0-.34-.255-.62-.583-.661l-.084-.006H4c-.34 0-.62.255-.661.583L3.333 4v6.75c0 .34.255.62.583.661l.084.006h.75a.833.833 0 0 1 .097 1.66l-.097.006H4a2.333 2.333 0 0 1-2.33-2.19l-.003-.143V4c0-1.24.968-2.256 2.19-2.33L4 1.668h6.75z"
|
|
@@ -23800,6 +25383,30 @@ var useClickOutside = function (ref, callback) {
|
|
|
23800
25383
|
}, [ref, callback]);
|
|
23801
25384
|
};
|
|
23802
25385
|
|
|
25386
|
+
function getSize() {
|
|
25387
|
+
return {
|
|
25388
|
+
width: window.innerWidth,
|
|
25389
|
+
height: window.innerHeight,
|
|
25390
|
+
};
|
|
25391
|
+
}
|
|
25392
|
+
function useWindowSize() {
|
|
25393
|
+
var timeout;
|
|
25394
|
+
var _a = __read(React.useState(getSize), 2), windowSize = _a[0], setWindowSize = _a[1];
|
|
25395
|
+
function handleResize(e) {
|
|
25396
|
+
if (timeout) {
|
|
25397
|
+
window.cancelAnimationFrame(timeout);
|
|
25398
|
+
}
|
|
25399
|
+
timeout = window.requestAnimationFrame(function () {
|
|
25400
|
+
setWindowSize(getSize());
|
|
25401
|
+
});
|
|
25402
|
+
}
|
|
25403
|
+
React.useEffect(function () {
|
|
25404
|
+
window.addEventListener('resize', handleResize, false);
|
|
25405
|
+
return function () { return window.removeEventListener('resize', handleResize, false); };
|
|
25406
|
+
}, []);
|
|
25407
|
+
return windowSize;
|
|
25408
|
+
}
|
|
25409
|
+
|
|
23803
25410
|
var StatusConstants = {
|
|
23804
25411
|
NOT_DEPLOYED: {
|
|
23805
25412
|
noSpaceLower: 'notdeployed',
|
|
@@ -26535,15 +28142,15 @@ var getInferredTypeFromValueType = function (value) {
|
|
|
26535
28142
|
}
|
|
26536
28143
|
};
|
|
26537
28144
|
|
|
26538
|
-
var _path;
|
|
26539
|
-
function _extends$
|
|
28145
|
+
var _path$1;
|
|
28146
|
+
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
26540
28147
|
var SvgIcChevronDown = function SvgIcChevronDown(props) {
|
|
26541
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
28148
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
26542
28149
|
xmlns: "http://www.w3.org/2000/svg",
|
|
26543
28150
|
width: "1em",
|
|
26544
28151
|
height: "1em",
|
|
26545
28152
|
viewBox: "0 0 24 24"
|
|
26546
|
-
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
28153
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
26547
28154
|
fill: "#999",
|
|
26548
28155
|
className: "ic-chevron-down_svg__fill-color",
|
|
26549
28156
|
fillRule: "nonzero",
|
|
@@ -26603,9 +28210,9 @@ var validator = RJSFValidator.default;
|
|
|
26603
28210
|
var RJSFForm = function (props) { return (jsxRuntime.jsx(Form, __assign({ noHtml5Validate: true, showErrorList: false, autoComplete: "off" }, props, { validator: validator, templates: __assign(__assign({}, templates), props.templates), widgets: __assign(__assign({}, widgets), props.widgets), translateString: translateString }))); };
|
|
26604
28211
|
|
|
26605
28212
|
var _style, _rect;
|
|
26606
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
28213
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
26607
28214
|
var SvgIcRotateDevtron = function SvgIcRotateDevtron(props) {
|
|
26608
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
28215
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
26609
28216
|
width: "1em",
|
|
26610
28217
|
height: "1em",
|
|
26611
28218
|
viewBox: "0 0 100 100",
|
|
@@ -26651,6 +28258,53 @@ function DevtronProgressing(_a) {
|
|
|
26651
28258
|
return (jsxRuntime.jsx("div", __assign({ className: parentClasses ? parentClasses : '' }, { children: jsxRuntime.jsx(SvgIcRotateDevtron, { className: classes ? classes : '' }) })));
|
|
26652
28259
|
}
|
|
26653
28260
|
|
|
28261
|
+
// @TODO: Generalize this component to be used in CodeEditor as Chart selector toolbar
|
|
28262
|
+
// when the Code Editor is moved to the fe-common-lib
|
|
28263
|
+
var ChartVersionAndTypeSelector = function (_a) {
|
|
28264
|
+
var setSelectedChartRefId = _a.setSelectedChartRefId;
|
|
28265
|
+
var _b = __read(React.useState([]), 2), charts = _b[0], setCharts = _b[1];
|
|
28266
|
+
var _c = __read(React.useState(null), 2), selectedChartType = _c[0], setSelectedChartType = _c[1];
|
|
28267
|
+
var _d = __read(React.useState([]), 2), chartVersionOptions = _d[0], setChartVersionOptions = _d[1];
|
|
28268
|
+
var _e = __read(React.useState([]), 2), chartTypeOptions = _e[0], setChartTypeOptions = _e[1];
|
|
28269
|
+
var _f = __read(React.useState(null), 2), selectedChartVersion = _f[0], setSelectedChartVersion = _f[1];
|
|
28270
|
+
React.useEffect(function () {
|
|
28271
|
+
fetchChartTemplateVersions()
|
|
28272
|
+
.then(function (res) {
|
|
28273
|
+
var charts = (res === null || res === void 0 ? void 0 : res.result) || [];
|
|
28274
|
+
setCharts(charts);
|
|
28275
|
+
// Extract unique chart types from the data
|
|
28276
|
+
var chartTypeOptions = __spreadArray([], __read(new Set(charts.map(function (item) { return item.chartType; }))), false).map(function (type) { return ({
|
|
28277
|
+
value: type,
|
|
28278
|
+
label: type,
|
|
28279
|
+
}); });
|
|
28280
|
+
setChartTypeOptions(chartTypeOptions);
|
|
28281
|
+
var filteredVersions = getFilteredChartVersions(charts, chartTypeOptions[0]);
|
|
28282
|
+
selectFirstChartVersion(filteredVersions);
|
|
28283
|
+
})
|
|
28284
|
+
.catch(function (err) {
|
|
28285
|
+
showError(err);
|
|
28286
|
+
});
|
|
28287
|
+
}, []);
|
|
28288
|
+
var selectFirstChartVersion = function (filteredVersions) {
|
|
28289
|
+
var _a;
|
|
28290
|
+
setChartVersionOptions(filteredVersions);
|
|
28291
|
+
setSelectedChartVersion(filteredVersions[0]); // Select the first chart version by default
|
|
28292
|
+
setSelectedChartRefId((_a = filteredVersions[0]) === null || _a === void 0 ? void 0 : _a.chartRefId);
|
|
28293
|
+
};
|
|
28294
|
+
// Function to update chart version options based on selected chart type
|
|
28295
|
+
var handleChartTypeChange = function (selectedOption) {
|
|
28296
|
+
setSelectedChartType(selectedOption);
|
|
28297
|
+
var filteredVersions = getFilteredChartVersions(charts, selectedOption);
|
|
28298
|
+
selectFirstChartVersion(filteredVersions);
|
|
28299
|
+
};
|
|
28300
|
+
// Function to handle the change of the selected chart version
|
|
28301
|
+
var handleChartVersionChange = function (selectedOption) {
|
|
28302
|
+
setSelectedChartVersion(selectedOption);
|
|
28303
|
+
setSelectedChartRefId(selectedOption.chartRefId);
|
|
28304
|
+
};
|
|
28305
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "chart-type-options flex", "data-testid": "chart-type-options" }, { children: [jsxRuntime.jsx("span", __assign({ className: "chart-type-options-label mr-4" }, { children: "Chart Type" })), jsxRuntime.jsx(ReactSelect, { value: selectedChartType !== null && selectedChartType !== void 0 ? selectedChartType : chartTypeOptions[0], options: chartTypeOptions, onChange: handleChartTypeChange, styles: customStyles })] })), jsxRuntime.jsxs("div", __assign({ className: "chart-version-options flex", "data-testid": "chart-version-options" }, { children: [jsxRuntime.jsx("span", __assign({ className: "chart-version-options-label mr-4" }, { children: "Chart Version" })), jsxRuntime.jsx(ReactSelect, { value: selectedChartVersion !== null && selectedChartVersion !== void 0 ? selectedChartVersion : chartVersionOptions[0], options: chartVersionOptions, onChange: handleChartVersionChange, styles: customStyles })] }))] })));
|
|
28306
|
+
};
|
|
28307
|
+
|
|
26654
28308
|
function TooltipContent(_a) {
|
|
26655
28309
|
var tooltipContent = _a.tooltipContent;
|
|
26656
28310
|
if (tooltipContent) {
|
|
@@ -26749,12 +28403,112 @@ function CustomInput(_a) {
|
|
|
26749
28403
|
}, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus, readOnly: readOnly, ref: ref, onKeyPress: onKeyPress, defaultValue: defaultValue, onKeyDown: onKeyDown, required: required }), getInputError(), helperText && (jsxRuntime.jsxs("div", __assign({ className: "form__text-field-info" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon form__icon--info" }), jsxRuntime.jsx("p", __assign({ className: "sentence-case" }, { children: helperText }))] })))] })));
|
|
26750
28404
|
}
|
|
26751
28405
|
|
|
28406
|
+
exports.DraggablePositionVariant = void 0;
|
|
28407
|
+
(function (DraggablePositionVariant) {
|
|
28408
|
+
DraggablePositionVariant["PARENT_BOTTOM_CENTER"] = "PARENT_BOTTOM_CENTER";
|
|
28409
|
+
DraggablePositionVariant["SCREEN_BOTTOM_CENTER"] = "SCREEN_BOTTOM_CENTER";
|
|
28410
|
+
// Can add more based on requirement
|
|
28411
|
+
})(exports.DraggablePositionVariant || (exports.DraggablePositionVariant = {}));
|
|
28412
|
+
|
|
28413
|
+
/**
|
|
28414
|
+
* TODO: import it as lazy, after it is supported in common
|
|
28415
|
+
* 1. If using react select please use menuPlacement='auto'
|
|
28416
|
+
* 2. dragClassName will be used to identify the grabbable button that will grab the div to drag
|
|
28417
|
+
* 3. parentRef is the reference point from which we will derive the base top:0 ,left: 0 position
|
|
28418
|
+
*/
|
|
28419
|
+
function DraggableWrapper(_a) {
|
|
28420
|
+
var children = _a.children, _b = _a.zIndex, zIndex = _b === void 0 ? MAX_Z_INDEX : _b, positionVariant = _a.positionVariant, dragClassName = _a.dragClassName, parentRef = _a.parentRef, _c = _a.boundaryGap, boundaryGap = _c === void 0 ? 16 : _c, _d = _a.childDivProps, childDivProps = _d === void 0 ? {} : _d;
|
|
28421
|
+
var windowSize = useWindowSize();
|
|
28422
|
+
var nodeRef = React.useRef(null);
|
|
28423
|
+
var getDefaultPosition = function (positionVariant) {
|
|
28424
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28425
|
+
// if i return x: 0, y: 0 then it will be top left corner of parentDiv
|
|
28426
|
+
var parentRect = (_b = (_a = parentRef === null || parentRef === void 0 ? void 0 : parentRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : {
|
|
28427
|
+
width: 0,
|
|
28428
|
+
height: 0,
|
|
28429
|
+
top: 0,
|
|
28430
|
+
left: 0,
|
|
28431
|
+
bottom: 0,
|
|
28432
|
+
};
|
|
28433
|
+
switch (positionVariant) {
|
|
28434
|
+
case exports.DraggablePositionVariant.PARENT_BOTTOM_CENTER: {
|
|
28435
|
+
var x = parentRect.width / 2 - ((_c = nodeRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().width) / 2;
|
|
28436
|
+
var y = Math.min(parentRect.height, windowSize.height) -
|
|
28437
|
+
parentRect.top -
|
|
28438
|
+
((_d = nodeRef.current) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect().height) -
|
|
28439
|
+
boundaryGap;
|
|
28440
|
+
return { x: x, y: y };
|
|
28441
|
+
}
|
|
28442
|
+
case exports.DraggablePositionVariant.SCREEN_BOTTOM_CENTER: {
|
|
28443
|
+
var x = windowSize.width / 2 - parentRect.left - ((_e = nodeRef.current) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect().width) / 2;
|
|
28444
|
+
var y = windowSize.height - parentRect.top - ((_f = nodeRef.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect().height) - boundaryGap;
|
|
28445
|
+
return { x: x, y: y };
|
|
28446
|
+
}
|
|
28447
|
+
// Add more cases for other variants if needed
|
|
28448
|
+
default:
|
|
28449
|
+
throw new Error('Please use DraggablePositionVariant enum');
|
|
28450
|
+
}
|
|
28451
|
+
};
|
|
28452
|
+
var _e = __read(React.useState({
|
|
28453
|
+
x: 0,
|
|
28454
|
+
y: 0,
|
|
28455
|
+
}), 2), position = _e[0], setPosition = _e[1];
|
|
28456
|
+
// On change of windowSize we will reset the position to default
|
|
28457
|
+
React.useEffect(function () {
|
|
28458
|
+
var defaultPosition = getDefaultPosition(positionVariant);
|
|
28459
|
+
setPosition(defaultPosition);
|
|
28460
|
+
}, [nodeRef, positionVariant, windowSize]);
|
|
28461
|
+
function handlePositionChange(e, data) {
|
|
28462
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28463
|
+
var offsetX = (_b = (_a = parentRef === null || parentRef === void 0 ? void 0 : parentRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left) !== null && _b !== void 0 ? _b : 0;
|
|
28464
|
+
var offsetY = (_d = (_c = parentRef === null || parentRef === void 0 ? void 0 : parentRef.current) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top) !== null && _d !== void 0 ? _d : 0;
|
|
28465
|
+
if (offsetX + data.x + ((_e = nodeRef.current) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect().width) + boundaryGap > windowSize.width ||
|
|
28466
|
+
offsetY + data.y + ((_f = nodeRef.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect().height) + boundaryGap > windowSize.height ||
|
|
28467
|
+
offsetX + data.x < 0 ||
|
|
28468
|
+
offsetY + data.y < 0) {
|
|
28469
|
+
return;
|
|
28470
|
+
}
|
|
28471
|
+
setPosition({
|
|
28472
|
+
x: data.x,
|
|
28473
|
+
y: data.y,
|
|
28474
|
+
});
|
|
28475
|
+
}
|
|
28476
|
+
return (
|
|
28477
|
+
// Check there might be a case if we need it to be absolute?
|
|
28478
|
+
jsxRuntime.jsx("div", __assign({ className: "dc__position-fixed", style: {
|
|
28479
|
+
zIndex: zIndex,
|
|
28480
|
+
} }, { children: jsxRuntime.jsx(Draggable, __assign({ handle: ".".concat(dragClassName), nodeRef: nodeRef, position: position, onDrag: handlePositionChange }, { children: jsxRuntime.jsx("div", __assign({ ref: nodeRef }, childDivProps, { style: {
|
|
28481
|
+
zIndex: zIndex,
|
|
28482
|
+
} }, { children: children })) })) })));
|
|
28483
|
+
}
|
|
28484
|
+
|
|
28485
|
+
var _path;
|
|
28486
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
28487
|
+
var SvgIcDrag = function SvgIcDrag(props) {
|
|
28488
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
28489
|
+
width: "1em",
|
|
28490
|
+
height: "1em",
|
|
28491
|
+
viewBox: "0 0 16 16",
|
|
28492
|
+
fill: "none",
|
|
28493
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
28494
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
28495
|
+
d: "M10.334 9.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 9.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM10.334 5.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 5.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM10.334 13.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 13.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
|
|
28496
|
+
fill: "#596168"
|
|
28497
|
+
})));
|
|
28498
|
+
};
|
|
28499
|
+
|
|
28500
|
+
function DraggableButton(_a) {
|
|
28501
|
+
var dragClassName = _a.dragClassName;
|
|
28502
|
+
return (jsxRuntime.jsx("button", __assign({ type: "button", className: "dc__outline-none-imp dc__no-border p-0 dc__transparent h-20" }, { children: jsxRuntime.jsx(SvgIcDrag, { className: "".concat(dragClassName, " dc__grabbable icon-dim-20 fcn-6") }) })));
|
|
28503
|
+
}
|
|
28504
|
+
|
|
26752
28505
|
exports.AddCDButton = AddCDButton;
|
|
26753
28506
|
exports.AppStatus = AppStatus;
|
|
26754
28507
|
exports.BreadCrumb = BreadCrumb;
|
|
26755
28508
|
exports.BreadcrumbStore = Store;
|
|
26756
28509
|
exports.BuildStageVariable = BuildStageVariable;
|
|
26757
28510
|
exports.CDModalTab = CDModalTab;
|
|
28511
|
+
exports.ChartVersionAndTypeSelector = ChartVersionAndTypeSelector;
|
|
26758
28512
|
exports.Checkbox = Checkbox$1;
|
|
26759
28513
|
exports.ClearIndicator = ClearIndicator;
|
|
26760
28514
|
exports.ClipboardButton = ClipboardButton;
|
|
@@ -26772,6 +28526,8 @@ exports.DetailsProgressing = DetailsProgressing;
|
|
|
26772
28526
|
exports.DevtronProgressing = DevtronProgressing;
|
|
26773
28527
|
exports.DialogForm = DialogForm;
|
|
26774
28528
|
exports.DialogFormSubmit = DialogFormSubmit;
|
|
28529
|
+
exports.DraggableButton = DraggableButton;
|
|
28530
|
+
exports.DraggableWrapper = DraggableWrapper;
|
|
26775
28531
|
exports.Drawer = Drawer;
|
|
26776
28532
|
exports.ERROR_EMPTY_SCREEN = ERROR_EMPTY_SCREEN;
|
|
26777
28533
|
exports.EmptyState = EmptyState;
|
|
@@ -26785,6 +28541,7 @@ exports.Host = Host;
|
|
|
26785
28541
|
exports.ImageTagButton = ImageTagButton;
|
|
26786
28542
|
exports.ImageTagsContainer = ImageTagsContainer;
|
|
26787
28543
|
exports.InfoColourBar = InfoColourBar;
|
|
28544
|
+
exports.MAX_Z_INDEX = MAX_Z_INDEX;
|
|
26788
28545
|
exports.Modal = Modal;
|
|
26789
28546
|
exports.MultiValueChipContainer = MultiValueChipContainer;
|
|
26790
28547
|
exports.MultiValueContainer = MultiValueContainer;
|
|
@@ -26827,17 +28584,22 @@ exports.VisibleModal2 = VisibleModal2;
|
|
|
26827
28584
|
exports.closeOnEscKeyPressed = closeOnEscKeyPressed;
|
|
26828
28585
|
exports.copyToClipboard = copyToClipboard;
|
|
26829
28586
|
exports.createGitCommitUrl = createGitCommitUrl;
|
|
28587
|
+
exports.customStyles = customStyles;
|
|
26830
28588
|
exports.extractImage = extractImage;
|
|
28589
|
+
exports.fetchChartTemplateVersions = fetchChartTemplateVersions;
|
|
26831
28590
|
exports.genericCDMaterialsService = genericCDMaterialsService;
|
|
26832
28591
|
exports.get = get;
|
|
26833
28592
|
exports.getAlphabetIcon = getAlphabetIcon;
|
|
26834
28593
|
exports.getCookie = getCookie;
|
|
26835
28594
|
exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
|
|
28595
|
+
exports.getFilteredChartVersions = getFilteredChartVersions;
|
|
26836
28596
|
exports.getInferredTypeFromValueType = getInferredTypeFromValueType;
|
|
28597
|
+
exports.getLockedJSON = getLockedJSON;
|
|
26837
28598
|
exports.getLoginInfo = getLoginInfo;
|
|
26838
28599
|
exports.getRandomColor = getRandomColor;
|
|
26839
28600
|
exports.getRedirectionProps = getRedirectionProps;
|
|
26840
28601
|
exports.getTeamListMin = getTeamListMin;
|
|
28602
|
+
exports.getUnlockedJSON = getUnlockedJSON;
|
|
26841
28603
|
exports.getUrlWithSearchParams = getUrlWithSearchParams;
|
|
26842
28604
|
exports.getUserRole = getUserRole;
|
|
26843
28605
|
exports.handleAddCD = handleAddCD;
|
|
@@ -26863,3 +28625,4 @@ exports.useForm = useForm;
|
|
|
26863
28625
|
exports.useSearchString = useSearchString;
|
|
26864
28626
|
exports.useSuperAdmin = useSuperAdmin;
|
|
26865
28627
|
exports.useThrottledEffect = useThrottledEffect;
|
|
28628
|
+
exports.useWindowSize = useWindowSize;
|