@sustaina/shared-ui 1.27.1 → 1.29.0
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.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -507,6 +507,7 @@ declare const getDialogAlertControls: () => {
|
|
|
507
507
|
openDialogAlert: (payload?: {
|
|
508
508
|
template?: TemplateKeys;
|
|
509
509
|
props?: OpenDialogAlert;
|
|
510
|
+
isExclusive?: boolean;
|
|
510
511
|
}) => void;
|
|
511
512
|
closeDialogAlert: () => void;
|
|
512
513
|
openErrorDialogAlert: (error: unknown) => void;
|
|
@@ -1318,7 +1319,7 @@ type InputNumberProps = NumericFormatProps<InputProps> & {
|
|
|
1318
1319
|
};
|
|
1319
1320
|
declare const InputNumber: ({ customInputProps, ...props }: InputNumberProps) => react_jsx_runtime.JSX.Element;
|
|
1320
1321
|
|
|
1321
|
-
declare function isDefined(value:
|
|
1322
|
+
declare function isDefined<T>(value: T | null | undefined): value is NonNullable<T>;
|
|
1322
1323
|
declare function isEmptyObject(value: any): boolean;
|
|
1323
1324
|
type DebounceOptions = {
|
|
1324
1325
|
leading?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -507,6 +507,7 @@ declare const getDialogAlertControls: () => {
|
|
|
507
507
|
openDialogAlert: (payload?: {
|
|
508
508
|
template?: TemplateKeys;
|
|
509
509
|
props?: OpenDialogAlert;
|
|
510
|
+
isExclusive?: boolean;
|
|
510
511
|
}) => void;
|
|
511
512
|
closeDialogAlert: () => void;
|
|
512
513
|
openErrorDialogAlert: (error: unknown) => void;
|
|
@@ -1318,7 +1319,7 @@ type InputNumberProps = NumericFormatProps<InputProps> & {
|
|
|
1318
1319
|
};
|
|
1319
1320
|
declare const InputNumber: ({ customInputProps, ...props }: InputNumberProps) => react_jsx_runtime.JSX.Element;
|
|
1320
1321
|
|
|
1321
|
-
declare function isDefined(value:
|
|
1322
|
+
declare function isDefined<T>(value: T | null | undefined): value is NonNullable<T>;
|
|
1322
1323
|
declare function isEmptyObject(value: any): boolean;
|
|
1323
1324
|
type DebounceOptions = {
|
|
1324
1325
|
leading?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -5313,7 +5313,8 @@ var getDialogTemplates = ({ setOpen = () => {
|
|
|
5313
5313
|
title: "error.session_expired.title",
|
|
5314
5314
|
description: "error.session_expired.description",
|
|
5315
5315
|
confirmText: "error.session_expired.confirm_text",
|
|
5316
|
-
showCancel: false
|
|
5316
|
+
showCancel: false,
|
|
5317
|
+
persistent: true
|
|
5317
5318
|
},
|
|
5318
5319
|
"error.user_not_found": {
|
|
5319
5320
|
variant: "error",
|
|
@@ -5440,9 +5441,17 @@ var getDialogTemplates = ({ setOpen = () => {
|
|
|
5440
5441
|
var useDialogAlertStore = zustand.create((set, get) => ({
|
|
5441
5442
|
open: false,
|
|
5442
5443
|
dialogProps: {},
|
|
5443
|
-
setOpen: (
|
|
5444
|
+
setOpen: (open) => {
|
|
5445
|
+
if (!open && get().isExclusive) {
|
|
5446
|
+
get().setIsExclusive(false);
|
|
5447
|
+
}
|
|
5448
|
+
set({ open });
|
|
5449
|
+
},
|
|
5444
5450
|
setDialogProps: (data) => set({ dialogProps: data }),
|
|
5445
5451
|
openDialogAlert: (payload) => {
|
|
5452
|
+
if (get().isExclusive) {
|
|
5453
|
+
return;
|
|
5454
|
+
}
|
|
5446
5455
|
let templateVal;
|
|
5447
5456
|
if (payload?.template) {
|
|
5448
5457
|
templateVal = getDialogTemplates({ setOpen: get().setOpen })[payload.template];
|
|
@@ -5453,10 +5462,13 @@ var useDialogAlertStore = zustand.create((set, get) => ({
|
|
|
5453
5462
|
}
|
|
5454
5463
|
get().setDialogProps({ ...templateVal, ...payload?.props });
|
|
5455
5464
|
get().setOpen(true);
|
|
5465
|
+
get().setIsExclusive(payload?.isExclusive ?? false);
|
|
5456
5466
|
},
|
|
5457
5467
|
closeDialogAlert: () => {
|
|
5458
5468
|
set({ open: false });
|
|
5459
|
-
}
|
|
5469
|
+
},
|
|
5470
|
+
isExclusive: false,
|
|
5471
|
+
setIsExclusive: (isExclusive) => set({ isExclusive })
|
|
5460
5472
|
}));
|
|
5461
5473
|
var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
5462
5474
|
const open = useDialogAlertStore((state) => state.open);
|
|
@@ -5486,16 +5498,16 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
|
5486
5498
|
var openDialogAlert = useDialogAlertStore.getState().openDialogAlert;
|
|
5487
5499
|
var closeDialogAlert = useDialogAlertStore.getState().closeDialogAlert;
|
|
5488
5500
|
var openErrorDialogAlert = (error) => {
|
|
5489
|
-
if (error
|
|
5490
|
-
openDialogAlert({ template: "error.something_went_wrong", props: { description: error.message } });
|
|
5491
|
-
} else if (error.isAxiosError) {
|
|
5501
|
+
if (error.isAxiosError) {
|
|
5492
5502
|
let template = "error.something_went_wrong";
|
|
5503
|
+
let props = void 0;
|
|
5493
5504
|
switch (error.response?.status) {
|
|
5494
5505
|
case 400:
|
|
5495
5506
|
template = "error.invalid_incomplete_data";
|
|
5496
5507
|
break;
|
|
5497
5508
|
case 401:
|
|
5498
5509
|
template = "error.session_expired";
|
|
5510
|
+
props = { confirmText: void 0 };
|
|
5499
5511
|
break;
|
|
5500
5512
|
case 403:
|
|
5501
5513
|
template = "error.permission_denied";
|
|
@@ -5510,7 +5522,9 @@ var openErrorDialogAlert = (error) => {
|
|
|
5510
5522
|
template = "error.api_db_error";
|
|
5511
5523
|
break;
|
|
5512
5524
|
}
|
|
5513
|
-
openDialogAlert({ template });
|
|
5525
|
+
openDialogAlert({ template, props });
|
|
5526
|
+
} else if (error instanceof Error) {
|
|
5527
|
+
openDialogAlert({ template: "error.something_went_wrong", props: { description: error.message } });
|
|
5514
5528
|
} else {
|
|
5515
5529
|
openDialogAlert({ template: "error.something_went_wrong" });
|
|
5516
5530
|
}
|
|
@@ -6061,7 +6075,7 @@ var pushVariableAndInner = (tokens, value, prefixMap, prefixes) => {
|
|
|
6061
6075
|
}
|
|
6062
6076
|
cursor += prefix.length;
|
|
6063
6077
|
const rest = value.slice(cursor);
|
|
6064
|
-
const codeMatch = rest.match(
|
|
6078
|
+
const codeMatch = rest.match(/^[\w-]+/);
|
|
6065
6079
|
if (codeMatch) {
|
|
6066
6080
|
tokens.push({ type: prefixMap[prefix], code: codeMatch[0] });
|
|
6067
6081
|
cursor += codeMatch[0].length;
|
|
@@ -6090,7 +6104,7 @@ var tokenizeFormulaString = (raw, prefixMap) => {
|
|
|
6090
6104
|
const prefix = findPrefixAt(raw, i, prefixes);
|
|
6091
6105
|
if (prefix) {
|
|
6092
6106
|
const rest = raw.slice(i + prefix.length);
|
|
6093
|
-
const codeMatch = rest.match(
|
|
6107
|
+
const codeMatch = rest.match(/^[\w-]+/);
|
|
6094
6108
|
if (codeMatch) {
|
|
6095
6109
|
flushBuffer();
|
|
6096
6110
|
segments.push({ kind: "token", prefix, code: codeMatch[0] });
|
|
@@ -6114,7 +6128,7 @@ var parseFormulaToToken = (text, prefixMap) => {
|
|
|
6114
6128
|
return tokens;
|
|
6115
6129
|
}
|
|
6116
6130
|
const afterPrefix = text.slice(leadingPrefix.length);
|
|
6117
|
-
const codeMatch = afterPrefix.match(
|
|
6131
|
+
const codeMatch = afterPrefix.match(/^[\w-]+/);
|
|
6118
6132
|
if (!codeMatch) {
|
|
6119
6133
|
pushVariableAndInner(tokens, text, prefixMap, prefixes);
|
|
6120
6134
|
return tokens;
|