@compill/admin 1.0.92 → 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 -477
- package/index.esm.js +246 -404
- 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
626
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
function
|
|
681
|
-
|
|
682
|
-
}
|
|
683
|
-
function
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
function
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
}
|
|
718
|
-
|
|
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
|
-
}
|
|
729
|
-
function isHotkeyEnabled(e, hotkey, enabled) {
|
|
730
|
-
if (typeof enabled === 'function') {
|
|
731
|
-
return enabled(e, hotkey);
|
|
732
|
-
}
|
|
733
|
-
return enabled === true || enabled === undefined;
|
|
734
|
-
}
|
|
735
|
-
function isKeyboardEventTriggeredByInput(ev) {
|
|
736
|
-
return isHotkeyEnabledOnTag(ev, ['input', 'textarea', 'select']);
|
|
737
|
-
}
|
|
738
|
-
function isHotkeyEnabledOnTag(_ref, enabledOnTags) {
|
|
739
|
-
var target = _ref.target;
|
|
740
|
-
if (enabledOnTags === void 0) {
|
|
741
|
-
enabledOnTags = false;
|
|
742
|
-
}
|
|
743
|
-
var targetTagName = target && target.tagName;
|
|
744
|
-
if (isReadonlyArray(enabledOnTags)) {
|
|
745
|
-
return Boolean(targetTagName && enabledOnTags && enabledOnTags.some(function (tag) {
|
|
746
|
-
return tag.toLowerCase() === targetTagName.toLowerCase();
|
|
747
|
-
}));
|
|
748
|
-
}
|
|
749
|
-
return Boolean(targetTagName && enabledOnTags && enabledOnTags === true);
|
|
750
|
-
}
|
|
751
|
-
function isScopeActive(activeScopes, scopes) {
|
|
752
|
-
if (activeScopes.length === 0 && scopes) {
|
|
753
|
-
console.warn('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>');
|
|
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') {
|
|
787
|
-
return false;
|
|
788
|
-
}
|
|
789
|
-
if (shift === !shiftKey && pressedKey !== 'shift') {
|
|
695
|
+
if (!o) {
|
|
696
|
+
if (i !== k && m !== "alt" || c !== g && m !== "shift")
|
|
790
697
|
return false;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
if (mod) {
|
|
794
|
-
if (!metaKey && !ctrlKey) {
|
|
698
|
+
if (n) {
|
|
699
|
+
if (!l && !a)
|
|
795
700
|
return false;
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {
|
|
799
|
-
return false;
|
|
800
|
-
}
|
|
801
|
-
if (ctrl === !ctrlKey && pressedKey !== 'ctrl' && pressedKey !== 'control') {
|
|
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;
|
|
850
|
-
}
|
|
851
|
-
return ref.current;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
var stopPropagation = function stopPropagation(e) {
|
|
855
|
-
e.stopPropagation();
|
|
856
|
-
e.preventDefault();
|
|
857
|
-
e.stopImmediatePropagation();
|
|
858
|
-
};
|
|
859
|
-
var useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
860
|
-
function useHotkeys(keys, callback, options, dependencies) {
|
|
861
|
-
var ref = useRef(null);
|
|
862
|
-
var hasTriggeredRef = useRef(false);
|
|
863
|
-
var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;
|
|
864
|
-
var _keys = isReadonlyArray(keys) ? keys.join(_options == null ? void 0 : _options.splitKey) : keys;
|
|
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;
|
|
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: () => {
|
|
872
719
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
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)) {
|
|
906
|
-
return;
|
|
907
|
-
}
|
|
908
|
-
if (isKeyUp && hasTriggeredRef.current) {
|
|
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);
|
|
909
742
|
return;
|
|
910
743
|
}
|
|
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
|
|
@@ -1001,10 +844,6 @@ function ViewButton(_a) {
|
|
|
1001
844
|
window.open(path, '_blank');
|
|
1002
845
|
}, [path]);
|
|
1003
846
|
return jsx(ButtonBarButton$1, Object.assign({
|
|
1004
|
-
type: "submit",
|
|
1005
|
-
scheme: "dark",
|
|
1006
|
-
variant: "glass",
|
|
1007
|
-
size: "md",
|
|
1008
847
|
onClick: openPage,
|
|
1009
848
|
dflex: true,
|
|
1010
849
|
alignItems: "center",
|
|
@@ -2002,7 +1841,7 @@ function ItemEditDialog(_a) {
|
|
|
2002
1841
|
error /*, error*/,
|
|
2003
1842
|
refetch
|
|
2004
1843
|
} = useApiQuery(api.queryKey, api.get, queryId, Object.assign({
|
|
2005
|
-
enabled: !(
|
|
1844
|
+
enabled: !(/*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
|
|
2006
1845
|
onError: onFetchError
|
|
2007
1846
|
}, queryFetchOptions));
|
|
2008
1847
|
// const [activeTab, setActiveTab] = React.useState(form && Array.isArray(form) ? form[0].key : "");
|
|
@@ -2189,7 +2028,10 @@ function DialogRenderer({
|
|
|
2189
2028
|
invalidateQueryKey,
|
|
2190
2029
|
queryId
|
|
2191
2030
|
}) {
|
|
2192
|
-
const
|
|
2031
|
+
const {
|
|
2032
|
+
type
|
|
2033
|
+
} = config,
|
|
2034
|
+
props = __rest(config, ["type"]);
|
|
2193
2035
|
if (config.type === "dialog") return jsx(ItemEditDialog, Object.assign({}, props, {
|
|
2194
2036
|
queryId: queryId,
|
|
2195
2037
|
invalidateQueryKey: invalidateQueryKey,
|
|
@@ -2213,7 +2055,7 @@ function RefreshButton({
|
|
|
2213
2055
|
queryKey
|
|
2214
2056
|
}) {
|
|
2215
2057
|
const invalidate = useInvalidateQuery(queryKey);
|
|
2216
|
-
|
|
2058
|
+
fe('ctrl+r', () => invalidate(), {
|
|
2217
2059
|
preventDefault: true
|
|
2218
2060
|
}, [invalidate]);
|
|
2219
2061
|
return jsx(ButtonBarButton, {
|
|
@@ -3038,7 +2880,7 @@ function UserBlock({
|
|
|
3038
2880
|
menuConfig,
|
|
3039
2881
|
path
|
|
3040
2882
|
}) {
|
|
3041
|
-
var _a, _b
|
|
2883
|
+
var _a, _b;
|
|
3042
2884
|
const {
|
|
3043
2885
|
isLoading,
|
|
3044
2886
|
user
|
|
@@ -3066,7 +2908,7 @@ function UserBlock({
|
|
|
3066
2908
|
}), jsx("span", {
|
|
3067
2909
|
flexGrow: true,
|
|
3068
2910
|
ms: "2",
|
|
3069
|
-
children: `${capitalize((
|
|
2911
|
+
children: `${capitalize((user === null || user === void 0 ? void 0 : user.firstname) || (user === null || user === void 0 ? void 0 : user.lastname) || "")}`
|
|
3070
2912
|
}), jsx(IconButton, {
|
|
3071
2913
|
variant: "borderless",
|
|
3072
2914
|
corners: "pill",
|
|
@@ -3206,7 +3048,7 @@ function Sidebar(_a) {
|
|
|
3206
3048
|
darkMode: darkMode
|
|
3207
3049
|
}), jsx("h1", {
|
|
3208
3050
|
textSize: "md",
|
|
3209
|
-
children: title
|
|
3051
|
+
children: title || AppEnv.appName()
|
|
3210
3052
|
})]
|
|
3211
3053
|
}), jsx(Menu, {
|
|
3212
3054
|
overflowY: "auto",
|
|
@@ -3292,7 +3134,7 @@ function LeftPanel({
|
|
|
3292
3134
|
userSettingsPath
|
|
3293
3135
|
}) {
|
|
3294
3136
|
const [isOpen, __, toggle] = useBoolean(true);
|
|
3295
|
-
|
|
3137
|
+
fe('ctrl+t', () => toggle(), [toggle]);
|
|
3296
3138
|
return jsxs("div", {
|
|
3297
3139
|
ms: isOpen ? "0" : "-14.5rem",
|
|
3298
3140
|
transition: "all",
|