@oliasoft-open-source/react-ui-library 5.7.4-beta-1 → 5.7.4-beta-3
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/index.d.ts +21 -0
- package/dist/index.js +142 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,22 @@ export declare enum Align {
|
|
|
35
35
|
CENTER = "center"
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export declare interface AuditLogItem {
|
|
39
|
+
id: string;
|
|
40
|
+
userName: string;
|
|
41
|
+
operation: AuditLogOperation;
|
|
42
|
+
source: AuditLogSource;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
diffs: any[];
|
|
45
|
+
operationMetaData?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare type AuditLogOperation = 'Created' | 'Cloned' | 'Reverted' | 'Imported' | 'Updated';
|
|
49
|
+
|
|
50
|
+
declare type AuditLogSource = 'System' | 'Application' | 'API';
|
|
51
|
+
|
|
52
|
+
export declare function AuditLogTable({ logs, loading }: IAuditLogTableProps): JSX_2.Element;
|
|
53
|
+
|
|
38
54
|
export declare const Badge: ({ children, color, title, dot, margin, small, }: IBadgeProps) => JSX_2.Element;
|
|
39
55
|
|
|
40
56
|
export declare const Breadcrumb: ({ links, small }: IBreadcrumbProps) => JSX_2.Element;
|
|
@@ -168,6 +184,11 @@ export declare interface IActionProps {
|
|
|
168
184
|
closeLayer?: TEmpty;
|
|
169
185
|
}
|
|
170
186
|
|
|
187
|
+
declare interface IAuditLogTableProps {
|
|
188
|
+
logs: AuditLogItem[];
|
|
189
|
+
loading?: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
171
192
|
export declare interface IBadgeProps {
|
|
172
193
|
children?: ReactNode;
|
|
173
194
|
color?: string;
|
package/dist/index.js
CHANGED
|
@@ -6563,7 +6563,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6563
6563
|
} : {
|
|
6564
6564
|
value: G,
|
|
6565
6565
|
unit: U
|
|
6566
|
-
}),
|
|
6566
|
+
}), Eu = k || K?.value === void 0, [J, Du] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Ou = !!(O || n), Y = C && C.find((e) => {
|
|
6567
6567
|
if (!e?.value) return;
|
|
6568
6568
|
if (E) return E === e.valueKey;
|
|
6569
6569
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6572,7 +6572,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6572
6572
|
toUnit: t
|
|
6573
6573
|
});
|
|
6574
6574
|
return withUnit(n, t) === e.value;
|
|
6575
|
-
}),
|
|
6575
|
+
}), ku = () => {
|
|
6576
6576
|
let e = l ?? "", t = K.unit;
|
|
6577
6577
|
if (checkConversion({
|
|
6578
6578
|
value: e,
|
|
@@ -6586,7 +6586,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6586
6586
|
return null;
|
|
6587
6587
|
}
|
|
6588
6588
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6589
|
-
},
|
|
6589
|
+
}, Au = (t) => {
|
|
6590
6590
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
|
|
6591
6591
|
h({ target: {
|
|
6592
6592
|
value: s,
|
|
@@ -6599,7 +6599,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6599
6599
|
}), R(() => {
|
|
6600
6600
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6601
6601
|
});
|
|
6602
|
-
},
|
|
6602
|
+
}, ju = (e, t) => {
|
|
6603
6603
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6604
6604
|
value: e,
|
|
6605
6605
|
unit: t
|
|
@@ -6630,7 +6630,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6630
6630
|
e !== void 0 && q({
|
|
6631
6631
|
value: e,
|
|
6632
6632
|
unit: t
|
|
6633
|
-
}), C &&
|
|
6633
|
+
}), C && Du(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6634
6634
|
}
|
|
6635
6635
|
}, [
|
|
6636
6636
|
U,
|
|
@@ -6638,7 +6638,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6638
6638
|
i,
|
|
6639
6639
|
T
|
|
6640
6640
|
]);
|
|
6641
|
-
let X =
|
|
6641
|
+
let X = ku(), Z = label(K.unit) || K.unit || "", Mu = p || !X || X && X.length === 1, Q = getStringName(e), $, Nu = (t) => {
|
|
6642
6642
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6643
6643
|
if (checkConversion({
|
|
6644
6644
|
value: r,
|
|
@@ -6658,7 +6658,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6658
6658
|
type: MenuType.OPTION,
|
|
6659
6659
|
inline: !0,
|
|
6660
6660
|
onClick: () => {
|
|
6661
|
-
validateNumber(i).valid && !n && (
|
|
6661
|
+
validateNumber(i).valid && !n && (Du(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6662
6662
|
value: r,
|
|
6663
6663
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6664
6664
|
predefinedSelected: !0,
|
|
@@ -6685,10 +6685,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6685
6685
|
label: "Custom",
|
|
6686
6686
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6687
6687
|
}], C?.length) {
|
|
6688
|
-
let e = C.map(
|
|
6688
|
+
let e = C.map(Nu);
|
|
6689
6689
|
$ = [...$, ...e];
|
|
6690
6690
|
}
|
|
6691
|
-
let
|
|
6691
|
+
let Pu = (e) => {
|
|
6692
6692
|
if (isValueWithUnit(e)) {
|
|
6693
6693
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6694
6694
|
value: e,
|
|
@@ -6700,7 +6700,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6700
6700
|
return n;
|
|
6701
6701
|
}
|
|
6702
6702
|
return e;
|
|
6703
|
-
},
|
|
6703
|
+
}, Fu = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Iu = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6704
6704
|
return /* @__PURE__ */ jsx("div", {
|
|
6705
6705
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6706
6706
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6732,31 +6732,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6732
6732
|
name: Q,
|
|
6733
6733
|
testId: x,
|
|
6734
6734
|
disabled: n,
|
|
6735
|
-
placeholder:
|
|
6735
|
+
placeholder: Pu(t),
|
|
6736
6736
|
value: K.value,
|
|
6737
|
-
onChange:
|
|
6737
|
+
onChange: Au,
|
|
6738
6738
|
onFocus: v,
|
|
6739
6739
|
error: i === null ? void 0 : i,
|
|
6740
6740
|
warning: S === null ? void 0 : S,
|
|
6741
6741
|
left: a,
|
|
6742
|
-
allowEmpty:
|
|
6742
|
+
allowEmpty: Eu,
|
|
6743
6743
|
validationCallback: (e, t) => D(Q, t),
|
|
6744
6744
|
enableCosmeticRounding: j,
|
|
6745
6745
|
enableDisplayRounding: M,
|
|
6746
6746
|
roundDisplayValue: N,
|
|
6747
|
-
groupOrder:
|
|
6748
|
-
disableInternalErrorValidationMessages:
|
|
6747
|
+
groupOrder: Fu,
|
|
6748
|
+
disableInternalErrorValidationMessages: Ou,
|
|
6749
6749
|
small: o,
|
|
6750
6750
|
selectOnFocus: P,
|
|
6751
6751
|
tooltip: I
|
|
6752
6752
|
}, Q)
|
|
6753
6753
|
}),
|
|
6754
|
-
Z && (
|
|
6755
|
-
groupOrder:
|
|
6754
|
+
Z && (Mu || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6755
|
+
groupOrder: Iu,
|
|
6756
6756
|
small: o,
|
|
6757
6757
|
children: Z
|
|
6758
6758
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6759
|
-
groupOrder:
|
|
6759
|
+
groupOrder: Iu,
|
|
6760
6760
|
maxHeight: 380,
|
|
6761
6761
|
disabled: r,
|
|
6762
6762
|
testId: x && `${x}-menu`,
|
|
@@ -6772,7 +6772,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6772
6772
|
label: j ? safeRoundNumbers(i) : i,
|
|
6773
6773
|
inline: !0,
|
|
6774
6774
|
onClick: (n) => {
|
|
6775
|
-
n.stopPropagation(),
|
|
6775
|
+
n.stopPropagation(), ju(e, t);
|
|
6776
6776
|
},
|
|
6777
6777
|
description: r,
|
|
6778
6778
|
selected: r === Z,
|
|
@@ -7051,7 +7051,128 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7051
7051
|
compareMethod: DiffMethod.WORDS
|
|
7052
7052
|
})
|
|
7053
7053
|
}) });
|
|
7054
|
-
}
|
|
7054
|
+
};
|
|
7055
|
+
function formatDate({ date: e, showTime: t, showSeconds: n, timeZone: r, showTimeZone: i, locale: a }) {
|
|
7056
|
+
return e ? new Date(e).toLocaleString(a, {
|
|
7057
|
+
year: "numeric",
|
|
7058
|
+
month: "short",
|
|
7059
|
+
day: "2-digit",
|
|
7060
|
+
hour: t ? "2-digit" : void 0,
|
|
7061
|
+
minute: t ? "2-digit" : void 0,
|
|
7062
|
+
second: n ? "2-digit" : void 0,
|
|
7063
|
+
timeZone: r,
|
|
7064
|
+
timeZoneName: i ? "short" : void 0
|
|
7065
|
+
}) : null;
|
|
7066
|
+
}
|
|
7067
|
+
function AuditLogTable({ logs: e, loading: t }) {
|
|
7068
|
+
let [n, r] = useState(!0), [i, a] = useState(!0), o = [
|
|
7069
|
+
{
|
|
7070
|
+
label: "10 / page",
|
|
7071
|
+
value: 10
|
|
7072
|
+
},
|
|
7073
|
+
{
|
|
7074
|
+
label: "20 / page",
|
|
7075
|
+
value: 20
|
|
7076
|
+
},
|
|
7077
|
+
{
|
|
7078
|
+
label: "50 / page",
|
|
7079
|
+
value: 50
|
|
7080
|
+
},
|
|
7081
|
+
{
|
|
7082
|
+
label: "Show all",
|
|
7083
|
+
value: 0
|
|
7084
|
+
}
|
|
7085
|
+
], [s, c] = useState(10), [l, u] = useState(1), d = ({ diffs: e = [], userName: t, source: n, operation: r, operationMetaData: i }) => {
|
|
7086
|
+
if (n === "API") return r === "Created" ? `Created through API by ${t || "Unknown user"}` : `Changed through API by ${t || "Unknown user"}`;
|
|
7087
|
+
switch (r) {
|
|
7088
|
+
case "Created": return `Created by ${t}`;
|
|
7089
|
+
case "Cloned": return `Cloned by ${t} (from ${i || "unknown"})`;
|
|
7090
|
+
case "Reverted": return `Reverted by ${t}`;
|
|
7091
|
+
case "Imported": return `Imported by ${t}`;
|
|
7092
|
+
case "Updated": return `Updated by ${t} (${e.length} changes)`;
|
|
7093
|
+
default: return `Change by ${t}`;
|
|
7094
|
+
}
|
|
7095
|
+
}, f = (l - 1) * (s || e.length || 1), p = s === 0 ? e.length : f + s, h = e.slice(f, p), g = [{ cells: [
|
|
7096
|
+
{ value: "Change" },
|
|
7097
|
+
{ value: "Modified by" },
|
|
7098
|
+
{ value: "Using" },
|
|
7099
|
+
{ value: "Operation" },
|
|
7100
|
+
{ value: "Date" }
|
|
7101
|
+
] }], _ = h.map((e) => ({ cells: [
|
|
7102
|
+
{
|
|
7103
|
+
value: d(e),
|
|
7104
|
+
type: "Static"
|
|
7105
|
+
},
|
|
7106
|
+
{
|
|
7107
|
+
value: e.userName || "Unknown",
|
|
7108
|
+
type: "Static"
|
|
7109
|
+
},
|
|
7110
|
+
{
|
|
7111
|
+
value: e.source || "System",
|
|
7112
|
+
type: "Static"
|
|
7113
|
+
},
|
|
7114
|
+
{
|
|
7115
|
+
value: e.operation,
|
|
7116
|
+
type: "Static"
|
|
7117
|
+
},
|
|
7118
|
+
{
|
|
7119
|
+
value: formatDate({
|
|
7120
|
+
date: e.createdAt,
|
|
7121
|
+
showTime: !0
|
|
7122
|
+
}),
|
|
7123
|
+
type: "Static"
|
|
7124
|
+
}
|
|
7125
|
+
] }));
|
|
7126
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7127
|
+
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
7128
|
+
gap: !0,
|
|
7129
|
+
wrap: !0,
|
|
7130
|
+
children: [
|
|
7131
|
+
/* @__PURE__ */ jsx(Heading, { children: "CHANGES" }),
|
|
7132
|
+
/* @__PURE__ */ jsx(Toggle, {
|
|
7133
|
+
small: !0,
|
|
7134
|
+
checked: n,
|
|
7135
|
+
onChange: () => r(!n),
|
|
7136
|
+
label: "Include company settings"
|
|
7137
|
+
}),
|
|
7138
|
+
/* @__PURE__ */ jsx(Toggle, {
|
|
7139
|
+
small: !0,
|
|
7140
|
+
checked: i,
|
|
7141
|
+
onChange: () => a(!i),
|
|
7142
|
+
label: "Include migrations"
|
|
7143
|
+
})
|
|
7144
|
+
]
|
|
7145
|
+
}),
|
|
7146
|
+
padding: !1,
|
|
7147
|
+
children: t ? /* @__PURE__ */ jsx(Loader, {
|
|
7148
|
+
height: "100px",
|
|
7149
|
+
cover: !0,
|
|
7150
|
+
theme: Theme.WHITE,
|
|
7151
|
+
children: /* @__PURE__ */ jsx(Spinner, { dark: !0 })
|
|
7152
|
+
}) : /* @__PURE__ */ jsx(Table, { table: {
|
|
7153
|
+
headers: g,
|
|
7154
|
+
rows: _,
|
|
7155
|
+
fixedWidth: "100%",
|
|
7156
|
+
bordered: !1,
|
|
7157
|
+
actionsRight: !0,
|
|
7158
|
+
footer: { pagination: {
|
|
7159
|
+
rowCount: e.length,
|
|
7160
|
+
selectedPage: l,
|
|
7161
|
+
rowsPerPage: {
|
|
7162
|
+
onChange: (e) => {
|
|
7163
|
+
let { value: t } = e.target;
|
|
7164
|
+
c(Number(t)), u(1);
|
|
7165
|
+
},
|
|
7166
|
+
options: o,
|
|
7167
|
+
value: s
|
|
7168
|
+
},
|
|
7169
|
+
onSelectPage: (e) => u(e),
|
|
7170
|
+
small: !0
|
|
7171
|
+
} }
|
|
7172
|
+
} })
|
|
7173
|
+
}) });
|
|
7174
|
+
}
|
|
7175
|
+
const isPrimitiveValue = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null, initializeGuiLibrary = (e) => {
|
|
7055
7176
|
setConfig(ConfigKeyType.LanguageKey, e.languageKey), Object.entries(e).forEach(([e, t]) => {
|
|
7056
7177
|
if (e === ConfigKeyType.Translations) setConfig(e, getTranslations(t));
|
|
7057
7178
|
else {
|
|
@@ -7060,4 +7181,4 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7060
7181
|
}
|
|
7061
7182
|
});
|
|
7062
7183
|
};
|
|
7063
|
-
export { Accordion, AccordionWithDefaultToggle, Actions, Align, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
|
|
7184
|
+
export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLogTable, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
|
package/package.json
CHANGED