@amirjalili1374/ui-kit 1.3.33 → 1.4.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.
Files changed (61) hide show
  1. package/dist/components/shared/ConfirmDialog.vue.d.ts +1 -1
  2. package/dist/components/shared/CustomAutocomplete.vue.d.ts +2 -2
  3. package/dist/components/shared/CustomDataTable.vue.d.ts +1 -1
  4. package/dist/components/shared/DescriptionInput.vue.d.ts +3 -3
  5. package/dist/components/shared/MoneyInput.vue.d.ts +4 -4
  6. package/dist/components/shared/PdfViewer.vue.d.ts +1 -1
  7. package/dist/components/shared/ShamsiDatePicker.vue.d.ts +8 -8
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/plugins/key-clock.d.ts +70 -0
  11. package/dist/plugins/key-clock.d.ts.map +1 -0
  12. package/dist/plugins/vuetify.d.ts +92 -0
  13. package/dist/plugins/vuetify.d.ts.map +1 -0
  14. package/dist/style.css +1 -1
  15. package/dist/theme/darkThemes/DarkModernTheme.d.ts +4 -0
  16. package/dist/theme/darkThemes/DarkModernTheme.d.ts.map +1 -0
  17. package/dist/theme/darkThemes/DarkOrangeTheme.d.ts +4 -0
  18. package/dist/theme/darkThemes/DarkOrangeTheme.d.ts.map +1 -0
  19. package/dist/theme/darkThemes/DarkPurpleTheme.d.ts +4 -0
  20. package/dist/theme/darkThemes/DarkPurpleTheme.d.ts.map +1 -0
  21. package/dist/theme/darkThemes/DarkRedTheme.d.ts +4 -0
  22. package/dist/theme/darkThemes/DarkRedTheme.d.ts.map +1 -0
  23. package/dist/theme/darkThemes/DarkSilverTheme.d.ts +4 -0
  24. package/dist/theme/darkThemes/DarkSilverTheme.d.ts.map +1 -0
  25. package/dist/theme/darkThemes/DarkSteelTealGreen.d.ts +4 -0
  26. package/dist/theme/darkThemes/DarkSteelTealGreen.d.ts.map +1 -0
  27. package/dist/theme/darkThemes/DarkTealTheme.d.ts +4 -0
  28. package/dist/theme/darkThemes/DarkTealTheme.d.ts.map +1 -0
  29. package/dist/theme/lightThemes/ModernTheme.d.ts +4 -0
  30. package/dist/theme/lightThemes/ModernTheme.d.ts.map +1 -0
  31. package/dist/theme/lightThemes/OrangeTheme.d.ts +4 -0
  32. package/dist/theme/lightThemes/OrangeTheme.d.ts.map +1 -0
  33. package/dist/theme/lightThemes/PurpleTheme.d.ts +4 -0
  34. package/dist/theme/lightThemes/PurpleTheme.d.ts.map +1 -0
  35. package/dist/theme/lightThemes/RedTheme.d.ts +4 -0
  36. package/dist/theme/lightThemes/RedTheme.d.ts.map +1 -0
  37. package/dist/theme/lightThemes/SilverTheme.d.ts +4 -0
  38. package/dist/theme/lightThemes/SilverTheme.d.ts.map +1 -0
  39. package/dist/theme/lightThemes/SteelTealGreen.d.ts +4 -0
  40. package/dist/theme/lightThemes/SteelTealGreen.d.ts.map +1 -0
  41. package/dist/theme/lightThemes/TealTheme.d.ts +4 -0
  42. package/dist/theme/lightThemes/TealTheme.d.ts.map +1 -0
  43. package/dist/types/themeTypes/ThemeType.d.ts +47 -0
  44. package/dist/types/themeTypes/ThemeType.d.ts.map +1 -0
  45. package/dist/ui-kit.cjs.js +1 -1
  46. package/dist/ui-kit.cjs.js.map +1 -1
  47. package/dist/ui-kit.es.js +349 -2
  48. package/dist/ui-kit.es.js.map +1 -1
  49. package/dist/utils/appInitializer/AppBootstrap.d.ts +90 -0
  50. package/dist/utils/appInitializer/AppBootstrap.d.ts.map +1 -0
  51. package/dist/utils/appInitializer/AuthModeInitializer.d.ts +38 -0
  52. package/dist/utils/appInitializer/AuthModeInitializer.d.ts.map +1 -0
  53. package/dist/utils/appInitializer/InitializerModeInitializer.d.ts +29 -0
  54. package/dist/utils/appInitializer/InitializerModeInitializer.d.ts.map +1 -0
  55. package/dist/utils/appInitializer/JwtInitializer.d.ts +21 -0
  56. package/dist/utils/appInitializer/JwtInitializer.d.ts.map +1 -0
  57. package/dist/utils/appInitializer/KeycloakInitializer.d.ts +18 -0
  58. package/dist/utils/appInitializer/KeycloakInitializer.d.ts.map +1 -0
  59. package/dist/utils/appInitializer/index.d.ts +17 -0
  60. package/dist/utils/appInitializer/index.d.ts.map +1 -0
  61. package/package.json +5 -1
package/dist/ui-kit.es.js CHANGED
@@ -1,9 +1,13 @@
1
+ var __defProp2 = Object.defineProperty;
2
+ var __defNormalProp2 = (obj, key2, value2) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key2] = value2;
3
+ var __publicField = (obj, key2, value2) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value2);
1
4
  import { capitalize, reactive, watchEffect, toRef, shallowRef, Fragment, camelize, isVNode, Comment, unref, warn, getCurrentInstance as getCurrentInstance$1, ref, computed, provide, inject, defineComponent as defineComponent$1, h, createElementVNode, normalizeStyle, normalizeClass, toValue, resolveDynamicComponent, nextTick, onScopeDispose, createVNode, mergeProps, toRefs, Text, isRef, TransitionGroup, Transition, watch, onBeforeMount, onBeforeUnmount, withDirectives, vShow, toDisplayString, effectScope, toRaw, readonly, createBlock, openBlock, withCtx, createCommentVNode, useId, onMounted, onUpdated, Teleport, createTextVNode, createElementBlock, renderSlot, onDeactivated, cloneVNode, renderList, createSlots, normalizeProps, guardReactiveProps, resolveComponent, onActivated, onBeforeUpdate, withModifiers, vModelText, withKeys, onUnmounted } from "vue";
2
5
  import { IconHome, IconArrowBadgeLeft, IconChevronDown, IconChevronRight, IconMinus, IconPlus, IconRefresh, IconChevronLeft, IconDownload, IconPrinter, IconMaximize, IconMinimize, IconX, IconFileText, IconCheck, IconPencil, IconClock, IconMenu2, IconPalette } from "@tabler/icons-vue";
3
6
  import axios from "axios";
4
7
  import { useDebounceFn } from "@vueuse/core";
5
8
  import { useRouter as useRouter$1 } from "vue-router";
6
9
  import { defineStore } from "pinia";
10
+ import VueKeycloakJs from "@dsb-norge/vue-keycloak-js";
7
11
  function propsFactory(props, source) {
8
12
  return (defaults) => {
9
13
  return Object.keys(props).reduce((obj, prop) => {
@@ -38252,7 +38256,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
38252
38256
  default: withCtx(() => [
38253
38257
  item.icon ? (openBlock(), createBlock(resolveDynamicComponent(item.icon), {
38254
38258
  key: 0,
38255
- class: "mr-2",
38259
+ class: "ml-2",
38256
38260
  size: "18"
38257
38261
  })) : createCommentVNode("", true),
38258
38262
  createElementVNode("span", null, toDisplayString(item.title), 1),
@@ -38386,7 +38390,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
38386
38390
  };
38387
38391
  }
38388
38392
  });
38389
- const AppHeader = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__scopeId", "data-v-60197e34"]]);
38393
+ const AppHeader = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__scopeId", "data-v-9b94743b"]]);
38390
38394
  const makeVAppProps = propsFactory({
38391
38395
  ...makeComponentProps(),
38392
38396
  ...omit(makeLayoutProps(), ["fullHeight"]),
@@ -39054,6 +39058,342 @@ function handleResponse(response) {
39054
39058
  return data2;
39055
39059
  });
39056
39060
  }
39061
+ function setupKeycloak(app, options) {
39062
+ const {
39063
+ config,
39064
+ init = {
39065
+ flow: "standard",
39066
+ checkLoginIframe: false,
39067
+ onLoad: "login-required",
39068
+ pkceMethod: "S256"
39069
+ },
39070
+ logout = {
39071
+ redirectUri: window.location.origin
39072
+ },
39073
+ callbacks = {},
39074
+ exposeGlobally = true
39075
+ } = options;
39076
+ const pluginOptions = {
39077
+ config,
39078
+ init,
39079
+ logout,
39080
+ onAuthLogout: callbacks.onAuthLogout || (() => {
39081
+ if (init.enableLogging) {
39082
+ console.log("User logged out from Keycloak");
39083
+ }
39084
+ }),
39085
+ onReady: (keycloakInstance) => {
39086
+ var _a;
39087
+ if (exposeGlobally) {
39088
+ window.$keycloak = keycloakInstance;
39089
+ if (init.enableLogging) {
39090
+ console.log("Keycloak ready, instance exposed globally");
39091
+ }
39092
+ }
39093
+ (_a = callbacks.onReady) == null ? void 0 : _a.call(callbacks, keycloakInstance);
39094
+ },
39095
+ onInitError: (error) => {
39096
+ var _a;
39097
+ if (init.enableLogging !== false) {
39098
+ console.error("Keycloak initialization error:", error);
39099
+ }
39100
+ (_a = callbacks.onInitError) == null ? void 0 : _a.call(callbacks, error);
39101
+ }
39102
+ };
39103
+ if (callbacks.onAuthSuccess) {
39104
+ pluginOptions.onAuthSuccess = callbacks.onAuthSuccess;
39105
+ }
39106
+ if (callbacks.onAuthError) {
39107
+ pluginOptions.onAuthError = callbacks.onAuthError;
39108
+ }
39109
+ return app.use(VueKeycloakJs, pluginOptions);
39110
+ }
39111
+ class AuthModeInitializer {
39112
+ constructor(config) {
39113
+ __publicField(this, "config");
39114
+ this.config = config;
39115
+ }
39116
+ /**
39117
+ * Check if this initializer should handle the given mode
39118
+ */
39119
+ canHandle(mode) {
39120
+ return this.getMode() === mode;
39121
+ }
39122
+ /**
39123
+ * Handle errors during initialization
39124
+ */
39125
+ handleError(error) {
39126
+ if (this.config.onError) {
39127
+ this.config.onError(error);
39128
+ } else {
39129
+ console.error(`[${this.getMode()}] Initialization error:`, error);
39130
+ }
39131
+ }
39132
+ /**
39133
+ * Handle successful initialization
39134
+ */
39135
+ handleSuccess() {
39136
+ if (this.config.onSuccess) {
39137
+ this.config.onSuccess();
39138
+ }
39139
+ }
39140
+ }
39141
+ class KeycloakInitializer extends AuthModeInitializer {
39142
+ constructor(app, config) {
39143
+ super(config);
39144
+ __publicField(this, "app");
39145
+ __publicField(this, "keycloakOptions");
39146
+ this.app = app;
39147
+ this.keycloakOptions = config.keycloakOptions;
39148
+ }
39149
+ getMode() {
39150
+ return "keycloak";
39151
+ }
39152
+ async initialize() {
39153
+ try {
39154
+ console.log("🔐 Initializing Keycloak authentication...");
39155
+ setupKeycloak(this.app, this.keycloakOptions);
39156
+ console.log("✅ Keycloak initialized successfully");
39157
+ this.handleSuccess();
39158
+ } catch (error) {
39159
+ this.handleError(error);
39160
+ throw error;
39161
+ }
39162
+ }
39163
+ }
39164
+ class JwtInitializer extends AuthModeInitializer {
39165
+ constructor(config) {
39166
+ super(config);
39167
+ }
39168
+ get jwtConfig() {
39169
+ return this.config;
39170
+ }
39171
+ getMode() {
39172
+ return "jwt";
39173
+ }
39174
+ async initialize() {
39175
+ var _a, _b;
39176
+ try {
39177
+ console.log("🔐 Initializing JWT authentication...");
39178
+ const response = await this.jwtConfig.getUserInfo();
39179
+ if (response == null ? void 0 : response.data) {
39180
+ this.jwtConfig.setUser(response.data);
39181
+ if (this.jwtConfig.setUserInStorage) {
39182
+ this.jwtConfig.setUserInStorage(response.data);
39183
+ }
39184
+ console.log("✅ JWT authentication initialized successfully");
39185
+ this.handleSuccess();
39186
+ } else {
39187
+ throw new Error("No user data received from getUserInfo");
39188
+ }
39189
+ } catch (error) {
39190
+ if (((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) === 401) {
39191
+ console.log("ℹ️ User not authenticated (401), continuing...");
39192
+ this.handleSuccess();
39193
+ return;
39194
+ }
39195
+ if (((_b = error == null ? void 0 : error.response) == null ? void 0 : _b.status) !== 401) {
39196
+ console.warn("⚠️ getUserInfo API call failed:", (error == null ? void 0 : error.message) ?? error);
39197
+ }
39198
+ this.handleError(error);
39199
+ }
39200
+ }
39201
+ }
39202
+ class InitializerModeInitializer extends AuthModeInitializer {
39203
+ constructor(app, config) {
39204
+ super(config);
39205
+ __publicField(this, "app");
39206
+ this.app = app;
39207
+ }
39208
+ get initializerConfig() {
39209
+ return this.config;
39210
+ }
39211
+ getMode() {
39212
+ return this.initializerConfig.mode;
39213
+ }
39214
+ async initialize() {
39215
+ try {
39216
+ console.log("📱 Initializing app via AppInitializer...");
39217
+ const initPromise = this.initializerConfig.appInitializer.initializeApp();
39218
+ if (this.initializerConfig.setLoading) {
39219
+ this.initializerConfig.setLoading(true);
39220
+ }
39221
+ try {
39222
+ await this.initializerConfig.appInitializer.startInitialization();
39223
+ await initPromise;
39224
+ console.log("✅ App initialization completed successfully");
39225
+ if (this.initializerConfig.mode === "dev") {
39226
+ console.log("🔧 Dev mode: forcing loading false");
39227
+ if (this.initializerConfig.setLoading) {
39228
+ this.initializerConfig.setLoading(false);
39229
+ setTimeout(() => {
39230
+ if (this.initializerConfig.setLoading) {
39231
+ this.initializerConfig.setLoading(false);
39232
+ }
39233
+ }, 100);
39234
+ }
39235
+ }
39236
+ this.handleSuccess();
39237
+ } catch (error) {
39238
+ console.error("❌ App initialization failed:", error);
39239
+ if (this.initializerConfig.redirectToLogin) {
39240
+ const currentPath = this.initializerConfig.currentRoutePath || "";
39241
+ const loginPath = this.initializerConfig.loginRoutePath || "/auth/login";
39242
+ if (currentPath !== loginPath) {
39243
+ await this.initializerConfig.redirectToLogin();
39244
+ }
39245
+ }
39246
+ this.handleError(error);
39247
+ throw error;
39248
+ } finally {
39249
+ if (this.initializerConfig.setLoading) {
39250
+ this.initializerConfig.setLoading(false);
39251
+ }
39252
+ }
39253
+ } catch (error) {
39254
+ this.handleError(error);
39255
+ throw error;
39256
+ }
39257
+ }
39258
+ }
39259
+ class AppBootstrap {
39260
+ constructor(config) {
39261
+ __publicField(this, "app");
39262
+ __publicField(this, "authMode");
39263
+ __publicField(this, "authConfig");
39264
+ __publicField(this, "plugins");
39265
+ __publicField(this, "directives");
39266
+ __publicField(this, "components");
39267
+ __publicField(this, "onBootstrapStart");
39268
+ __publicField(this, "onBootstrapComplete");
39269
+ __publicField(this, "onBootstrapError");
39270
+ this.app = config.app;
39271
+ this.authMode = config.authMode;
39272
+ this.authConfig = config.authConfig;
39273
+ this.plugins = config.plugins;
39274
+ this.directives = config.directives;
39275
+ this.components = config.components;
39276
+ this.onBootstrapStart = config.onBootstrapStart;
39277
+ this.onBootstrapComplete = config.onBootstrapComplete;
39278
+ this.onBootstrapError = config.onBootstrapError;
39279
+ }
39280
+ /**
39281
+ * Start the bootstrap process
39282
+ */
39283
+ async bootstrap() {
39284
+ var _a, _b, _c;
39285
+ try {
39286
+ (_a = this.onBootstrapStart) == null ? void 0 : _a.call(this);
39287
+ console.log("🚀 Bootstrap starting with authMode:", this.authMode);
39288
+ await this.initializeAuth();
39289
+ this.registerPlugins();
39290
+ this.registerDirectives();
39291
+ this.registerComponents();
39292
+ this.mountApp();
39293
+ (_b = this.onBootstrapComplete) == null ? void 0 : _b.call(this);
39294
+ console.log("✅ Bootstrap completed successfully");
39295
+ } catch (error) {
39296
+ console.error("❌ Bootstrap error:", error);
39297
+ (_c = this.onBootstrapError) == null ? void 0 : _c.call(this, error);
39298
+ throw error;
39299
+ }
39300
+ }
39301
+ /**
39302
+ * Initialize authentication based on mode
39303
+ */
39304
+ async initializeAuth() {
39305
+ let initializer;
39306
+ switch (this.authMode) {
39307
+ case "keycloak":
39308
+ if (!("keycloakOptions" in this.authConfig)) {
39309
+ throw new Error("Keycloak config must include keycloakOptions");
39310
+ }
39311
+ initializer = new KeycloakInitializer(this.app, this.authConfig);
39312
+ break;
39313
+ case "jwt":
39314
+ initializer = new JwtInitializer(this.authConfig);
39315
+ break;
39316
+ case "initializer":
39317
+ case "dev":
39318
+ initializer = new InitializerModeInitializer(this.app, this.authConfig);
39319
+ break;
39320
+ default:
39321
+ throw new Error(`Unknown auth mode: ${this.authMode}`);
39322
+ }
39323
+ await initializer.initialize();
39324
+ }
39325
+ /**
39326
+ * Register Vue plugins
39327
+ */
39328
+ registerPlugins() {
39329
+ if (!this.plugins) return;
39330
+ if (this.plugins.router) {
39331
+ this.app.use(this.plugins.router);
39332
+ }
39333
+ if (this.plugins.perfectScrollbar) {
39334
+ this.app.use(this.plugins.perfectScrollbar);
39335
+ }
39336
+ if (this.plugins.print) {
39337
+ this.app.use(this.plugins.print);
39338
+ }
39339
+ if (this.plugins.vueApexCharts) {
39340
+ this.app.use(this.plugins.vueApexCharts);
39341
+ }
39342
+ if (this.plugins.vuetify) {
39343
+ this.app.use(this.plugins.vuetify);
39344
+ }
39345
+ if (this.plugins.customPlugins) {
39346
+ this.plugins.customPlugins.forEach(({ plugin, options }) => {
39347
+ if (options) {
39348
+ this.app.use(plugin, options);
39349
+ } else {
39350
+ this.app.use(plugin);
39351
+ }
39352
+ });
39353
+ }
39354
+ }
39355
+ /**
39356
+ * Register Vue directives
39357
+ */
39358
+ registerDirectives() {
39359
+ if (!this.directives) return;
39360
+ if (this.directives.digitLimit) {
39361
+ this.app.directive("digit-limit", this.directives.digitLimit);
39362
+ }
39363
+ if (this.directives.permission) {
39364
+ this.app.directive("permission", this.directives.permission);
39365
+ }
39366
+ if (this.directives.customDirectives) {
39367
+ this.directives.customDirectives.forEach(({ name: name2, directive: directive2 }) => {
39368
+ this.app.directive(name2, directive2);
39369
+ });
39370
+ }
39371
+ }
39372
+ /**
39373
+ * Register Vue components
39374
+ */
39375
+ registerComponents() {
39376
+ if (!this.components) return;
39377
+ if (this.components.vue3PersianDatetimePicker) {
39378
+ this.app.component("Vue3PersianDatetimePicker", this.components.vue3PersianDatetimePicker);
39379
+ }
39380
+ if (this.components.customComponents) {
39381
+ this.components.customComponents.forEach(({ name: name2, component }) => {
39382
+ this.app.component(name2, component);
39383
+ });
39384
+ }
39385
+ }
39386
+ /**
39387
+ * Mount the Vue app
39388
+ */
39389
+ mountApp() {
39390
+ this.app.mount("#app");
39391
+ }
39392
+ }
39393
+ async function bootstrapApp(config) {
39394
+ const bootstrap = new AppBootstrap(config);
39395
+ await bootstrap.bootstrap();
39396
+ }
39057
39397
  function nationalCodeRule(nationalCode, customerType) {
39058
39398
  if (!NationalCodeValidator.isValid(nationalCode, customerType)) return "کد ملی نامعتبر است";
39059
39399
  return false;
@@ -39073,10 +39413,12 @@ const index = {
39073
39413
  install
39074
39414
  };
39075
39415
  export {
39416
+ AppBootstrap,
39076
39417
  AppHeader,
39077
39418
  AppLayout,
39078
39419
  _sfc_main$2 as AppSidebar,
39079
39420
  AppStepper,
39421
+ AuthModeInitializer,
39080
39422
  _sfc_main$l as BaseBreadcrumb,
39081
39423
  _sfc_main$k as BaseIcon,
39082
39424
  BooleanEnum,
@@ -39089,6 +39431,9 @@ export {
39089
39431
  DigitLimit,
39090
39432
  DownloadButton,
39091
39433
  GreetingUtils,
39434
+ InitializerModeInitializer,
39435
+ JwtInitializer,
39436
+ KeycloakInitializer,
39092
39437
  Loading,
39093
39438
  _sfc_main$h as MoneyInput,
39094
39439
  NationalCodeValidator,
@@ -39097,6 +39442,7 @@ export {
39097
39442
  _sfc_main$b as UiChildCard,
39098
39443
  _sfc_main$a as UiParentCard,
39099
39444
  _sfc_main$9 as VPriceTextField,
39445
+ bootstrapApp,
39100
39446
  configureAuth,
39101
39447
  configureAxiosInstance,
39102
39448
  index as default,
@@ -39106,6 +39452,7 @@ export {
39106
39452
  getAxiosInstance,
39107
39453
  install,
39108
39454
  nationalCodeRule,
39455
+ setupKeycloak,
39109
39456
  useCustomizerStore,
39110
39457
  useDataTable,
39111
39458
  useTableActions,