@kodaris/krubble-app-components 1.0.2 → 1.0.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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@kodaris/krubble-components')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@kodaris/krubble-components'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.krApp = {}, global.kr));
5
- })(this, (function (exports, krubbleComponents) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@kodaris/krubble-components'), require('@kodaris/krubble-data')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@kodaris/krubble-components', '@kodaris/krubble-data'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.krApp = {}, global.kr, global.kr.data));
5
+ })(this, (function (exports, krubbleComponents, krubbleData) { 'use strict';
6
6
 
7
7
  /**
8
8
  * @license
@@ -97,7 +97,7 @@
97
97
  * @fires menu-item-click - When a menu item is clicked. Detail: { item: KRShellMenuItem }
98
98
  * @fires logout - When logout is clicked
99
99
  */
100
- exports.KRShell = class KRShell extends i$1 {
100
+ exports.Shell = class KRShell extends i$1 {
101
101
  constructor() {
102
102
  super(...arguments);
103
103
  this.logo = 'https://s3.amazonaws.com/kodariscom/kodariscom/content/website/kodaris-logo-icon-light-53.png';
@@ -368,7 +368,7 @@
368
368
  `;
369
369
  }
370
370
  };
371
- exports.KRShell.styles = i$4 `
371
+ exports.Shell.styles = i$4 `
372
372
  :host {
373
373
  display: flex;
374
374
  flex-direction: column;
@@ -897,99 +897,31 @@
897
897
  `;
898
898
  __decorate$5([
899
899
  n({ type: String })
900
- ], exports.KRShell.prototype, "logo", void 0);
900
+ ], exports.Shell.prototype, "logo", void 0);
901
901
  __decorate$5([
902
902
  n({ type: Array })
903
- ], exports.KRShell.prototype, "apps", void 0);
903
+ ], exports.Shell.prototype, "apps", void 0);
904
904
  __decorate$5([
905
905
  n({ type: String, attribute: 'active-app-id' })
906
- ], exports.KRShell.prototype, "activeAppId", void 0);
906
+ ], exports.Shell.prototype, "activeAppId", void 0);
907
907
  __decorate$5([
908
908
  n({ type: Object })
909
- ], exports.KRShell.prototype, "user", void 0);
909
+ ], exports.Shell.prototype, "user", void 0);
910
910
  __decorate$5([
911
911
  n({ type: Array, attribute: 'menu-items' })
912
- ], exports.KRShell.prototype, "menuItems", void 0);
912
+ ], exports.Shell.prototype, "menuItems", void 0);
913
913
  __decorate$5([
914
914
  r()
915
- ], exports.KRShell.prototype, "isUserMenuOpen", void 0);
915
+ ], exports.Shell.prototype, "isUserMenuOpen", void 0);
916
916
  __decorate$5([
917
917
  r()
918
- ], exports.KRShell.prototype, "isAppsMenuOpen", void 0);
918
+ ], exports.Shell.prototype, "isAppsMenuOpen", void 0);
919
919
  __decorate$5([
920
920
  r()
921
- ], exports.KRShell.prototype, "pendingRequests", void 0);
922
- exports.KRShell = __decorate$5([
921
+ ], exports.Shell.prototype, "pendingRequests", void 0);
922
+ exports.Shell = __decorate$5([
923
923
  t$1('kr-shell')
924
- ], exports.KRShell);
925
-
926
- class KRClient {
927
- constructor() {
928
- this._url = `https://content.kodaris.com`;
929
- }
930
- static getInstance() {
931
- if (!KRClient._instance) {
932
- KRClient._instance = new KRClient();
933
- }
934
- return KRClient._instance;
935
- }
936
- fetch(options) {
937
- let url = options.url;
938
- // Add on the default base url if user
939
- // has not provided the full url
940
- if (url.indexOf('http') !== 0) {
941
- url = this._url + url;
942
- }
943
- if (options.params) {
944
- url += '?';
945
- Object.keys(options.params).forEach((key, keyIdx) => {
946
- if (keyIdx > 0) {
947
- url += '&';
948
- }
949
- url += `${key}=${options.params[key]}`;
950
- });
951
- }
952
- // fixme
953
- if (!options) {
954
- options = {};
955
- }
956
- if (!options.headers) {
957
- options.headers = {};
958
- }
959
- if (!options.headers['Content-Type']) {
960
- options.headers['Content-Type'] = 'application/json';
961
- }
962
- options.credentials = 'include';
963
- // User and Customer apis require CSRF tokens on non-GET reequests
964
- let token;
965
- if (url.indexOf('/api/user/') > -1 || url.indexOf('/api/customer/') > -1) {
966
- token = fetch(`${this._url}/api/user/customer/authToken`, { credentials: 'include' });
967
- }
968
- else {
969
- token = Promise.resolve(null);
970
- }
971
- let response;
972
- return token
973
- .then(res => res?.json())
974
- .then(res => {
975
- if (res?.data) {
976
- options.headers['X-CSRF-TOKEN'] = res.data;
977
- }
978
- return fetch(url, options);
979
- })
980
- .then(res => {
981
- response = res;
982
- return res.json();
983
- })
984
- .then(json => {
985
- if (!response?.ok) {
986
- return Promise.reject(json);
987
- }
988
- return Promise.resolve(json);
989
- });
990
- }
991
- }
992
- KRClient._instance = null;
924
+ ], exports.Shell);
993
925
 
994
926
  var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
995
927
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1260,13 +1192,13 @@
1260
1192
  * - Don't hardcode breadcrumbs
1261
1193
  * - Look at renderNormalFooter and renderEditFooter and see if that is what we want to do
1262
1194
  */
1263
- exports.KRScaffold = class KRScaffold extends i$1 {
1195
+ exports.Scaffold = class KRScaffold extends i$1 {
1264
1196
  constructor() {
1265
1197
  super();
1266
1198
  /**
1267
1199
  * HTTP client for API calls
1268
1200
  */
1269
- this.http = KRClient.getInstance();
1201
+ this.http = krubbleData.Client.getInstance();
1270
1202
  /**
1271
1203
  * Default icon for nav items without an icon (shown at top level)
1272
1204
  */
@@ -1568,9 +1500,14 @@
1568
1500
  });
1569
1501
  this.dispatchEvent(navEvent);
1570
1502
  // If a listener called preventDefault(), prevent the native navigation
1503
+ // (e.g., Angular router handles it and will call updateActiveNavItem() after route change)
1571
1504
  if (navEvent.defaultPrevented) {
1572
1505
  e.preventDefault();
1573
1506
  }
1507
+ else {
1508
+ // Native browser navigation - set active item immediately for visual feedback
1509
+ this.activeNavItemId = item.id;
1510
+ }
1574
1511
  }
1575
1512
  }
1576
1513
  /**
@@ -1655,7 +1592,7 @@
1655
1592
  if (!this.isEditing)
1656
1593
  return;
1657
1594
  e.preventDefault();
1658
- krubbleComponents.KRContextMenu.open({
1595
+ krubbleComponents.ContextMenu.open({
1659
1596
  x: e.clientX,
1660
1597
  y: e.clientY,
1661
1598
  items: [
@@ -1690,7 +1627,7 @@
1690
1627
  * @param item - The nav item to edit
1691
1628
  */
1692
1629
  openNavItemEdit(item) {
1693
- krubbleComponents.KRDialog.open(KRNavItemEdit, { data: item }).afterClosed().then((res) => {
1630
+ krubbleComponents.Dialog.open(KRNavItemEdit, { data: item }).afterClosed().then((res) => {
1694
1631
  const result = res;
1695
1632
  if (!result)
1696
1633
  return;
@@ -2253,7 +2190,7 @@
2253
2190
  `;
2254
2191
  }
2255
2192
  };
2256
- exports.KRScaffold.styles = i$4 `
2193
+ exports.Scaffold.styles = i$4 `
2257
2194
  :host {
2258
2195
  display: flex;
2259
2196
  flex-direction: column;
@@ -2983,70 +2920,70 @@
2983
2920
  `;
2984
2921
  __decorate$3([
2985
2922
  r()
2986
- ], exports.KRScaffold.prototype, "navItemsExpanded", void 0);
2923
+ ], exports.Scaffold.prototype, "navItemsExpanded", void 0);
2987
2924
  __decorate$3([
2988
2925
  r()
2989
- ], exports.KRScaffold.prototype, "navQuery", void 0);
2926
+ ], exports.Scaffold.prototype, "navQuery", void 0);
2990
2927
  __decorate$3([
2991
2928
  r()
2992
- ], exports.KRScaffold.prototype, "activeNavItemId", void 0);
2929
+ ], exports.Scaffold.prototype, "activeNavItemId", void 0);
2993
2930
  __decorate$3([
2994
2931
  r()
2995
- ], exports.KRScaffold.prototype, "isNavScrolled", void 0);
2932
+ ], exports.Scaffold.prototype, "isNavScrolled", void 0);
2996
2933
  __decorate$3([
2997
2934
  r()
2998
- ], exports.KRScaffold.prototype, "isNavOpened", void 0);
2935
+ ], exports.Scaffold.prototype, "isNavOpened", void 0);
2999
2936
  __decorate$3([
3000
2937
  r()
3001
- ], exports.KRScaffold.prototype, "isEditing", void 0);
2938
+ ], exports.Scaffold.prototype, "isEditing", void 0);
3002
2939
  __decorate$3([
3003
2940
  r()
3004
- ], exports.KRScaffold.prototype, "isUserMenuOpen", void 0);
2941
+ ], exports.Scaffold.prototype, "isUserMenuOpen", void 0);
3005
2942
  __decorate$3([
3006
2943
  r()
3007
- ], exports.KRScaffold.prototype, "pref", void 0);
2944
+ ], exports.Scaffold.prototype, "pref", void 0);
3008
2945
  __decorate$3([
3009
2946
  r()
3010
- ], exports.KRScaffold.prototype, "draggedNavItemId", void 0);
2947
+ ], exports.Scaffold.prototype, "draggedNavItemId", void 0);
3011
2948
  __decorate$3([
3012
2949
  r()
3013
- ], exports.KRScaffold.prototype, "navItemDropTargetId", void 0);
2950
+ ], exports.Scaffold.prototype, "navItemDropTargetId", void 0);
3014
2951
  __decorate$3([
3015
2952
  r()
3016
- ], exports.KRScaffold.prototype, "navItemDropPosition", void 0);
2953
+ ], exports.Scaffold.prototype, "navItemDropPosition", void 0);
3017
2954
  __decorate$3([
3018
2955
  r()
3019
- ], exports.KRScaffold.prototype, "pendingRequests", void 0);
2956
+ ], exports.Scaffold.prototype, "pendingRequests", void 0);
3020
2957
  __decorate$3([
3021
2958
  n({ type: String })
3022
- ], exports.KRScaffold.prototype, "logo", void 0);
2959
+ ], exports.Scaffold.prototype, "logo", void 0);
3023
2960
  __decorate$3([
3024
2961
  n({ type: String })
3025
- ], exports.KRScaffold.prototype, "title", void 0);
2962
+ ], exports.Scaffold.prototype, "title", void 0);
3026
2963
  __decorate$3([
3027
2964
  n({ type: String, reflect: true })
3028
- ], exports.KRScaffold.prototype, "scheme", void 0);
2965
+ ], exports.Scaffold.prototype, "scheme", void 0);
3029
2966
  __decorate$3([
3030
2967
  n({ type: Array })
3031
- ], exports.KRScaffold.prototype, "nav", void 0);
2968
+ ], exports.Scaffold.prototype, "nav", void 0);
3032
2969
  __decorate$3([
3033
2970
  n({ type: Boolean, attribute: 'nav-icons-displayed', reflect: true })
3034
- ], exports.KRScaffold.prototype, "navIconsDisplayed", void 0);
2971
+ ], exports.Scaffold.prototype, "navIconsDisplayed", void 0);
3035
2972
  __decorate$3([
3036
2973
  n({ type: Boolean, attribute: 'nav-expanded' })
3037
- ], exports.KRScaffold.prototype, "navExpanded", void 0);
2974
+ ], exports.Scaffold.prototype, "navExpanded", void 0);
3038
2975
  __decorate$3([
3039
2976
  n({ type: Object })
3040
- ], exports.KRScaffold.prototype, "user", void 0);
2977
+ ], exports.Scaffold.prototype, "user", void 0);
3041
2978
  __decorate$3([
3042
2979
  n({ type: Boolean })
3043
- ], exports.KRScaffold.prototype, "subbar", void 0);
2980
+ ], exports.Scaffold.prototype, "subbar", void 0);
3044
2981
  __decorate$3([
3045
2982
  n({ type: Array })
3046
- ], exports.KRScaffold.prototype, "breadcrumbs", void 0);
3047
- exports.KRScaffold = __decorate$3([
2983
+ ], exports.Scaffold.prototype, "breadcrumbs", void 0);
2984
+ exports.Scaffold = __decorate$3([
3048
2985
  t$1('kr-scaffold')
3049
- ], exports.KRScaffold);
2986
+ ], exports.Scaffold);
3050
2987
 
3051
2988
  var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3052
2989
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3084,7 +3021,7 @@
3084
3021
  * @property {KRScreenNavItem[]} navItems - Navigation items as JSON array
3085
3022
  * @property {string} activeId - Currently active item ID
3086
3023
  */
3087
- exports.KRScreenNav = class KRScreenNav extends i$1 {
3024
+ exports.ScreenNav = class KRScreenNav extends i$1 {
3088
3025
  constructor() {
3089
3026
  super(...arguments);
3090
3027
  /**
@@ -3196,7 +3133,7 @@
3196
3133
  `;
3197
3134
  }
3198
3135
  };
3199
- exports.KRScreenNav.styles = i$4 `
3136
+ exports.ScreenNav.styles = i$4 `
3200
3137
  :host {
3201
3138
  display: flex;
3202
3139
  height: 100%;
@@ -3325,22 +3262,22 @@
3325
3262
  `;
3326
3263
  __decorate$2([
3327
3264
  n({ type: String })
3328
- ], exports.KRScreenNav.prototype, "title", void 0);
3265
+ ], exports.ScreenNav.prototype, "title", void 0);
3329
3266
  __decorate$2([
3330
3267
  n({ type: String })
3331
- ], exports.KRScreenNav.prototype, "subtitle", void 0);
3268
+ ], exports.ScreenNav.prototype, "subtitle", void 0);
3332
3269
  __decorate$2([
3333
3270
  n({ type: String })
3334
- ], exports.KRScreenNav.prototype, "backUrl", void 0);
3271
+ ], exports.ScreenNav.prototype, "backUrl", void 0);
3335
3272
  __decorate$2([
3336
3273
  n({ type: Array })
3337
- ], exports.KRScreenNav.prototype, "navItems", void 0);
3274
+ ], exports.ScreenNav.prototype, "navItems", void 0);
3338
3275
  __decorate$2([
3339
3276
  n({ type: String })
3340
- ], exports.KRScreenNav.prototype, "activeId", void 0);
3341
- exports.KRScreenNav = __decorate$2([
3277
+ ], exports.ScreenNav.prototype, "activeId", void 0);
3278
+ exports.ScreenNav = __decorate$2([
3342
3279
  t$1('kr-screen-nav')
3343
- ], exports.KRScreenNav);
3280
+ ], exports.ScreenNav);
3344
3281
 
3345
3282
  var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3346
3283
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3367,7 +3304,7 @@
3367
3304
  *
3368
3305
  * @property {string} title - Section title (e.g., "Company Details")
3369
3306
  */
3370
- exports.KRScreenDetail = class KRScreenDetail extends i$1 {
3307
+ exports.ScreenDetail = class KRScreenDetail extends i$1 {
3371
3308
  constructor() {
3372
3309
  super(...arguments);
3373
3310
  /**
@@ -3391,7 +3328,7 @@
3391
3328
  `;
3392
3329
  }
3393
3330
  };
3394
- exports.KRScreenDetail.styles = i$4 `
3331
+ exports.ScreenDetail.styles = i$4 `
3395
3332
  :host {
3396
3333
  display: flex;
3397
3334
  flex-direction: column;
@@ -3438,10 +3375,10 @@
3438
3375
  `;
3439
3376
  __decorate$1([
3440
3377
  n({ type: String })
3441
- ], exports.KRScreenDetail.prototype, "title", void 0);
3442
- exports.KRScreenDetail = __decorate$1([
3378
+ ], exports.ScreenDetail.prototype, "title", void 0);
3379
+ exports.ScreenDetail = __decorate$1([
3443
3380
  t$1('kr-screen-detail')
3444
- ], exports.KRScreenDetail);
3381
+ ], exports.ScreenDetail);
3445
3382
 
3446
3383
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
3447
3384
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3454,7 +3391,7 @@
3454
3391
  *
3455
3392
  * @slot - Content to display in the subbar (right side)
3456
3393
  */
3457
- exports.KRSubbar = class KRSubbar extends i$1 {
3394
+ exports.Subbar = class KRSubbar extends i$1 {
3458
3395
  constructor() {
3459
3396
  super(...arguments);
3460
3397
  /**
@@ -3496,7 +3433,7 @@
3496
3433
  `;
3497
3434
  }
3498
3435
  };
3499
- exports.KRSubbar.styles = i$4 `
3436
+ exports.Subbar.styles = i$4 `
3500
3437
  :host {
3501
3438
  display: flex;
3502
3439
  flex-direction: row;
@@ -3564,13 +3501,13 @@
3564
3501
  `;
3565
3502
  __decorate([
3566
3503
  n({ type: Array })
3567
- ], exports.KRSubbar.prototype, "breadcrumbs", void 0);
3504
+ ], exports.Subbar.prototype, "breadcrumbs", void 0);
3568
3505
  __decorate([
3569
3506
  n({ type: Boolean })
3570
- ], exports.KRSubbar.prototype, "menu", void 0);
3571
- exports.KRSubbar = __decorate([
3507
+ ], exports.Subbar.prototype, "menu", void 0);
3508
+ exports.Subbar = __decorate([
3572
3509
  t$1('kr-subbar')
3573
- ], exports.KRSubbar);
3510
+ ], exports.Subbar);
3574
3511
 
3575
3512
  }));
3576
3513
  (function(e){Object.keys(e).forEach(function(k){if(k.startsWith('KR')&&typeof e[k]==='function'){e[k.slice(2)]=e[k];delete e[k];}});})(krApp);