@quandis/qbo4.ui 4.0.1-CI-20240429-172951 → 4.0.1-CI-20240429-225952

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Quandis, Inc.",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "4.0.1-CI-20240429-172951",
6
+ "version": "4.0.1-CI-20240429-225952",
7
7
  "workspaces": [
8
8
  "code"
9
9
  ],
package/readme.md CHANGED
@@ -69,7 +69,6 @@ In this example, the `qms` is cloned in `getApiService`, and the `relativePath`
69
69
  You can write your own `IApiService` class, and register it to qbo's DI container:
70
70
 
71
71
  ```typescript
72
- import { services } from "@quandis/qbo4.logging";
73
72
  import { services, IApiService } from "@quandis/qbo4.ui";
74
73
 
75
74
  @injectable()
@@ -13,6 +13,7 @@ export interface IApiService {
13
13
  * @param payload The payload to send to the API.
14
14
  */
15
15
  fetch(relativePath: string | null, payload: Record<string, string> | null): Promise<any>;
16
+ clone(relativePath: string | null): IApiService;
16
17
  }
17
18
  /**
18
19
  * Define a token for the IApiService interface
@@ -16,6 +16,9 @@ export interface IApiService {
16
16
  * @param payload The payload to send to the API.
17
17
  */
18
18
  fetch(relativePath: string | null, payload: Record<string, string> | null): Promise<any>;
19
+
20
+
21
+ clone(relativePath: string | null): IApiService;
19
22
  }
20
23
 
21
24
  /**
@@ -11,6 +11,7 @@ export * from './qbo-badge.js';
11
11
  export * from './qbo-contact.js';
12
12
  export * from './qbo-datalist.js';
13
13
  export * from './qbo-docviewer.js';
14
+ export * from './qbo-form-edit.js';
14
15
  export * from './qbo-form-element.js';
15
16
  export * from './qbo-json.js';
16
17
  export * from './qbo-mainmenu.js';
@@ -12,6 +12,7 @@ export * from './qbo-badge.js';
12
12
  export * from './qbo-contact.js';
13
13
  export * from './qbo-datalist.js';
14
14
  export * from './qbo-docviewer.js';
15
+ export * from './qbo-form-edit.js';
15
16
  export * from './qbo-form-element.js';
16
17
  export * from './qbo-json.js';
17
18
  export * from './qbo-mainmenu.js';
@@ -115,10 +116,5 @@ export function getApiService(url) {
115
116
  const service = services.container.isRegistered(name)
116
117
  ? services.container.resolve(name)
117
118
  : new RestApiService(url);
118
- if (relativePath) {
119
- const clone = structuredClone(service);
120
- clone.relativePath = relativePath;
121
- return clone;
122
- }
123
- return service;
119
+ return (relativePath) ? service.clone(relativePath) : service;
124
120
  }
@@ -14,6 +14,7 @@ export * from './qbo-badge.js';
14
14
  export * from './qbo-contact.js';
15
15
  export * from './qbo-datalist.js'
16
16
  export * from './qbo-docviewer.js'
17
+ export * from './qbo-form-edit.js';
17
18
  export * from './qbo-form-element.js';
18
19
  export * from './qbo-json.js';
19
20
  export * from './qbo-mainmenu.js';
@@ -124,10 +125,5 @@ export function getApiService(url: string) {
124
125
  ? services.container.resolve<IApiService>(name)
125
126
  : new RestApiService(url);
126
127
 
127
- if (relativePath) {
128
- const clone = structuredClone(service);
129
- clone.relativePath = relativePath;
130
- return clone;
131
- }
132
- return service;
128
+ return (relativePath) ? service.clone(relativePath) : service;
133
129
  }
@@ -6,5 +6,6 @@ export declare class RestApiService implements IApiService {
6
6
  relativePath: string;
7
7
  constructor(apiEndpoint: string, headers?: HeadersInit, method?: string | null);
8
8
  fetch(relativePath: string | null, payload?: Record<string, string> | null): Promise<any>;
9
+ clone(relativePath: string | null): IApiService;
9
10
  }
10
11
  export declare function registerRestApi(name: string, apiEndpoint: string, headers?: HeadersInit, method?: string | null): void;
@@ -24,6 +24,11 @@ export class RestApiService {
24
24
  }
25
25
  return response.json();
26
26
  }
27
+ clone(relativePath) {
28
+ const clone = new RestApiService(this.apiEndpoint, this.headers, this.method);
29
+ clone.relativePath = relativePath ?? '';
30
+ return clone;
31
+ }
27
32
  }
28
33
  // Register a RestApiService with the default name 'default' and the base URL of the current page
29
34
  services.container.registerInstance('default', new RestApiService(document.querySelector('base[href]')?.getAttribute('href') || window.location.origin));
@@ -35,6 +35,12 @@ export class RestApiService implements IApiService {
35
35
 
36
36
  return response.json();
37
37
  }
38
+
39
+ clone(relativePath: string | null): IApiService {
40
+ const clone = new RestApiService(this.apiEndpoint, this.headers, this.method);
41
+ clone.relativePath = relativePath ?? '';
42
+ return clone;
43
+ }
38
44
  }
39
45
 
40
46
  // Register a RestApiService with the default name 'default' and the base URL of the current page
@@ -187,6 +187,7 @@ let QboContact = class QboContact extends LitElement {
187
187
  <label for="SCRAID" class="${this.formLabelSmallClass}">SCRA ID</label>
188
188
  <input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAID" value="${this.jsonData?.ContactItem?.SCRAID}"/>
189
189
  </div>
190
+ <qbo-form-edit createdDate="${this.jsonData?.ContactItem?.CreatedDate}" createdPerson="${this.jsonData?.ContactItem?.CreatedPerson}" updatedDate="${this.jsonData?.ContactItem?.UpdatedDate}" updatedPerson="${this.jsonData?.ContactItem?.UpdatedPerson}"></qbo-select>
190
191
  </slot>`;
191
192
  }
192
193
  };
@@ -212,6 +212,7 @@ export class QboContact extends LitElement {
212
212
  <label for="SCRAID" class="${this.formLabelSmallClass}">SCRA ID</label>
213
213
  <input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAID" value="${this.jsonData?.ContactItem?.SCRAID}"/>
214
214
  </div>
215
+ <qbo-form-edit createdDate="${this.jsonData?.ContactItem?.CreatedDate}" createdPerson="${this.jsonData?.ContactItem?.CreatedPerson}" updatedDate="${this.jsonData?.ContactItem?.UpdatedDate}" updatedPerson="${this.jsonData?.ContactItem?.UpdatedPerson}"></qbo-select>
215
216
  </slot>`;
216
217
  }
217
218
  }
@@ -0,0 +1,10 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class QboFormEdit extends LitElement {
3
+ createdDate: null;
4
+ createdPerson: null;
5
+ updatedDate: null;
6
+ updatedPerson: null;
7
+ renderInHost: boolean;
8
+ createRenderRoot(): HTMLElement | DocumentFragment;
9
+ render(): import("lit-html").TemplateResult<1>;
10
+ }
@@ -0,0 +1,82 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { html, LitElement } from 'lit';
11
+ import { customElement, property } from 'lit/decorators.js';
12
+ let QboFormEdit = class QboFormEdit extends LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.createdDate = null;
16
+ this.createdPerson = null;
17
+ this.updatedDate = null;
18
+ this.updatedPerson = null;
19
+ this.renderInHost = true;
20
+ }
21
+ createRenderRoot() {
22
+ return this.renderInHost ? this : super.createRenderRoot();
23
+ }
24
+ render() {
25
+ return html `<slot>
26
+ <div class="col-md-12 mt-3">
27
+ <hr />
28
+ </div>
29
+ <div class="col-md-12 mt-2">
30
+ <div class="btn-group">
31
+ <button type="button" class="btn btn-primary">
32
+ <span class="bi-pencil-square"> Edit</span>
33
+ </button>
34
+ <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>
35
+ <ul class="dropdown-menu">
36
+ <li>
37
+ <a class="dropdown-item" href="#">
38
+ <i class="bi-clock-history"></i>
39
+ <span>History</span>
40
+ </a>
41
+ </li>
42
+ <li>
43
+ <a class="dropdown-item" href="#">
44
+ <i class="bi-question"></i>
45
+ <span>Help</span>
46
+ </a>
47
+ </li>
48
+ </ul>
49
+ </div>
50
+ <qbo-popover>
51
+ <button type="button" class="btn btn-light float-end" data-bs-toggle="popover" data-bs-placement="left" data-bs-container="body" title="Last Updated" data-bs-html="true" data-bs-content="Created:<br/>${this.createdDate}<br/>${this.createdPerson}<br/><br/>Updated:<br/>${this.updatedDate}<br/>${this.updatedPerson}">
52
+ <i class="bi-info"></i>
53
+ </button>
54
+ </qbo-popover>
55
+ </div>
56
+ </slot>`;
57
+ }
58
+ };
59
+ __decorate([
60
+ property({ type: Date }),
61
+ __metadata("design:type", Object)
62
+ ], QboFormEdit.prototype, "createdDate", void 0);
63
+ __decorate([
64
+ property({ type: String }),
65
+ __metadata("design:type", Object)
66
+ ], QboFormEdit.prototype, "createdPerson", void 0);
67
+ __decorate([
68
+ property({ type: Date }),
69
+ __metadata("design:type", Object)
70
+ ], QboFormEdit.prototype, "updatedDate", void 0);
71
+ __decorate([
72
+ property({ type: String }),
73
+ __metadata("design:type", Object)
74
+ ], QboFormEdit.prototype, "updatedPerson", void 0);
75
+ __decorate([
76
+ property({ type: Boolean }),
77
+ __metadata("design:type", Object)
78
+ ], QboFormEdit.prototype, "renderInHost", void 0);
79
+ QboFormEdit = __decorate([
80
+ customElement('qbo-form-edit')
81
+ ], QboFormEdit);
82
+ export { QboFormEdit };
@@ -0,0 +1,60 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ @customElement('qbo-form-edit')
5
+ export class QboFormEdit extends LitElement {
6
+
7
+ @property({ type: Date })
8
+ createdDate = null;
9
+
10
+ @property({ type: String })
11
+ createdPerson = null;
12
+
13
+ @property({ type: Date })
14
+ updatedDate = null;
15
+
16
+ @property({ type: String })
17
+ updatedPerson = null;
18
+
19
+ @property({ type: Boolean })
20
+ renderInHost = true;
21
+
22
+ createRenderRoot() {
23
+ return this.renderInHost ? this : super.createRenderRoot();
24
+ }
25
+
26
+ render() {
27
+ return html`<slot>
28
+ <div class="col-md-12 mt-3">
29
+ <hr />
30
+ </div>
31
+ <div class="col-md-12 mt-2">
32
+ <div class="btn-group">
33
+ <button type="button" class="btn btn-primary">
34
+ <span class="bi-pencil-square"> Edit</span>
35
+ </button>
36
+ <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>
37
+ <ul class="dropdown-menu">
38
+ <li>
39
+ <a class="dropdown-item" href="#">
40
+ <i class="bi-clock-history"></i>
41
+ <span>History</span>
42
+ </a>
43
+ </li>
44
+ <li>
45
+ <a class="dropdown-item" href="#">
46
+ <i class="bi-question"></i>
47
+ <span>Help</span>
48
+ </a>
49
+ </li>
50
+ </ul>
51
+ </div>
52
+ <qbo-popover>
53
+ <button type="button" class="btn btn-light float-end" data-bs-toggle="popover" data-bs-placement="left" data-bs-container="body" title="Last Updated" data-bs-html="true" data-bs-content="Created:<br/>${this.createdDate}<br/>${this.createdPerson}<br/><br/>Updated:<br/>${this.updatedDate}<br/>${this.updatedPerson}">
54
+ <i class="bi-info"></i>
55
+ </button>
56
+ </qbo-popover>
57
+ </div>
58
+ </slot>`;
59
+ }
60
+ }