-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge develop into master (#221)
* build: bump componentsjs & n3 (#202) Signed-off-by: Wouter Termont <[email protected]> * feat: add resourceShapeFromQuads to discovery (#201) * feat: add resourceShapeFromQuads to discovery * test: remove redundant casts Signed-off-by: Wouter Termont <[email protected]> Co-authored-by: Wouter Termont <[email protected]> * docs: complete-ts-docs (#194) * docs: complete ts docs WIP * docs: complete ts docs WIP * docs: semcom docs update * chore: apply suggestions from code review Co-authored-by: Wouter Termont <[email protected]> * docs: fixed typo in tsdocs Co-authored-by: Wouter Termont <[email protected]> * chore: release v0.9.7 * build: release component package (#206) Signed-off-by: Wouter Termont <[email protected]> * chore: release v0.9.8 * chore: import semcom components from dgt-compontens (#209) * chore: added DS_Store to gitignore * build: added dgt shared dependencies * feat: added semcom components from dgt-components * chore: replaced components WIP * fix: fix node modules build error * chore: restrucute components into folders * chore: exported and defined imported semcom components * chore: added imported semcom components to rollup options * feat: added metadata json files * feat: document-component (#210) * feat: added document component WIP * chore: added typing * feat: added json metadata file * chore: defined, exported document component + added to rollup options * fix: fixed using custom port * chore: added components to demo * chore: added test data * fix: fixed typo * fix: incorrect path fix * chore: added intial data to document component * fix: fixed non loading css * test: move demo data Signed-off-by: Wouter Termont <[email protected]> Co-authored-by: Wouter Termont <[email protected]> * chore: release v0.10.0 * chore: change metadata folder structure (#215) * chore: changed folder structure for components metadata * fix: fixed incorrect paths * fix: fix correct paths index.ts * chore: release v0.10.1 * fix: component-shape corrections (#216) * fix: component shape corrections * build: publish upload component * build: clean * chore: release v0.10.2 * fix: start default in memory without sync (#185) * fix: start default in memory without sync Signed-off-by: Wouter Termont <[email protected]> * fix: remove local env var Signed-off-by: Wouter Termont <[email protected]> * chore: merge from develop * fix: restore demo files in lib * fix: start default in mem * chore: remove last old handler syntax (#217) * chore: remove intermediate response (WIP) * test: fix old rxjs syntax * chore: release v0.11.0 * build: add licenses (#220) --------- Signed-off-by: Wouter Termont <[email protected]> Co-authored-by: Arne Vandoorslaer <[email protected]> Co-authored-by: Jasper Vandenberghen <[email protected]>
- Loading branch information
1 parent
461d11d
commit d2d9d19
Showing
114 changed files
with
5,856 additions
and
1,149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,4 +121,7 @@ dist | |
#*.npmrc | ||
|
||
coverage-summary.json | ||
rundata/ | ||
rundata/ | ||
|
||
# OS file | ||
.DS_store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,5 +56,5 @@ | |
} | ||
} | ||
}, | ||
"version": "0.9.6" | ||
"version": "0.11.0" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact Digita at https://digita.ai. For AGPL licensing, see below. | ||
|
||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. |
133 changes: 133 additions & 0 deletions
133
packages/semcom-components/lib/components/barcode.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* eslint-disable no-console -- is a web component */ | ||
import { Store } from 'n3'; | ||
import { css, CSSResult, html, state, property, PropertyValues, query, TemplateResult, unsafeCSS } from 'lit-element'; | ||
import { ComponentResponseEvent } from '@digita-ai/semcom-sdk'; | ||
import { Theme, QR, Open } from '@digita-ai/dgt-theme'; | ||
import JsBarcode from 'jsbarcode'; | ||
import { unsafeSVG } from 'lit-html/directives/unsafe-svg'; | ||
import { ComponentDataTypes } from '@digita-ai/semcom-core'; | ||
import { BaseComponent } from './base.component'; | ||
|
||
export class BarcodeComponent extends BaseComponent { | ||
|
||
@state() cardNumber?: string; | ||
@state() program?: string; | ||
@state() hostingOrganization?: string; | ||
@property({ type: Boolean }) hideProgram = false; | ||
|
||
@query('#barcode') barcodeSvg?: HTMLOrSVGElement; | ||
|
||
/** | ||
* Handles a response event. | ||
* Expects an event containing a detail object that contains a data object containing quads. Will take the first quad containing a membershipNumber it finds. | ||
* Make sure to filter the quads you send it if you want a specific barcode. | ||
* | ||
* @param event The response event to handle. | ||
*/ | ||
handleResponse<D extends keyof ComponentDataTypes>(event: ComponentResponseEvent<D>): void { | ||
|
||
console.log('handleResponse'); | ||
|
||
if (!event || !event.detail || !event.detail.data) { | ||
|
||
throw new Error('Arguments event, event.detail, and event.detail.data should be set.'); | ||
|
||
} | ||
|
||
const store = new Store(event.detail.data); | ||
|
||
const quad = store.getQuads(null, 'http://schema.org/membershipNumber', null, null)[0]; | ||
|
||
const program = store.getQuads(quad.subject, 'http://schema.org/programName', null, null)[0]; | ||
const hostingOrganization = store.getQuads(quad.subject, 'http://schema.org/hostingOrganization', null, null)[0]; | ||
|
||
this.cardNumber = quad.object.value; | ||
this.program = program.object.value; | ||
this.hostingOrganization = hostingOrganization?.object?.value; | ||
|
||
} | ||
|
||
updated(changed: PropertyValues): void { | ||
|
||
if (changed.has('entry') && this.entry) this.readData(this.entry, 'quads'); | ||
|
||
if (this.barcodeSvg && this.cardNumber) { | ||
|
||
JsBarcode(this.barcodeSvg, this.cardNumber, { | ||
background: 'none', | ||
}); | ||
|
||
} | ||
|
||
super.updated(changed); | ||
|
||
} | ||
|
||
render(): TemplateResult { | ||
|
||
return html` | ||
${this.program && !this.hideProgram ? html` | ||
<nde-card ?hideImage="${ true }"> | ||
<div slot="title">${this.program}</div> | ||
<div slot="subtitle">This is your barcode</div> | ||
<div slot="icon"> | ||
${unsafeSVG(QR)} | ||
</div> | ||
<div slot="content"> | ||
<div class="barcode-container"> | ||
<svg id="barcode"></svg> | ||
</div> | ||
${this.hostingOrganization ? html`<a target="_blank" .href="${this.hostingOrganization}" class="btn primary">${unsafeSVG(Open)} <div>More information</div></a>` : ``} | ||
</div> | ||
</nde-card> | ||
` : ''} | ||
`; | ||
|
||
} | ||
|
||
static get styles(): CSSResult[] { | ||
|
||
return [ | ||
unsafeCSS(Theme), | ||
css` | ||
div[slot="icon"] svg { | ||
fill: var(--colors-foreground-normal); | ||
} | ||
div[slot="content"] { | ||
display: flex; | ||
align-items: stretch; | ||
flex-direction: column; | ||
} | ||
a.btn { | ||
display: flex; | ||
align-items: center; | ||
flex-direction: row; | ||
margin-top: var(--gap-large); | ||
justify-content: center; | ||
} | ||
a.btn svg { | ||
fill: var(--colors-foreground-inverse); | ||
margin-right: var(--gap-normal); | ||
} | ||
.barcode-container { | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
.barcode-container #barcode { | ||
width: 200px; | ||
height: 110px; | ||
} | ||
`, | ||
]; | ||
|
||
} | ||
|
||
} | ||
|
||
export default BarcodeComponent; |
Oops, something went wrong.