@je-es/client 0.2.2 → 0.2.4
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/README.md +2 -2
- package/dist/main.cjs +5 -108
- package/dist/main.cjs.map +1 -1
- package/dist/main.d.cts +296 -43
- package/dist/main.d.ts +296 -43
- package/dist/main.js +5 -108
- package/dist/main.js.map +1 -1
- package/package.json +2 -2
package/dist/main.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ApiInterceptors } from '@je-es/capi';
|
|
|
2
2
|
export { ApiError, ApiInterceptors, ApiOptions, ApiResponse, ApiConfig as CapiConfig, HttpMethod, ParamValue, RequestData, api, configureApi, getApiConfig, http, resetApiConfig } from '@je-es/capi';
|
|
3
3
|
import * as _je_es_vdom from '@je-es/vdom';
|
|
4
4
|
import { VNode } from '@je-es/vdom';
|
|
5
|
-
export { VNode, VNodeChild, VNodeProps, createDOMElement, createElement, html, patch } from '@je-es/vdom';
|
|
5
|
+
export { VNode, VNodeChild, VNodeChildren, VNodeProps, a, button, createDOMElement, createElement, div, form, h1, h2, h3, h4, h5, h6, html, i, img, input, isVNode, label, option, p, patch, select, span, textarea, validateVNode } from '@je-es/vdom';
|
|
6
6
|
|
|
7
7
|
declare abstract class Component<P = Record<string, unknown>, S = Record<string, unknown>> {
|
|
8
8
|
props: P;
|
|
@@ -179,6 +179,13 @@ interface FormFieldOption {
|
|
|
179
179
|
label: string;
|
|
180
180
|
value: string | number;
|
|
181
181
|
}
|
|
182
|
+
interface FieldButtonConfig {
|
|
183
|
+
type: 'rules' | 'togglePassword' | 'custom';
|
|
184
|
+
icon?: string;
|
|
185
|
+
label?: string;
|
|
186
|
+
tooltip?: string;
|
|
187
|
+
onClick?: () => void | Promise<void>;
|
|
188
|
+
}
|
|
182
189
|
interface FormFieldConfig {
|
|
183
190
|
name: string;
|
|
184
191
|
label?: string;
|
|
@@ -190,6 +197,8 @@ interface FormFieldConfig {
|
|
|
190
197
|
validation?: ValidationRule;
|
|
191
198
|
disabled?: boolean;
|
|
192
199
|
className?: string;
|
|
200
|
+
fieldButtons?: (FieldButtonConfig | 'rules' | 'togglePassword')[];
|
|
201
|
+
showValidationRules?: boolean;
|
|
193
202
|
}
|
|
194
203
|
type FormSubmitHandler = (data: Record<string, unknown>, event: Event) => void | Promise<void>;
|
|
195
204
|
type ClassValue = string | Record<string, boolean> | undefined | null | false;
|
|
@@ -731,7 +740,112 @@ declare class StyleManager {
|
|
|
731
740
|
* CSS template literal tag
|
|
732
741
|
* Usage: css`.class { color: red; }`
|
|
733
742
|
*/
|
|
734
|
-
declare function css(strings: TemplateStringsArray, ...values:
|
|
743
|
+
declare function css(strings: TemplateStringsArray, ...values: (string | number | boolean | null | undefined)[]): string;
|
|
744
|
+
|
|
745
|
+
declare const ClassMaker: {
|
|
746
|
+
/**
|
|
747
|
+
* Generate Font Awesome icon classes
|
|
748
|
+
* @param icon Icon name (without 'fa-' prefix)
|
|
749
|
+
* @param style Font Awesome style (default: 'solid')
|
|
750
|
+
*/
|
|
751
|
+
fa: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => string;
|
|
752
|
+
/**
|
|
753
|
+
* Generate button classes
|
|
754
|
+
* @param level Button level (primary, secondary, tertiary)
|
|
755
|
+
* @param className Additional classes
|
|
756
|
+
*/
|
|
757
|
+
btn: (level: "primary" | "secondary" | "tertiary", className?: string) => string;
|
|
758
|
+
};
|
|
759
|
+
declare const CM: {
|
|
760
|
+
/**
|
|
761
|
+
* Generate Font Awesome icon classes
|
|
762
|
+
* @param icon Icon name (without 'fa-' prefix)
|
|
763
|
+
* @param style Font Awesome style (default: 'solid')
|
|
764
|
+
*/
|
|
765
|
+
fa: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => string;
|
|
766
|
+
/**
|
|
767
|
+
* Generate button classes
|
|
768
|
+
* @param level Button level (primary, secondary, tertiary)
|
|
769
|
+
* @param className Additional classes
|
|
770
|
+
*/
|
|
771
|
+
btn: (level: "primary" | "secondary" | "tertiary", className?: string) => string;
|
|
772
|
+
};
|
|
773
|
+
declare const ElementCreator: {
|
|
774
|
+
div: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
775
|
+
span: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
776
|
+
h1: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
777
|
+
h2: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
778
|
+
h3: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
779
|
+
h4: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
780
|
+
h5: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
781
|
+
h6: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
782
|
+
p: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
783
|
+
i: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
784
|
+
img: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
785
|
+
a: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
786
|
+
button: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
787
|
+
input: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
788
|
+
select: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
789
|
+
option: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
790
|
+
textarea: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
791
|
+
form: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
792
|
+
/**
|
|
793
|
+
* Create icon element with Font Awesome classes
|
|
794
|
+
* @param icon Icon name (without 'fa-' prefix)
|
|
795
|
+
* @param style Font Awesome style (default: 'solid')
|
|
796
|
+
*/
|
|
797
|
+
icon: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => VNode;
|
|
798
|
+
/**
|
|
799
|
+
* Create button element
|
|
800
|
+
*/
|
|
801
|
+
btn: (args: {
|
|
802
|
+
label: string;
|
|
803
|
+
onClick?: () => void | Promise<void>;
|
|
804
|
+
className?: string;
|
|
805
|
+
icon?: string;
|
|
806
|
+
iconStyle?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard";
|
|
807
|
+
level?: "primary" | "secondary" | "tertiary";
|
|
808
|
+
disabled?: boolean;
|
|
809
|
+
}) => VNode;
|
|
810
|
+
};
|
|
811
|
+
declare const EC: {
|
|
812
|
+
div: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
813
|
+
span: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
814
|
+
h1: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
815
|
+
h2: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
816
|
+
h3: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
817
|
+
h4: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
818
|
+
h5: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
819
|
+
h6: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
820
|
+
p: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
821
|
+
i: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
822
|
+
img: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
823
|
+
a: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
824
|
+
button: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
825
|
+
input: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
826
|
+
select: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
827
|
+
option: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
828
|
+
textarea: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
829
|
+
form: (props?: _je_es_vdom.VNodeProps | string | null | undefined, ...children: _je_es_vdom.VNodeChildren[]) => VNode;
|
|
830
|
+
/**
|
|
831
|
+
* Create icon element with Font Awesome classes
|
|
832
|
+
* @param icon Icon name (without 'fa-' prefix)
|
|
833
|
+
* @param style Font Awesome style (default: 'solid')
|
|
834
|
+
*/
|
|
835
|
+
icon: (icon: string, style?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard") => VNode;
|
|
836
|
+
/**
|
|
837
|
+
* Create button element
|
|
838
|
+
*/
|
|
839
|
+
btn: (args: {
|
|
840
|
+
label: string;
|
|
841
|
+
onClick?: () => void | Promise<void>;
|
|
842
|
+
className?: string;
|
|
843
|
+
icon?: string;
|
|
844
|
+
iconStyle?: "solid" | "regular" | "light" | "thin" | "duotone" | "brands" | "sharp-solid" | "sharp-regular" | "sharp-light" | "sharp-thin" | "sharp-duotone-solid" | "sharp-duotone-regular" | "sharp-duotone-light" | "sharp-duotone-thin" | "notdog" | "notdog-duo" | "jelly" | "jelly-fill" | "jelly-duo" | "chisel" | "etch" | "slab" | "slab-press" | "thumbprint" | "utility" | "utility-fill" | "utility-duo" | "whiteboard";
|
|
845
|
+
level?: "primary" | "secondary" | "tertiary";
|
|
846
|
+
disabled?: boolean;
|
|
847
|
+
}) => VNode;
|
|
848
|
+
};
|
|
735
849
|
|
|
736
850
|
declare class I18nManager {
|
|
737
851
|
private translations;
|
|
@@ -744,9 +858,16 @@ declare class I18nManager {
|
|
|
744
858
|
/**
|
|
745
859
|
* Load translations for a specific language
|
|
746
860
|
* @param lang Language code (e.g., 'en', 'ar', 'fr')
|
|
747
|
-
* @param translations Translation object
|
|
861
|
+
* @param translations Translation object (can be nested)
|
|
862
|
+
*/
|
|
863
|
+
loadLanguage(lang: LanguageCode, translations: Record<string, any>): void;
|
|
864
|
+
/**
|
|
865
|
+
* Flatten nested object into dot notation
|
|
866
|
+
* @param obj Nested object
|
|
867
|
+
* @param prefix Current prefix
|
|
868
|
+
* @returns Flattened object with dot notation keys
|
|
748
869
|
*/
|
|
749
|
-
|
|
870
|
+
private flattenObject;
|
|
750
871
|
/**
|
|
751
872
|
* Load all translations from static files
|
|
752
873
|
* @param translations Object with language codes as keys and translation objects as values
|
|
@@ -771,19 +892,19 @@ declare class I18nManager {
|
|
|
771
892
|
*
|
|
772
893
|
* @example
|
|
773
894
|
* // Simple translation
|
|
774
|
-
* t('
|
|
895
|
+
* t('button.login') // => "Login" or "دخـول" depending on current language
|
|
775
896
|
*
|
|
776
897
|
* @example
|
|
777
898
|
* // With parameters
|
|
778
|
-
* t('
|
|
779
|
-
* // => "
|
|
899
|
+
* t('nav.credits', { count: '100' })
|
|
900
|
+
* // => "Available Credits: 100"
|
|
780
901
|
*
|
|
781
902
|
* @example
|
|
782
903
|
* // With nested translation keys as parameters
|
|
783
|
-
* t('
|
|
784
|
-
* // => "
|
|
904
|
+
* t('language.switching_to', { language: 'button.login' })
|
|
905
|
+
* // => "Switching to Login..."
|
|
785
906
|
*
|
|
786
|
-
* @param key Translation key
|
|
907
|
+
* @param key Translation key (supports dot notation for nested keys)
|
|
787
908
|
* @param params Optional parameters for replacement
|
|
788
909
|
* @param defaultValue Optional default translation key
|
|
789
910
|
* @returns Translated string with replaced parameters
|
|
@@ -806,7 +927,7 @@ declare class I18nManager {
|
|
|
806
927
|
*
|
|
807
928
|
* @example
|
|
808
929
|
* // Translation: "Hello <br> World"
|
|
809
|
-
* tHtml('
|
|
930
|
+
* tHtml('page.home.title') // => [text node, br element, text node]
|
|
810
931
|
*
|
|
811
932
|
* @param key Translation key
|
|
812
933
|
* @param params Optional parameters for replacement
|
|
@@ -880,7 +1001,7 @@ declare function getI18n(): I18nManager;
|
|
|
880
1001
|
|
|
881
1002
|
/**
|
|
882
1003
|
* Global translation function
|
|
883
|
-
* @param key Translation key
|
|
1004
|
+
* @param key Translation key (supports dot notation for nested keys)
|
|
884
1005
|
* @param params Optional parameters
|
|
885
1006
|
* @param defaultValue Optional default translation key
|
|
886
1007
|
* @returns Translated string
|
|
@@ -923,14 +1044,14 @@ declare function getCurrentLanguage(): string;
|
|
|
923
1044
|
/**
|
|
924
1045
|
* Load translations for a specific language
|
|
925
1046
|
* @param lang Language code
|
|
926
|
-
* @param translations Translation object
|
|
1047
|
+
* @param translations Translation object (can be nested)
|
|
927
1048
|
*/
|
|
928
|
-
declare function loadLanguage(lang: string, translations: Record<string,
|
|
1049
|
+
declare function loadLanguage(lang: string, translations: Record<string, any>): void;
|
|
929
1050
|
/**
|
|
930
1051
|
* Load all translations
|
|
931
|
-
* @param translations The translations object
|
|
1052
|
+
* @param translations The translations object (can be nested)
|
|
932
1053
|
*/
|
|
933
|
-
declare function loadTranslations(translations: Record<string, Record<string,
|
|
1054
|
+
declare function loadTranslations(translations: Record<string, Record<string, any>>): void;
|
|
934
1055
|
/**
|
|
935
1056
|
* Get all supported languages
|
|
936
1057
|
*/
|
|
@@ -994,7 +1115,7 @@ declare function initializeI18n(config?: I18nConfig): void;
|
|
|
994
1115
|
* supportedLanguages: ['en', 'ar'],
|
|
995
1116
|
* staticPath: 'static/i18n'
|
|
996
1117
|
* });
|
|
997
|
-
* console.log(t('
|
|
1118
|
+
* console.log(t('button.login')); // Ready to use in current language!
|
|
998
1119
|
*/
|
|
999
1120
|
declare function setupI18n(config: I18nConfig): Promise<void>;
|
|
1000
1121
|
/**
|
|
@@ -1033,8 +1154,8 @@ declare class Toast extends Component {
|
|
|
1033
1154
|
error(message: string, duration?: number, translateKey?: string): void;
|
|
1034
1155
|
info(message: string, duration?: number, translateKey?: string): void;
|
|
1035
1156
|
warning(message: string, duration?: number, translateKey?: string): void;
|
|
1036
|
-
render():
|
|
1037
|
-
renderToast(msg: ToastMessage):
|
|
1157
|
+
render(): VNode;
|
|
1158
|
+
renderToast(msg: ToastMessage): VNode;
|
|
1038
1159
|
}
|
|
1039
1160
|
declare function initToast(container?: HTMLElement): Toast;
|
|
1040
1161
|
declare function getToast(): Toast;
|
|
@@ -1066,10 +1187,10 @@ declare class Loader extends Component {
|
|
|
1066
1187
|
private hideTimeout;
|
|
1067
1188
|
onMount(): Promise<void>;
|
|
1068
1189
|
onUnmount(): void;
|
|
1069
|
-
render():
|
|
1070
|
-
renderSpinner():
|
|
1071
|
-
renderMessage():
|
|
1072
|
-
renderProgressBar():
|
|
1190
|
+
render(): VNode;
|
|
1191
|
+
renderSpinner(): VNode;
|
|
1192
|
+
renderMessage(): VNode;
|
|
1193
|
+
renderProgressBar(): VNode;
|
|
1073
1194
|
show(options?: LoaderOptions | string): void;
|
|
1074
1195
|
hide(delay?: number): void;
|
|
1075
1196
|
setMessage(message: string): void;
|
|
@@ -1089,19 +1210,22 @@ declare class Loader extends Component {
|
|
|
1089
1210
|
};
|
|
1090
1211
|
}
|
|
1091
1212
|
|
|
1213
|
+
interface ButtonConfig {
|
|
1214
|
+
label: string;
|
|
1215
|
+
className?: string;
|
|
1216
|
+
icon?: string;
|
|
1217
|
+
loadingLabel?: string;
|
|
1218
|
+
onClick?: 'submit' | (() => void | Promise<void>);
|
|
1219
|
+
}
|
|
1092
1220
|
interface FormConfig {
|
|
1093
|
-
fields: FormFieldConfig[];
|
|
1221
|
+
fields: (FormFieldConfig | (FormFieldConfig | VNode)[])[];
|
|
1094
1222
|
endpoint?: string;
|
|
1095
1223
|
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1096
1224
|
onSubmit?: (data: Record<string, unknown>, event: Event) => void | Promise<void>;
|
|
1097
1225
|
onSuccess?: (data: unknown) => void;
|
|
1098
1226
|
onError?: (error: unknown) => void;
|
|
1099
1227
|
onValidationError?: (errors: Record<string, string>) => void;
|
|
1100
|
-
|
|
1101
|
-
label?: string;
|
|
1102
|
-
loadingLabel?: string;
|
|
1103
|
-
className?: string;
|
|
1104
|
-
};
|
|
1228
|
+
buttons?: Record<string, ButtonConfig>;
|
|
1105
1229
|
className?: string;
|
|
1106
1230
|
autoValidate?: boolean;
|
|
1107
1231
|
}
|
|
@@ -1119,6 +1243,7 @@ declare class SmartFormComponent extends Component<FormConfig> {
|
|
|
1119
1243
|
isSubmitting: boolean;
|
|
1120
1244
|
submitError: string;
|
|
1121
1245
|
submitSuccess: boolean;
|
|
1246
|
+
passwordVisibility: Record<string, boolean>;
|
|
1122
1247
|
constructor(props: FormConfig);
|
|
1123
1248
|
onMount(): void;
|
|
1124
1249
|
/**
|
|
@@ -1145,10 +1270,30 @@ declare class SmartFormComponent extends Component<FormConfig> {
|
|
|
1145
1270
|
* Render label with optional icon
|
|
1146
1271
|
*/
|
|
1147
1272
|
renderLabel(field: FormField): VNode | string;
|
|
1273
|
+
/**
|
|
1274
|
+
* Get field buttons configuration
|
|
1275
|
+
*/
|
|
1276
|
+
getFieldButtons(field: FormField): FieldButtonConfig[];
|
|
1277
|
+
/**
|
|
1278
|
+
* Handle field button click
|
|
1279
|
+
*/
|
|
1280
|
+
handleFieldButton(field: FormField, buttonType: string): void;
|
|
1281
|
+
/**
|
|
1282
|
+
* Render validation rules popup
|
|
1283
|
+
*/
|
|
1284
|
+
renderValidationRules(field: FormField): VNode | string;
|
|
1285
|
+
/**
|
|
1286
|
+
* Render field input buttons
|
|
1287
|
+
*/
|
|
1288
|
+
renderFieldButtons(field: FormField): VNode | string;
|
|
1148
1289
|
/**
|
|
1149
1290
|
* Render form field
|
|
1150
1291
|
*/
|
|
1151
1292
|
renderField(field: FormField): VNode;
|
|
1293
|
+
/**
|
|
1294
|
+
* Render buttons section
|
|
1295
|
+
*/
|
|
1296
|
+
renderButtons(): VNode;
|
|
1152
1297
|
render(): VNode;
|
|
1153
1298
|
styles(): string;
|
|
1154
1299
|
}
|
|
@@ -1203,7 +1348,7 @@ interface PopupOptions {
|
|
|
1203
1348
|
}
|
|
1204
1349
|
interface ActivePopup extends PopupOptions {
|
|
1205
1350
|
id: number;
|
|
1206
|
-
resolve?: (value: boolean | string | null | unknown) => void;
|
|
1351
|
+
resolve?: (value: boolean | string | null | Record<string, unknown>) => void;
|
|
1207
1352
|
inputValue?: string;
|
|
1208
1353
|
isSubmitting?: boolean;
|
|
1209
1354
|
}
|
|
@@ -1218,11 +1363,11 @@ declare class Popup extends Component {
|
|
|
1218
1363
|
/**
|
|
1219
1364
|
* Show a custom popup
|
|
1220
1365
|
*/
|
|
1221
|
-
show(options: PopupOptions): Promise<boolean | string | null | unknown
|
|
1366
|
+
show(options: PopupOptions): Promise<boolean | string | null | Record<string, unknown>>;
|
|
1222
1367
|
/**
|
|
1223
1368
|
* Show a form popup
|
|
1224
1369
|
*/
|
|
1225
|
-
showForm(options: PopupFormOptions): Promise<unknown
|
|
1370
|
+
showForm(options: PopupFormOptions): Promise<boolean | string | null | Record<string, unknown>>;
|
|
1226
1371
|
/**
|
|
1227
1372
|
* Show a confirmation dialog
|
|
1228
1373
|
*/
|
|
@@ -1276,7 +1421,7 @@ declare class Popup extends Component {
|
|
|
1276
1421
|
/**
|
|
1277
1422
|
* Close a specific popup
|
|
1278
1423
|
*/
|
|
1279
|
-
closePopup(id: number, result: boolean | string | null | unknown): void;
|
|
1424
|
+
closePopup(id: number, result: boolean | string | null | Record<string, unknown>): void;
|
|
1280
1425
|
/**
|
|
1281
1426
|
* Close all popups
|
|
1282
1427
|
*/
|
|
@@ -1288,7 +1433,7 @@ declare class Popup extends Component {
|
|
|
1288
1433
|
declare function initPopup(container?: HTMLElement): Popup;
|
|
1289
1434
|
declare function getPopup(): Popup;
|
|
1290
1435
|
declare const popup: {
|
|
1291
|
-
show: (options: PopupOptions) => Promise<unknown>;
|
|
1436
|
+
show: (options: PopupOptions) => Promise<string | boolean | Record<string, unknown> | null>;
|
|
1292
1437
|
confirm: (options: Parameters<Popup["confirm"]>[0]) => Promise<boolean>;
|
|
1293
1438
|
alert: (options: Parameters<Popup["alert"]>[0]) => Promise<boolean>;
|
|
1294
1439
|
prompt: (options: {
|
|
@@ -1299,8 +1444,8 @@ declare const popup: {
|
|
|
1299
1444
|
messageTranslateKey?: string;
|
|
1300
1445
|
onConfirm?: () => void | Promise<void>;
|
|
1301
1446
|
}) => Promise<string | null>;
|
|
1302
|
-
showForm: (options: PopupFormOptions) => Promise<unknown>;
|
|
1303
|
-
closePopup: (id: number, result: boolean | string | null | unknown) => void;
|
|
1447
|
+
showForm: (options: PopupFormOptions) => Promise<string | boolean | Record<string, unknown> | null>;
|
|
1448
|
+
closePopup: (id: number, result: boolean | string | null | Record<string, unknown>) => void;
|
|
1304
1449
|
closeLastPopup: () => void;
|
|
1305
1450
|
closeFirstPopup: () => void;
|
|
1306
1451
|
closeAll: () => void;
|
|
@@ -1375,7 +1520,7 @@ declare class TabbedView extends Component {
|
|
|
1375
1520
|
renderTabList(): VNode;
|
|
1376
1521
|
renderTab(tab: Tab): VNode;
|
|
1377
1522
|
renderTabContent(): VNode;
|
|
1378
|
-
renderActiveTabContent(tab: Tab):
|
|
1523
|
+
renderActiveTabContent(tab: Tab): VNode;
|
|
1379
1524
|
}
|
|
1380
1525
|
/**
|
|
1381
1526
|
* Create a new TabbedView instance with options
|
|
@@ -1410,8 +1555,8 @@ interface ItemsLoaderConfig<T> {
|
|
|
1410
1555
|
onLoadMore?: (page: number, items: T[]) => void;
|
|
1411
1556
|
onError?: (error: Error) => void;
|
|
1412
1557
|
initialItems?: T[];
|
|
1413
|
-
extractItems?: (response:
|
|
1414
|
-
extractTotal?: (response:
|
|
1558
|
+
extractItems?: (response: Record<string, unknown>) => T[];
|
|
1559
|
+
extractTotal?: (response: Record<string, unknown>) => number;
|
|
1415
1560
|
getAuthToken?: () => string | null;
|
|
1416
1561
|
enableInfiniteScroll?: boolean;
|
|
1417
1562
|
scrollThreshold?: number;
|
|
@@ -1500,7 +1645,7 @@ interface DropdownConfig {
|
|
|
1500
1645
|
trigger: {
|
|
1501
1646
|
text?: string;
|
|
1502
1647
|
icon?: string;
|
|
1503
|
-
element?: () =>
|
|
1648
|
+
element?: () => VNode | HTMLElement;
|
|
1504
1649
|
className?: string;
|
|
1505
1650
|
};
|
|
1506
1651
|
items: (DropdownItemConfig | 'divider')[];
|
|
@@ -1520,6 +1665,7 @@ declare class Dropdown extends Component {
|
|
|
1520
1665
|
config: DropdownConfig;
|
|
1521
1666
|
isOpen: boolean;
|
|
1522
1667
|
private mounted;
|
|
1668
|
+
private bb_;
|
|
1523
1669
|
constructor(config: DropdownConfig);
|
|
1524
1670
|
onMount(): void;
|
|
1525
1671
|
onUnmount(): void;
|
|
@@ -1556,12 +1702,12 @@ declare function createDropdown(config: DropdownConfig): Dropdown;
|
|
|
1556
1702
|
* Debounce function
|
|
1557
1703
|
* Delays function execution until after wait time
|
|
1558
1704
|
*/
|
|
1559
|
-
declare function debounce<T extends (...args: never[]) =>
|
|
1705
|
+
declare function debounce<T extends (...args: never[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
1560
1706
|
/**
|
|
1561
1707
|
* Throttle function
|
|
1562
1708
|
* Limits function execution to once per time period
|
|
1563
1709
|
*/
|
|
1564
|
-
declare function throttle<T extends (...args: never[]) =>
|
|
1710
|
+
declare function throttle<T extends (...args: never[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
1565
1711
|
/**
|
|
1566
1712
|
* Class names utility
|
|
1567
1713
|
* Combines class names conditionally
|
|
@@ -1732,4 +1878,111 @@ declare function formatTimeAgo(timestamp: string | Date): string;
|
|
|
1732
1878
|
*/
|
|
1733
1879
|
declare function getTimeTitle(timestamp: string | Date): string;
|
|
1734
1880
|
|
|
1735
|
-
|
|
1881
|
+
declare const bbMap: {
|
|
1882
|
+
form: {
|
|
1883
|
+
base: string;
|
|
1884
|
+
field: string;
|
|
1885
|
+
fieldCheckbox: string;
|
|
1886
|
+
fieldInput: string;
|
|
1887
|
+
fieldInputContainer: string;
|
|
1888
|
+
fieldInputButtons: string;
|
|
1889
|
+
fieldInputButton: string;
|
|
1890
|
+
fieldInputButtonRules: string;
|
|
1891
|
+
fieldInputButtonRulesContent: string;
|
|
1892
|
+
fieldTextarea: string;
|
|
1893
|
+
fieldSelect: string;
|
|
1894
|
+
fieldLabel: string;
|
|
1895
|
+
fieldError: string;
|
|
1896
|
+
fieldTitle: string;
|
|
1897
|
+
buttonsContainer: string;
|
|
1898
|
+
button: string;
|
|
1899
|
+
alert: string;
|
|
1900
|
+
alertError: string;
|
|
1901
|
+
alertSuccess: string;
|
|
1902
|
+
};
|
|
1903
|
+
toast: {
|
|
1904
|
+
container: string;
|
|
1905
|
+
toast: string;
|
|
1906
|
+
icon: string;
|
|
1907
|
+
msg: string;
|
|
1908
|
+
};
|
|
1909
|
+
loader: {
|
|
1910
|
+
container: string;
|
|
1911
|
+
containerOverlay: string;
|
|
1912
|
+
bg: string;
|
|
1913
|
+
loader: string;
|
|
1914
|
+
spinner: {
|
|
1915
|
+
container: string;
|
|
1916
|
+
icon: string;
|
|
1917
|
+
dot: string;
|
|
1918
|
+
pulse: string;
|
|
1919
|
+
text: string;
|
|
1920
|
+
};
|
|
1921
|
+
progress: {
|
|
1922
|
+
container: string;
|
|
1923
|
+
bar: string;
|
|
1924
|
+
text: string;
|
|
1925
|
+
};
|
|
1926
|
+
};
|
|
1927
|
+
popup: {
|
|
1928
|
+
container: string;
|
|
1929
|
+
overlay: string;
|
|
1930
|
+
popup: {
|
|
1931
|
+
base: string;
|
|
1932
|
+
close: string;
|
|
1933
|
+
};
|
|
1934
|
+
header: {
|
|
1935
|
+
container: string;
|
|
1936
|
+
icon: string;
|
|
1937
|
+
content: string;
|
|
1938
|
+
title: string;
|
|
1939
|
+
description: string;
|
|
1940
|
+
};
|
|
1941
|
+
body: {
|
|
1942
|
+
container: string;
|
|
1943
|
+
message: string;
|
|
1944
|
+
input: string;
|
|
1945
|
+
formContainer: string;
|
|
1946
|
+
};
|
|
1947
|
+
footer: string;
|
|
1948
|
+
button: string;
|
|
1949
|
+
};
|
|
1950
|
+
dropdown: {
|
|
1951
|
+
container: string;
|
|
1952
|
+
trigger: string;
|
|
1953
|
+
menu: string;
|
|
1954
|
+
item: string;
|
|
1955
|
+
divider: string;
|
|
1956
|
+
icon: string;
|
|
1957
|
+
};
|
|
1958
|
+
itemsLoader: {
|
|
1959
|
+
container: string;
|
|
1960
|
+
list: string;
|
|
1961
|
+
searchbar: string;
|
|
1962
|
+
loading: string;
|
|
1963
|
+
error: string;
|
|
1964
|
+
trigger: string;
|
|
1965
|
+
end: string;
|
|
1966
|
+
emptyState: string;
|
|
1967
|
+
button: string;
|
|
1968
|
+
item: string;
|
|
1969
|
+
formFieldInput: string;
|
|
1970
|
+
};
|
|
1971
|
+
tabbedView: {
|
|
1972
|
+
container: string;
|
|
1973
|
+
header: string;
|
|
1974
|
+
tab: {
|
|
1975
|
+
base: string;
|
|
1976
|
+
active: string;
|
|
1977
|
+
disabled: string;
|
|
1978
|
+
badge: string;
|
|
1979
|
+
};
|
|
1980
|
+
content: {
|
|
1981
|
+
container: string;
|
|
1982
|
+
emptyState: string;
|
|
1983
|
+
error: string;
|
|
1984
|
+
};
|
|
1985
|
+
};
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
export { type ApiConfig, type AppConfig, type BuildConfig, type ButtonConfig, CM, ClassMaker, type ClassValue, type ClientConfig, CombinedContext, Component, type ComponentConstructor, Context, type ContextSubscriber, type DeepPartial, type DevToolsConfig, Dropdown, type DropdownConfig, type DropdownItemConfig, EC, ElementCreator, type EventHandler, type FieldButtonConfig, type FormConfig, type FormFieldConfig, type FormFieldOption, type FormSubmitHandler, type FormsConfig, type I18nConfig, I18nManager, type IntersectionConfig, ItemsLoader, type ItemsLoaderConfig, type LanguageCode, Loader, type LoaderOptions, type LoaderSize, type LoaderVariant, type NavigationGuard, Popup, type PopupButton, type PopupFormOptions, type PopupOptions, type PopupSize, type PopupType, type PopupVariant, Provider, type ProviderProps, type Route, type RouteConfig, Router, type RouterConfig, SmartForm, SmartFormComponent, type StateConfig, Store, type StoreMiddleware, type StoreOptions, type StoreSubscriber, StyleManager, type Tab, type TabPosition, type TabStyle, TabbedView, type TabbedViewOptions, Toast, type ToastMessage, type ToastType, type TranslationSet, type ValidationRule, VisibilityObserver, bbMap, camelCase, capitalize, clamp, classNames, clearHookContext, client, computed, connect, createCombinedContext, createComputedStore, createContext, createDropdown, createFunctionalComponent, createItemsLoader, createStore, createTabbedView, createTranslator, css, debounce, deepClone, deepMerge, formatDate, formatRelativeTime, formatTimeAgo, getCurrentLanguage, getCurrentPath, getI18n, getPopup, getQueryParam, getQueryParams, getSupportedLanguages, getTimeDisplay, getTimeTitle, getToast, getTranslations, goBack, goForward, hasKey, initPopup, initToast, initializeI18n, isBrowser, isCurrentPath, isCurrentPathPrefix, isEmpty, kebabCase, loadFromUrl, loadLanguage, loadLanguageFile, loadTranslations, mountTabbedView, navigate, navigateWithQuery, observeVisibility, parseQuery, pascalCase, popup, reloadRoute, router, safeJsonParse, scheduler, setHookContext, setLanguage, setLanguageAsync, setupI18n, sleep, state, stringifyQuery, t, tHtml, tLang, throttle, toast, truncate, uniqueId, useCallback, useContext, useDebounce, useEffect, useEventListener, useFetch, useInterval, useLocalStorage, useMemo, usePrevious, useReducer, useRef, useState, useToggle, useWindowSize, utils, watch };
|