@compill/admin 1.0.93 → 1.0.94
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/index.cjs.js +311 -473
- package/index.esm.js +246 -400
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -11,7 +11,7 @@ import { useFormikContext, Formik, Form } from 'formik';
|
|
|
11
11
|
import { ButtonBarButton as ButtonBarButton$1, ButtonBarSubmitButton as ButtonBarSubmitButton$1, PageSectionTitle as PageSectionTitle$1, ButtonBar as ButtonBar$1, ButtonBarDialogButton as ButtonBarDialogButton$1, Breadcrumbs as Breadcrumbs$1, TableRowActionButton as TableRowActionButton$1, DialogButton as DialogButton$1 } from '@compill/admin';
|
|
12
12
|
import { toast } from 'react-toastify';
|
|
13
13
|
import 'react/jsx-runtime';
|
|
14
|
-
import { FormProvider,
|
|
14
|
+
import { FormProvider, FormRenderer, TextArea, mergeInitialFormValues, FieldLabel, SubmitButton } from '@compill/form';
|
|
15
15
|
import { createContext as createContext$1, runIfFn, isFunction } from '@soperio/react';
|
|
16
16
|
import { FormEditor } from '@compill/form-editor';
|
|
17
17
|
import { ImageExtension } from '@compill/editor';
|
|
@@ -60,20 +60,8 @@ var mdiPublish = "M5,4V6H19V4H5M5,14H9V20H15V14H19L12,7L5,14Z";
|
|
|
60
60
|
var mdiPublishOff = "M20.8 22.7L15 16.9V20H9V14H5L8.6 10.4L1.1 3L2.4 1.7L22.1 21.4L20.8 22.7M19 6V4H7.2L9.2 6H19M17.2 14H19L12 7L11.1 7.9L17.2 14Z";
|
|
61
61
|
var mdiRefresh = "M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";
|
|
62
62
|
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
function isPlainObject(value) {
|
|
66
|
-
if (!value || typeof value !== 'object') {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
const proto = Object.getPrototypeOf(value);
|
|
70
|
-
const hasObjectPrototype = proto === null ||
|
|
71
|
-
proto === Object.prototype ||
|
|
72
|
-
Object.getPrototypeOf(proto) === null;
|
|
73
|
-
if (!hasObjectPrototype) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
|
63
|
+
function eq(value, other) {
|
|
64
|
+
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
|
77
65
|
}
|
|
78
66
|
|
|
79
67
|
function getSymbols(object) {
|
|
@@ -114,8 +102,22 @@ const bigInt64ArrayTag = '[object BigInt64Array]';
|
|
|
114
102
|
const float32ArrayTag = '[object Float32Array]';
|
|
115
103
|
const float64ArrayTag = '[object Float64Array]';
|
|
116
104
|
|
|
117
|
-
function
|
|
118
|
-
return
|
|
105
|
+
function isArray(value) {
|
|
106
|
+
return Array.isArray(value);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isPlainObject(value) {
|
|
110
|
+
if (!value || typeof value !== 'object') {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
const proto = Object.getPrototypeOf(value);
|
|
114
|
+
const hasObjectPrototype = proto === null ||
|
|
115
|
+
proto === Object.prototype ||
|
|
116
|
+
Object.getPrototypeOf(proto) === null;
|
|
117
|
+
if (!hasObjectPrototype) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
function isEqualWith(a, b, areValuesEqual) {
|
|
@@ -296,6 +298,8 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
296
298
|
}
|
|
297
299
|
}
|
|
298
300
|
|
|
301
|
+
function noop() { }
|
|
302
|
+
|
|
299
303
|
function isEqual(a, b) {
|
|
300
304
|
return isEqualWith(a, b, noop);
|
|
301
305
|
}
|
|
@@ -304,10 +308,6 @@ function capitalize(str) {
|
|
|
304
308
|
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
|
305
309
|
}
|
|
306
310
|
|
|
307
|
-
function isArray(value) {
|
|
308
|
-
return Array.isArray(value);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
311
|
function Breadcrumbs(_a) {
|
|
312
312
|
var {
|
|
313
313
|
breadcrumbs
|
|
@@ -468,9 +468,7 @@ const ButtonBarSubmitButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
468
468
|
handleSubmit
|
|
469
469
|
} = (_b = useFormikContext()) !== null && _b !== void 0 ? _b : {
|
|
470
470
|
dirty: false,
|
|
471
|
-
handleSubmit: undefined
|
|
472
|
-
values: {}
|
|
473
|
-
};
|
|
471
|
+
handleSubmit: undefined};
|
|
474
472
|
const onSubmit = React.useCallback(() => handleSubmit(), [handleSubmit]);
|
|
475
473
|
return jsxs(Button, Object.assign({
|
|
476
474
|
scheme: "dark",
|
|
@@ -580,391 +578,238 @@ function PublishButton(_a) {
|
|
|
580
578
|
}));
|
|
581
579
|
}
|
|
582
580
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
esc: 'escape',
|
|
601
|
-
"return": 'enter',
|
|
602
|
-
'.': 'period',
|
|
603
|
-
',': 'comma',
|
|
604
|
-
'-': 'slash',
|
|
605
|
-
' ': 'space',
|
|
606
|
-
'`': 'backquote',
|
|
607
|
-
'#': 'backslash',
|
|
608
|
-
'+': 'bracketright',
|
|
609
|
-
ShiftLeft: 'shift',
|
|
610
|
-
ShiftRight: 'shift',
|
|
611
|
-
AltLeft: 'alt',
|
|
612
|
-
AltRight: 'alt',
|
|
613
|
-
MetaLeft: 'meta',
|
|
614
|
-
MetaRight: 'meta',
|
|
615
|
-
OSLeft: 'meta',
|
|
616
|
-
OSRight: 'meta',
|
|
617
|
-
ControlLeft: 'ctrl',
|
|
618
|
-
ControlRight: 'ctrl'
|
|
581
|
+
const j = ["shift", "alt", "meta", "mod", "ctrl", "control"], Q = {
|
|
582
|
+
esc: "escape",
|
|
583
|
+
return: "enter",
|
|
584
|
+
left: "arrowleft",
|
|
585
|
+
right: "arrowright",
|
|
586
|
+
up: "arrowup",
|
|
587
|
+
down: "arrowdown",
|
|
588
|
+
ShiftLeft: "shift",
|
|
589
|
+
ShiftRight: "shift",
|
|
590
|
+
AltLeft: "alt",
|
|
591
|
+
AltRight: "alt",
|
|
592
|
+
MetaLeft: "meta",
|
|
593
|
+
MetaRight: "meta",
|
|
594
|
+
OSLeft: "meta",
|
|
595
|
+
OSRight: "meta",
|
|
596
|
+
ControlLeft: "ctrl",
|
|
597
|
+
ControlRight: "ctrl"
|
|
619
598
|
};
|
|
620
|
-
function
|
|
621
|
-
return (
|
|
622
|
-
}
|
|
623
|
-
function
|
|
624
|
-
return
|
|
625
|
-
}
|
|
626
|
-
function
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
599
|
+
function K(e) {
|
|
600
|
+
return (Q[e.trim()] || e.trim()).toLowerCase().replace(/key|digit|numpad/, "");
|
|
601
|
+
}
|
|
602
|
+
function D(e) {
|
|
603
|
+
return j.includes(e);
|
|
604
|
+
}
|
|
605
|
+
function H(e, r = ",") {
|
|
606
|
+
return e.toLowerCase().split(r);
|
|
607
|
+
}
|
|
608
|
+
function P(e, r = "+", o = ">", i = false, u) {
|
|
609
|
+
let n = [], c = false;
|
|
610
|
+
e = e.trim(), e.includes(o) ? (c = true, n = e.toLocaleLowerCase().split(o).map((f) => K(f))) : n = e.toLocaleLowerCase().split(r).map((f) => K(f));
|
|
611
|
+
const y = {
|
|
612
|
+
alt: n.includes("alt"),
|
|
613
|
+
ctrl: n.includes("ctrl") || n.includes("control"),
|
|
614
|
+
shift: n.includes("shift"),
|
|
615
|
+
meta: n.includes("meta"),
|
|
616
|
+
mod: n.includes("mod"),
|
|
617
|
+
useKey: i
|
|
618
|
+
}, d = n.filter((f) => !j.includes(f));
|
|
619
|
+
return {
|
|
620
|
+
...y,
|
|
621
|
+
keys: d,
|
|
622
|
+
description: u,
|
|
623
|
+
isSequence: c,
|
|
624
|
+
hotkey: e
|
|
645
625
|
};
|
|
646
|
-
var singleCharKeys = keys.filter(function (k) {
|
|
647
|
-
return !reservedModifierKeywords.includes(k);
|
|
648
|
-
});
|
|
649
|
-
return _extends({}, modifiers, {
|
|
650
|
-
keys: singleCharKeys,
|
|
651
|
-
description: description
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
(function () {
|
|
656
|
-
if (typeof document !== 'undefined') {
|
|
657
|
-
document.addEventListener('keydown', function (e) {
|
|
658
|
-
if (e.key === undefined) {
|
|
659
|
-
// Synthetic event (e.g., Chrome autofill). Ignore.
|
|
660
|
-
return;
|
|
661
|
-
}
|
|
662
|
-
pushToCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);
|
|
663
|
-
});
|
|
664
|
-
document.addEventListener('keyup', function (e) {
|
|
665
|
-
if (e.key === undefined) {
|
|
666
|
-
// Synthetic event (e.g., Chrome autofill). Ignore.
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
removeFromCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
if (typeof window !== 'undefined') {
|
|
673
|
-
window.addEventListener('blur', function () {
|
|
674
|
-
currentlyPressedKeys.clear();
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
})();
|
|
678
|
-
var currentlyPressedKeys = /*#__PURE__*/new Set();
|
|
679
|
-
// https://github.com/microsoft/TypeScript/issues/17002
|
|
680
|
-
function isReadonlyArray(value) {
|
|
681
|
-
return Array.isArray(value);
|
|
682
|
-
}
|
|
683
|
-
function isHotkeyPressed(key, splitKey) {
|
|
684
|
-
if (splitKey === void 0) {
|
|
685
|
-
splitKey = ',';
|
|
686
|
-
}
|
|
687
|
-
var hotkeyArray = isReadonlyArray(key) ? key : key.split(splitKey);
|
|
688
|
-
return hotkeyArray.every(function (hotkey) {
|
|
689
|
-
return currentlyPressedKeys.has(hotkey.trim().toLowerCase());
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
function pushToCurrentlyPressedKeys(key) {
|
|
693
|
-
var hotkeyArray = Array.isArray(key) ? key : [key];
|
|
694
|
-
/*
|
|
695
|
-
Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.
|
|
696
|
-
https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser
|
|
697
|
-
Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.
|
|
698
|
-
*/
|
|
699
|
-
if (currentlyPressedKeys.has('meta')) {
|
|
700
|
-
currentlyPressedKeys.forEach(function (key) {
|
|
701
|
-
return !isHotkeyModifier(key) && currentlyPressedKeys["delete"](key.toLowerCase());
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
hotkeyArray.forEach(function (hotkey) {
|
|
705
|
-
return currentlyPressedKeys.add(hotkey.toLowerCase());
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
function removeFromCurrentlyPressedKeys(key) {
|
|
709
|
-
var hotkeyArray = Array.isArray(key) ? key : [key];
|
|
710
|
-
/*
|
|
711
|
-
Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.
|
|
712
|
-
https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser
|
|
713
|
-
Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.
|
|
714
|
-
*/
|
|
715
|
-
if (key === 'meta') {
|
|
716
|
-
currentlyPressedKeys.clear();
|
|
717
|
-
} else {
|
|
718
|
-
hotkeyArray.forEach(function (hotkey) {
|
|
719
|
-
return currentlyPressedKeys["delete"](hotkey.toLowerCase());
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
function maybePreventDefault(e, hotkey, preventDefault) {
|
|
725
|
-
if (typeof preventDefault === 'function' && preventDefault(e, hotkey) || preventDefault === true) {
|
|
726
|
-
e.preventDefault();
|
|
727
|
-
}
|
|
728
626
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
function
|
|
752
|
-
|
|
753
|
-
|
|
627
|
+
typeof document < "u" && (document.addEventListener("keydown", (e) => {
|
|
628
|
+
e.code !== void 0 && I([K(e.code)]);
|
|
629
|
+
}), document.addEventListener("keyup", (e) => {
|
|
630
|
+
e.code !== void 0 && _([K(e.code)]);
|
|
631
|
+
})), typeof window < "u" && (window.addEventListener("blur", () => {
|
|
632
|
+
L.clear();
|
|
633
|
+
}), window.addEventListener("contextmenu", () => {
|
|
634
|
+
setTimeout(() => {
|
|
635
|
+
L.clear();
|
|
636
|
+
}, 0);
|
|
637
|
+
}));
|
|
638
|
+
const L = /* @__PURE__ */ new Set();
|
|
639
|
+
function R(e) {
|
|
640
|
+
return Array.isArray(e);
|
|
641
|
+
}
|
|
642
|
+
function U(e, r = ",") {
|
|
643
|
+
return (R(e) ? e : e.split(r)).every((i) => L.has(i.trim().toLowerCase()));
|
|
644
|
+
}
|
|
645
|
+
function I(e) {
|
|
646
|
+
const r = Array.isArray(e) ? e : [e];
|
|
647
|
+
L.has("meta") && L.forEach((o) => !D(o) && L.delete(o.toLowerCase())), r.forEach((o) => L.add(o.toLowerCase()));
|
|
648
|
+
}
|
|
649
|
+
function _(e) {
|
|
650
|
+
const r = Array.isArray(e) ? e : [e];
|
|
651
|
+
e === "meta" ? L.clear() : r.forEach((o) => L.delete(o.toLowerCase()));
|
|
652
|
+
}
|
|
653
|
+
function V(e, r, o) {
|
|
654
|
+
(typeof o == "function" && o(e, r) || o === true) && e.preventDefault();
|
|
655
|
+
}
|
|
656
|
+
function X(e, r, o) {
|
|
657
|
+
return typeof o == "function" ? o(e, r) : o === true || o === void 0;
|
|
658
|
+
}
|
|
659
|
+
const Y = [
|
|
660
|
+
"input",
|
|
661
|
+
"textarea",
|
|
662
|
+
"select",
|
|
663
|
+
"searchbox",
|
|
664
|
+
"slider",
|
|
665
|
+
"spinbutton",
|
|
666
|
+
"menuitem",
|
|
667
|
+
"menuitemcheckbox",
|
|
668
|
+
"menuitemradio",
|
|
669
|
+
"option",
|
|
670
|
+
"radio",
|
|
671
|
+
"textbox"
|
|
672
|
+
];
|
|
673
|
+
function Z(e) {
|
|
674
|
+
return F(e, Y);
|
|
675
|
+
}
|
|
676
|
+
function F(e, r = false) {
|
|
677
|
+
const { target: o, composed: i } = e;
|
|
678
|
+
let u, n;
|
|
679
|
+
return ee(o) && i ? (u = e.composedPath()[0] && e.composedPath()[0].tagName, n = e.composedPath()[0] && e.composedPath()[0].role) : (u = o && o.tagName, n = o && o.role), R(r) ? !!(u && r && r.some((c) => c.toLowerCase() === u.toLowerCase() || c === n)) : !!(u && r && r);
|
|
680
|
+
}
|
|
681
|
+
function ee(e) {
|
|
682
|
+
return !!e.tagName && !e.tagName.startsWith("-") && e.tagName.includes("-");
|
|
683
|
+
}
|
|
684
|
+
function te(e, r) {
|
|
685
|
+
return e.length === 0 && r ? (console.warn(
|
|
686
|
+
'A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'
|
|
687
|
+
), true) : r ? e.some((o) => r.includes(o)) || e.includes("*") : true;
|
|
688
|
+
}
|
|
689
|
+
const re = (e, r, o = false) => {
|
|
690
|
+
const { alt: i, meta: u, mod: n, shift: c, ctrl: y, keys: d, useKey: f } = r, { code: p, key: t, ctrlKey: a, metaKey: l, shiftKey: g, altKey: k } = e, m = K(p);
|
|
691
|
+
if (f && d?.length === 1 && d.includes(t))
|
|
754
692
|
return true;
|
|
755
|
-
|
|
756
|
-
if (!scopes) {
|
|
757
|
-
return true;
|
|
758
|
-
}
|
|
759
|
-
return activeScopes.some(function (scope) {
|
|
760
|
-
return scopes.includes(scope);
|
|
761
|
-
}) || activeScopes.includes('*');
|
|
762
|
-
}
|
|
763
|
-
var isHotkeyMatchingKeyboardEvent = function isHotkeyMatchingKeyboardEvent(e, hotkey, ignoreModifiers) {
|
|
764
|
-
if (ignoreModifiers === void 0) {
|
|
765
|
-
ignoreModifiers = false;
|
|
766
|
-
}
|
|
767
|
-
var alt = hotkey.alt,
|
|
768
|
-
meta = hotkey.meta,
|
|
769
|
-
mod = hotkey.mod,
|
|
770
|
-
shift = hotkey.shift,
|
|
771
|
-
ctrl = hotkey.ctrl,
|
|
772
|
-
keys = hotkey.keys;
|
|
773
|
-
var pressedKeyUppercase = e.key,
|
|
774
|
-
code = e.code,
|
|
775
|
-
ctrlKey = e.ctrlKey,
|
|
776
|
-
metaKey = e.metaKey,
|
|
777
|
-
shiftKey = e.shiftKey,
|
|
778
|
-
altKey = e.altKey;
|
|
779
|
-
var keyCode = mapKey(code);
|
|
780
|
-
var pressedKey = pressedKeyUppercase.toLowerCase();
|
|
781
|
-
if (!(keys != null && keys.includes(keyCode)) && !(keys != null && keys.includes(pressedKey)) && !['ctrl', 'control', 'unknown', 'meta', 'alt', 'shift', 'os'].includes(keyCode)) {
|
|
693
|
+
if (!d?.includes(m) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(m))
|
|
782
694
|
return false;
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
// We check the pressed keys for compatibility with the keyup event. In keyup events the modifier flags are not set.
|
|
786
|
-
if (alt === !altKey && pressedKey !== 'alt') {
|
|
695
|
+
if (!o) {
|
|
696
|
+
if (i !== k && m !== "alt" || c !== g && m !== "shift")
|
|
787
697
|
return false;
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
return false;
|
|
791
|
-
}
|
|
792
|
-
// Mod is a special key name that is checking for meta on macOS and ctrl on other platforms
|
|
793
|
-
if (mod) {
|
|
794
|
-
if (!metaKey && !ctrlKey) {
|
|
795
|
-
return false;
|
|
796
|
-
}
|
|
797
|
-
} else {
|
|
798
|
-
if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {
|
|
698
|
+
if (n) {
|
|
699
|
+
if (!l && !a)
|
|
799
700
|
return false;
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
return false;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
// All modifiers are correct, now check the key
|
|
807
|
-
// If the key is set, we check for the key
|
|
808
|
-
if (keys && keys.length === 1 && (keys.includes(pressedKey) || keys.includes(keyCode))) {
|
|
809
|
-
return true;
|
|
810
|
-
} else if (keys) {
|
|
811
|
-
// Check if all keys are present in pressedDownKeys set
|
|
812
|
-
return isHotkeyPressed(keys);
|
|
813
|
-
} else if (!keys) {
|
|
814
|
-
// If the key is not set, we only listen for modifiers, that check went alright, so we return true
|
|
815
|
-
return true;
|
|
701
|
+
} else if (u !== l && m !== "meta" && m !== "os" || y !== a && m !== "ctrl" && m !== "control")
|
|
702
|
+
return false;
|
|
816
703
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
var useBoundHotkeysProxy = function useBoundHotkeysProxy() {
|
|
823
|
-
return useContext$2(BoundHotkeysProxyProvider);
|
|
824
|
-
};
|
|
825
|
-
|
|
826
|
-
function deepEqual(x, y) {
|
|
827
|
-
//@ts-ignore
|
|
828
|
-
return x && y && typeof x === 'object' && typeof y === 'object' ? Object.keys(x).length === Object.keys(y).length &&
|
|
829
|
-
//@ts-ignore
|
|
830
|
-
Object.keys(x).reduce(function (isEqual, key) {
|
|
831
|
-
return isEqual && deepEqual(x[key], y[key]);
|
|
832
|
-
}, true) : x === y;
|
|
704
|
+
return d && d.length === 1 && d.includes(m) ? true : d ? U(d) : !d;
|
|
705
|
+
}, $ = createContext(void 0), oe = () => useContext$2($);
|
|
706
|
+
function x(e, r) {
|
|
707
|
+
return e && r && typeof e == "object" && typeof r == "object" ? Object.keys(e).length === Object.keys(r).length && // @ts-expect-error TS7053
|
|
708
|
+
Object.keys(e).reduce((o, i) => o && x(e[i], r[i]), true) : e === r;
|
|
833
709
|
}
|
|
834
|
-
|
|
835
|
-
var HotkeysContext = /*#__PURE__*/createContext({
|
|
710
|
+
const W = createContext({
|
|
836
711
|
hotkeys: [],
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
function useDeepEqualMemo(value) {
|
|
847
|
-
var ref = useRef(undefined);
|
|
848
|
-
if (!deepEqual(ref.current, value)) {
|
|
849
|
-
ref.current = value;
|
|
712
|
+
activeScopes: [],
|
|
713
|
+
// This array has to be empty instead of containing '*' as default, to check if the provider is set or not
|
|
714
|
+
toggleScope: () => {
|
|
715
|
+
},
|
|
716
|
+
enableScope: () => {
|
|
717
|
+
},
|
|
718
|
+
disableScope: () => {
|
|
850
719
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
e.stopImmediatePropagation();
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined;
|
|
866
|
-
var memoisedCB = useCallback(callback, _deps != null ? _deps : []);
|
|
867
|
-
var cbRef = useRef(memoisedCB);
|
|
868
|
-
if (_deps) {
|
|
869
|
-
cbRef.current = memoisedCB;
|
|
870
|
-
} else {
|
|
871
|
-
cbRef.current = callback;
|
|
872
|
-
}
|
|
873
|
-
var memoisedOptions = useDeepEqualMemo(_options);
|
|
874
|
-
var _useHotkeysContext = useHotkeysContext(),
|
|
875
|
-
enabledScopes = _useHotkeysContext.enabledScopes;
|
|
876
|
-
var proxy = useBoundHotkeysProxy();
|
|
877
|
-
useSafeLayoutEffect(function () {
|
|
878
|
-
if ((memoisedOptions == null ? void 0 : memoisedOptions.enabled) === false || !isScopeActive(enabledScopes, memoisedOptions == null ? void 0 : memoisedOptions.scopes)) {
|
|
720
|
+
}), se = () => useContext$2(W);
|
|
721
|
+
function ie(e) {
|
|
722
|
+
const r = useRef(void 0);
|
|
723
|
+
return x(r.current, e) || (r.current = e), r.current;
|
|
724
|
+
}
|
|
725
|
+
const N = (e) => {
|
|
726
|
+
e.stopPropagation(), e.preventDefault(), e.stopImmediatePropagation();
|
|
727
|
+
}, ue = typeof window < "u" ? useLayoutEffect : useEffect;
|
|
728
|
+
function fe(e, r, o, i) {
|
|
729
|
+
const u = useRef(null), n = useRef(false), c = Array.isArray(o) ? Array.isArray(i) ? void 0 : i : o, y = R(e) ? e.join(c?.delimiter) : e, d = Array.isArray(o) ? o : Array.isArray(i) ? i : void 0, f = useCallback(r, d ?? []), p = useRef(f);
|
|
730
|
+
d ? p.current = f : p.current = r;
|
|
731
|
+
const t = ie(c), { activeScopes: a } = se(), l = oe();
|
|
732
|
+
return ue(() => {
|
|
733
|
+
if (t?.enabled === false || !te(a, t?.scopes))
|
|
879
734
|
return;
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
return;
|
|
888
|
-
}
|
|
889
|
-
// TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE
|
|
890
|
-
// REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY.
|
|
891
|
-
if (ref.current !== null) {
|
|
892
|
-
var rootNode = ref.current.getRootNode();
|
|
893
|
-
if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref.current && !ref.current.contains(rootNode.activeElement)) {
|
|
894
|
-
stopPropagation(e);
|
|
895
|
-
return;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
if ((_e$target = e.target) != null && _e$target.isContentEditable && !(memoisedOptions != null && memoisedOptions.enableOnContentEditable)) {
|
|
899
|
-
return;
|
|
900
|
-
}
|
|
901
|
-
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
|
|
902
|
-
var _hotkey$keys;
|
|
903
|
-
var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey);
|
|
904
|
-
if (isHotkeyMatchingKeyboardEvent(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.ignoreModifiers) || (_hotkey$keys = hotkey.keys) != null && _hotkey$keys.includes('*')) {
|
|
905
|
-
if (memoisedOptions != null && memoisedOptions.ignoreEventWhen != null && memoisedOptions.ignoreEventWhen(e)) {
|
|
735
|
+
let g = [], k;
|
|
736
|
+
const m = (s, B = false) => {
|
|
737
|
+
if (!(Z(s) && !F(s, t?.enableOnFormTags))) {
|
|
738
|
+
if (u.current !== null) {
|
|
739
|
+
const v = u.current.getRootNode();
|
|
740
|
+
if ((v instanceof Document || v instanceof ShadowRoot) && v.activeElement !== u.current && !u.current.contains(v.activeElement)) {
|
|
741
|
+
N(s);
|
|
906
742
|
return;
|
|
907
743
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
744
|
+
}
|
|
745
|
+
s.target?.isContentEditable && !t?.enableOnContentEditable || H(y, t?.delimiter).forEach((v) => {
|
|
746
|
+
if (v.includes(t?.splitKey ?? "+") && v.includes(t?.sequenceSplitKey ?? ">")) {
|
|
747
|
+
console.warn(
|
|
748
|
+
`Hotkey ${v} contains both ${t?.splitKey ?? "+"} and ${t?.sequenceSplitKey ?? ">"} which is not supported.`
|
|
749
|
+
);
|
|
914
750
|
return;
|
|
915
751
|
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
752
|
+
const h = P(
|
|
753
|
+
v,
|
|
754
|
+
t?.splitKey,
|
|
755
|
+
t?.sequenceSplitKey,
|
|
756
|
+
t?.useKey,
|
|
757
|
+
t?.description
|
|
758
|
+
);
|
|
759
|
+
if (h.isSequence) {
|
|
760
|
+
k = setTimeout(() => {
|
|
761
|
+
g = [];
|
|
762
|
+
}, t?.sequenceTimeoutMs ?? 1e3);
|
|
763
|
+
const C = h.useKey ? s.key : K(s.code);
|
|
764
|
+
if (D(C.toLowerCase()))
|
|
765
|
+
return;
|
|
766
|
+
g.push(C);
|
|
767
|
+
const G = h.keys?.[g.length - 1];
|
|
768
|
+
if (C !== G) {
|
|
769
|
+
g = [], k && clearTimeout(k);
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
g.length === h.keys?.length && (p.current(s, h), k && clearTimeout(k), g = []);
|
|
773
|
+
} else if (re(s, h, t?.ignoreModifiers) || h.keys?.includes("*")) {
|
|
774
|
+
if (t?.ignoreEventWhen?.(s) || B && n.current)
|
|
775
|
+
return;
|
|
776
|
+
if (V(s, h, t?.preventDefault), !X(s, h, t?.enabled)) {
|
|
777
|
+
N(s);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
p.current(s, h), B || (n.current = true);
|
|
920
781
|
}
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
};
|
|
924
|
-
var handleKeyDown = function handleKeyDown(event) {
|
|
925
|
-
if (event.key === undefined) {
|
|
926
|
-
// Synthetic event (e.g., Chrome autofill). Ignore.
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
pushToCurrentlyPressedKeys(mapKey(event.code));
|
|
930
|
-
if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {
|
|
931
|
-
listener(event);
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
var handleKeyUp = function handleKeyUp(event) {
|
|
935
|
-
if (event.key === undefined) {
|
|
936
|
-
// Synthetic event (e.g., Chrome autofill). Ignore.
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
removeFromCurrentlyPressedKeys(mapKey(event.code));
|
|
940
|
-
hasTriggeredRef.current = false;
|
|
941
|
-
if (memoisedOptions != null && memoisedOptions.keyup) {
|
|
942
|
-
listener(event, true);
|
|
943
|
-
}
|
|
944
|
-
};
|
|
945
|
-
var domNode = ref.current || (_options == null ? void 0 : _options.document) || document;
|
|
946
|
-
// @ts-ignore
|
|
947
|
-
domNode.addEventListener('keyup', handleKeyUp);
|
|
948
|
-
// @ts-ignore
|
|
949
|
-
domNode.addEventListener('keydown', handleKeyDown);
|
|
950
|
-
if (proxy) {
|
|
951
|
-
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
|
|
952
|
-
return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
return function () {
|
|
956
|
-
// @ts-ignore
|
|
957
|
-
domNode.removeEventListener('keyup', handleKeyUp);
|
|
958
|
-
// @ts-ignore
|
|
959
|
-
domNode.removeEventListener('keydown', handleKeyDown);
|
|
960
|
-
if (proxy) {
|
|
961
|
-
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
|
|
962
|
-
return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));
|
|
963
782
|
});
|
|
964
783
|
}
|
|
784
|
+
}, O = (s) => {
|
|
785
|
+
s.code !== void 0 && (I(K(s.code)), (t?.keydown === void 0 && t?.keyup !== true || t?.keydown) && m(s));
|
|
786
|
+
}, q = (s) => {
|
|
787
|
+
s.code !== void 0 && (_(K(s.code)), n.current = false, t?.keyup && m(s, true));
|
|
788
|
+
}, E = u.current || c?.document || document;
|
|
789
|
+
return E.addEventListener("keyup", q, c?.eventListenerOptions), E.addEventListener("keydown", O, c?.eventListenerOptions), l && H(y, t?.delimiter).forEach(
|
|
790
|
+
(s) => l.addHotkey(
|
|
791
|
+
P(
|
|
792
|
+
s,
|
|
793
|
+
t?.splitKey,
|
|
794
|
+
t?.sequenceSplitKey,
|
|
795
|
+
t?.useKey,
|
|
796
|
+
t?.description
|
|
797
|
+
)
|
|
798
|
+
)
|
|
799
|
+
), () => {
|
|
800
|
+
E.removeEventListener("keyup", q, c?.eventListenerOptions), E.removeEventListener("keydown", O, c?.eventListenerOptions), l && H(y, t?.delimiter).forEach(
|
|
801
|
+
(s) => l.removeHotkey(
|
|
802
|
+
P(
|
|
803
|
+
s,
|
|
804
|
+
t?.splitKey,
|
|
805
|
+
t?.sequenceSplitKey,
|
|
806
|
+
t?.useKey,
|
|
807
|
+
t?.description
|
|
808
|
+
)
|
|
809
|
+
)
|
|
810
|
+
), g = [], k && clearTimeout(k);
|
|
965
811
|
};
|
|
966
|
-
}, [
|
|
967
|
-
return ref;
|
|
812
|
+
}, [y, t, a]), u;
|
|
968
813
|
}
|
|
969
814
|
|
|
970
815
|
function UpdateButton(_a) {
|
|
@@ -975,10 +820,8 @@ function UpdateButton(_a) {
|
|
|
975
820
|
handleSubmit
|
|
976
821
|
} = (_b = useFormikContext()) !== null && _b !== void 0 ? _b : {
|
|
977
822
|
dirty: false,
|
|
978
|
-
handleSubmit: undefined
|
|
979
|
-
|
|
980
|
-
};
|
|
981
|
-
useHotkeys('ctrl+s', () => {
|
|
823
|
+
handleSubmit: undefined};
|
|
824
|
+
fe('ctrl+s', () => {
|
|
982
825
|
if (dirty && !props.disabled) handleSubmit();
|
|
983
826
|
}, {
|
|
984
827
|
preventDefault: true
|
|
@@ -1998,7 +1841,7 @@ function ItemEditDialog(_a) {
|
|
|
1998
1841
|
error /*, error*/,
|
|
1999
1842
|
refetch
|
|
2000
1843
|
} = useApiQuery(api.queryKey, api.get, queryId, Object.assign({
|
|
2001
|
-
enabled: !(
|
|
1844
|
+
enabled: !(/*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
|
|
2002
1845
|
onError: onFetchError
|
|
2003
1846
|
}, queryFetchOptions));
|
|
2004
1847
|
// const [activeTab, setActiveTab] = React.useState(form && Array.isArray(form) ? form[0].key : "");
|
|
@@ -2185,7 +2028,10 @@ function DialogRenderer({
|
|
|
2185
2028
|
invalidateQueryKey,
|
|
2186
2029
|
queryId
|
|
2187
2030
|
}) {
|
|
2188
|
-
const
|
|
2031
|
+
const {
|
|
2032
|
+
type
|
|
2033
|
+
} = config,
|
|
2034
|
+
props = __rest(config, ["type"]);
|
|
2189
2035
|
if (config.type === "dialog") return jsx(ItemEditDialog, Object.assign({}, props, {
|
|
2190
2036
|
queryId: queryId,
|
|
2191
2037
|
invalidateQueryKey: invalidateQueryKey,
|
|
@@ -2209,7 +2055,7 @@ function RefreshButton({
|
|
|
2209
2055
|
queryKey
|
|
2210
2056
|
}) {
|
|
2211
2057
|
const invalidate = useInvalidateQuery(queryKey);
|
|
2212
|
-
|
|
2058
|
+
fe('ctrl+r', () => invalidate(), {
|
|
2213
2059
|
preventDefault: true
|
|
2214
2060
|
}, [invalidate]);
|
|
2215
2061
|
return jsx(ButtonBarButton, {
|
|
@@ -3034,7 +2880,7 @@ function UserBlock({
|
|
|
3034
2880
|
menuConfig,
|
|
3035
2881
|
path
|
|
3036
2882
|
}) {
|
|
3037
|
-
var _a, _b
|
|
2883
|
+
var _a, _b;
|
|
3038
2884
|
const {
|
|
3039
2885
|
isLoading,
|
|
3040
2886
|
user
|
|
@@ -3062,7 +2908,7 @@ function UserBlock({
|
|
|
3062
2908
|
}), jsx("span", {
|
|
3063
2909
|
flexGrow: true,
|
|
3064
2910
|
ms: "2",
|
|
3065
|
-
children: `${capitalize((
|
|
2911
|
+
children: `${capitalize((user === null || user === void 0 ? void 0 : user.firstname) || (user === null || user === void 0 ? void 0 : user.lastname) || "")}`
|
|
3066
2912
|
}), jsx(IconButton, {
|
|
3067
2913
|
variant: "borderless",
|
|
3068
2914
|
corners: "pill",
|
|
@@ -3202,7 +3048,7 @@ function Sidebar(_a) {
|
|
|
3202
3048
|
darkMode: darkMode
|
|
3203
3049
|
}), jsx("h1", {
|
|
3204
3050
|
textSize: "md",
|
|
3205
|
-
children: title
|
|
3051
|
+
children: title || AppEnv.appName()
|
|
3206
3052
|
})]
|
|
3207
3053
|
}), jsx(Menu, {
|
|
3208
3054
|
overflowY: "auto",
|
|
@@ -3288,7 +3134,7 @@ function LeftPanel({
|
|
|
3288
3134
|
userSettingsPath
|
|
3289
3135
|
}) {
|
|
3290
3136
|
const [isOpen, __, toggle] = useBoolean(true);
|
|
3291
|
-
|
|
3137
|
+
fe('ctrl+t', () => toggle(), [toggle]);
|
|
3292
3138
|
return jsxs("div", {
|
|
3293
3139
|
ms: isOpen ? "0" : "-14.5rem",
|
|
3294
3140
|
transition: "all",
|