import { i, r, x } from './query-assigned-elements-fea1f631.js';
|
import { e } from './custom-element-30fc6381.js';
|
import { n, B as BaseElement } from './base.component-813fc7cf.js';
|
import '@dh-software/furnview-icons';
|
|
var css_248z = i`.close-symbol{cursor:pointer;height:100%;position:relative;width:100%}.close-symbol.loading{z-index:999}.close-symbol.loading:after,.close-symbol.loading:before{background:#fff}.close-symbol:after,.close-symbol:before{background:var(--close-symbol-background,#888);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;content:" ";height:1px;margin:0;padding:0;position:absolute;top:50%;width:100%}.close-symbol:after:hover,.close-symbol:before:hover{background:var(--close-symbol-background-hover,#333)}.close-symbol:after{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);transform:rotate(-45deg)}.close-symbol:before{-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);transform:rotate(45deg)}:host(.active) .circle-number-symbol{border:var(--circle-number-symbol-border-active,2px solid #000)}.circle-number-symbol{align-items:center;background:var(--circle-number-symbol-background,var(--primary-color,red));border:var(--circle-number-symbol-border,2px solid #fff);border-radius:50%;box-shadow:var(--circle-number-symbol-box-shadow,1px 2px 5px 0 #000);color:var(--circle-number-symbol-color,var(--primary-text-color,#000));display:flex;height:var(--circle-number-symbol-size,30px);justify-content:center;position:relative;width:var(--circle-number-symbol-size,30px)}.custom-symbol{cursor:pointer;display:flex;left:10px;position:relative}.custom-symbol.up:after{background-image:var(--custom-symbol-image-down,url("/webui/images/minus.svg"));content:"";height:18px}.custom-symbol.down:after{background-image:var(--custom-symbol-image-down,url("/webui/images/plus.svg"));content:"";height:18px}.custom-symbol:after{color:#1e1e1e;margin:auto 0;padding:0 0 2px;pointer-events:none;transform:translateX(-15px);width:18px}.accordion-symbol{cursor:pointer;display:flex;left:10px;position:relative}.accordion-symbol.up:after{content:"-";font-size:xx-large;transform:scaleX(2) translateX(-4px)}.accordion-symbol.down:after{content:"+";font-size:xx-large}.accordion-symbol:after{color:#1e1e1e;margin:auto 0;padding:0 0 2px;pointer-events:none;transform:translateX(-15px);width:18px}.chevron-symbol{cursor:pointer;left:10px;position:relative}.chevron-symbol.up:after{content:"<"}.chevron-symbol.down:after{content:">"}.chevron-symbol:after{color:inherit;font:17px Consolas,monospace;padding:0 0 2px;pointer-events:none;position:absolute;-webkit-transform:rotate(90deg) translateX(-100%);-moz-transform:rotate(90deg) translateX(-100%);-ms-transform:rotate(90deg) translateX(-100%);transform:rotate(90deg) translateX(-100%)}@media (width >= 980px){.only-mobile{display:none!important}}@media (width <= 980px){.only-desktop{display:none!important}}.bold{font-weight:var(--global-font-weight-bold,600)}*{font-family:var(--global-font,Roboto);font-weight:var(--global-font-weight,400);-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.container{display:flex;margin:10px 0}.container.column{flex-direction:column}.container.column.reverse{flex-direction:column-reverse}.container.row{flex-direction:row}.container.row.reverse{flex-direction:row-reverse}.fluid{flex:1}.fluid.space-after{margin-right:55px}.hidden{display:none!important}.mobile-mode-hide,:host(.mobile-mode-hide){display:none!important}.invisible{visibility:hidden!important}.invisible-scroll,:host(.invisible-scroll){margin-right:-22px;overflow:hidden}.invisible-scroll>:first-child,:host(.invisible-scroll)>:first-child{box-sizing:content-box;overflow-x:hidden;overflow-y:scroll;padding-right:22px}.invisible-scroll.bottom,:host(.invisible-scroll.bottom){margin-right:unset;overflow:hidden}.invisible-scroll.bottom>:first-child,:host(.invisible-scroll.bottom)>:first-child{box-sizing:content-box;margin-bottom:-22px;overflow-x:scroll;overflow-y:hidden;padding-bottom:22px;padding-right:unset}:host([disabled]){filter:contrast(.5) grayscale(1);pointer-events:none}*{scrollbar-color:#5c5c5c hsla(0,0%,100%,.004);scrollbar-width:thin}[disabled]{filter:contrast(.5) grayscale(1);pointer-events:none}::-webkit-scrollbar{height:8px;width:8px}::-webkit-scrollbar,::-webkit-scrollbar-corner{background:hsla(0,0%,100%,0)}::-webkit-scrollbar-thumb{background:#5c5c5c;-webkit-border-radius:8px}::-webkit-scrollbar-button,::-webkit-scrollbar-button:horizontal:end:decrement,::-webkit-scrollbar-button:horizontal:end:increment,::-webkit-scrollbar-button:vertical:end:decrement,::-webkit-scrollbar-button:vertical:start:increment{background-color:transparent;border:none;color:transparent}:host{--constrained-input-border-color:var(--webcab-input-border-color,#e3e3e3);--constrained-input-border-size:var(--webcab-input-border-size,2px);--constrained-input-font-size:var(--webcab-inputs-font-size,15px);font-size:var(--webcab-ui-font-size,16px);width:fit-content}:host .indecrease-button{height:100%;width:100%}:host .disabled{--constrained-input-indecrease-buttons-background:var(--webcab-input-button-background,#e3e3e3)}:host .label-outer-container{display:flex;flex-flow:column nowrap;justify-content:var(--webcab-input-label-justify-content,unset)}:host .label-outer-container.inline{flex-flow:row nowrap}:host .label-suffix-container{color:var(--wwebcab-input-min-max-color,#a8a7a7);display:flex;flex-flow:row nowrap}:host .minmax-labels{white-space:nowrap}:host .min-max-label-dash{padding-left:var(--webcab-input-min-max-dash-padding-left-right,unset);padding-right:var(--webcab-input-min-max-dash-padding-left-right,unset)}:host .label-suffixes-container{display:flex;flex-flow:row nowrap;justify-content:var(--webcab-input-label-suffixes-justify-content,unset)}`;
|
|
var __defProp = Object.defineProperty;
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
var __getProtoOf = Object.getPrototypeOf;
|
var __reflectGet = Reflect.get;
|
var __decorateClass = (decorators, target, key, kind) => {
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
if (decorator = decorators[i])
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
if (kind && result)
|
__defProp(target, key, result);
|
return result;
|
};
|
var __superStaticGet = (obj, member) => __reflectGet(__getProtoOf(obj), member, obj);
|
var __async = (__this, __arguments, generator) => {
|
return new Promise((resolve, reject) => {
|
var fulfilled = (value) => {
|
try {
|
step(generator.next(value));
|
} catch (e) {
|
reject(e);
|
}
|
};
|
var rejected = (value) => {
|
try {
|
step(generator.throw(value));
|
} catch (e) {
|
reject(e);
|
}
|
};
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
step((generator = generator.apply(__this, __arguments)).next());
|
});
|
};
|
let WebCabValueInputComponent = class extends BaseElement {
|
constructor() {
|
super();
|
this.increment = void 0;
|
this.fractionDigits = 0;
|
this.timeoutms = 500;
|
this.preventInlineLabel = false;
|
this.customerType = "";
|
this.configSuffix = "";
|
this.instanceIdent = -1;
|
this.value = 0;
|
this.name = "";
|
this.GroupID = void 0;
|
this.InGroupID = void 0;
|
this.ZSpaceID = void 0;
|
this.ModificationTargets = void 0;
|
this.minValue = void 0;
|
this.maxValue = void 0;
|
this.unitTxt = "error";
|
this.dimScale = void 0;
|
this.oldvalue = 0;
|
}
|
get min() {
|
return this.minValue ? this.minValue : 0;
|
}
|
get max() {
|
return this.maxValue ? this.maxValue : 9999999999e-2;
|
}
|
change(ev_) {
|
const target = ev_.target;
|
if (target) {
|
const changeEventData = {
|
"old-value": this.value,
|
value: 0
|
};
|
this.value = target.value;
|
changeEventData.value = this.value;
|
const changeEvent = new WebCabValueInputChanged(changeEventData);
|
this.dispatchEvent(changeEvent);
|
}
|
}
|
applyDimScale(value_) {
|
if (this.dimScale) {
|
return value_ * (1 / this.dimScale);
|
}
|
return value_;
|
}
|
render() {
|
const increase = this.value != this.max, decrease = this.value != this.min;
|
const additionalSuffix = this.querySelector("[slot='additional-suffix']");
|
const hasInlinesuffix = this.unitTxt != void 0 && this.unitTxt.length > 0 && this.unitTxt != "error";
|
const inlineSuffix = hasInlinesuffix ? " " + this.unitTxt : "";
|
const result = x`
|
<div class="label-outer-container${this.preventInlineLabel ? "" : " inline"}">
|
<div class="label-container">
|
<span><slot name="label"></slot></span>
|
</div>
|
<div part="label-suffixes-container" class="label-suffixes-container">
|
<div part="min-max-label" class="label-suffix-container">
|
<span><label part="min-label" class="minmax-labels">${this.min.toFixed(this.fractionDigits) + inlineSuffix}</label></span>
|
<span><label part="min-max-label-dash" class="min-max-label-dash"> - </label></span>
|
<span><label part="max-label" class="minmax-labels">${this.max.toFixed(this.fractionDigits) + inlineSuffix}</label></span>
|
</div>
|
${additionalSuffix != void 0 ? x`<div part="additional-suffix-container"><slot name="additional-suffix"></slot></div>` : x``}
|
</div>
|
</div>
|
<fv-constrained-input
|
@change="${this.change}"
|
min="${this.minValue ? this.applyDimScale(this.minValue) : 0}"
|
max="${this.maxValue ? this.applyDimScale(this.maxValue) : 0}"
|
value="${this.value ? this.applyDimScale(this.value) : 0}"
|
step="${this.increment ? this.increment : 1}"
|
decimals="${this.fractionDigits}"
|
unit="${this.unitTxt}"
|
timeoutms="${this.timeoutms}"
|
show-increase-decrease hide-unused-unit-container pool-repeated-button-clicks>
|
|
<div slot="increase" part="increase-button${increase ? "" : " disabled"}" class="indecrease-button increase-button${increase ? "" : " disabled"}">
|
<slot name="increase-button"></slot>
|
</div>
|
<div slot="decrease" part="decrease-button${decrease ? "" : " disabled"}" class="indecrease-button decrease-button${decrease ? "" : " disabled"}">
|
<slot name="decrease-button"></slot>
|
</div>
|
|
</fv-constrained-input>
|
`;
|
this.oldvalue = this.value;
|
this.setAttribute("exportparts", "label-suffixes-container, additional-suffix-container, min-max-label, min-label, min-max-label-dash, max-label, input, input-suffix-container, input-suffix, increase-button, decrease-button, disabled");
|
return result;
|
}
|
updated(_changedProperties) {
|
var __superGet = (key) => super[key];
|
return __async(this, null, function* () {
|
__superGet("updated").call(this, _changedProperties);
|
this.dispatchEvent(new WebCabValueInputRenderedEvent());
|
});
|
}
|
refreshComponent(uidata_) {
|
return __async(this, null, function* () {
|
if (this.name && this.name.length > 0) {
|
let uidata = uidata_;
|
if (uidata_ == void 0) {
|
uidata = yield WebCabApi.GetUIs(this.customerType, this.configSuffix, [this.instanceIdent]);
|
}
|
if (uidata != void 0 && uidata[this.instanceIdent] != void 0 && uidata[this.instanceIdent].components != void 0) {
|
const components = uidata[this.instanceIdent].components;
|
for (const component of components) {
|
if (component && component.name === this.name) {
|
if (component.change) {
|
this.GroupID = component.change.GroupID ? component.change.GroupID : void 0;
|
this.InGroupID = component.change.InGroupID ? component.change.InGroupID : void 0;
|
this.ModificationTargets = component.change.ModificationTargets ? JSON.stringify(component.change.ModificationTargets) : void 0;
|
}
|
if (component.attributes) {
|
this.maxValue = component.attributes.max;
|
this.minValue = component.attributes.min;
|
this.unitTxt = component.attributes["unit-txt"] == "" ? "error" : component.attributes["unit-txt"];
|
}
|
return;
|
}
|
}
|
}
|
}
|
});
|
}
|
dispatchLoadingEvent(loading_, uiData_) {
|
this.dispatchEvent(new CustomEvent("webcab-value-input-loading", { detail: { loading: loading_, uiData: uiData_ }, bubbles: true, composed: true }));
|
}
|
ChangeCount(preventLimitToInstanceIdent_ = false) {
|
return __async(this, null, function* () {
|
if (this.oldvalue != this.value) {
|
if (!this.GroupID) {
|
console.error("groupId invalid:", this.GroupID);
|
return;
|
}
|
if (!this.ModificationTargets) {
|
console.error("ModificationTargets invalid!");
|
return;
|
}
|
this.dispatchLoadingEvent(true);
|
const modificationTargets = JSON.parse(this.ModificationTargets);
|
const modifications = [];
|
for (const target of modificationTargets) {
|
modifications.push({
|
GroupID: this.GroupID,
|
target,
|
value: this.value.toFixed(0)
|
});
|
}
|
const uidata = yield WebCabApi.ModifyGroups(this.customerType, modifications, this.configSuffix, preventLimitToInstanceIdent_ ? void 0 : [this.instanceIdent]);
|
yield this.refreshComponent(uidata);
|
this.dispatchLoadingEvent(false, uidata);
|
}
|
});
|
}
|
ModifyFloatValue(preventLimitToInstanceIdent_ = false) {
|
return __async(this, null, function* () {
|
if (this.oldvalue != this.value) {
|
if (this.ModificationTargets == void 0) {
|
console.error("ModificationTargets are not set!");
|
return;
|
}
|
this.dispatchLoadingEvent(true);
|
const modificationTargets = JSON.parse(this.ModificationTargets);
|
const modifications = [];
|
for (const target of modificationTargets) {
|
modifications.push({
|
target,
|
value: this.value.toFixed(2)
|
});
|
}
|
const uidata = yield WebCabApi.ModifyValues(this.customerType, modifications, this.configSuffix, preventLimitToInstanceIdent_ ? void 0 : [this.instanceIdent]);
|
yield this.refreshComponent(uidata);
|
this.dispatchLoadingEvent(false, uidata);
|
}
|
});
|
}
|
ModifyZSplitting(preventLimitToInstanceIdent_ = false, isFloat) {
|
return __async(this, null, function* () {
|
if (this.oldvalue != this.value) {
|
if (this.ModificationTargets == void 0) {
|
console.error("ModificationTargets are not set!");
|
return;
|
}
|
this.dispatchLoadingEvent(true);
|
const modificationTargets = JSON.parse(this.ModificationTargets);
|
const modifications = [];
|
for (const target of modificationTargets) {
|
modifications.push({
|
XGroupID: this.GroupID ? this.GroupID : "",
|
XInGroupID: this.InGroupID ? this.InGroupID : "",
|
ZSpaceIndex: this.ZSpaceID ? this.ZSpaceID : void 0,
|
target,
|
value: isFloat ? this.value.toFixed(2) : this.value.toFixed(0)
|
});
|
}
|
yield WebCabApi.ModifyZSplitting(this.customerType, modifications, this.configSuffix, preventLimitToInstanceIdent_ ? void 0 : [this.instanceIdent]);
|
const uidata = yield WebCabApi.GetUIs(this.customerType, this.configSuffix, preventLimitToInstanceIdent_ ? void 0 : [this.instanceIdent]);
|
yield this.refreshComponent(uidata);
|
this.dispatchLoadingEvent(false, uidata);
|
}
|
});
|
}
|
ModifySingleSpace(preventLimitToInstanceIdent_ = false) {
|
return __async(this, null, function* () {
|
if (this.oldvalue != this.value) {
|
if (!this.GroupID || !this.InGroupID || !this.ModificationTargets) {
|
if (!this.GroupID) {
|
console.error("GroupId invalid:", this.GroupID);
|
}
|
if (!this.InGroupID) {
|
console.error("InGroupId invalid:", this.InGroupID);
|
}
|
if (!this.ModificationTargets) {
|
console.error("modificationTarget invalid!");
|
}
|
return;
|
}
|
this.dispatchLoadingEvent(true);
|
const modificationTargets = JSON.parse(this.ModificationTargets);
|
const modifications = [];
|
for (const target of modificationTargets) {
|
modifications.push({
|
GroupID: this.GroupID,
|
InGroupID: this.InGroupID,
|
target,
|
value: this.value.toFixed(2)
|
});
|
}
|
yield WebCabApi.ModifySpaces(this.customerType, modifications, this.configSuffix, preventLimitToInstanceIdent_ ? void 0 : [this.instanceIdent]);
|
const uidata = yield WebCabApi.GetUIs(this.customerType, this.configSuffix, preventLimitToInstanceIdent_ ? void 0 : [this.instanceIdent]);
|
yield this.refreshComponent(uidata);
|
this.dispatchLoadingEvent(false, uidata);
|
}
|
});
|
}
|
};
|
WebCabValueInputComponent.styles = [
|
__superStaticGet(WebCabValueInputComponent, "styles") || [],
|
i`${r(css_248z)}`
|
];
|
__decorateClass([
|
n({ type: Number, reflect: true })
|
], WebCabValueInputComponent.prototype, "increment", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true, attribute: "fraction-digits" })
|
], WebCabValueInputComponent.prototype, "fractionDigits", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true })
|
], WebCabValueInputComponent.prototype, "timeoutms", 2);
|
__decorateClass([
|
n({ type: Boolean, reflect: true, attribute: "prevent-inline-label" })
|
], WebCabValueInputComponent.prototype, "preventInlineLabel", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "customer-type" })
|
], WebCabValueInputComponent.prototype, "customerType", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "config-suffix" })
|
], WebCabValueInputComponent.prototype, "configSuffix", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true, attribute: "instance-ident" })
|
], WebCabValueInputComponent.prototype, "instanceIdent", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true })
|
], WebCabValueInputComponent.prototype, "value", 2);
|
__decorateClass([
|
n({ type: String, reflect: true })
|
], WebCabValueInputComponent.prototype, "name", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "group-id" })
|
], WebCabValueInputComponent.prototype, "GroupID", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "in-group-id" })
|
], WebCabValueInputComponent.prototype, "InGroupID", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "z-space-id" })
|
], WebCabValueInputComponent.prototype, "ZSpaceID", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "modification-targets" })
|
], WebCabValueInputComponent.prototype, "ModificationTargets", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true, attribute: "min-value" })
|
], WebCabValueInputComponent.prototype, "minValue", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true, attribute: "max-value" })
|
], WebCabValueInputComponent.prototype, "maxValue", 2);
|
__decorateClass([
|
n({ type: String, reflect: true, attribute: "unit-txt" })
|
], WebCabValueInputComponent.prototype, "unitTxt", 2);
|
__decorateClass([
|
n({ type: Number, reflect: true, attribute: "dim-scale" })
|
], WebCabValueInputComponent.prototype, "dimScale", 2);
|
WebCabValueInputComponent = __decorateClass([
|
e("fv-webcab-value-input")
|
], WebCabValueInputComponent);
|
class WebCabValueInputRenderedEvent extends CustomEvent {
|
constructor() {
|
super("webcab-value-input-rendered", { detail: {}, bubbles: true, composed: true });
|
}
|
}
|
class WebCabValueInputChanged extends CustomEvent {
|
constructor(data_) {
|
super("webcab-value-input-changed", { detail: data_, bubbles: true, composed: true });
|
}
|
}
|
|
export { WebCabValueInputChanged, WebCabValueInputComponent, WebCabValueInputRenderedEvent };
|