@datagrok/webcomponents 1.3.0 → 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.
- package/CREDITS.md +56 -0
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +2 -2
package/CREDITS.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# WebComponents — Third-Party Libraries
|
|
2
|
+
|
|
3
|
+
The `@datagrok/webcomponents` package is distributed under the MIT license
|
|
4
|
+
that covers the rest of the `public/` repository (see [`../../LICENSE.md`](../../LICENSE.md)).
|
|
5
|
+
|
|
6
|
+
This package is a small runtime-glue layer for Datagrok web components; it
|
|
7
|
+
contains no bundled third-party JavaScript runtime libraries beyond what the
|
|
8
|
+
Datagrok platform already provides as webpack externals.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Bundled in the published artifact (`dist/`)
|
|
13
|
+
|
|
14
|
+
None. All runtime dependencies are either listed in Section 2 (provided by the
|
|
15
|
+
platform) or are Datagrok-internal libraries (`@datagrok-libraries/*`) covered
|
|
16
|
+
by the repo-wide `LICENSE.md`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. Linked at runtime via the Datagrok platform (webpack externals)
|
|
21
|
+
|
|
22
|
+
These libraries are not bundled into WebComponents' `dist/` — they are
|
|
23
|
+
provided once by the platform host and shared across all packages.
|
|
24
|
+
|
|
25
|
+
| Component | Version | License | Upstream |
|
|
26
|
+
|----------------------------------|---------|--------------|---------------------------------------------------|
|
|
27
|
+
| OpenChemLib JS | 7.x | BSD-3-Clause | https://github.com/cheminfo/openchemlib-js |
|
|
28
|
+
| RxJS | 6.x | Apache-2.0 | https://github.com/ReactiveX/rxjs |
|
|
29
|
+
| cash-dom | 8.x | MIT | https://github.com/fabiospampinato/cash |
|
|
30
|
+
| Day.js | 1.x | MIT | https://github.com/iamkun/dayjs |
|
|
31
|
+
| wu.js | 2.x | MIT | https://github.com/fitzgen/wu.js |
|
|
32
|
+
| ExcelJS | 4.x | MIT | https://github.com/exceljs/exceljs |
|
|
33
|
+
| html2canvas | 1.x | MIT | https://github.com/niklasvh/html2canvas |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 3. Fetched at runtime from third-party services
|
|
38
|
+
|
|
39
|
+
None.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 4. Docker container images
|
|
44
|
+
|
|
45
|
+
None.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 5. Development-only dependencies
|
|
50
|
+
|
|
51
|
+
Tools used during the build/test cycle (not in the runtime tree, not bundled):
|
|
52
|
+
the `datagrok-tools` CLI transitively pulls in `puppeteer-screen-recorder`,
|
|
53
|
+
which references `@ffmpeg-installer/ffmpeg` (LGPL-2.1) and
|
|
54
|
+
`@ffmpeg-installer/win32-x64` (GPLv3). These binaries are **not** redistributed
|
|
55
|
+
as part of the published WebComponents plugin and impose no obligation on
|
|
56
|
+
users of the plugin.
|
package/dist/package.js
CHANGED
|
@@ -516,5 +516,5 @@ var webcomponents;(()=>{"use strict";var e={365(e,t,n){n.d(t,{A:()=>l});var i=n(
|
|
|
516
516
|
-webkit-user-select: none;
|
|
517
517
|
-ms-user-select: none;
|
|
518
518
|
cursor: default;
|
|
519
|
-
}`},415(e,t,n){n.d(t,{V:()=>l});var i=n(7389),o=n(6082),s=n(1858),a=n(9713);class l extends HTMLElement{constructor(){super(),this.skipDefaultInit=!0,this.formChanges$=new s.Subject,this.destroyed$=new s.Subject,this.formChanges$.pipe((0,a.switchMap)(e=>e.onInputChanged),(0,a.takeUntil)(this.destroyed$)).subscribe(e=>this.dispatchEvent(new CustomEvent("input-changed",{detail:e}))),this.formChanges$.pipe((0,a.switchMap)(e=>e.onValidationCompleted.pipe((0,a.mapTo)(e),(0,a.startWith)(e))),(0,a.map)(e=>e.isValid),(0,a.distinctUntilChanged)(),(0,a.takeUntil)(this.destroyed$)).subscribe(e=>this.dispatchEvent(new CustomEvent("validation-changed",{detail:e})))}connectedCallback(){}disconnectedCallback(){}get funcCall(){var e;return null===(e=this.formInst)||void 0===e?void 0:e.source}set funcCall(e){i.empty(this),this.replaceFunc(e)}set skipInit(e){this.skipDefaultInit=e}get skipInit(){return this.skipDefaultInit}destroy(){this.destroyed$.next(!0),i.empty(this)}replaceFunc(e){return t=this,n=void 0,s=function*(){e?(this.formInst=yield o.InputForm.forFuncCall(e,{twoWayBinding:!0,skipDefaultInit:this.skipDefaultInit}),this.formInst.root.style.overflowY="hidden",this.appendChild(this.formInst.root)):this.formInst=void 0,this.formChanges$.next(this.formInst),this.dispatchEvent(new CustomEvent("form-replaced",{detail:this.formInst}))},new((i=void 0)||(i=Promise))(function(e,o){function a(e){try{r(s.next(e))}catch(e){o(e)}}function l(e){try{r(s.throw(e))}catch(e){o(e)}}function r(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(a,l)}r((s=s.apply(t,n||[])).next())});var t,n,i,s}}},4999(e,t,n){n.d(t,{Z:()=>o});var i=n(7389);class o extends HTMLElement{constructor(){super(),this._content=""}set content(e){this._content=e,this.render()}render(){i.empty(this);const e=i.markdown(this._content);this.appendChild(e)}}},5673(e,t,n){n.d(t,{f:()=>r});var i=n(7389),o=n(1858),s=n(1757),a=n.n(s),l=n(9713);class r extends HTMLElement{constructor(){super(),this.destroyed$=new o.Subject,this.status$=new o.BehaviorSubject(void 0),this.isScalar$=new o.BehaviorSubject(!0),this.isDataFrame$=new o.BehaviorSubject(!1),this.hover$=new o.BehaviorSubject(!1),(0,o.combineLatest)([this.status$.pipe((0,l.distinct)()),this.isScalar$.pipe((0,l.distinct)()),this.hover$.pipe((0,l.distinct)())]).pipe((0,l.debounceTime)(0),(0,l.takeUntil)(this.destroyed$)).subscribe(()=>this.update())}destroy(){this.destroyed$.next(!0),i.empty(this)}connectedCallback(){}disconnectedCallback(){}set validationStatus(e){this.status$.next(e)}get validationStatus(){return this.status$.value}set useHover(e){this.hover$.next(e)}get useHover(){return this.hover$.value}set isScalar(e){this.isScalar$.next(e)}get isScalar(){return this.isScalar$.value}set isDataFrame(e){this.isDataFrame$.next(e)}get isDataFrame(){return this.isDataFrame$.value}consistencyReset(){this.dispatchEvent(new CustomEvent("consistency-reset"))}requestAction(e){this.dispatchEvent(new CustomEvent("action-request",{detail:e}))}showDataFrameDiff(e){this.dispatchEvent(new CustomEvent("show-dataframe-diff",{detail:e}))}update(){if(!this.status$.value)return;const{validation:e,consistency:t}=this.status$.value;for(a()(this).addClass("rfv2-validation-icon");this.firstChild&&this.removeChild(this.firstChild););this.rerenderValidations(),this.currentIcon&&this.appendChild(this.currentIcon),this.currentPopover&&this.appendChild(this.currentPopover);const n=(null==e?void 0:e.errors)&&e.errors.length||(null==e?void 0:e.warnings)&&e.warnings.length||(null==e?void 0:e.notifications)&&e.notifications.length||(null==t?void 0:t.inconsistent);a()(this).css("display",n?"flex":"none")}rerenderValidations(){if(!this.status$.value)return;const{validation:e,consistency:t}=this.status$.value,n=(()=>(null==t?void 0:t.inconsistent)&&this.isImportantRestriction(null==t?void 0:t.restriction)?{name:"handshake-slash",color:"var(--red-3)"}:(null==e?void 0:e.errors)&&e.errors.length?{name:"exclamation-circle",color:"var(--red-3)"}:(null==e?void 0:e.warnings)&&e.warnings.length?{name:"exclamation-circle",color:"var(--orange-2)"}:(null==e?void 0:e.notifications)&&e.notifications.length?{name:"info-circle",color:"var(--blue-1)"}:(null==t?void 0:t.inconsistent)&&!this.isImportantRestriction(null==t?void 0:t.restriction)?{name:"handshake-slash",color:"var(--blue-1)"}:null)();if(!n)return null;if(this.hover$.value){const e=i.iconFA(n.name);i.tooltip.bind(e,()=>this.renderValidationResults()),n.color&&a()(e).css("color",`${n.color}!important`),this.currentIcon=e,this.currentPopover=void 0}else{const e=i.iconFA(n.name,()=>this.displayValidation());a()(e).css({"pointer-events":"all"}),n.color&&a()(e).css("color",`${n.color}!important`),a()(e).toggleClass("fal far");const t=this.addPopover(e);this.currentIcon=e,this.currentPopover=t}}renderValidationResults(){var e,t;const n=i.divV([],{style:{gap:"10px"}}),o=null==this?void 0:this.status$.value;if((null==o?void 0:o.validation)&&["errors","warnings","notifications"].filter(e=>{var t,n;return!!(null===(n=null===(t=o.validation)||void 0===t?void 0:t[e])||void 0===n?void 0:n.length)}).flatMap(e=>o.validation[e].map(t=>({category:e,advice:t}))).forEach(({category:e,advice:t})=>{var o;const s=this.getIconOptions(e),l=i.iconFA(s.name);a()(l).css({color:s.color,"margin-right":"4px"});const r="string"==typeof t?t:t.description,h="string"!=typeof t&&null!==(o=t.actions)&&void 0!==o?o:[];n.appendChild(i.divV([i.divH([l,i.divText(r)],{style:{alignItems:"center"}}),...h.map(e=>i.link(e.actionName,()=>this.requestAction(e.action),void 0,{style:{paddingLeft:"20px"}}))]))}),null===(e=null==o?void 0:o.consistency)||void 0===e?void 0:e.inconsistent){const e=this.getIconOptions("inconsistent",null===(t=null==o?void 0:o.consistency)||void 0===t?void 0:t.restriction),s=i.iconFA(e.name);a()(s).css({color:e.color,"margin-right":"4px"});const l=o.consistency.assignedValue;n.appendChild(i.divV([i.divH([s,i.divText(`Current value is incosistent. Computed value was ${this.isScalar$.value?l:"different"}`)]),...this.isDataFrame$.value?[i.link("Show dataframes diff",()=>this.showDataFrameDiff(l),void 0,{style:{paddingLeft:"20px"}})]:[],i.link("Reset to consistent value",()=>this.consistencyReset(),void 0,{style:{paddingLeft:"20px"}})]))}return n}getIconOptions(e,t){return"errors"===e?{name:"exclamation-circle",color:"var(--red-3)!important"}:"warnings"===e?{name:"exclamation-circle",color:"var(--orange-2)!important"}:"notifications"===e?{name:"info-circle",color:"var(--blue-1)!important"}:"inconsistent"===e?{name:"handshake-slash",color:this.isImportantRestriction(t)?"var(--red-3)!important":"var(--blue-1)!important"}:void 0}isImportantRestriction(e){return"disabled"===e||"restricted"===e}addPopover(e){const t=i.div([],"d4-tooltip");return this.stylePopover(t),e.appendChild(t),t}displayValidation(){const{currentIcon:e,currentPopover:t}=this;if(!e||!t)return;this.alignPopover(e,t),i.empty(t);const n=this.renderValidationResults();t.appendChild(n),t.showPopover()}alignPopover(e,t){const n=e.getBoundingClientRect().toJSON();t.style.inset="unset",t.style.top=n.y+"px",t.style.left=n.x+20+"px"}stylePopover(e){e.popover="auto",a()(e).css({"font-style":"normal","pointer-events":"all","max-width":"300px","text-wrap":"pretty"})}}},3313(e,t,n){n.d(t,{j:()=>a});var i=n(7389),o=n(1858),s=n(9713);class a extends HTMLElement{constructor(){super(),this.dfSetted$=new o.BehaviorSubject(void 0),this.typeSetted$=new o.BehaviorSubject(void 0),this._options={},this.viewer$=new o.BehaviorSubject(void 0),this.destroyed$=new o.Subject;const e=this.viewer$.pipe((0,s.distinctUntilChanged)()),t=(0,o.merge)(e.pipe((0,s.map)(e=>null==e?void 0:e.type)),this.typeSetted$).pipe((0,s.distinctUntilChanged)()),n=(0,o.merge)(e.pipe((0,s.map)(e=>null==e?void 0:e.dataFrame)),this.getViewerEventObservable("d4-data-frame-changed").pipe((0,s.map)(e=>e.data.args.newValue)),this.dfSetted$).pipe((0,s.distinctUntilChanged)());(0,o.combineLatest)([t,n]).pipe((0,s.takeUntil)(this.destroyed$)).subscribe(([e,t])=>{e!==this.typeSetted$.value&&this.dispatchEvent(new CustomEvent("viewer-type-changed",{detail:e})),t!==this.dfSetted$.value&&this.dispatchEvent(new CustomEvent("viewer-data-frame-changed",{detail:e}))}),(0,o.combineLatest)([this.typeSetted$,this.dfSetted$]).pipe((0,s.switchMap)(([e,t])=>{var n;return e&&t?(null===(n=this.viewer)||void 0===n?void 0:n.type)===e&&this.viewer?o.EMPTY:(0,o.from)(this.createViewer(e,t)):(0,o.of)(void 0)}),(0,s.takeUntil)(this.destroyed$)).subscribe(e=>{this.changeAttachedViewer(e)}),this.dfSetted$.pipe((0,s.withLatestFrom)(this.viewer$),(0,s.takeUntil)(this.destroyed$)).subscribe(([e,t])=>{t&&e&&t.dataFrame!==e&&(t.dataFrame=e,t.setOptions(this._options))}),this.viewer$.pipe((0,s.distinctUntilChanged)(),(0,s.takeUntil)(this.destroyed$)).subscribe(e=>{this.dispatchEvent(new CustomEvent("viewer-changed",{detail:e}))})}destroy(){this.destroyed$.next(!0),i.empty(this)}connectedCallback(){}disconnectedCallback(){}get viewer(){return this.viewer$.value}get dataFrame(){var e,t;return null!==(t=null===(e=this.viewer$.value)||void 0===e?void 0:e.dataFrame)&&void 0!==t?t:this.dfSetted$.value}set dataFrame(e){this.dfSetted$.next(e)}get type(){var e,t;return null!==(t=null===(e=this.viewer$.value)||void 0===e?void 0:e.type)&&void 0!==t?t:this.typeSetted$.value}set type(e){this.typeSetted$.next(e)}set options(e){var t;this._options=e,null===(t=this.viewer)||void 0===t||t.setOptions(e)}getViewerEventObservable(e){return this.viewer$.pipe((0,s.switchMap)(t=>t?t.onEvent().pipe(e?(0,s.filter)(t=>t.type===e):o.identity):(0,o.of)()),(0,s.filter)(e=>e))}createViewer(e,t){return n=this,i=void 0,s=function*(){const n=yield t.plot.fromType(e);return n.setOptions(this._options),n},new((o=void 0)||(o=Promise))(function(e,t){function a(e){try{r(s.next(e))}catch(e){t(e)}}function l(e){try{r(s.throw(e))}catch(e){t(e)}}function r(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(a,l)}r((s=s.apply(n,i||[])).next())});var n,i,o,s}changeAttachedViewer(e){i.empty(this),this.viewer$.next(e),e&&this.appendChild(e.root)}}},6523(e,t,n){n.d(t,{G:()=>l,UX:()=>a,Up:()=>o,a5:()=>s,u7:()=>r,um:()=>h});var i=n(7389);class o extends HTMLButtonElement{constructor(){super(),this.classList.add("ui-btn","ui-btn-ok")}}class s extends HTMLButtonElement{constructor(){super(),this.classList.add("ui-btn","ui-btn-ok","ui-btn-raised")}}class a extends HTMLElement{constructor(){super(),this._caption="Caption",this.innerEditor=null}render(){i.empty(this),this.innerEditor=i.input.toggle(this._caption),this.appendChild(this.innerEditor.root),this.innerEditor.onChanged.subscribe(()=>this.dispatchEvent(new CustomEvent("value-changed",{detail:this.innerEditor.value})))}set caption(e){this.innerEditor||this.render(),this.innerEditor.caption=e}set nullable(e){this.innerEditor||this.render(),this.innerEditor.nullable=e}set value(e){this.innerEditor||this.render(),this.innerEditor.value=e}set tooltip(e){this.innerEditor||this.render(),this.innerEditor.setTooltip(e)}}class l extends HTMLElement{constructor(){super(),this._name="edit",this._cursor="pointer",this._animation=null,this._tooltip=null,this._faStyle="fal"}render(){i.empty(this);const e=i.iconFA(this._name,null,this._tooltip);e.style.cursor=this._cursor,this._animation&&e.classList.add(`fa-${this._animation}`),e.classList.remove("fal","fas","far","fad"),e.classList.add(this._faStyle),this.appendChild(e)}set name(e){this._name=e,this.render()}set cursor(e){this._cursor=e,this.render()}set animation(e){this._animation=e,this.render()}set tooltip(e){this._tooltip=e,this.render()}set faStyle(e){this._faStyle=e,this.render()}}class r extends HTMLElement{constructor(){super(),this._name="edit",this._cursor="pointer",this._path=null,this._tooltip=null}render(){if(i.empty(this),!this._path)return;const e=i.iconImage(this._name,this._path,null,this._tooltip);e.style.cursor=this._cursor,e.style.width="100%",e.style.height="100%",this.appendChild(e)}set name(e){this._name=e,this.render()}set path(e){this._path=e,this.render()}set cursor(e){this._cursor=e,this.render()}set tooltip(e){this._tooltip=e,this.render()}}class h extends HTMLElement{constructor(){super(),this._caption="Caption",this._items=[],this._tooltip=null,this._rightAligned=!1}set caption(e){this._caption=e,this.render()}set items(e){this._items=e,this.render()}set tooltip(e){this._tooltip=e,this.render()}set rightAligned(e){this._rightAligned=e,this.render()}render(){i.empty(this);const e=i.comboPopup(this._caption,this._items,e=>this.dispatchEvent(new CustomEvent("selected",{detail:{item:e,itemIdx:this._items.findIndex(t=>t===e)}})));this._rightAligned&&e.classList.add("right-aligned"),i.tooltip.bind(e,this._tooltip),e.style.height="24px",e.style.minWidth="0px",e.onclick=e=>{e.stopPropagation()},this.appendChild(e)}}},2961(e,t,n){n.d(t,{T:()=>o});var i=n(2650);function o(){return e=this,t=void 0,o=function*(){yield i.PackageFunctions.init()},new((n=void 0)||(n=Promise))(function(i,s){function a(e){try{r(o.next(e))}catch(e){s(e)}}function l(e){try{r(o.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}r((o=o.apply(e,t||[])).next())});var e,t,n,o}},2650(e,t,n){n.r(t),n.d(t,{PackageFunctions:()=>g,_package:()=>p,init:()=>c.T});var i=n(4328),o=n(6082),s=n(3313),a=n(415),l=n(4999),r=n(5673),h=n(6523),d=n(2323),c=(n(4788),n(2961)),u=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};const p=new o.Package;let m=!1;class g{static init(){return e=this,t=void 0,i=function*(){m||(customElements.define("dg-viewer",s.j),customElements.define("dg-input-form",a.V),customElements.define("dg-button",h.Up,{extends:"button"}),customElements.define("dg-big-button",h.a5,{extends:"button"}),customElements.define("dg-icon-fa",h.G),customElements.define("dg-icon-image",h.u7),customElements.define("dg-toggle-input",h.UX),customElements.define("dg-combo-popup",h.um),customElements.define("dock-spawn-ts",d.j),customElements.define("dg-markdown",l.Z),customElements.define("dg-validation-icon",r.f),m=!0,yield Promise.all([customElements.whenDefined("dg-viewer"),customElements.whenDefined("dg-input-form"),customElements.whenDefined("dg-button"),customElements.whenDefined("dg-big-button"),customElements.whenDefined("dg-icon-fa"),customElements.whenDefined("dg-icon-image"),customElements.whenDefined("dg-toggle-input"),customElements.whenDefined("dg-combo-popup"),customElements.whenDefined("dock-spawn-ts"),customElements.whenDefined("dg-markdown"),customElements.whenDefined("dg-validation-icon")]),console.log("webcomponents registered"))},new((n=void 0)||(n=Promise))(function(o,s){function a(e){try{r(i.next(e))}catch(e){s(e)}}function l(e){try{r(i.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}r((i=i.apply(e,t||[])).next())});var e,t,n,i}}!function(e,t,n,i){var o,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(s<3?o(a):s>3?o(t,n,a):o(t,n))||a);s>3&&a&&Object.defineProperty(t,n,a)}([i.decorators.init(),u("design:type",Function),u("design:paramtypes",[]),u("design:returntype",Promise)],g,"init",null)},1757(e){e.exports=$},6082(e){e.exports=DG},4328(e){e.exports=grok},1858(e){e.exports=rxjs},9713(e){e.exports=rxjs.operators},7389(e){e.exports=ui}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var s=t[i]={id:i,exports:{}};return e[i](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var i=n(2650);webcomponents=i})();
|
|
519
|
+
}`},415(e,t,n){n.d(t,{V:()=>l});var i=n(7389),o=n(6082),s=n(1858),a=n(9713);class l extends HTMLElement{constructor(){super(),this.skipDefaultInit=!0,this.formChanges$=new s.Subject,this.destroyed$=new s.Subject,this.formChanges$.pipe((0,a.switchMap)(e=>e.onInputChanged),(0,a.takeUntil)(this.destroyed$)).subscribe(e=>this.dispatchEvent(new CustomEvent("input-changed",{detail:e}))),this.formChanges$.pipe((0,a.switchMap)(e=>e.onValidationCompleted.pipe((0,a.mapTo)(e),(0,a.startWith)(e))),(0,a.map)(e=>e.isValid),(0,a.distinctUntilChanged)(),(0,a.takeUntil)(this.destroyed$)).subscribe(e=>this.dispatchEvent(new CustomEvent("validation-changed",{detail:e})))}connectedCallback(){}disconnectedCallback(){}get funcCall(){var e;return null===(e=this.formInst)||void 0===e?void 0:e.source}set funcCall(e){i.empty(this),this.replaceFunc(e)}set skipInit(e){this.skipDefaultInit=e}get skipInit(){return this.skipDefaultInit}destroy(){this.destroyed$.next(!0),i.empty(this)}replaceFunc(e){return t=this,n=void 0,s=function*(){e?(this.formInst=yield o.InputForm.forFuncCall(e,{twoWayBinding:!0,skipDefaultInit:this.skipDefaultInit}),this.formInst.root.style.overflowY="hidden",this.appendChild(this.formInst.root)):this.formInst=void 0,this.formChanges$.next(this.formInst),this.dispatchEvent(new CustomEvent("form-replaced",{detail:this.formInst}))},new((i=void 0)||(i=Promise))(function(e,o){function a(e){try{r(s.next(e))}catch(e){o(e)}}function l(e){try{r(s.throw(e))}catch(e){o(e)}}function r(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(a,l)}r((s=s.apply(t,n||[])).next())});var t,n,i,s}}},4999(e,t,n){n.d(t,{Z:()=>o});var i=n(7389);class o extends HTMLElement{constructor(){super(),this._content=""}set content(e){this._content=e,this.render()}render(){i.empty(this);const e=i.markdown(this._content);this.appendChild(e)}}},5673(e,t,n){n.d(t,{f:()=>r});var i=n(7389),o=n(1858),s=n(1757),a=n.n(s),l=n(9713);class r extends HTMLElement{constructor(){super(),this.destroyed$=new o.Subject,this.status$=new o.BehaviorSubject(void 0),this.isScalar$=new o.BehaviorSubject(!0),this.isDataFrame$=new o.BehaviorSubject(!1),this.hover$=new o.BehaviorSubject(!1),(0,o.combineLatest)([this.status$.pipe((0,l.distinct)()),this.isScalar$.pipe((0,l.distinct)()),this.hover$.pipe((0,l.distinct)())]).pipe((0,l.debounceTime)(0),(0,l.takeUntil)(this.destroyed$)).subscribe(()=>this.update())}destroy(){this.destroyed$.next(!0),i.empty(this)}connectedCallback(){}disconnectedCallback(){}set validationStatus(e){this.status$.next(e)}get validationStatus(){return this.status$.value}set useHover(e){this.hover$.next(e)}get useHover(){return this.hover$.value}set isScalar(e){this.isScalar$.next(e)}get isScalar(){return this.isScalar$.value}set isDataFrame(e){this.isDataFrame$.next(e)}get isDataFrame(){return this.isDataFrame$.value}consistencyReset(){this.dispatchEvent(new CustomEvent("consistency-reset"))}requestAction(e){this.dispatchEvent(new CustomEvent("action-request",{detail:e}))}showDataFrameDiff(e){this.dispatchEvent(new CustomEvent("show-dataframe-diff",{detail:e}))}update(){if(!this.status$.value)return;const{validation:e,consistency:t}=this.status$.value;for(a()(this).addClass("rfv2-validation-icon");this.firstChild&&this.removeChild(this.firstChild););this.rerenderValidations(),this.currentIcon&&this.appendChild(this.currentIcon),this.currentPopover&&this.appendChild(this.currentPopover);const n=(null==e?void 0:e.errors)&&e.errors.length||(null==e?void 0:e.warnings)&&e.warnings.length||(null==e?void 0:e.notifications)&&e.notifications.length||(null==t?void 0:t.inconsistent);a()(this).css("display",n?"flex":"none")}rerenderValidations(){if(!this.status$.value)return;const{validation:e,consistency:t}=this.status$.value,n=(()=>(null==t?void 0:t.inconsistent)&&this.isImportantRestriction(null==t?void 0:t.restriction)?{name:"handshake-slash",color:"var(--red-3)"}:(null==e?void 0:e.errors)&&e.errors.length?{name:"exclamation-circle",color:"var(--red-3)"}:(null==e?void 0:e.warnings)&&e.warnings.length?{name:"exclamation-circle",color:"var(--orange-2)"}:(null==e?void 0:e.notifications)&&e.notifications.length?{name:"info-circle",color:"var(--blue-1)"}:(null==t?void 0:t.inconsistent)&&!this.isImportantRestriction(null==t?void 0:t.restriction)?{name:"handshake-slash",color:"var(--blue-1)"}:null)();if(!n)return null;if(this.hover$.value){const e=i.iconFA(n.name);i.tooltip.bind(e,()=>this.renderValidationResults()),n.color&&a()(e).css("color",`${n.color}!important`),this.currentIcon=e,this.currentPopover=void 0}else{const e=i.iconFA(n.name,()=>this.displayValidation(),"Show validation");a()(e).css({"pointer-events":"all"}),n.color&&a()(e).css("color",`${n.color}!important`),a()(e).toggleClass("fal far");const t=this.addPopover(e);this.currentIcon=e,this.currentPopover=t}}renderValidationResults(){var e,t;const n=i.divV([],{style:{gap:"10px"}}),o=null==this?void 0:this.status$.value;if((null==o?void 0:o.validation)&&["errors","warnings","notifications"].filter(e=>{var t,n;return!!(null===(n=null===(t=o.validation)||void 0===t?void 0:t[e])||void 0===n?void 0:n.length)}).flatMap(e=>o.validation[e].map(t=>({category:e,advice:t}))).forEach(({category:e,advice:t})=>{var o;const s=this.getIconOptions(e),l=i.iconFA(s.name);a()(l).css({color:s.color,"margin-right":"4px"});const r="string"==typeof t?t:t.description,h="string"!=typeof t&&null!==(o=t.actions)&&void 0!==o?o:[];n.appendChild(i.divV([i.divH([l,i.divText(r)],{style:{alignItems:"center"}}),...h.map(e=>i.link(e.actionName,()=>this.requestAction(e.action),void 0,{style:{paddingLeft:"20px"}}))]))}),null===(e=null==o?void 0:o.consistency)||void 0===e?void 0:e.inconsistent){const e=this.getIconOptions("inconsistent",null===(t=null==o?void 0:o.consistency)||void 0===t?void 0:t.restriction),s=i.iconFA(e.name);a()(s).css({color:e.color,"margin-right":"4px"});const l=o.consistency.assignedValue;n.appendChild(i.divV([i.divH([s,i.divText(`Current value is incosistent. Computed value was ${this.isScalar$.value?l:"different"}`)]),...this.isDataFrame$.value?[i.link("Show dataframes diff",()=>this.showDataFrameDiff(l),void 0,{style:{paddingLeft:"20px"}})]:[],i.link("Reset to consistent value",()=>this.consistencyReset(),void 0,{style:{paddingLeft:"20px"}})]))}return n}getIconOptions(e,t){return"errors"===e?{name:"exclamation-circle",color:"var(--red-3)!important"}:"warnings"===e?{name:"exclamation-circle",color:"var(--orange-2)!important"}:"notifications"===e?{name:"info-circle",color:"var(--blue-1)!important"}:"inconsistent"===e?{name:"handshake-slash",color:this.isImportantRestriction(t)?"var(--red-3)!important":"var(--blue-1)!important"}:void 0}isImportantRestriction(e){return"disabled"===e||"restricted"===e}addPopover(e){const t=i.div([],"d4-tooltip");return this.stylePopover(t),e.appendChild(t),t}displayValidation(){const{currentIcon:e,currentPopover:t}=this;if(!e||!t)return;this.alignPopover(e,t),i.empty(t);const n=this.renderValidationResults();t.appendChild(n),t.showPopover()}alignPopover(e,t){const n=e.getBoundingClientRect().toJSON();t.style.inset="unset",t.style.top=n.y+"px",t.style.left=n.x+20+"px"}stylePopover(e){e.popover="auto",a()(e).css({"font-style":"normal","pointer-events":"all","max-width":"300px","text-wrap":"pretty"})}}},3313(e,t,n){n.d(t,{j:()=>a});var i=n(7389),o=n(1858),s=n(9713);class a extends HTMLElement{constructor(){super(),this.dfSetted$=new o.BehaviorSubject(void 0),this.typeSetted$=new o.BehaviorSubject(void 0),this._options={},this.viewer$=new o.BehaviorSubject(void 0),this.destroyed$=new o.Subject;const e=this.viewer$.pipe((0,s.distinctUntilChanged)()),t=(0,o.merge)(e.pipe((0,s.map)(e=>null==e?void 0:e.type)),this.typeSetted$).pipe((0,s.distinctUntilChanged)()),n=(0,o.merge)(e.pipe((0,s.map)(e=>null==e?void 0:e.dataFrame)),this.getViewerEventObservable("d4-data-frame-changed").pipe((0,s.map)(e=>e.data.args.newValue)),this.dfSetted$).pipe((0,s.distinctUntilChanged)());(0,o.combineLatest)([t,n]).pipe((0,s.takeUntil)(this.destroyed$)).subscribe(([e,t])=>{e!==this.typeSetted$.value&&this.dispatchEvent(new CustomEvent("viewer-type-changed",{detail:e})),t!==this.dfSetted$.value&&this.dispatchEvent(new CustomEvent("viewer-data-frame-changed",{detail:t}))}),(0,o.combineLatest)([this.typeSetted$,this.dfSetted$]).pipe((0,s.switchMap)(([e,t])=>{var n;return e&&t?(null===(n=this.viewer)||void 0===n?void 0:n.type)===e&&this.viewer?o.EMPTY:(0,o.from)(this.createViewer(e,t)):(0,o.of)(void 0)}),(0,s.takeUntil)(this.destroyed$)).subscribe(e=>{this.changeAttachedViewer(e)}),this.dfSetted$.pipe((0,s.withLatestFrom)(this.viewer$),(0,s.takeUntil)(this.destroyed$)).subscribe(([e,t])=>{t&&e&&t.dataFrame!==e&&(t.dataFrame=e,t.setOptions(this._options))}),this.viewer$.pipe((0,s.distinctUntilChanged)(),(0,s.takeUntil)(this.destroyed$)).subscribe(e=>{this.dispatchEvent(new CustomEvent("viewer-changed",{detail:e}))})}destroy(){this.destroyed$.next(!0),i.empty(this)}connectedCallback(){}disconnectedCallback(){}get viewer(){return this.viewer$.value}get dataFrame(){var e,t;return null!==(t=null===(e=this.viewer$.value)||void 0===e?void 0:e.dataFrame)&&void 0!==t?t:this.dfSetted$.value}set dataFrame(e){this.dfSetted$.next(e)}get type(){var e,t;return null!==(t=null===(e=this.viewer$.value)||void 0===e?void 0:e.type)&&void 0!==t?t:this.typeSetted$.value}set type(e){this.typeSetted$.next(e)}set options(e){var t;this._options=e,null===(t=this.viewer)||void 0===t||t.setOptions(e)}getViewerEventObservable(e){return this.viewer$.pipe((0,s.switchMap)(t=>t?t.onEvent().pipe(e?(0,s.filter)(t=>t.type===e):o.identity):(0,o.of)()),(0,s.filter)(e=>e))}createViewer(e,t){return n=this,i=void 0,s=function*(){const n=yield t.plot.fromType(e);return n.setOptions(this._options),n},new((o=void 0)||(o=Promise))(function(e,t){function a(e){try{r(s.next(e))}catch(e){t(e)}}function l(e){try{r(s.throw(e))}catch(e){t(e)}}function r(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(a,l)}r((s=s.apply(n,i||[])).next())});var n,i,o,s}changeAttachedViewer(e){i.empty(this),this.viewer$.next(e),e&&this.appendChild(e.root)}}},6523(e,t,n){n.d(t,{G:()=>l,UX:()=>a,Up:()=>o,a5:()=>s,u7:()=>r,um:()=>h});var i=n(7389);class o extends HTMLButtonElement{constructor(){super(),this.classList.add("ui-btn","ui-btn-ok")}}class s extends HTMLButtonElement{constructor(){super(),this.classList.add("ui-btn","ui-btn-ok","ui-btn-raised")}}class a extends HTMLElement{constructor(){super(),this._caption="Caption",this.innerEditor=null}render(){i.empty(this),this.innerEditor=i.input.toggle(this._caption),this.appendChild(this.innerEditor.root),this.innerEditor.onChanged.subscribe(()=>this.dispatchEvent(new CustomEvent("value-changed",{detail:this.innerEditor.value})))}set caption(e){this.innerEditor||this.render(),this.innerEditor.caption=e}set nullable(e){this.innerEditor||this.render(),this.innerEditor.nullable=e}set value(e){this.innerEditor||this.render(),this.innerEditor.value=e}set tooltip(e){this.innerEditor||this.render(),this.innerEditor.setTooltip(e)}}class l extends HTMLElement{constructor(){super(),this._name="edit",this._cursor="pointer",this._animation=null,this._tooltip=null,this._faStyle="fal"}render(){i.empty(this);const e=i.iconFA(this._name,null,this._tooltip);e.style.cursor=this._cursor,this._animation&&e.classList.add(`fa-${this._animation}`),e.classList.remove("fal","fas","far","fad"),e.classList.add(this._faStyle),this.appendChild(e)}set name(e){this._name=e,this.render()}set cursor(e){this._cursor=e,this.render()}set animation(e){this._animation=e,this.render()}set tooltip(e){this._tooltip=e,this.render()}set faStyle(e){this._faStyle=e,this.render()}}class r extends HTMLElement{constructor(){super(),this._name="edit",this._cursor="pointer",this._path=null,this._tooltip=null}render(){if(i.empty(this),!this._path)return;const e=i.iconImage(this._name,this._path,null,this._tooltip);e.style.cursor=this._cursor,e.style.width="100%",e.style.height="100%",this.appendChild(e)}set name(e){this._name=e,this.render()}set path(e){this._path=e,this.render()}set cursor(e){this._cursor=e,this.render()}set tooltip(e){this._tooltip=e,this.render()}}class h extends HTMLElement{constructor(){super(),this._caption="Caption",this._items=[],this._tooltip=null,this._rightAligned=!1}set caption(e){this._caption=e,this.render()}set items(e){this._items=e,this.render()}set tooltip(e){this._tooltip=e,this.render()}set rightAligned(e){this._rightAligned=e,this.render()}render(){i.empty(this);const e=i.comboPopup(this._caption,this._items,e=>this.dispatchEvent(new CustomEvent("selected",{detail:{item:e,itemIdx:this._items.findIndex(t=>t===e)}})));this._rightAligned&&e.classList.add("right-aligned"),i.tooltip.bind(e,this._tooltip),e.style.height="24px",e.style.minWidth="0px",e.onclick=e=>{e.stopPropagation()},this.appendChild(e)}}},2961(e,t,n){n.d(t,{T:()=>o});var i=n(2650);function o(){return e=this,t=void 0,o=function*(){yield i.PackageFunctions.init()},new((n=void 0)||(n=Promise))(function(i,s){function a(e){try{r(o.next(e))}catch(e){s(e)}}function l(e){try{r(o.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}r((o=o.apply(e,t||[])).next())});var e,t,n,o}},2650(e,t,n){n.r(t),n.d(t,{PackageFunctions:()=>g,_package:()=>p,init:()=>c.T});var i=n(4328),o=n(6082),s=n(3313),a=n(415),l=n(4999),r=n(5673),h=n(6523),d=n(2323),c=(n(4788),n(2961)),u=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};const p=new o.Package;let m=!1;class g{static init(){return e=this,t=void 0,i=function*(){m||(customElements.define("dg-viewer",s.j),customElements.define("dg-input-form",a.V),customElements.define("dg-button",h.Up,{extends:"button"}),customElements.define("dg-big-button",h.a5,{extends:"button"}),customElements.define("dg-icon-fa",h.G),customElements.define("dg-icon-image",h.u7),customElements.define("dg-toggle-input",h.UX),customElements.define("dg-combo-popup",h.um),customElements.define("dock-spawn-ts",d.j),customElements.define("dg-markdown",l.Z),customElements.define("dg-validation-icon",r.f),m=!0,yield Promise.all([customElements.whenDefined("dg-viewer"),customElements.whenDefined("dg-input-form"),customElements.whenDefined("dg-button"),customElements.whenDefined("dg-big-button"),customElements.whenDefined("dg-icon-fa"),customElements.whenDefined("dg-icon-image"),customElements.whenDefined("dg-toggle-input"),customElements.whenDefined("dg-combo-popup"),customElements.whenDefined("dock-spawn-ts"),customElements.whenDefined("dg-markdown"),customElements.whenDefined("dg-validation-icon")]),console.log("webcomponents registered"))},new((n=void 0)||(n=Promise))(function(o,s){function a(e){try{r(i.next(e))}catch(e){s(e)}}function l(e){try{r(i.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,l)}r((i=i.apply(e,t||[])).next())});var e,t,n,i}}!function(e,t,n,i){var o,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(s<3?o(a):s>3?o(t,n,a):o(t,n))||a);s>3&&a&&Object.defineProperty(t,n,a)}([i.decorators.init(),u("design:type",Function),u("design:paramtypes",[]),u("design:returntype",Promise)],g,"init",null)},1757(e){e.exports=$},6082(e){e.exports=DG},4328(e){e.exports=grok},1858(e){e.exports=rxjs},9713(e){e.exports=rxjs.operators},7389(e){e.exports=ui}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var s=t[i]={id:i,exports:{}};return e[i](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var i=n(2650);webcomponents=i})();
|
|
520
520
|
//# sourceMappingURL=package.js.map
|