@itwin/frontend-devtools 3.5.0-dev.4 → 3.5.0-dev.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.
@@ -23,6 +23,7 @@ export declare function createNumericInput(props: NumericInputProps, useFloat?:
23
23
  export interface LabeledNumericInputProps extends NumericInputProps {
24
24
  name: string;
25
25
  id: string;
26
+ divDisplay?: "block" | "none" | "inline";
26
27
  }
27
28
  /** @alpha */
28
29
  export interface LabeledNumericInput {
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInput.d.ts","sourceRoot":"","sources":["../../../src/ui/NumericInput.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,oBAAY,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAEnF,aAAa;AACb,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,aAAa;AACb,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,GAAE,OAAe,GAAG,gBAAgB,CAiCxG;AAED,aAAa;AACb,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,aAAa;AACb,MAAM,W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CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,aAAa;AACb,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,CAsB9F"}
@@ -42,6 +42,8 @@ exports.createNumericInput = createNumericInput;
42
42
  /** @alpha */
43
43
  function createLabeledNumericInput(props) {
44
44
  const div = document.createElement("div");
45
+ if (props.divDisplay)
46
+ div.style.display = props.divDisplay;
45
47
  const label = document.createElement("label");
46
48
  label.htmlFor = props.id;
47
49
  label.innerText = props.name;
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../../src/ui/NumericInput.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAwB/F,aAAa;AACb,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,WAAoB,KAAK;IACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;IACtB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAErC,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;QACpB,IAAI;YACF,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC7E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;gBACtB,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SAC/B;QAAC,OAAO,GAAG,EAAE;YACZ,EAAE;SACH;IACH,CAAC,CAAC;IAEF,IAAI,SAAS,KAAK,KAAK,CAAC,EAAE;QACxB,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACtB,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC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,QAAQ,CAAC;IAC9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC;IAE1E,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IAE5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AApBD,8DAoBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport type NumericInputHandler = (value: number, input: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface NumericInputProps {\r\n handler: NumericInputHandler;\r\n id?: string;\r\n parent?: HTMLElement;\r\n value: number;\r\n display?: \"inline\" | \"none\" | \"block\";\r\n disabled?: boolean;\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n tooltip?: string;\r\n parseAsFloat?: true;\r\n}\r\n\r\n/** @alpha */\r\nexport function createNumericInput(props: NumericInputProps, useFloat: boolean = false): HTMLInputElement {\r\n const input = document.createElement(\"input\");\r\n input.type = \"number\";\r\n input.value = props.value.toString();\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = useFloat ? parseFloat(input.value) : parseInt(input.value, 10);\r\n if (!Number.isNaN(value))\r\n props.handler(value, input);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n if (undefined !== props.id)\r\n input.id = props.id;\r\n if (undefined !== props.display)\r\n input.style.display = props.display;\r\n if (undefined !== props.min)\r\n input.min = props.min.toString();\r\n if (undefined !== props.max)\r\n input.max = props.max.toString();\r\n if (undefined !== props.step)\r\n input.step = props.step.toString();\r\n if (undefined !== props.tooltip)\r\n input.title = props.tooltip;\r\n if (undefined !== props.disabled)\r\n input.disabled = props.disabled;\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(input);\r\n\r\n return input;\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInputProps extends NumericInputProps {\r\n name: string;\r\n id: string;\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInput {\r\n input: HTMLInputElement;\r\n div: HTMLDivElement;\r\n label: HTMLLabelElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createLabeledNumericInput(props: LabeledNumericInputProps): LabeledNumericInput {\r\n const div = document.createElement(\"div\");\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const inputProps = { ...props };\r\n inputProps.parent = div;\r\n inputProps.display = \"inline\";\r\n const input = createNumericInput(inputProps, true === props.parseAsFloat);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n if (undefined !== props.tooltip)\r\n div.title = props.tooltip;\r\n\r\n return { label, div, input };\r\n}\r\n"]}
1
+ {"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../../src/ui/NumericInput.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAwB/F,aAAa;AACb,SAAgB,kBAAkB,CAAC,KAAwB,EAAE,WAAoB,KAAK;IACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;IACtB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAErC,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;QACpB,IAAI;YACF,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,K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IACvE,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,UAAU;QAClB,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC;IAEvC,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,UAAU,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAChC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC;IACxB,UAAU,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC;IAE1E,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IAE5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AAtBD,8DAsBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport type NumericInputHandler = (value: number, input: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface NumericInputProps {\r\n handler: NumericInputHandler;\r\n id?: string;\r\n parent?: HTMLElement;\r\n value: number;\r\n display?: \"inline\" | \"none\" | \"block\";\r\n disabled?: boolean;\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n tooltip?: string;\r\n parseAsFloat?: true;\r\n}\r\n\r\n/** @alpha */\r\nexport function createNumericInput(props: NumericInputProps, useFloat: boolean = false): HTMLInputElement {\r\n const input = document.createElement(\"input\");\r\n input.type = \"number\";\r\n input.value = props.value.toString();\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = useFloat ? parseFloat(input.value) : parseInt(input.value, 10);\r\n if (!Number.isNaN(value))\r\n props.handler(value, input);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n if (undefined !== props.id)\r\n input.id = props.id;\r\n if (undefined !== props.display)\r\n input.style.display = props.display;\r\n if (undefined !== props.min)\r\n input.min = props.min.toString();\r\n if (undefined !== props.max)\r\n input.max = props.max.toString();\r\n if (undefined !== props.step)\r\n input.step = props.step.toString();\r\n if (undefined !== props.tooltip)\r\n input.title = props.tooltip;\r\n if (undefined !== props.disabled)\r\n input.disabled = props.disabled;\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(input);\r\n\r\n return input;\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInputProps extends NumericInputProps {\r\n name: string;\r\n id: string;\r\n divDisplay?: \"block\" | \"none\" | \"inline\";\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInput {\r\n input: HTMLInputElement;\r\n div: HTMLDivElement;\r\n label: HTMLLabelElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createLabeledNumericInput(props: LabeledNumericInputProps): LabeledNumericInput {\r\n const div = document.createElement(\"div\");\r\n if (props.divDisplay)\r\n div.style.display = props.divDisplay;\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const inputProps = { ...props };\r\n inputProps.parent = div;\r\n inputProps.display = \"inline\";\r\n const input = createNumericInput(inputProps, true === props.parseAsFloat);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n if (undefined !== props.tooltip)\r\n div.title = props.tooltip;\r\n\r\n return { label, div, input };\r\n}\r\n"]}
@@ -23,6 +23,7 @@ export interface RadioBox {
23
23
  label?: HTMLLabelElement;
24
24
  setValue: (newValue: number | string) => boolean;
25
25
  div: HTMLDivElement;
26
+ form: HTMLFormElement;
26
27
  }
27
28
  /** @alpha */
28
29
  export declare function createRadioBox(props: RadioBoxProps): RadioBox;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioBox.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,oBAAY,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;AAE7E,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AACb,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;IACjD,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CA4E7D"}
1
+ {"version":3,"file":"RadioBox.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,oBAAY,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;AAE7E,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AACb,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;IACjD,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,aAAa;AACb,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CA4E7D"}
@@ -71,7 +71,7 @@ function createRadioBox(props) {
71
71
  }
72
72
  return validValue;
73
73
  };
74
- return { div, label, setValue };
74
+ return { div, label, setValue, form };
75
75
  }
76
76
  exports.createRadioBox = createRadioBox;
77
77
  //# sourceMappingURL=RadioBox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioBox.js","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAiC/F,aAAa;AACb,SAAgB,cAAc,CAAC,KAAoB;IACjD,MAAM,GAAG,GAAG,Q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CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACzF,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC;YAC3E,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAClC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAClC,CAAC;AA5ED,wCA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface RadioBoxEntry {\r\n value: number | string | undefined;\r\n label: string;\r\n}\r\n\r\n/** @alpha */\r\nexport type RadioBoxHandler = (value: string, form: HTMLFormElement) => void;\r\n\r\n/** @alpha */\r\nexport interface RadioBoxProps {\r\n id: string;\r\n entries: RadioBoxEntry[];\r\n handler: RadioBoxHandler;\r\n name?: string;\r\n parent?: HTMLElement;\r\n defaultValue?: number | string;\r\n vertical?: boolean;\r\n}\r\n\r\n/** @alpha */\r\nexport interface RadioBox {\r\n label?: HTMLLabelElement;\r\n setValue: (newValue: number | string) => boolean;\r\n div: HTMLDivElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createRadioBox(props: RadioBoxProps): RadioBox {\r\n const div = document.createElement(\"div\");\r\n\r\n let label: HTMLLabelElement | undefined;\r\n if (undefined !== props.name) {\r\n label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n }\r\n\r\n const form = document.createElement(\"form\");\r\n form.id = props.id;\r\n\r\n const radioBoxes: HTMLInputElement[] = [];\r\n\r\n for (const entry of props.entries) {\r\n const input = document.createElement(\"input\");\r\n input.type = \"radio\";\r\n input.name = props.name ? props.name : props.id;\r\n\r\n input.value = (undefined !== entry.value) ? entry.value.toString() : \"\";\r\n\r\n const inputLabel: HTMLLabelElement = document.createElement(\"label\");\r\n inputLabel.innerText = entry.label;\r\n\r\n inputLabel.onclick = () => {\r\n try {\r\n input.checked = true;\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n if (props.defaultValue === entry.value) {\r\n input.checked = true;\r\n }\r\n\r\n radioBoxes.push(input);\r\n\r\n if (props.vertical) {\r\n const container = document.createElement(\"div\");\r\n container.appendChild(input);\r\n container.appendChild(inputLabel);\r\n form.appendChild(container);\r\n } else {\r\n form.appendChild(input);\r\n form.appendChild(inputLabel);\r\n }\r\n }\r\n\r\n div.appendChild(form);\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n const setValue = (value: number | string): boolean => {\r\n const stringValue = value.toString();\r\n const validValue: boolean = radioBoxes.map((input) => input.value).includes(stringValue);\r\n if (validValue) {\r\n radioBoxes.forEach((input) => input.checked = input.value === stringValue);\r\n props.handler(stringValue, form);\r\n }\r\n return validValue;\r\n };\r\n\r\n return { div, label, setValue };\r\n}\r\n"]}
1
+ {"version":3,"file":"RadioBox.js","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAkC/F,aAAa;AACb,SAAgB,cAAc,CAAC,KAAoB;IACjD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,KAAmC,CAAC;IACxC,IAAI,SAAS,KAAK,KAAK,CAAC,IAAI,EAAE;QAC5B,KAAK,GAAG,QAAQ,CAAC,aAAa,CA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AAC,KAAK,KAAK,WAAW,CAAC,CAAC;YAC3E,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAClC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACxC,CAAC;AA5ED,wCA4EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface RadioBoxEntry {\r\n value: number | string | undefined;\r\n label: string;\r\n}\r\n\r\n/** @alpha */\r\nexport type RadioBoxHandler = (value: string, form: HTMLFormElement) => void;\r\n\r\n/** @alpha */\r\nexport interface RadioBoxProps {\r\n id: string;\r\n entries: RadioBoxEntry[];\r\n handler: RadioBoxHandler;\r\n name?: string;\r\n parent?: HTMLElement;\r\n defaultValue?: number | string;\r\n vertical?: boolean;\r\n}\r\n\r\n/** @alpha */\r\nexport interface RadioBox {\r\n label?: HTMLLabelElement;\r\n setValue: (newValue: number | string) => boolean;\r\n div: HTMLDivElement;\r\n form: HTMLFormElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createRadioBox(props: RadioBoxProps): RadioBox {\r\n const div = document.createElement(\"div\");\r\n\r\n let label: HTMLLabelElement | undefined;\r\n if (undefined !== props.name) {\r\n label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n }\r\n\r\n const form = document.createElement(\"form\");\r\n form.id = props.id;\r\n\r\n const radioBoxes: HTMLInputElement[] = [];\r\n\r\n for (const entry of props.entries) {\r\n const input = document.createElement(\"input\");\r\n input.type = \"radio\";\r\n input.name = props.name ? props.name : props.id;\r\n\r\n input.value = (undefined !== entry.value) ? entry.value.toString() : \"\";\r\n\r\n const inputLabel: HTMLLabelElement = document.createElement(\"label\");\r\n inputLabel.innerText = entry.label;\r\n\r\n inputLabel.onclick = () => {\r\n try {\r\n input.checked = true;\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n if (props.defaultValue === entry.value) {\r\n input.checked = true;\r\n }\r\n\r\n radioBoxes.push(input);\r\n\r\n if (props.vertical) {\r\n const container = document.createElement(\"div\");\r\n container.appendChild(input);\r\n container.appendChild(inputLabel);\r\n form.appendChild(container);\r\n } else {\r\n form.appendChild(input);\r\n form.appendChild(inputLabel);\r\n }\r\n }\r\n\r\n div.appendChild(form);\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n const setValue = (value: number | string): boolean => {\r\n const stringValue = value.toString();\r\n const validValue: boolean = radioBoxes.map((input) => input.value).includes(stringValue);\r\n if (validValue) {\r\n radioBoxes.forEach((input) => input.checked = input.value === stringValue);\r\n props.handler(stringValue, form);\r\n }\r\n return validValue;\r\n };\r\n\r\n return { div, label, setValue, form };\r\n}\r\n"]}
@@ -19,6 +19,8 @@ export interface SliderProps {
19
19
  max: string;
20
20
  step: string;
21
21
  value: string;
22
+ verticalAlign?: "middle" | false;
23
+ textAlign?: "right" | false;
22
24
  }
23
25
  /** @alpha */
24
26
  export declare function createSlider(props: SliderProps): Slider;
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,oBAAY,aAAa,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAE/D,aAAa;AACb,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA0BvD"}
1
+ {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,oBAAY,aAAa,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAE/D,aAAa;AACb,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAC7B;AAED,aAAa;AACb,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA6BvD"}
@@ -9,8 +9,10 @@ exports.createSlider = void 0;
9
9
  function createSlider(props) {
10
10
  const div = document.createElement("div");
11
11
  div.style.display = "block";
12
- div.style.verticalAlign = "middle";
13
- div.style.textAlign = "right";
12
+ if (props.verticalAlign)
13
+ div.style.verticalAlign = props.verticalAlign;
14
+ if (props.textAlign)
15
+ div.style.textAlign = props.textAlign;
14
16
  const label = document.createElement("label");
15
17
  label.htmlFor = props.id;
16
18
  label.innerText = props.name;
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA4B/F,aAAa;AACb,SAAgB,YAAY,CAAC,KAAkB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,GAAG,CAAC,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC;IACnC,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC;IAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACrB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACzB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAExB,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC;AA1BD,oCA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface Slider {\r\n label: HTMLLabelElement;\r\n slider: HTMLInputElement;\r\n div: HTMLDivElement;\r\n}\r\n\r\n/** @alpha */\r\nexport type SliderHandler = (slider: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface SliderProps {\r\n name: string;\r\n handler: SliderHandler;\r\n id: string;\r\n parent?: HTMLElement;\r\n min: string;\r\n max: string;\r\n step: string;\r\n value: string;\r\n}\r\n\r\n/** @alpha */\r\nexport function createSlider(props: SliderProps): Slider {\r\n const div = document.createElement(\"div\");\r\n div.style.display = \"block\";\r\n div.style.verticalAlign = \"middle\";\r\n div.style.textAlign = \"right\";\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const slider = document.createElement(\"input\");\r\n slider.type = \"range\";\r\n slider.className = \"slider\";\r\n slider.id = props.id;\r\n slider.min = props.min;\r\n slider.max = props.max;\r\n slider.step = props.step;\r\n slider.value = props.value;\r\n slider.addEventListener(\"input\", () => props.handler(slider));\r\n div.appendChild(slider);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n return { label, slider, div };\r\n}\r\n"]}
1
+ {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA8B/F,aAAa;AACb,SAAgB,YAAY,CAAC,KAAkB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,IAAI,KAAK,CAAC,aAAa;QACrB,GAAG,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAEhD,IAAI,KAAK,CAAC,SAAS;QACjB,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAExC,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACrB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACzB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAExB,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC;AA7BD,oCA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface Slider {\r\n label: HTMLLabelElement;\r\n slider: HTMLInputElement;\r\n div: HTMLDivElement;\r\n}\r\n\r\n/** @alpha */\r\nexport type SliderHandler = (slider: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface SliderProps {\r\n name: string;\r\n handler: SliderHandler;\r\n id: string;\r\n parent?: HTMLElement;\r\n min: string;\r\n max: string;\r\n step: string;\r\n value: string;\r\n verticalAlign?: \"middle\" | false;\r\n textAlign?: \"right\" | false;\r\n}\r\n\r\n/** @alpha */\r\nexport function createSlider(props: SliderProps): Slider {\r\n const div = document.createElement(\"div\");\r\n div.style.display = \"block\";\r\n if (props.verticalAlign)\r\n div.style.verticalAlign = props.verticalAlign;\r\n\r\n if (props.textAlign)\r\n div.style.textAlign = props.textAlign;\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const slider = document.createElement(\"input\");\r\n slider.type = \"range\";\r\n slider.className = \"slider\";\r\n slider.id = props.id;\r\n slider.min = props.min;\r\n slider.max = props.max;\r\n slider.step = props.step;\r\n slider.value = props.value;\r\n slider.addEventListener(\"input\", () => props.handler(slider));\r\n div.appendChild(slider);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n return { label, slider, div };\r\n}\r\n"]}
@@ -23,6 +23,7 @@ export declare function createNumericInput(props: NumericInputProps, useFloat?:
23
23
  export interface LabeledNumericInputProps extends NumericInputProps {
24
24
  name: string;
25
25
  id: string;
26
+ divDisplay?: "block" | "none" | "inline";
26
27
  }
27
28
  /** @alpha */
28
29
  export interface LabeledNumericInput {
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInput.d.ts","sourceRoot":"","sources":["../../../src/ui/NumericInput.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,oBAAY,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAEnF,aAAa;AACb,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,aAAa;AACb,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,GAAE,OAAe,GAAG,gBAAgB,CAiCxG;AAED,aAAa;AACb,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,aAAa;AACb,MAAM,WAAW,mBAAmB;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AAK,EAAE,gBAAgB,CAAC;CACzB;AAED,aAAa;AACb,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,CAsB9F"}
@@ -38,6 +38,8 @@ export function createNumericInput(props, useFloat = false) {
38
38
  /** @alpha */
39
39
  export function createLabeledNumericInput(props) {
40
40
  const div = document.createElement("div");
41
+ if (props.divDisplay)
42
+ div.style.display = props.divDisplay;
41
43
  const label = document.createElement("label");
42
44
  label.htmlFor = props.id;
43
45
  label.innerText = props.name;
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../../src/ui/NumericInput.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAwB/F,aAAa;AACb,MAAM,UAAU,kBAAkB,CAAC,KAAwB,EAAE,WAAoB,KAAK;IACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;IACtB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAErC,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;QACpB,IAAI;YACF,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC7E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;gBACtB,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SAC/B;QAAC,OAAO,GAAG,EAAE;YACZ,EAAE;SACH;IACH,CAAC,CAAC;IAEF,IAAI,SAAS,KAAK,KAAK,CAAC,EAAE;QACxB,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACtB,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,KAA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9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC;IAE1E,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IAE5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport type NumericInputHandler = (value: number, input: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface NumericInputProps {\r\n handler: NumericInputHandler;\r\n id?: string;\r\n parent?: HTMLElement;\r\n value: number;\r\n display?: \"inline\" | \"none\" | \"block\";\r\n disabled?: boolean;\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n tooltip?: string;\r\n parseAsFloat?: true;\r\n}\r\n\r\n/** @alpha */\r\nexport function createNumericInput(props: NumericInputProps, useFloat: boolean = false): HTMLInputElement {\r\n const input = document.createElement(\"input\");\r\n input.type = \"number\";\r\n input.value = props.value.toString();\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = useFloat ? parseFloat(input.value) : parseInt(input.value, 10);\r\n if (!Number.isNaN(value))\r\n props.handler(value, input);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n if (undefined !== props.id)\r\n input.id = props.id;\r\n if (undefined !== props.display)\r\n input.style.display = props.display;\r\n if (undefined !== props.min)\r\n input.min = props.min.toString();\r\n if (undefined !== props.max)\r\n input.max = props.max.toString();\r\n if (undefined !== props.step)\r\n input.step = props.step.toString();\r\n if (undefined !== props.tooltip)\r\n input.title = props.tooltip;\r\n if (undefined !== props.disabled)\r\n input.disabled = props.disabled;\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(input);\r\n\r\n return input;\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInputProps extends NumericInputProps {\r\n name: string;\r\n id: string;\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInput {\r\n input: HTMLInputElement;\r\n div: HTMLDivElement;\r\n label: HTMLLabelElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createLabeledNumericInput(props: LabeledNumericInputProps): LabeledNumericInput {\r\n const div = document.createElement(\"div\");\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const inputProps = { ...props };\r\n inputProps.parent = div;\r\n inputProps.display = \"inline\";\r\n const input = createNumericInput(inputProps, true === props.parseAsFloat);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n if (undefined !== props.tooltip)\r\n div.title = props.tooltip;\r\n\r\n return { label, div, input };\r\n}\r\n"]}
1
+ {"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../../src/ui/NumericInput.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAwB/F,aAAa;AACb,MAAM,UAAU,kBAAkB,CAAC,KAAwB,EAAE,WAAoB,KAAK;IACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;IACtB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAErC,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;QACpB,IAAI;YACF,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,C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a,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,UAAU;QAClB,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC;IAEvC,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,UAAU,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAChC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC;IACxB,UAAU,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,EAAE,IAAI,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC;IAE1E,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,IAAI,SAAS,KAAK,KAAK,CAAC,OAAO;QAC7B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;IAE5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport type NumericInputHandler = (value: number, input: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface NumericInputProps {\r\n handler: NumericInputHandler;\r\n id?: string;\r\n parent?: HTMLElement;\r\n value: number;\r\n display?: \"inline\" | \"none\" | \"block\";\r\n disabled?: boolean;\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n tooltip?: string;\r\n parseAsFloat?: true;\r\n}\r\n\r\n/** @alpha */\r\nexport function createNumericInput(props: NumericInputProps, useFloat: boolean = false): HTMLInputElement {\r\n const input = document.createElement(\"input\");\r\n input.type = \"number\";\r\n input.value = props.value.toString();\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = useFloat ? parseFloat(input.value) : parseInt(input.value, 10);\r\n if (!Number.isNaN(value))\r\n props.handler(value, input);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n if (undefined !== props.id)\r\n input.id = props.id;\r\n if (undefined !== props.display)\r\n input.style.display = props.display;\r\n if (undefined !== props.min)\r\n input.min = props.min.toString();\r\n if (undefined !== props.max)\r\n input.max = props.max.toString();\r\n if (undefined !== props.step)\r\n input.step = props.step.toString();\r\n if (undefined !== props.tooltip)\r\n input.title = props.tooltip;\r\n if (undefined !== props.disabled)\r\n input.disabled = props.disabled;\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(input);\r\n\r\n return input;\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInputProps extends NumericInputProps {\r\n name: string;\r\n id: string;\r\n divDisplay?: \"block\" | \"none\" | \"inline\";\r\n}\r\n\r\n/** @alpha */\r\nexport interface LabeledNumericInput {\r\n input: HTMLInputElement;\r\n div: HTMLDivElement;\r\n label: HTMLLabelElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createLabeledNumericInput(props: LabeledNumericInputProps): LabeledNumericInput {\r\n const div = document.createElement(\"div\");\r\n if (props.divDisplay)\r\n div.style.display = props.divDisplay;\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const inputProps = { ...props };\r\n inputProps.parent = div;\r\n inputProps.display = \"inline\";\r\n const input = createNumericInput(inputProps, true === props.parseAsFloat);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n if (undefined !== props.tooltip)\r\n div.title = props.tooltip;\r\n\r\n return { label, div, input };\r\n}\r\n"]}
@@ -23,6 +23,7 @@ export interface RadioBox {
23
23
  label?: HTMLLabelElement;
24
24
  setValue: (newValue: number | string) => boolean;
25
25
  div: HTMLDivElement;
26
+ form: HTMLFormElement;
26
27
  }
27
28
  /** @alpha */
28
29
  export declare function createRadioBox(props: RadioBoxProps): RadioBox;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioBox.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,oBAAY,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;AAE7E,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AACb,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;IACjD,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CA4E7D"}
1
+ {"version":3,"file":"RadioBox.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,oBAAY,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;AAE7E,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,aAAa;AACb,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC;IACjD,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,aAAa;AACb,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CA4E7D"}
@@ -68,6 +68,6 @@ export function createRadioBox(props) {
68
68
  }
69
69
  return validValue;
70
70
  };
71
- return { div, label, setValue };
71
+ return { div, label, setValue, form };
72
72
  }
73
73
  //# sourceMappingURL=RadioBox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioBox.js","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAiC/F,aAAa;AACb,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,KAAmC,CAAC;IACxC,IAAI,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AC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC;YAC3E,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAClC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAClC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface RadioBoxEntry {\r\n value: number | string | undefined;\r\n label: string;\r\n}\r\n\r\n/** @alpha */\r\nexport type RadioBoxHandler = (value: string, form: HTMLFormElement) => void;\r\n\r\n/** @alpha */\r\nexport interface RadioBoxProps {\r\n id: string;\r\n entries: RadioBoxEntry[];\r\n handler: RadioBoxHandler;\r\n name?: string;\r\n parent?: HTMLElement;\r\n defaultValue?: number | string;\r\n vertical?: boolean;\r\n}\r\n\r\n/** @alpha */\r\nexport interface RadioBox {\r\n label?: HTMLLabelElement;\r\n setValue: (newValue: number | string) => boolean;\r\n div: HTMLDivElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createRadioBox(props: RadioBoxProps): RadioBox {\r\n const div = document.createElement(\"div\");\r\n\r\n let label: HTMLLabelElement | undefined;\r\n if (undefined !== props.name) {\r\n label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n }\r\n\r\n const form = document.createElement(\"form\");\r\n form.id = props.id;\r\n\r\n const radioBoxes: HTMLInputElement[] = [];\r\n\r\n for (const entry of props.entries) {\r\n const input = document.createElement(\"input\");\r\n input.type = \"radio\";\r\n input.name = props.name ? props.name : props.id;\r\n\r\n input.value = (undefined !== entry.value) ? entry.value.toString() : \"\";\r\n\r\n const inputLabel: HTMLLabelElement = document.createElement(\"label\");\r\n inputLabel.innerText = entry.label;\r\n\r\n inputLabel.onclick = () => {\r\n try {\r\n input.checked = true;\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n if (props.defaultValue === entry.value) {\r\n input.checked = true;\r\n }\r\n\r\n radioBoxes.push(input);\r\n\r\n if (props.vertical) {\r\n const container = document.createElement(\"div\");\r\n container.appendChild(input);\r\n container.appendChild(inputLabel);\r\n form.appendChild(container);\r\n } else {\r\n form.appendChild(input);\r\n form.appendChild(inputLabel);\r\n }\r\n }\r\n\r\n div.appendChild(form);\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n const setValue = (value: number | string): boolean => {\r\n const stringValue = value.toString();\r\n const validValue: boolean = radioBoxes.map((input) => input.value).includes(stringValue);\r\n if (validValue) {\r\n radioBoxes.forEach((input) => input.checked = input.value === stringValue);\r\n props.handler(stringValue, form);\r\n }\r\n return validValue;\r\n };\r\n\r\n return { div, label, setValue };\r\n}\r\n"]}
1
+ {"version":3,"file":"RadioBox.js","sourceRoot":"","sources":["../../../src/ui/RadioBox.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAkC/F,aAAa;AACb,MAAM,UAAU,cAAc,CAAC,KAAoB;IACjD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,KAAmC,CAAC;IACxC,IAAI,SAAS,KAAK,KAAK,CAAC,IAAI,EAAE;QAC5B,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,CAAC,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C;SAClC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACxC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface RadioBoxEntry {\r\n value: number | string | undefined;\r\n label: string;\r\n}\r\n\r\n/** @alpha */\r\nexport type RadioBoxHandler = (value: string, form: HTMLFormElement) => void;\r\n\r\n/** @alpha */\r\nexport interface RadioBoxProps {\r\n id: string;\r\n entries: RadioBoxEntry[];\r\n handler: RadioBoxHandler;\r\n name?: string;\r\n parent?: HTMLElement;\r\n defaultValue?: number | string;\r\n vertical?: boolean;\r\n}\r\n\r\n/** @alpha */\r\nexport interface RadioBox {\r\n label?: HTMLLabelElement;\r\n setValue: (newValue: number | string) => boolean;\r\n div: HTMLDivElement;\r\n form: HTMLFormElement;\r\n}\r\n\r\n/** @alpha */\r\nexport function createRadioBox(props: RadioBoxProps): RadioBox {\r\n const div = document.createElement(\"div\");\r\n\r\n let label: HTMLLabelElement | undefined;\r\n if (undefined !== props.name) {\r\n label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n }\r\n\r\n const form = document.createElement(\"form\");\r\n form.id = props.id;\r\n\r\n const radioBoxes: HTMLInputElement[] = [];\r\n\r\n for (const entry of props.entries) {\r\n const input = document.createElement(\"input\");\r\n input.type = \"radio\";\r\n input.name = props.name ? props.name : props.id;\r\n\r\n input.value = (undefined !== entry.value) ? entry.value.toString() : \"\";\r\n\r\n const inputLabel: HTMLLabelElement = document.createElement(\"label\");\r\n inputLabel.innerText = entry.label;\r\n\r\n inputLabel.onclick = () => {\r\n try {\r\n input.checked = true;\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n\r\n input.onchange = () => {\r\n try {\r\n const value = input.value;\r\n props.handler(value, form);\r\n } catch (_ex) {\r\n //\r\n }\r\n };\r\n if (props.defaultValue === entry.value) {\r\n input.checked = true;\r\n }\r\n\r\n radioBoxes.push(input);\r\n\r\n if (props.vertical) {\r\n const container = document.createElement(\"div\");\r\n container.appendChild(input);\r\n container.appendChild(inputLabel);\r\n form.appendChild(container);\r\n } else {\r\n form.appendChild(input);\r\n form.appendChild(inputLabel);\r\n }\r\n }\r\n\r\n div.appendChild(form);\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n const setValue = (value: number | string): boolean => {\r\n const stringValue = value.toString();\r\n const validValue: boolean = radioBoxes.map((input) => input.value).includes(stringValue);\r\n if (validValue) {\r\n radioBoxes.forEach((input) => input.checked = input.value === stringValue);\r\n props.handler(stringValue, form);\r\n }\r\n return validValue;\r\n };\r\n\r\n return { div, label, setValue, form };\r\n}\r\n"]}
@@ -19,6 +19,8 @@ export interface SliderProps {
19
19
  max: string;
20
20
  step: string;
21
21
  value: string;
22
+ verticalAlign?: "middle" | false;
23
+ textAlign?: "right" | false;
22
24
  }
23
25
  /** @alpha */
24
26
  export declare function createSlider(props: SliderProps): Slider;
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,oBAAY,aAAa,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAE/D,aAAa;AACb,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA0BvD"}
1
+ {"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACrB;AAED,aAAa;AACb,oBAAY,aAAa,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAE/D,aAAa;AACb,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAC7B;AAED,aAAa;AACb,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA6BvD"}
@@ -6,8 +6,10 @@
6
6
  export function createSlider(props) {
7
7
  const div = document.createElement("div");
8
8
  div.style.display = "block";
9
- div.style.verticalAlign = "middle";
10
- div.style.textAlign = "right";
9
+ if (props.verticalAlign)
10
+ div.style.verticalAlign = props.verticalAlign;
11
+ if (props.textAlign)
12
+ div.style.textAlign = props.textAlign;
11
13
  const label = document.createElement("label");
12
14
  label.htmlFor = props.id;
13
15
  label.innerText = props.name;
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/ui/Slider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AA4B/F,aAAa;AACb,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,GAAG,CAAC,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC;IACnC,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC;IAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAEvB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;IACrB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACvB,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACzB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC3B,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAExB,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface Slider {\r\n label: HTMLLabelElement;\r\n slider: HTMLInputElement;\r\n div: HTMLDivElement;\r\n}\r\n\r\n/** @alpha */\r\nexport type SliderHandler = (slider: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface SliderProps {\r\n name: string;\r\n handler: SliderHandler;\r\n id: string;\r\n parent?: HTMLElement;\r\n min: string;\r\n max: string;\r\n step: string;\r\n value: string;\r\n}\r\n\r\n/** @alpha */\r\nexport function createSlider(props: SliderProps): Slider {\r\n const div = document.createElement(\"div\");\r\n div.style.display = \"block\";\r\n div.style.verticalAlign = \"middle\";\r\n div.style.textAlign = \"right\";\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const slider = document.createElement(\"input\");\r\n slider.type = \"range\";\r\n slider.className = \"slider\";\r\n slider.id = props.id;\r\n slider.min = props.min;\r\n slider.max = props.max;\r\n slider.step = props.step;\r\n slider.value = props.value;\r\n slider.addEventListener(\"input\", () => props.handler(slider));\r\n div.appendChild(slider);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n return { label, slider, div };\r\n}\r\n"]}
1
+ {"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/ui/Sl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,SAAS,KAAK,KAAK,CAAC,MAAM;QAC5B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Controls\r\n */\r\n\r\n/** @alpha */\r\nexport interface Slider {\r\n label: HTMLLabelElement;\r\n slider: HTMLInputElement;\r\n div: HTMLDivElement;\r\n}\r\n\r\n/** @alpha */\r\nexport type SliderHandler = (slider: HTMLInputElement) => void;\r\n\r\n/** @alpha */\r\nexport interface SliderProps {\r\n name: string;\r\n handler: SliderHandler;\r\n id: string;\r\n parent?: HTMLElement;\r\n min: string;\r\n max: string;\r\n step: string;\r\n value: string;\r\n verticalAlign?: \"middle\" | false;\r\n textAlign?: \"right\" | false;\r\n}\r\n\r\n/** @alpha */\r\nexport function createSlider(props: SliderProps): Slider {\r\n const div = document.createElement(\"div\");\r\n div.style.display = \"block\";\r\n if (props.verticalAlign)\r\n div.style.verticalAlign = props.verticalAlign;\r\n\r\n if (props.textAlign)\r\n div.style.textAlign = props.textAlign;\r\n\r\n const label = document.createElement(\"label\");\r\n label.htmlFor = props.id;\r\n label.innerText = props.name;\r\n div.appendChild(label);\r\n\r\n const slider = document.createElement(\"input\");\r\n slider.type = \"range\";\r\n slider.className = \"slider\";\r\n slider.id = props.id;\r\n slider.min = props.min;\r\n slider.max = props.max;\r\n slider.step = props.step;\r\n slider.value = props.value;\r\n slider.addEventListener(\"input\", () => props.handler(slider));\r\n div.appendChild(slider);\r\n\r\n if (undefined !== props.parent)\r\n props.parent.appendChild(div);\r\n\r\n return { label, slider, div };\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/frontend-devtools",
3
- "version": "3.5.0-dev.4",
3
+ "version": "3.5.0-dev.5",
4
4
  "description": "Debug menu and supporting UI widgets",
5
5
  "main": "lib/cjs/frontend-devtools.js",
6
6
  "module": "lib/esm/frontend-devtools.js",
@@ -22,15 +22,15 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "dependencies": {
25
- "@itwin/core-bentley": "3.5.0-dev.4",
26
- "@itwin/core-common": "3.5.0-dev.4",
27
- "@itwin/core-frontend": "3.5.0-dev.4",
28
- "@itwin/core-geometry": "3.5.0-dev.4",
25
+ "@itwin/core-bentley": "3.5.0-dev.5",
26
+ "@itwin/core-common": "3.5.0-dev.5",
27
+ "@itwin/core-frontend": "3.5.0-dev.5",
28
+ "@itwin/core-geometry": "3.5.0-dev.5",
29
29
  "file-saver": "^2.0.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@itwin/build-tools": "3.5.0-dev.4",
33
- "@itwin/eslint-plugin": "3.5.0-dev.4",
32
+ "@itwin/build-tools": "3.5.0-dev.5",
33
+ "@itwin/eslint-plugin": "3.5.0-dev.5",
34
34
  "@types/file-saver": "^2.0.1",
35
35
  "@types/node": "16.11.59",
36
36
  "cpx2": "^3.0.0",