@paperless/core 1.67.3 → 1.67.5
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/CHANGELOG.md +19 -0
- package/dist/build/p-a924f6fe.entry.js +2 -0
- package/dist/build/p-a924f6fe.entry.js.map +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/p-stepper.cjs.entry.js +50 -27
- package/dist/cjs/p-stepper.cjs.entry.js.map +1 -1
- package/dist/collection/components/molecules/stepper/stepper.component.js +50 -27
- package/dist/collection/components/molecules/stepper/stepper.component.js.map +1 -1
- package/dist/components/p-stepper.js +50 -27
- package/dist/components/p-stepper.js.map +1 -1
- package/dist/esm/p-stepper.entry.js +50 -27
- package/dist/esm/p-stepper.entry.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-a924f6fe.entry.js +2 -0
- package/dist/paperless/p-a924f6fe.entry.js.map +1 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/types/components/molecules/stepper/stepper.component.d.ts +5 -2
- package/hydrate/index.js +50 -27
- package/package.json +1 -1
- package/dist/build/p-9c1e350b.entry.js +0 -2
- package/dist/build/p-9c1e350b.entry.js.map +0 -1
- package/dist/paperless/p-9c1e350b.entry.js +0 -2
- package/dist/paperless/p-9c1e350b.entry.js.map +0 -1
|
@@ -16,11 +16,14 @@ export declare class Stepper {
|
|
|
16
16
|
*/
|
|
17
17
|
private _el;
|
|
18
18
|
private _rendering;
|
|
19
|
-
private
|
|
20
|
-
private
|
|
19
|
+
private _generateTimeout;
|
|
20
|
+
private _resizeObserver;
|
|
21
21
|
private _onSlotChange;
|
|
22
|
+
private _generateStepsOnce;
|
|
22
23
|
private _generateSteps;
|
|
24
|
+
private _setStepperLineData;
|
|
23
25
|
componentDidLoad(): void;
|
|
26
|
+
disconnectCallback(): void;
|
|
24
27
|
render(): any;
|
|
25
28
|
protected _onActiveStepChange(): void;
|
|
26
29
|
}
|
package/hydrate/index.js
CHANGED
|
@@ -21796,12 +21796,19 @@ const stepperComponentCss = "/*!@.flex*/.flex.sc-p-stepper{display:flex!importan
|
|
|
21796
21796
|
class Stepper {
|
|
21797
21797
|
constructor(hostRef) {
|
|
21798
21798
|
registerInstance(this, hostRef);
|
|
21799
|
-
this.
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
if (
|
|
21799
|
+
this._onSlotChange = async (_e) => this._generateStepsOnce();
|
|
21800
|
+
this._generateStepsOnce = () => {
|
|
21801
|
+
if (this._rendering) {
|
|
21802
|
+
return;
|
|
21803
|
+
}
|
|
21804
|
+
if (this._generateTimeout) {
|
|
21805
|
+
clearTimeout(this._generateTimeout);
|
|
21806
|
+
this._generateTimeout = null;
|
|
21807
|
+
}
|
|
21808
|
+
this._generateTimeout = setTimeout(() => this._generateSteps());
|
|
21809
|
+
};
|
|
21810
|
+
this._generateSteps = async () => {
|
|
21811
|
+
if (!this._el || this._rendering) {
|
|
21805
21812
|
return;
|
|
21806
21813
|
}
|
|
21807
21814
|
this._rendering = true;
|
|
@@ -21818,44 +21825,44 @@ class Stepper {
|
|
|
21818
21825
|
}
|
|
21819
21826
|
}
|
|
21820
21827
|
}
|
|
21828
|
+
let directionChanged = false;
|
|
21821
21829
|
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21822
|
-
let directionChanged = false;
|
|
21823
21830
|
const item = items.item(i);
|
|
21824
21831
|
item.active = i === activeStep;
|
|
21825
21832
|
item.finished = i < activeStep;
|
|
21826
|
-
if (item.direction !== this.direction) {
|
|
21833
|
+
if (item.direction !== this.direction && !directionChanged) {
|
|
21827
21834
|
directionChanged = true;
|
|
21828
21835
|
}
|
|
21829
21836
|
item.direction = this.direction;
|
|
21830
21837
|
item.align =
|
|
21831
21838
|
i === 0 ? 'start' : i === (items === null || items === void 0 ? void 0 : items.length) - 1 ? 'end' : 'center';
|
|
21832
21839
|
item.contentPosition = this.contentPosition;
|
|
21840
|
+
}
|
|
21841
|
+
if (directionChanged) {
|
|
21842
|
+
// super hacky way to ensure all elements that have a direction changed are re-rendered
|
|
21843
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
21844
|
+
}
|
|
21845
|
+
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21846
|
+
const item = items.item(i);
|
|
21833
21847
|
if (i < items.length - 1) {
|
|
21834
|
-
|
|
21848
|
+
let nextItem = item.nextElementSibling;
|
|
21835
21849
|
if (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {
|
|
21836
|
-
// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight
|
|
21837
|
-
// otherwise we always get the initial "16"
|
|
21838
|
-
if (directionChanged) {
|
|
21839
|
-
await this._delay(10);
|
|
21840
|
-
}
|
|
21841
|
-
const heightDiff = (item.clientHeight > 16
|
|
21842
|
-
? item.clientHeight - 16
|
|
21843
|
-
: item.clientHeight) / 2;
|
|
21844
21850
|
const stepperLine = document.createElement('p-stepper-line');
|
|
21845
|
-
stepperLine.direction = this.direction;
|
|
21846
|
-
stepperLine.active = i < activeStep;
|
|
21847
|
-
if (heightDiff > 0 && this.direction === 'vertical') {
|
|
21848
|
-
stepperLine.style.marginTop = `-${heightDiff / 16}rem`;
|
|
21849
|
-
stepperLine.style.marginBottom = `-${heightDiff / 16}rem`;
|
|
21850
|
-
stepperLine.style.minHeight = `calc(1rem + ${(heightDiff * 2) / 16}rem)`;
|
|
21851
|
-
}
|
|
21852
21851
|
this._el.insertBefore(stepperLine, nextItem);
|
|
21852
|
+
this._setStepperLineData(stepperLine, item, nextItem, i, activeStep);
|
|
21853
21853
|
const previous = stepperLine.previousElementSibling;
|
|
21854
21854
|
if (previous && previous.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21855
21855
|
previous.remove();
|
|
21856
21856
|
}
|
|
21857
21857
|
continue;
|
|
21858
21858
|
}
|
|
21859
|
+
if (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21860
|
+
const stepperLine = nextItem;
|
|
21861
|
+
nextItem = nextItem.nextElementSibling;
|
|
21862
|
+
if (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {
|
|
21863
|
+
this._setStepperLineData(stepperLine, item, nextItem, i, activeStep);
|
|
21864
|
+
}
|
|
21865
|
+
}
|
|
21859
21866
|
}
|
|
21860
21867
|
if (i > 0) {
|
|
21861
21868
|
const previousItem = item.previousElementSibling;
|
|
@@ -21872,20 +21879,36 @@ class Stepper {
|
|
|
21872
21879
|
}
|
|
21873
21880
|
setTimeout(() => (this._rendering = false), 100);
|
|
21874
21881
|
};
|
|
21882
|
+
this._setStepperLineData = (stepperLine, item, nextItem, i, activeStep) => {
|
|
21883
|
+
const heightDiff = item.clientHeight / 2;
|
|
21884
|
+
const heightDiffNext = nextItem.clientHeight / 2;
|
|
21885
|
+
stepperLine.direction = this.direction;
|
|
21886
|
+
stepperLine.active = i < activeStep;
|
|
21887
|
+
if (heightDiff > 0 && this.direction === 'vertical') {
|
|
21888
|
+
stepperLine.style.marginTop = `-${heightDiff / 16}rem`;
|
|
21889
|
+
stepperLine.style.marginBottom = `-${heightDiffNext / 16}rem`;
|
|
21890
|
+
stepperLine.style.minHeight = `calc(1rem + ${(heightDiff + heightDiffNext) / 16}rem)`;
|
|
21891
|
+
}
|
|
21892
|
+
};
|
|
21875
21893
|
this.activeStep = 1;
|
|
21876
21894
|
this.direction = 'horizontal';
|
|
21877
21895
|
this.contentPosition = 'end';
|
|
21878
21896
|
this._rendering = false;
|
|
21879
21897
|
}
|
|
21880
21898
|
componentDidLoad() {
|
|
21881
|
-
this.
|
|
21882
|
-
this.
|
|
21899
|
+
this._resizeObserver = new ResizeObserver(() => this._generateStepsOnce());
|
|
21900
|
+
this._resizeObserver.observe(this._el);
|
|
21901
|
+
}
|
|
21902
|
+
disconnectCallback() {
|
|
21903
|
+
if (this._resizeObserver) {
|
|
21904
|
+
this._resizeObserver.disconnect();
|
|
21905
|
+
}
|
|
21883
21906
|
}
|
|
21884
21907
|
render() {
|
|
21885
21908
|
return (hAsync(Host, { class: 'p-stepper' }, hAsync("slot", { onSlotchange: this._onSlotChange })));
|
|
21886
21909
|
}
|
|
21887
21910
|
_onActiveStepChange() {
|
|
21888
|
-
this.
|
|
21911
|
+
this._generateStepsOnce();
|
|
21889
21912
|
}
|
|
21890
21913
|
get _el() { return getElement(this); }
|
|
21891
21914
|
static get watchers() { return {
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as e,g as s}from"./p-0c2cc6c4.js";const o=".flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}.static{position:static!important}";const n=class{constructor(i){t(this,i);this._loaded=false;this._delay=t=>new Promise((i=>setTimeout(i,t)));this._onSlotChange=async t=>this._generateSteps();this._generateSteps=async(t=false)=>{if(!t&&(!this._el||this._rendering||!this._loaded)){return}this._rendering=true;let i=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||i<0){for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){const s=e.item(t);if(s.active){i=t}if(i<0&&s.finished){i=t+1}}}for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){let s=false;const o=e.item(t);o.active=t===i;o.finished=t<i;if(o.direction!==this.direction){s=true}o.direction=this.direction;o.align=t===0?"start":t===(e===null||e===void 0?void 0:e.length)-1?"end":"center";o.contentPosition=this.contentPosition;if(t<e.length-1){const e=o.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){if(s){await this._delay(10)}const n=(o.clientHeight>16?o.clientHeight-16:o.clientHeight)/2;const r=document.createElement("p-stepper-line");r.direction=this.direction;r.active=t<i;if(n>0&&this.direction==="vertical"){r.style.marginTop=`-${n/16}rem`;r.style.marginBottom=`-${n/16}rem`;r.style.minHeight=`calc(1rem + ${n*2/16}rem)`}this._el.insertBefore(r,e);const l=r.previousElementSibling;if(l&&l.tagName.toLowerCase()==="p-stepper-line"){l.remove()}continue}}if(t>0){const t=o.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=o.active||o.finished}}}const s=this._el.querySelectorAll("p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child");for(let t=s.length-1;t>=0;t--){const i=s.item(t);i.remove()}setTimeout((()=>this._rendering=false),100)};this.activeStep=1;this.direction="horizontal";this.contentPosition="end";this._rendering=false}componentDidLoad(){this._loaded=true;this._generateSteps(true)}render(){return i(e,{class:"p-stepper"},i("slot",{onSlotchange:this._onSlotChange}))}_onActiveStepChange(){this._generateSteps()}get _el(){return s(this)}static get watchers(){return{activeStep:["_onActiveStepChange"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-9c1e350b.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","this","_loaded","_delay","amount","Promise","resolve","setTimeout","_onSlotChange","async","_e","_generateSteps","firstLoad","_el","_rendering","activeStep","items","querySelectorAll","i","length","item","active","finished","directionChanged","direction","align","contentPosition","nextItem","nextElementSibling","tagName","toLowerCase","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previous","previousElementSibling","remove","previousItem","lines","j","line","componentDidLoad","render","h","Host","class","onSlotchange","_onActiveStepChange"],"sources":["src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n\t@apply flex;\n}\n\n:host([direction='horizontal']) {\n\t@apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n\t@apply flex-col flex-wrap items-start;\n\t@apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n\t@apply items-end;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n\ttag: 'p-stepper',\n\tstyleUrl: 'stepper.component.scss',\n\tshadow: true,\n})\nexport class Stepper {\n\t/**\n\t * The currently active step\n\t */\n\t@Prop() activeStep: number = 1;\n\n\t/**\n\t * The direction of the stepper\n\t */\n\t@Prop({ reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';\n\n\t/**\n\t * The position of the content in case of vertical direction\n\t */\n\t@Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t@State() private _rendering = false;\n\n\tprivate _loaded = false;\n\n\t// private _steps: Array<HTMLPStepperItemElement>;\n\n\tprivate _delay = (amount: number) =>\n\t\tnew Promise(resolve => setTimeout(resolve, amount));\n\n\tprivate _onSlotChange = async (_e: Event) => this._generateSteps();\n\n\tprivate _generateSteps = async (firstLoad = false) => {\n\t\tif (!firstLoad && (!this._el || this._rendering || !this._loaded)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._rendering = true;\n\n\t\tlet activeStep = this.activeStep - 1 || 0;\n\t\tconst items = this._el.querySelectorAll('p-stepper-item');\n\n\t\tif (!this.activeStep || activeStep < 0) {\n\t\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\t\tconst item = items.item(i) as any;\n\n\t\t\t\tif (item.active) {\n\t\t\t\t\tactiveStep = i;\n\t\t\t\t}\n\n\t\t\t\tif (activeStep < 0 && item.finished) {\n\t\t\t\t\tactiveStep = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tlet directionChanged = false;\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\titem.active = i === activeStep;\n\t\t\titem.finished = i < activeStep;\n\n\t\t\tif (item.direction !== this.direction) {\n\t\t\t\tdirectionChanged = true;\n\t\t\t}\n\n\t\t\titem.direction = this.direction;\n\t\t\titem.align =\n\t\t\t\ti === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n\t\t\titem.contentPosition = this.contentPosition;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tconst nextItem = item.nextElementSibling;\n\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\t// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight\n\t\t\t\t\t// otherwise we always get the initial \"16\"\n\t\t\t\t\tif (directionChanged) {\n\t\t\t\t\t\tawait this._delay(10);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst heightDiff =\n\t\t\t\t\t\t(item.clientHeight > 16\n\t\t\t\t\t\t\t? item.clientHeight - 16\n\t\t\t\t\t\t\t: item.clientHeight) / 2;\n\n\t\t\t\t\tconst stepperLine = document.createElement('p-stepper-line');\n\n\t\t\t\t\tstepperLine.direction = this.direction;\n\t\t\t\t\tstepperLine.active = i < activeStep;\n\n\t\t\t\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\t\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.marginBottom = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t\t\t\t(heightDiff * 2) / 16\n\t\t\t\t\t\t}rem)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\n\t\t\t\t\tconst previous = stepperLine.previousElementSibling;\n\t\t\t\t\tif (previous && previous.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\t\tprevious.remove();\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i > 0) {\n\t\t\t\tconst previousItem = item.previousElementSibling;\n\t\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tpreviousItem.direction = this.direction;\n\t\t\t\t\tpreviousItem.active = item.active || item.finished;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines = this._el.querySelectorAll(\n\t\t\t'p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child'\n\t\t);\n\t\tfor (let j = lines.length - 1; j >= 0; j--) {\n\t\t\tconst line = lines.item(j);\n\t\t\tline.remove();\n\t\t}\n\n\t\tsetTimeout(() => (this._rendering = false), 100);\n\t};\n\n\tcomponentDidLoad() {\n\t\tthis._loaded = true;\n\t\tthis._generateSteps(true);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class='p-stepper'>\n\t\t\t\t<slot onSlotchange={this._onSlotChange} />\n\t\t\t</Host>\n\t\t);\n\t}\n\n\t@Watch('activeStep')\n\tprotected _onActiveStepChange() {\n\t\tthis._generateSteps();\n\t}\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yBAuBXC,KAAAC,QAAU,MAIVD,KAAAE,OAAUC,GACjB,IAAIC,SAAQC,GAAWC,WAAWD,EAASF,KAEpCH,KAAAO,cAAgBC,MAAOC,GAAcT,KAAKU,iBAE1CV,KAAAU,eAAiBF,MAAOG,EAAY,SAC3C,IAAKA,KAAeX,KAAKY,KAAOZ,KAAKa,aAAeb,KAAKC,SAAU,CAClE,M,CAGDD,KAAKa,WAAa,KAElB,IAAIC,EAAad,KAAKc,WAAa,GAAK,EACxC,MAAMC,EAAQf,KAAKY,IAAII,iBAAiB,kBAExC,IAAKhB,KAAKc,YAAcA,EAAa,EAAG,CACvC,IAAK,IAAIG,EAAI,EAAGA,GAAIF,IAAK,MAALA,SAAK,SAALA,EAAOG,QAAQD,IAAK,CACvC,MAAME,EAAOJ,EAAMI,KAAKF,GAExB,GAAIE,EAAKC,OAAQ,CACh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,uBAC1B,GAAIE,EAAaf,QAAQC,gBAAkB,iBAAkB,CAC5Dc,EAAapB,UAAYvB,KAAKuB,UAC9BoB,EAAavB,OAASD,EAAKC,QAAUD,EAAKE,Q,GAK7C,MAAMuB,EAAQ5C,KAAKY,IAAII,iBACtB,0EAED,IAAK,IAAI6B,EAAID,EAAM1B,OAAS,EAAG2B,GAAK,EAAGA,IAAK,CAC3C,MAAMC,EAAOF,EAAMzB,KAAK0B,GACxBC,EAAKJ,Q,CAGNpC,YAAW,IAAON,KAAKa,WAAa,OAAQ,IAAI,E,gBA5HpB,E,eAKmC,a,qBAKJ,M,gBAO9B,K,CA8G9B,gBAAAkC,GACC/C,KAAKC,QAAU,KACfD,KAAKU,eAAe,K,CAGrB,MAAAsC,GACC,OACCC,EAACC,EAAI,CAACC,MAAM,aACXF,EAAA,QAAMG,aAAcpD,KAAKO,gB,CAMlB,mBAAA8C,GACTrD,KAAKU,gB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as e,g as s}from"./p-0c2cc6c4.js";const o=".flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}.static{position:static!important}";const n=class{constructor(i){t(this,i);this._loaded=false;this._delay=t=>new Promise((i=>setTimeout(i,t)));this._onSlotChange=async t=>this._generateSteps();this._generateSteps=async(t=false)=>{if(!t&&(!this._el||this._rendering||!this._loaded)){return}this._rendering=true;let i=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||i<0){for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){const s=e.item(t);if(s.active){i=t}if(i<0&&s.finished){i=t+1}}}for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){let s=false;const o=e.item(t);o.active=t===i;o.finished=t<i;if(o.direction!==this.direction){s=true}o.direction=this.direction;o.align=t===0?"start":t===(e===null||e===void 0?void 0:e.length)-1?"end":"center";o.contentPosition=this.contentPosition;if(t<e.length-1){const e=o.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){if(s){await this._delay(10)}const n=(o.clientHeight>16?o.clientHeight-16:o.clientHeight)/2;const r=document.createElement("p-stepper-line");r.direction=this.direction;r.active=t<i;if(n>0&&this.direction==="vertical"){r.style.marginTop=`-${n/16}rem`;r.style.marginBottom=`-${n/16}rem`;r.style.minHeight=`calc(1rem + ${n*2/16}rem)`}this._el.insertBefore(r,e);const l=r.previousElementSibling;if(l&&l.tagName.toLowerCase()==="p-stepper-line"){l.remove()}continue}}if(t>0){const t=o.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=o.active||o.finished}}}const s=this._el.querySelectorAll("p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child");for(let t=s.length-1;t>=0;t--){const i=s.item(t);i.remove()}setTimeout((()=>this._rendering=false),100)};this.activeStep=1;this.direction="horizontal";this.contentPosition="end";this._rendering=false}componentDidLoad(){this._loaded=true;this._generateSteps(true)}render(){return i(e,{class:"p-stepper"},i("slot",{onSlotchange:this._onSlotChange}))}_onActiveStepChange(){this._generateSteps()}get _el(){return s(this)}static get watchers(){return{activeStep:["_onActiveStepChange"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-9c1e350b.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","this","_loaded","_delay","amount","Promise","resolve","setTimeout","_onSlotChange","async","_e","_generateSteps","firstLoad","_el","_rendering","activeStep","items","querySelectorAll","i","length","item","active","finished","directionChanged","direction","align","contentPosition","nextItem","nextElementSibling","tagName","toLowerCase","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previous","previousElementSibling","remove","previousItem","lines","j","line","componentDidLoad","render","h","Host","class","onSlotchange","_onActiveStepChange"],"sources":["src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n\t@apply flex;\n}\n\n:host([direction='horizontal']) {\n\t@apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n\t@apply flex-col flex-wrap items-start;\n\t@apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n\t@apply items-end;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n\ttag: 'p-stepper',\n\tstyleUrl: 'stepper.component.scss',\n\tshadow: true,\n})\nexport class Stepper {\n\t/**\n\t * The currently active step\n\t */\n\t@Prop() activeStep: number = 1;\n\n\t/**\n\t * The direction of the stepper\n\t */\n\t@Prop({ reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';\n\n\t/**\n\t * The position of the content in case of vertical direction\n\t */\n\t@Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t@State() private _rendering = false;\n\n\tprivate _loaded = false;\n\n\t// private _steps: Array<HTMLPStepperItemElement>;\n\n\tprivate _delay = (amount: number) =>\n\t\tnew Promise(resolve => setTimeout(resolve, amount));\n\n\tprivate _onSlotChange = async (_e: Event) => this._generateSteps();\n\n\tprivate _generateSteps = async (firstLoad = false) => {\n\t\tif (!firstLoad && (!this._el || this._rendering || !this._loaded)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._rendering = true;\n\n\t\tlet activeStep = this.activeStep - 1 || 0;\n\t\tconst items = this._el.querySelectorAll('p-stepper-item');\n\n\t\tif (!this.activeStep || activeStep < 0) {\n\t\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\t\tconst item = items.item(i) as any;\n\n\t\t\t\tif (item.active) {\n\t\t\t\t\tactiveStep = i;\n\t\t\t\t}\n\n\t\t\t\tif (activeStep < 0 && item.finished) {\n\t\t\t\t\tactiveStep = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tlet directionChanged = false;\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\titem.active = i === activeStep;\n\t\t\titem.finished = i < activeStep;\n\n\t\t\tif (item.direction !== this.direction) {\n\t\t\t\tdirectionChanged = true;\n\t\t\t}\n\n\t\t\titem.direction = this.direction;\n\t\t\titem.align =\n\t\t\t\ti === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n\t\t\titem.contentPosition = this.contentPosition;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tconst nextItem = item.nextElementSibling;\n\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\t// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight\n\t\t\t\t\t// otherwise we always get the initial \"16\"\n\t\t\t\t\tif (directionChanged) {\n\t\t\t\t\t\tawait this._delay(10);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst heightDiff =\n\t\t\t\t\t\t(item.clientHeight > 16\n\t\t\t\t\t\t\t? item.clientHeight - 16\n\t\t\t\t\t\t\t: item.clientHeight) / 2;\n\n\t\t\t\t\tconst stepperLine = document.createElement('p-stepper-line');\n\n\t\t\t\t\tstepperLine.direction = this.direction;\n\t\t\t\t\tstepperLine.active = i < activeStep;\n\n\t\t\t\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\t\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.marginBottom = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t\t\t\t(heightDiff * 2) / 16\n\t\t\t\t\t\t}rem)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\n\t\t\t\t\tconst previous = stepperLine.previousElementSibling;\n\t\t\t\t\tif (previous && previous.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\t\tprevious.remove();\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i > 0) {\n\t\t\t\tconst previousItem = item.previousElementSibling;\n\t\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tpreviousItem.direction = this.direction;\n\t\t\t\t\tpreviousItem.active = item.active || item.finished;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines = this._el.querySelectorAll(\n\t\t\t'p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child'\n\t\t);\n\t\tfor (let j = lines.length - 1; j >= 0; j--) {\n\t\t\tconst line = lines.item(j);\n\t\t\tline.remove();\n\t\t}\n\n\t\tsetTimeout(() => (this._rendering = false), 100);\n\t};\n\n\tcomponentDidLoad() {\n\t\tthis._loaded = true;\n\t\tthis._generateSteps(true);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class='p-stepper'>\n\t\t\t\t<slot onSlotchange={this._onSlotChange} />\n\t\t\t</Host>\n\t\t);\n\t}\n\n\t@Watch('activeStep')\n\tprotected _onActiveStepChange() {\n\t\tthis._generateSteps();\n\t}\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yBAuBXC,KAAAC,QAAU,MAIVD,KAAAE,OAAUC,GACjB,IAAIC,SAAQC,GAAWC,WAAWD,EAASF,KAEpCH,KAAAO,cAAgBC,MAAOC,GAAcT,KAAKU,iBAE1CV,KAAAU,eAAiBF,MAAOG,EAAY,SAC3C,IAAKA,KAAeX,KAAKY,KAAOZ,KAAKa,aAAeb,KAAKC,SAAU,CAClE,M,CAGDD,KAAKa,WAAa,KAElB,IAAIC,EAAad,KAAKc,WAAa,GA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