@quandis/qbo4.messages 4.0.1-CI-20240405-163539

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 ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@quandis/qbo4.messages",
3
+ "author": "Quandis, Inc.",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "version": "4.0.1-CI-20240405-163539",
7
+ "workspaces": [
8
+ "code"
9
+ ],
10
+ "main": "src/Program.js",
11
+ "private": false,
12
+ "scripts": {
13
+ "build": "ncu -u && npm install && npm run sass && tsc --build --force && npm run packdev && npm run packprod && del *.tgz && npm pack && ren *.tgz qbo4.messages.tgz",
14
+ "quick": "tsc --build --force && npm run packdev && del *.tgz && npm pack && ren *.tgz qbo4.messages.tgz",
15
+ "packdev": "webpack --config pack.dev.js --no-color",
16
+ "packprod": "webpack --config pack.prod.js --no-color",
17
+ "sass": "sass --load-path=node_modules --quiet scss/:wwwroot/css && node cssshake.js"
18
+ },
19
+ "keywords": [
20
+ "qbo"
21
+ ],
22
+ "files": [
23
+ "wwwroot/js/",
24
+ "wwwroot/css/",
25
+ "wwwroot/images/",
26
+ "src/",
27
+ "scss/"
28
+ ],
29
+ "dependencies": {
30
+ "@floating-ui/dom": "^1.6.12",
31
+ "@quandis/qbo4.configuration": "*",
32
+ "@quandis/qbo4.logging": "*",
33
+ "@quandis/qbo4.ui": "*",
34
+ "jsonpath-plus": "^10.2.0",
35
+ "lit": "^3.2.1",
36
+ "reflect-metadata": "^0.2.2",
37
+ "tsyringe": "^4.8.0"
38
+ },
39
+ "devDependencies": {
40
+ "@esm-bundle/chai": "^4.3.4",
41
+ "@fullhuman/postcss-purgecss": "^7.0.2",
42
+ "autoprefixer": "^10.4.20",
43
+ "clean-css": "^5.3.3",
44
+ "eslint": "^9.17.0",
45
+ "glob": "^11.0.0",
46
+ "html-webpack-plugin": "^5.6.3",
47
+ "mini-css-extract-plugin": "^2.9.2",
48
+ "postcss": "^8.4.49",
49
+ "postcss-loader": "^8.1.1",
50
+ "sass": "^1.83.0",
51
+ "typescript": "^5.7.2",
52
+ "webpack": "^5.97.1",
53
+ "webpack-cli": "^5.1.4",
54
+ "webpack-merge": "^6.0.1"
55
+ }
56
+ }
@@ -0,0 +1 @@
1
+ 
@@ -0,0 +1,5 @@
1
+ export { LitElement, TemplateResult, css, html } from "lit";
2
+ export { customElement, property, state } from "lit/decorators.js";
3
+ export { services } from '@quandis/qbo4.ui';
4
+ export * from './qbo-message.js';
5
+ export * from './styles.js';
package/src/Program.js ADDED
@@ -0,0 +1,9 @@
1
+ import { html } from 'lit';
2
+ window.qbo4 = window.qbo4 || {};
3
+ window.qbo4.configuration = window.qbo4.configuration || {};
4
+ window.qbo4.configuration.html = html;
5
+ export { LitElement, css, html } from "lit";
6
+ export { customElement, property, state } from "lit/decorators.js";
7
+ export { services } from '@quandis/qbo4.ui';
8
+ export * from './qbo-message.js';
9
+ export * from './styles.js';
package/src/Program.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { html } from 'lit';
2
+
3
+ (window.qbo4 as any) = window.qbo4 || {};
4
+ (window.qbo4 as any).configuration = (window.qbo4 as any).configuration || {};
5
+ (window.qbo4 as any).configuration.html = html;
6
+
7
+ export { LitElement, TemplateResult, css, html } from "lit";
8
+ export { customElement, property, state } from "lit/decorators.js";
9
+
10
+ export { services } from '@quandis/qbo4.ui';
11
+ export * from './qbo-message.js';
12
+ export * from './styles.js';
@@ -0,0 +1,17 @@
1
+ declare const QboMessage_base: (new (...args: any[]) => import("@quandis/qbo4.ui").IFetch) & (new (...args: any[]) => import("@quandis/qbo4.configuration").ITemplate) & typeof import("lit").LitElement;
2
+ export declare class QboMessage extends QboMessage_base {
3
+ static styles: import("lit").CSSResult[];
4
+ apiEndpoint: URL;
5
+ imagePath: any;
6
+ renderInHost: boolean;
7
+ show: boolean;
8
+ type: string;
9
+ connectedCallback(): Promise<void>;
10
+ firstUpdated(changedProperties: any): void;
11
+ disconnectedCallback(): void;
12
+ createRenderRoot(): HTMLElement | DocumentFragment;
13
+ paginate(e: CustomEvent): Promise<void>;
14
+ updatePayload(event: Event): Promise<void>;
15
+ search(component: QboMessage): import("lit-html").TemplateResult<1>;
16
+ }
17
+ export {};
@@ -0,0 +1,135 @@
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 } from "lit";
11
+ import { property } from "lit/decorators.js";
12
+ import { QboTemplate, template } from "@quandis/qbo4.configuration";
13
+ import { QboFetchMixin, getArray, formatDate, qboui } from "@quandis/qbo4.ui";
14
+ import { messageCss } from "./styles.js";
15
+ export class QboMessage extends QboFetchMixin(QboTemplate) {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.apiEndpoint = new URL("api://qbo4/messages/message");
19
+ this.imagePath = window.qbo4['imagePath'] ?? '/ui/images/qbo-icons.svg';
20
+ this.renderInHost = false;
21
+ this.show = true;
22
+ this.type = 'search';
23
+ }
24
+ static { this.styles = [
25
+ qboui,
26
+ messageCss,
27
+ ]; }
28
+ async connectedCallback() {
29
+ if (Object.keys(this.dataset).length > 0)
30
+ this.payload = { ...this.dataset };
31
+ switch (this.type) {
32
+ case "search":
33
+ this.apiEndpoint = new URL("api://qbo4/messages/message/search");
34
+ break;
35
+ }
36
+ super.connectedCallback();
37
+ }
38
+ firstUpdated(changedProperties) {
39
+ super.firstUpdated(changedProperties);
40
+ }
41
+ disconnectedCallback() {
42
+ super.disconnectedCallback();
43
+ }
44
+ createRenderRoot() {
45
+ return this.renderInHost ? this : super.createRenderRoot();
46
+ }
47
+ async paginate(e) {
48
+ if (this.payload == null)
49
+ this.payload = {};
50
+ this.payload['DisplaySize'] = e.detail['display'];
51
+ this.payload['RecordStart'] = e.detail['start'];
52
+ await this.fetchData(this.headers ?? {}, this.payload);
53
+ }
54
+ async updatePayload(event) {
55
+ const payload = event.detail?.payload;
56
+ if (payload) {
57
+ this.payload = payload;
58
+ await this.fetchData(this.headers, this.payload);
59
+ }
60
+ }
61
+ search(component) {
62
+ const json = getArray(component.jsonData);
63
+ const count = Number(json?.[0]?.RecordCount) || 25;
64
+ return html `<slot class=${component.show ? '' : 'collapse'}>
65
+ <h3 class="title">
66
+ <button type="button" class="expandcollapse" @click="${(e) => component.show = !component.show}">
67
+ <svg>
68
+ <use href="${component.imagePath}#${component.show ? 'dash' : 'plus'}">
69
+ </svg>
70
+ </button>
71
+ Messages
72
+ </h3>
73
+ <div class="qbo-row">
74
+ <div class="qbo-col qbo-col-noborder">
75
+ <table class="qbo-nowrap" data-drop>
76
+ <thead>
77
+ <tr>
78
+ <th>Date</th>
79
+ <th>Time</th>
80
+ <th>Comment</th>
81
+ <th>User</th>
82
+ <th>Parent Type</th>
83
+ <th>Parent Name</th>
84
+ </tr>
85
+ </thead>
86
+ <tbody>
87
+ ${json ? json.map(item => html `
88
+ <tr>
89
+ <td>${formatDate(item.DateAdded)}</td>
90
+ <td></td>
91
+ <td>${item.BodyText}</td>
92
+ <td>${item.CreatedPerson}</td>
93
+ <td>${item.Object}</td>
94
+ <td>${item.ParentLabel}</td>
95
+ </tr>
96
+ `) : html `<tr><td colspan="6">No data available</td></tr>`}
97
+ </tbody>
98
+ <tfoot>
99
+ <tr>
100
+ <td colspan="6" class="progress-wrapper">${json && json[0] ? html `<qbo-paginate count="${json[0].RecordCount ?? 25}" @change=${(e) => component.paginate(e)}></qbo-paginate>` : html ``}</td>
101
+ </tr>
102
+ </tfoot>
103
+ </table>
104
+ </div>
105
+ </div></slot>`;
106
+ }
107
+ }
108
+ __decorate([
109
+ property({ type: URL }),
110
+ __metadata("design:type", Object)
111
+ ], QboMessage.prototype, "apiEndpoint", void 0);
112
+ __decorate([
113
+ property({ type: String }),
114
+ __metadata("design:type", Object)
115
+ ], QboMessage.prototype, "imagePath", void 0);
116
+ __decorate([
117
+ property(),
118
+ __metadata("design:type", Boolean)
119
+ ], QboMessage.prototype, "renderInHost", void 0);
120
+ __decorate([
121
+ property({ type: Boolean }),
122
+ __metadata("design:type", Object)
123
+ ], QboMessage.prototype, "show", void 0);
124
+ __decorate([
125
+ property(),
126
+ __metadata("design:type", String)
127
+ ], QboMessage.prototype, "type", void 0);
128
+ __decorate([
129
+ template('search'),
130
+ __metadata("design:type", Function),
131
+ __metadata("design:paramtypes", [QboMessage]),
132
+ __metadata("design:returntype", void 0)
133
+ ], QboMessage.prototype, "search", null);
134
+ if (!customElements.get('qbo-message'))
135
+ customElements.define('qbo-message', QboMessage);
@@ -0,0 +1,120 @@
1
+ import { css, html } from "lit";
2
+ import { property } from "lit/decorators.js";
3
+ import { QboTemplate, template } from "@quandis/qbo4.configuration";
4
+ import { QboFetchMixin, getArray, formatDate, qboui } from "@quandis/qbo4.ui";
5
+ import { messageCss } from "./styles.js";
6
+
7
+ export class QboMessage extends QboFetchMixin(QboTemplate) {
8
+
9
+ static styles = [
10
+ qboui,
11
+ messageCss,
12
+ ];
13
+
14
+ @property({ type: URL })
15
+ apiEndpoint = new URL("api://qbo4/messages/message");
16
+
17
+ @property({ type: String })
18
+ imagePath = window.qbo4['imagePath'] ?? '/ui/images/qbo-icons.svg';
19
+
20
+ @property()
21
+ renderInHost: boolean = false;
22
+
23
+ @property({ type: Boolean })
24
+ show = true;
25
+
26
+ @property()
27
+ type: string = 'search';
28
+
29
+ async connectedCallback() {
30
+ if (Object.keys(this.dataset).length > 0)
31
+ this.payload = { ...this.dataset } as Record<string, string>;
32
+ switch (this.type) {
33
+ case "search":
34
+ this.apiEndpoint = new URL("api://qbo4/messages/message/search");
35
+ break;
36
+ }
37
+ super.connectedCallback();
38
+ }
39
+
40
+ firstUpdated(changedProperties) {
41
+ super.firstUpdated(changedProperties);
42
+ }
43
+
44
+ disconnectedCallback() {
45
+ super.disconnectedCallback();
46
+ }
47
+
48
+ createRenderRoot() {
49
+ return this.renderInHost ? this : super.createRenderRoot();
50
+ }
51
+
52
+ async paginate(e: CustomEvent) {
53
+ if (this.payload == null)
54
+ this.payload = {};
55
+
56
+ this.payload['DisplaySize'] = e.detail['display'];
57
+ this.payload['RecordStart'] = e.detail['start'];
58
+ await this.fetchData(this.headers ?? {}, this.payload);
59
+ }
60
+
61
+ async updatePayload(event: Event) {
62
+ const payload = (event as CustomEvent).detail?.payload;
63
+ if (payload) {
64
+ this.payload = payload;
65
+ await this.fetchData(this.headers!, this.payload);
66
+ }
67
+ }
68
+
69
+ @template('search')
70
+ search(component: QboMessage) {
71
+ const json = getArray(component.jsonData);
72
+ const count: number = Number(json?.[0]?.RecordCount) || 25;
73
+
74
+ return html`<slot class=${component.show ? '' : 'collapse'}>
75
+ <h3 class="title">
76
+ <button type="button" class="expandcollapse" @click="${(e) => component.show = !component.show}">
77
+ <svg>
78
+ <use href="${component.imagePath}#${component.show ? 'dash' : 'plus'}">
79
+ </svg>
80
+ </button>
81
+ Message Center
82
+ </h3>
83
+ <div class="qbo-row-viewer">
84
+ <div class="qbo-col qbo-col-noborder">
85
+ <table class="qbo-nowrap" data-drop>
86
+ <thead>
87
+ <tr>
88
+ <th>Date</th>
89
+ <th>Time</th>
90
+ <th>Comment</th>
91
+ <th>User</th>
92
+ <th>Parent Type</th>
93
+ <th>Parent Name</th>
94
+ </tr>
95
+ </thead>
96
+ <tbody>
97
+ ${json ? json.map(item => html`
98
+ <tr>
99
+ <td>${formatDate(item.DateAdded)}</td>
100
+ <td></td>
101
+ <td>${item.BodyText}</td>
102
+ <td>${item.CreatedPerson}</td>
103
+ <td>${item.Object}</td>
104
+ <td>${item.ParentLabel}</td>
105
+ </tr>
106
+ `) : html`<tr><td colspan="6">No data available</td></tr>`}
107
+ </tbody>
108
+ <tfoot>
109
+ <tr>
110
+ <td colspan="6" class="progress-wrapper">${json && json[0] ? html`<qbo-paginate count="${json[0].RecordCount ?? 25}" @change=${(e) => component.paginate(e)}></qbo-paginate>` : html``}</td>
111
+ </tr>
112
+ </tfoot>
113
+ </table>
114
+ </div>
115
+ </div></slot>`
116
+ }
117
+ }
118
+
119
+ if (!customElements.get('qbo-message'))
120
+ customElements.define('qbo-message', QboMessage);
@@ -0,0 +1 @@
1
+ export declare const messageCss: import("lit").CSSResult;
package/src/styles.js ADDED
@@ -0,0 +1,2 @@
1
+ import { css } from 'lit';
2
+ export const messageCss = css ``;
package/src/styles.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { css } from 'lit';
2
+
3
+ export const messageCss = css``;
@@ -0,0 +1,3 @@
1
+
2
+
3
+ /*# sourceMappingURL=qbo-message.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"qbo-message.css"}
File without changes