@omegagrid/form 0.9.14 → 0.9.15

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.
@@ -5,7 +5,6 @@ export declare class FormNumericInput extends BaseControl<number> {
5
5
  max: number;
6
6
  validate(): void;
7
7
  constructor();
8
- _onKeydown: (e: KeyboardEvent) => void;
9
8
  _onChange: (e: InputEvent) => void;
10
9
  updateValue(value: number): void;
11
10
  up: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"numericInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,gBAAiB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAExD,MAAM,CAAC,MAAM,4BA4BV;IAGH,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,EAAE,MAAM,CAAC;IAEZ,QAAQ;;IASR,UAAU,GAAI,GAAG,aAAa,UAW7B;IAED,SAAS,GAAI,GAAG,UAAU,UAEzB;IAED,WAAW,CAAC,KAAK,EAAE,MAAM;IASzB,EAAE,aAAkD;IACpD,IAAI,aAAiD;IAErD,MAAM,6CASJ;CAEF"}
1
+ {"version":3,"file":"numericInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,gBAAiB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAExD,MAAM,CAAC,MAAM,4BA4BV;IAGH,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,EAAE,MAAM,CAAC;IAEZ,QAAQ;;IAQR,SAAS,GAAI,GAAG,UAAU,UAEzB;IAED,WAAW,CAAC,KAAK,EAAE,MAAM;IASzB,EAAE,aAAkD;IACpD,IAAI,aAAiD;IAErD,MAAM,6CASJ;CAEF"}
@@ -14,18 +14,6 @@ let FormNumericInput = class FormNumericInput extends BaseControl {
14
14
  }
15
15
  constructor() {
16
16
  super();
17
- this._onKeydown = (e) => {
18
- switch (e.key) {
19
- case 'ArrowUp':
20
- e.preventDefault();
21
- this.up();
22
- break;
23
- case 'ArrowDown':
24
- e.preventDefault();
25
- this.down();
26
- break;
27
- }
28
- };
29
17
  this._onChange = (e) => {
30
18
  this.updateValue(parseFloat(e.target.value));
31
19
  };
@@ -41,7 +29,6 @@ let FormNumericInput = class FormNumericInput extends BaseControl {
41
29
  @change="${this._onChange}">
42
30
  </og-numericinput>
43
31
  `;
44
- this.addEventListener('keydown', this._onKeydown);
45
32
  }
46
33
  updateValue(value) {
47
34
  if (value != null) {
@@ -1 +1 @@
1
- {"version":3,"file":"numericInput.js","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAmB;IAsCxD,QAAQ;QACP,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED;QACC,KAAK,EAAE,CAAC;QAIT,eAAU,GAAG,CAAC,CAAgB,EAAE,EAAE;YACjC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;gBACf,KAAK,SAAS;oBACb,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,IAAI,CAAC,EAAE,EAAE,CAAC;oBACV,MAAM;gBACP,KAAK,WAAW;oBACf,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACZ,MAAM;YACR,CAAC;QACF,CAAC,CAAA;QAED,cAAS,GAAG,CAAC,CAAa,EAA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AM,EAAE,GAAG,CAAA;;;;;;kBAM1B,SAAS,CAAC,wBAAwB;;;;;;;;;;;;;;;;;;;;;;EAsBlD,CAAC,AA5BW,CA4BV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACb;AAGZ;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACb;AApCA,gBAAgB;IAD5B,aAAa,CAAC,sBAAsB,CAAC;GACzB,gBAAgB,CAuF5B","sourcesContent":["import constants from \"../../constants\";\nimport { css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\n\n@customElement('og-form-numericinput')\nexport class FormNumericInput extends BaseControl<number> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\tog-numericinput {\n\t\t\tborder: 1px solid var(--og-accent-color);\n\t\t\tbackground-color: var(--og-form-background-color);\n\t\t\tcolor: var(--og-text-color);\n\t\t\theight: 100%;\n\t\t\tline-height: ${constants.DEFAULT_FORM_LINE_HEIGHT}px;\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t.buttons {\n\t\t\tdisplay: none;\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t\twidth: 15px;\n\t\t\tbackground-color: var(--og-accent-color);\n\t\t}\n\n\t\t:host {\n\t\t\tposition: relative;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\t:host(:hover) .buttons {\n\t\t\tdisplay: block;\n\t\t}\n\t`];\n\n\t@property({type: Number})\n\tmin: number;\n\n\t@property({type: Number})\n\tmax: number;\n\n\tvalidate() {\n\t\tsuper.validate();\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('keydown', this._onKeydown);\n\t}\n\n\t_onKeydown = (e: KeyboardEvent) => {\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.up();\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.down();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t_onChange = (e: InputEvent) => {\n\t\tthis.updateValue(parseFloat((e.target as HTMLInputElement).value));\n\t}\n\n\tupdateValue(value: number) {\n\t\tif (value != null) {\n\t\t\tvalue = isNaN(this.min) ? value : Math.max(value, this.min);\n\t\t\tvalue = isNaN(this.max) ? value : Math.min(value, this.max);\n\t\t}\n\t\tsuper.updateValue(value);\n\t\tthis.requestUpdate();\n\t}\n\n\tup = () => this.updateValue((this.value ?? -1) + 1);\n\tdown = () => this.updateValue((this.value ?? 1) - 1);\n\n\trender = () => html`\n\t\t<og-numericinput\n\t\t\t?buttons=\"${true}\"\n\t\t\t.min=\"${this.min}\"\n\t\t\t.max=\"${this.max}\"\n\t\t\t.value=\"${this.value}\"\n\t\t\t.placeholder=\"${this.model?.props.placeholder}\"\n\t\t\t@change=\"${this._onChange}\">\n\t\t</og-numericinput>\n\t`;\n\t\n}"]}
1
+ {"version":3,"file":"numericInput.js","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAmB;IAsCxD,QAAQ;QACP,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAED;QACC,KAAK,EAAE,CAAC;QAGT,cAAS,GAAG,CAAC,CAAa,EAAE,EAAE;YAC7B,IAAI,CAAC,WAAW,CAAC,UAAU,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAC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C;6CACb;AAGZ;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACb;AApCA,gBAAgB;IAD5B,aAAa,CAAC,sBAAsB,CAAC;GACzB,gBAAgB,CAyE5B","sourcesContent":["import constants from \"../../constants\";\nimport { css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\n\n@customElement('og-form-numericinput')\nexport class FormNumericInput extends BaseControl<number> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\tog-numericinput {\n\t\t\tborder: 1px solid var(--og-accent-color);\n\t\t\tbackground-color: var(--og-form-background-color);\n\t\t\tcolor: var(--og-text-color);\n\t\t\theight: 100%;\n\t\t\tline-height: ${constants.DEFAULT_FORM_LINE_HEIGHT}px;\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t.buttons {\n\t\t\tdisplay: none;\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t\twidth: 15px;\n\t\t\tbackground-color: var(--og-accent-color);\n\t\t}\n\n\t\t:host {\n\t\t\tposition: relative;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\t:host(:hover) .buttons {\n\t\t\tdisplay: block;\n\t\t}\n\t`];\n\n\t@property({type: Number})\n\tmin: number;\n\n\t@property({type: Number})\n\tmax: number;\n\n\tvalidate() {\n\t\tsuper.validate();\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t_onChange = (e: InputEvent) => {\n\t\tthis.updateValue(parseFloat((e.target as HTMLInputElement).value));\n\t}\n\n\tupdateValue(value: number) {\n\t\tif (value != null) {\n\t\t\tvalue = isNaN(this.min) ? value : Math.max(value, this.min);\n\t\t\tvalue = isNaN(this.max) ? value : Math.min(value, this.max);\n\t\t}\n\t\tsuper.updateValue(value);\n\t\tthis.requestUpdate();\n\t}\n\n\tup = () => this.updateValue((this.value ?? -1) + 1);\n\tdown = () => this.updateValue((this.value ?? 1) - 1);\n\n\trender = () => html`\n\t\t<og-numericinput\n\t\t\t?buttons=\"${true}\"\n\t\t\t.min=\"${this.min}\"\n\t\t\t.max=\"${this.max}\"\n\t\t\t.value=\"${this.value}\"\n\t\t\t.placeholder=\"${this.model?.props.placeholder}\"\n\t\t\t@change=\"${this._onChange}\">\n\t\t</og-numericinput>\n\t`;\n\t\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/form",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Universal form component",
6
6
  "main": "./dist/index.js",
@@ -27,10 +27,10 @@
27
27
  "_prepublish": "yarn test && yarn lint"
28
28
  },
29
29
  "dependencies": {
30
- "@omegagrid/calendar": "^0.9.14",
31
- "@omegagrid/core": "^0.9.14",
32
- "@omegagrid/localize": "^0.9.14",
33
- "@omegagrid/tree": "^0.9.14",
30
+ "@omegagrid/calendar": "^0.9.15",
31
+ "@omegagrid/core": "^0.9.15",
32
+ "@omegagrid/localize": "^0.9.15",
33
+ "@omegagrid/tree": "^0.9.15",
34
34
  "lit": "^3.1.1",
35
35
  "lit-html": "^3.1.1",
36
36
  "ts-debounce": "^4.0.0"