@paperless/core 1.67.6 → 1.67.8
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 +22 -0
- package/dist/build/p-a689640d.entry.js +2 -0
- package/dist/build/p-a689640d.entry.js.map +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/build/paperless.esm.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/p-stepper.cjs.entry.js +18 -22
- package/dist/cjs/p-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/paperless.cjs.js +1 -1
- package/dist/collection/components/molecules/stepper/stepper.component.js +18 -27
- package/dist/collection/components/molecules/stepper/stepper.component.js.map +1 -1
- package/dist/components/p-stepper.js +19 -24
- package/dist/components/p-stepper.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/p-stepper.entry.js +18 -22
- package/dist/esm/p-stepper.entry.js.map +1 -1
- package/dist/esm/paperless.js +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-a689640d.entry.js +2 -0
- package/dist/paperless/p-a689640d.entry.js.map +1 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/paperless/paperless.esm.js.map +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 +0 -2
- package/hydrate/index.js +19 -24
- package/package.json +1 -1
- package/dist/build/p-4ee6e401.entry.js +0 -2
- package/dist/build/p-4ee6e401.entry.js.map +0 -1
- package/dist/paperless/p-4ee6e401.entry.js +0 -2
- package/dist/paperless/p-4ee6e401.entry.js.map +0 -1
|
@@ -19,10 +19,8 @@ export declare class Stepper {
|
|
|
19
19
|
* The host element
|
|
20
20
|
*/
|
|
21
21
|
private _el;
|
|
22
|
-
private _rendering;
|
|
23
22
|
private _generateTimeout;
|
|
24
23
|
private _resizeObserver;
|
|
25
|
-
private _onSlotChange;
|
|
26
24
|
private _generateStepsOnce;
|
|
27
25
|
private _generateSteps;
|
|
28
26
|
private _setStepperLineData;
|
package/hydrate/index.js
CHANGED
|
@@ -21796,35 +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._onSlotChange = async (_e) => this._generateStepsOnce();
|
|
21800
21799
|
this._generateStepsOnce = () => {
|
|
21801
|
-
if (this._rendering) {
|
|
21802
|
-
return;
|
|
21803
|
-
}
|
|
21804
21800
|
if (this._generateTimeout) {
|
|
21805
21801
|
clearTimeout(this._generateTimeout);
|
|
21806
21802
|
this._generateTimeout = null;
|
|
21807
21803
|
}
|
|
21808
|
-
this._generateTimeout = setTimeout(() => this._generateSteps());
|
|
21804
|
+
this._generateTimeout = setTimeout(() => this._generateSteps(), 50);
|
|
21809
21805
|
};
|
|
21810
21806
|
this._generateSteps = async () => {
|
|
21811
|
-
if (!this._el
|
|
21807
|
+
if (!this._el) {
|
|
21812
21808
|
return;
|
|
21813
21809
|
}
|
|
21814
|
-
this._rendering = true;
|
|
21815
21810
|
let activeStep = this.activeStep - 1 || 0;
|
|
21816
21811
|
const items = this._el.querySelectorAll('p-stepper-item');
|
|
21817
|
-
if (!this.activeStep || activeStep < 0) {
|
|
21818
|
-
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21819
|
-
const item = items.item(i);
|
|
21820
|
-
if (item.active) {
|
|
21821
|
-
activeStep = i;
|
|
21822
|
-
}
|
|
21823
|
-
if (activeStep < 0 && item.finished) {
|
|
21824
|
-
activeStep = i + 1;
|
|
21825
|
-
}
|
|
21826
|
-
}
|
|
21827
|
-
}
|
|
21828
21812
|
let directionChanged = false;
|
|
21829
21813
|
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21830
21814
|
const item = items.item(i);
|
|
@@ -21832,12 +21816,26 @@ class Stepper {
|
|
|
21832
21816
|
item.active = i === activeStep;
|
|
21833
21817
|
item.finished = i < activeStep;
|
|
21834
21818
|
}
|
|
21819
|
+
if (!this.activeStep || activeStep < 0) {
|
|
21820
|
+
if (item.active) {
|
|
21821
|
+
activeStep = i;
|
|
21822
|
+
}
|
|
21823
|
+
if (activeStep < 0 && item.finished) {
|
|
21824
|
+
activeStep = i + 1;
|
|
21825
|
+
}
|
|
21826
|
+
}
|
|
21835
21827
|
if (item.direction !== this.direction && !directionChanged) {
|
|
21836
21828
|
directionChanged = true;
|
|
21837
21829
|
}
|
|
21838
21830
|
item.direction = this.direction;
|
|
21839
21831
|
item.align =
|
|
21840
|
-
|
|
21832
|
+
this.direction === 'vertical'
|
|
21833
|
+
? 'start'
|
|
21834
|
+
: i === 0
|
|
21835
|
+
? 'start'
|
|
21836
|
+
: i === (items === null || items === void 0 ? void 0 : items.length) - 1
|
|
21837
|
+
? 'end'
|
|
21838
|
+
: 'center';
|
|
21841
21839
|
item.contentPosition = this.contentPosition;
|
|
21842
21840
|
}
|
|
21843
21841
|
if (directionChanged) {
|
|
@@ -21880,7 +21878,6 @@ class Stepper {
|
|
|
21880
21878
|
const line = lines.item(j);
|
|
21881
21879
|
line.remove();
|
|
21882
21880
|
}
|
|
21883
|
-
setTimeout(() => (this._rendering = false), 100);
|
|
21884
21881
|
};
|
|
21885
21882
|
this._setStepperLineData = (stepperLine, item, nextItem, i, activeStep) => {
|
|
21886
21883
|
const heightDiff = item.clientHeight / 2;
|
|
@@ -21897,7 +21894,6 @@ class Stepper {
|
|
|
21897
21894
|
this.enableAutoStatus = true;
|
|
21898
21895
|
this.direction = 'horizontal';
|
|
21899
21896
|
this.contentPosition = 'end';
|
|
21900
|
-
this._rendering = false;
|
|
21901
21897
|
}
|
|
21902
21898
|
componentDidLoad() {
|
|
21903
21899
|
this._resizeObserver = new ResizeObserver(() => this._generateStepsOnce());
|
|
@@ -21909,7 +21905,7 @@ class Stepper {
|
|
|
21909
21905
|
}
|
|
21910
21906
|
}
|
|
21911
21907
|
render() {
|
|
21912
|
-
return (hAsync(Host, { class: 'p-stepper' }, hAsync("slot", { onSlotchange: this.
|
|
21908
|
+
return (hAsync(Host, { class: 'p-stepper' }, hAsync("slot", { onSlotchange: () => this._generateStepsOnce() })));
|
|
21913
21909
|
}
|
|
21914
21910
|
_onActiveStepChange() {
|
|
21915
21911
|
this._generateStepsOnce();
|
|
@@ -21926,8 +21922,7 @@ class Stepper {
|
|
|
21926
21922
|
"activeStep": [2, "active-step"],
|
|
21927
21923
|
"enableAutoStatus": [4, "enable-auto-status"],
|
|
21928
21924
|
"direction": [513],
|
|
21929
|
-
"contentPosition": [513, "content-position"]
|
|
21930
|
-
"_rendering": [32]
|
|
21925
|
+
"contentPosition": [513, "content-position"]
|
|
21931
21926
|
},
|
|
21932
21927
|
"$listeners$": undefined,
|
|
21933
21928
|
"$lazyBundleId$": "-",
|
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._onSlotChange=async t=>this._generateStepsOnce();this._generateStepsOnce=()=>{if(this._rendering){return}if(this._generateTimeout){clearTimeout(this._generateTimeout);this._generateTimeout=null}this._generateTimeout=setTimeout((()=>this._generateSteps()))};this._generateSteps=async()=>{if(!this._el||this._rendering){return}this._rendering=true;let t=this.activeStep-1||0;const i=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||t<0){for(let e=0;e<(i===null||i===void 0?void 0:i.length);e++){const s=i.item(e);if(s.active){t=e}if(t<0&&s.finished){t=e+1}}}let e=false;for(let s=0;s<(i===null||i===void 0?void 0:i.length);s++){const o=i.item(s);if(this.enableAutoStatus){o.active=s===t;o.finished=s<t}if(o.direction!==this.direction&&!e){e=true}o.direction=this.direction;o.align=s===0?"start":s===(i===null||i===void 0?void 0:i.length)-1?"end":"center";o.contentPosition=this.contentPosition}if(e){await new Promise((t=>setTimeout(t,200)))}for(let e=0;e<(i===null||i===void 0?void 0:i.length);e++){const s=i.item(e);if(e<i.length-1){let i=s.nextElementSibling;if(i&&i.tagName.toLowerCase()==="p-stepper-item"){const o=document.createElement("p-stepper-line");this._el.insertBefore(o,i);this._setStepperLineData(o,s,i,e,t);const n=o.previousElementSibling;if(n&&n.tagName.toLowerCase()==="p-stepper-line"){n.remove()}continue}if(i&&i.tagName.toLowerCase()==="p-stepper-line"){const o=i;i=i.nextElementSibling;if(i&&i.tagName.toLowerCase()==="p-stepper-item"){this._setStepperLineData(o,s,i,e,t)}}}if(e>0){const t=s.previousElementSibling;if(t&&t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=s.active||s.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._setStepperLineData=(t,i,e,s,o)=>{const n=i.clientHeight/2;const r=e.clientHeight/2;t.direction=this.direction;t.active=s<o;if(n>0&&this.direction==="vertical"){t.style.marginTop=`-${n/16}rem`;t.style.marginBottom=`-${r/16}rem`;t.style.minHeight=`calc(1rem + ${(n+r)/16}rem)`}};this.activeStep=1;this.enableAutoStatus=true;this.direction="horizontal";this.contentPosition="end";this._rendering=false}componentDidLoad(){this._resizeObserver=new ResizeObserver((()=>this._generateStepsOnce()));this._resizeObserver.observe(this._el)}disconnectCallback(){if(this._resizeObserver){this._resizeObserver.disconnect()}}render(){return i(e,{class:"p-stepper"},i("slot",{onSlotchange:this._onSlotChange}))}_onActiveStepChange(){this._generateStepsOnce()}get _el(){return s(this)}static get watchers(){return{activeStep:["_onActiveStepChange"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-4ee6e401.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","this","_onSlotChange","async","_e","_generateStepsOnce","_rendering","_generateTimeout","clearTimeout","setTimeout","_generateSteps","_el","activeStep","items","querySelectorAll","i","length","item","active","finished","directionChanged","enableAutoStatus","direction","align","contentPosition","Promise","resolve","nextItem","nextElementSibling","tagName","toLowerCase","stepperLine","document","createElement","insertBefore","_setStepperLineData","previous","previousElementSibling","remove","previousItem","lines","j","line","heightDiff","clientHeight","heightDiffNext","style","marginTop","marginBottom","minHeight","componentDidLoad","_resizeObserver","ResizeObserver","observe","disconnectCallback","disconnect","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 * Wether to automatically apply active & finished to items\n\t */\n\t@Prop() enableAutoStatus: boolean = true;\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 _generateTimeout: NodeJS.Timer;\n\tprivate _resizeObserver: ResizeObserver;\n\n\tprivate _onSlotChange = async (_e: Event) => this._generateStepsOnce();\n\n\tprivate _generateStepsOnce = () => {\n\t\tif (this._rendering) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._generateTimeout) {\n\t\t\tclearTimeout(this._generateTimeout);\n\t\t\tthis._generateTimeout = null;\n\t\t}\n\n\t\tthis._generateTimeout = setTimeout(() => this._generateSteps());\n\t};\n\n\tprivate _generateSteps = async () => {\n\t\tif (!this._el || this._rendering) {\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\tlet directionChanged = false;\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\tif (this.enableAutoStatus) {\n\t\t\t\titem.active = i === activeStep;\n\t\t\t\titem.finished = i < activeStep;\n\t\t\t}\n\n\t\t\tif (item.direction !== this.direction && !directionChanged) {\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\t\t}\n\n\t\tif (directionChanged) {\n\t\t\t// super hacky way to ensure all elements that have a direction changed are re-rendered\n\t\t\tawait new Promise(resolve => setTimeout(resolve, 200));\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tlet nextItem = item.nextElementSibling;\n\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\tconst stepperLine = document.createElement('p-stepper-line');\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\t\t\t\t\tthis._setStepperLineData(stepperLine, item, nextItem, i, activeStep);\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\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tconst stepperLine = nextItem;\n\t\t\t\t\tnextItem = nextItem.nextElementSibling;\n\n\t\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\t\tthis._setStepperLineData(\n\t\t\t\t\t\t\tstepperLine,\n\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\tnextItem,\n\t\t\t\t\t\t\ti,\n\t\t\t\t\t\t\tactiveStep\n\t\t\t\t\t\t);\n\t\t\t\t\t}\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 (\n\t\t\t\t\tpreviousItem &&\n\t\t\t\t\tpreviousItem.tagName.toLowerCase() === 'p-stepper-line'\n\t\t\t\t) {\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\tprivate _setStepperLineData = (\n\t\tstepperLine: HTMLPStepperLineElement,\n\t\titem: HTMLPStepperItemElement,\n\t\tnextItem: HTMLPStepperItemElement,\n\t\ti: number,\n\t\tactiveStep: number\n\t) => {\n\t\tconst heightDiff = item.clientHeight / 2;\n\t\tconst heightDiffNext = nextItem.clientHeight / 2;\n\n\t\tstepperLine.direction = this.direction;\n\t\tstepperLine.active = i < activeStep;\n\n\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\tstepperLine.style.marginBottom = `-${heightDiffNext / 16}rem`;\n\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t(heightDiff + heightDiffNext) / 16\n\t\t\t}rem)`;\n\t\t}\n\t};\n\n\tcomponentDidLoad() {\n\t\tthis._resizeObserver = new ResizeObserver(() => this._generateStepsOnce());\n\t\tthis._resizeObserver.observe(this._el);\n\t}\n\n\tdisconnectCallback() {\n\t\tif (this._resizeObserver) {\n\t\t\tthis._resizeObserver.disconnect();\n\t\t}\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._generateStepsOnce();\n\t}\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yBA+BXC,KAAAC,cAAgBC,MAAOC,GAAcH,KAAKI,qBAE1CJ,KAAAI,mBAAqB,KAC5B,GAAIJ,KAAKK,WAAY,CACpB,M,CAGD,GAAIL,KAAKM,iBAAkB,CAC1BC,aAAaP,KAAKM,kBAClBN,K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B,QACtDd,EAAYe,MAAMG,UAAY,gBAC5BN,EAAaE,GAAkB,Q,mBArKN,E,sBAKO,K,eAK4B,a,qBAKJ,M,gBAO9B,K,CAoJ9B,gBAAAK,GACCjD,KAAKkD,gBAAkB,IAAIC,gBAAe,IAAMnD,KAAKI,uBACrDJ,KAAKkD,gBAAgBE,QAAQpD,KAAKU,I,CAGnC,kBAAA2C,GACC,GAAIrD,KAAKkD,gBAAiB,CACzBlD,KAAKkD,gBAAgBI,Y,EAIvB,MAAAC,GACC,OACCC,EAACC,EAAI,CAACC,MAAM,aACXF,EAAA,QAAMG,aAAc3D,KAAKC,gB,CAMlB,mBAAA2D,GACT5D,KAAKI,oB"}
|
|
@@ -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._onSlotChange=async t=>this._generateStepsOnce();this._generateStepsOnce=()=>{if(this._rendering){return}if(this._generateTimeout){clearTimeout(this._generateTimeout);this._generateTimeout=null}this._generateTimeout=setTimeout((()=>this._generateSteps()))};this._generateSteps=async()=>{if(!this._el||this._rendering){return}this._rendering=true;let t=this.activeStep-1||0;const i=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||t<0){for(let e=0;e<(i===null||i===void 0?void 0:i.length);e++){const s=i.item(e);if(s.active){t=e}if(t<0&&s.finished){t=e+1}}}let e=false;for(let s=0;s<(i===null||i===void 0?void 0:i.length);s++){const o=i.item(s);if(this.enableAutoStatus){o.active=s===t;o.finished=s<t}if(o.direction!==this.direction&&!e){e=true}o.direction=this.direction;o.align=s===0?"start":s===(i===null||i===void 0?void 0:i.length)-1?"end":"center";o.contentPosition=this.contentPosition}if(e){await new Promise((t=>setTimeout(t,200)))}for(let e=0;e<(i===null||i===void 0?void 0:i.length);e++){const s=i.item(e);if(e<i.length-1){let i=s.nextElementSibling;if(i&&i.tagName.toLowerCase()==="p-stepper-item"){const o=document.createElement("p-stepper-line");this._el.insertBefore(o,i);this._setStepperLineData(o,s,i,e,t);const n=o.previousElementSibling;if(n&&n.tagName.toLowerCase()==="p-stepper-line"){n.remove()}continue}if(i&&i.tagName.toLowerCase()==="p-stepper-line"){const o=i;i=i.nextElementSibling;if(i&&i.tagName.toLowerCase()==="p-stepper-item"){this._setStepperLineData(o,s,i,e,t)}}}if(e>0){const t=s.previousElementSibling;if(t&&t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=s.active||s.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._setStepperLineData=(t,i,e,s,o)=>{const n=i.clientHeight/2;const r=e.clientHeight/2;t.direction=this.direction;t.active=s<o;if(n>0&&this.direction==="vertical"){t.style.marginTop=`-${n/16}rem`;t.style.marginBottom=`-${r/16}rem`;t.style.minHeight=`calc(1rem + ${(n+r)/16}rem)`}};this.activeStep=1;this.enableAutoStatus=true;this.direction="horizontal";this.contentPosition="end";this._rendering=false}componentDidLoad(){this._resizeObserver=new ResizeObserver((()=>this._generateStepsOnce()));this._resizeObserver.observe(this._el)}disconnectCallback(){if(this._resizeObserver){this._resizeObserver.disconnect()}}render(){return i(e,{class:"p-stepper"},i("slot",{onSlotchange:this._onSlotChange}))}_onActiveStepChange(){this._generateStepsOnce()}get _el(){return s(this)}static get watchers(){return{activeStep:["_onActiveStepChange"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-4ee6e401.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","this","_onSlotChange","async","_e","_generateStepsOnce","_rendering","_generateTimeout","clearTimeout","setTimeout","_generateSteps","_el","activeStep","items","querySelectorAll","i","length","item","active","finished","directionChanged","enableAutoStatus","direction","align","contentPosition","Promise","resolve","nextItem","nextElementSibling","tagName","toLowerCase","stepperLine","document","createElement","insertBefore","_setStepperLineData","previous","previousElementSibling","remove","previousItem","lines","j","line","heightDiff","clientHeight","heightDiffNext","style","marginTop","marginBottom","minHeight","componentDidLoad","_resizeObserver","ResizeObserver","observe","disconnectCallback","disconnect","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 * Wether to automatically apply active & finished to items\n\t */\n\t@Prop() enableAutoStatus: boolean = true;\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 _generateTimeout: NodeJS.Timer;\n\tprivate _resizeObserver: ResizeObserver;\n\n\tprivate _onSlotChange = async (_e: Event) => this._generateStepsOnce();\n\n\tprivate _generateStepsOnce = () => {\n\t\tif (this._rendering) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._generateTimeout) {\n\t\t\tclearTimeout(this._generateTimeout);\n\t\t\tthis._generateTimeout = null;\n\t\t}\n\n\t\tthis._generateTimeout = setTimeout(() => this._generateSteps());\n\t};\n\n\tprivate _generateSteps = async () => {\n\t\tif (!this._el || this._rendering) {\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\tlet directionChanged = false;\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\tif (this.enableAutoStatus) {\n\t\t\t\titem.active = i === activeStep;\n\t\t\t\titem.finished = i < activeStep;\n\t\t\t}\n\n\t\t\tif (item.direction !== this.direction && !directionChanged) {\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\t\t}\n\n\t\tif (directionChanged) {\n\t\t\t// super hacky way to ensure all elements that have a direction changed are re-rendered\n\t\t\tawait new Promise(resolve => setTimeout(resolve, 200));\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tlet nextItem = item.nextElementSibling;\n\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\tconst stepperLine = document.createElement('p-stepper-line');\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\t\t\t\t\tthis._setStepperLineData(stepperLine, item, nextItem, i, activeStep);\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\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tconst stepperLine = nextItem;\n\t\t\t\t\tnextItem = nextItem.nextElementSibling;\n\n\t\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\t\tthis._setStepperLineData(\n\t\t\t\t\t\t\tstepperLine,\n\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\tnextItem,\n\t\t\t\t\t\t\ti,\n\t\t\t\t\t\t\tactiveStep\n\t\t\t\t\t\t);\n\t\t\t\t\t}\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 (\n\t\t\t\t\tpreviousItem &&\n\t\t\t\t\tpreviousItem.tagName.toLowerCase() === 'p-stepper-line'\n\t\t\t\t) {\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\tprivate _setStepperLineData = (\n\t\tstepperLine: HTMLPStepperLineElement,\n\t\titem: HTMLPStepperItemElement,\n\t\tnextItem: HTMLPStepperItemElement,\n\t\ti: number,\n\t\tactiveStep: number\n\t) => {\n\t\tconst heightDiff = item.clientHeight / 2;\n\t\tconst heightDiffNext = nextItem.clientHeight / 2;\n\n\t\tstepperLine.direction = this.direction;\n\t\tstepperLine.active = i < activeStep;\n\n\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\tstepperLine.style.marginBottom = `-${heightDiffNext / 16}rem`;\n\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t(heightDiff + heightDiffNext) / 16\n\t\t\t}rem)`;\n\t\t}\n\t};\n\n\tcomponentDidLoad() {\n\t\tthis._resizeObserver = new ResizeObserver(() => this._generateStepsOnce());\n\t\tthis._resizeObserver.observe(this._el);\n\t}\n\n\tdisconnectCallback() {\n\t\tif (this._resizeObserver) {\n\t\t\tthis._resizeObserver.disconnect();\n\t\t}\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._generateStepsOnce();\n\t}\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yBA+BXC,KAAAC,cAAgBC,MAAOC,GAAcH,KAAKI,qBAE1CJ,KAAAI,mBAAqB,KAC5B,GAAIJ,KAAKK,WAAY,CACpB,M,CAGD,GAAIL,KAAKM,iBAAkB,CAC1BC,aAAaP,KAAKM,kBAClBN,KAAKM,iBAAmB,I,CAGzBN,KAAKM,iBAAmBE,YAAW,IAAMR,KAAKS,kBAAiB,EAGxDT,KAAAS,eAAiBP,UACxB,IAAKF,KAAKU,KAAOV,KAAKK,WAAY,CACjC,M,CAGDL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