@omegagrid/form 0.2.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.
Files changed (89) hide show
  1. package/dist/constants.d.ts +45 -0
  2. package/dist/constants.d.ts.map +1 -0
  3. package/dist/constants.js +15 -0
  4. package/dist/constants.js.map +1 -0
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +20 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/model/formAdapter.d.ts +13 -0
  10. package/dist/model/formAdapter.d.ts.map +1 -0
  11. package/dist/model/formAdapter.js +24 -0
  12. package/dist/model/formAdapter.js.map +1 -0
  13. package/dist/model/formControlModel.d.ts +9 -0
  14. package/dist/model/formControlModel.d.ts.map +1 -0
  15. package/dist/model/formControlModel.js +13 -0
  16. package/dist/model/formControlModel.js.map +1 -0
  17. package/dist/model/formModel.d.ts +17 -0
  18. package/dist/model/formModel.d.ts.map +1 -0
  19. package/dist/model/formModel.js +49 -0
  20. package/dist/model/formModel.js.map +1 -0
  21. package/dist/model/index.d.ts +4 -0
  22. package/dist/model/index.d.ts.map +1 -0
  23. package/dist/model/index.js +20 -0
  24. package/dist/model/index.js.map +1 -0
  25. package/dist/options.d.ts +3 -0
  26. package/dist/options.d.ts.map +1 -0
  27. package/dist/options.js +21 -0
  28. package/dist/options.js.map +1 -0
  29. package/dist/types.d.ts +89 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/dist/types.js +15 -0
  32. package/dist/types.js.map +1 -0
  33. package/dist/ui/controls/baseControl.d.ts +30 -0
  34. package/dist/ui/controls/baseControl.d.ts.map +1 -0
  35. package/dist/ui/controls/baseControl.js +85 -0
  36. package/dist/ui/controls/baseControl.js.map +1 -0
  37. package/dist/ui/controls/button.d.ts +16 -0
  38. package/dist/ui/controls/button.d.ts.map +1 -0
  39. package/dist/ui/controls/button.js +70 -0
  40. package/dist/ui/controls/button.js.map +1 -0
  41. package/dist/ui/controls/checkbox.d.ts +7 -0
  42. package/dist/ui/controls/checkbox.d.ts.map +1 -0
  43. package/dist/ui/controls/checkbox.js +29 -0
  44. package/dist/ui/controls/checkbox.js.map +1 -0
  45. package/dist/ui/controls/colorInput.d.ts +8 -0
  46. package/dist/ui/controls/colorInput.d.ts.map +1 -0
  47. package/dist/ui/controls/colorInput.js +41 -0
  48. package/dist/ui/controls/colorInput.js.map +1 -0
  49. package/dist/ui/controls/index.d.ts +8 -0
  50. package/dist/ui/controls/index.d.ts.map +1 -0
  51. package/dist/ui/controls/index.js +24 -0
  52. package/dist/ui/controls/index.js.map +1 -0
  53. package/dist/ui/controls/label.d.ts +6 -0
  54. package/dist/ui/controls/label.d.ts.map +1 -0
  55. package/dist/ui/controls/label.js +54 -0
  56. package/dist/ui/controls/label.js.map +1 -0
  57. package/dist/ui/controls/list.d.ts +16 -0
  58. package/dist/ui/controls/list.d.ts.map +1 -0
  59. package/dist/ui/controls/list.js +83 -0
  60. package/dist/ui/controls/list.js.map +1 -0
  61. package/dist/ui/controls/numericInput.d.ts +15 -0
  62. package/dist/ui/controls/numericInput.d.ts.map +1 -0
  63. package/dist/ui/controls/numericInput.js +135 -0
  64. package/dist/ui/controls/numericInput.js.map +1 -0
  65. package/dist/ui/controls/textInput.d.ts +8 -0
  66. package/dist/ui/controls/textInput.d.ts.map +1 -0
  67. package/dist/ui/controls/textInput.js +61 -0
  68. package/dist/ui/controls/textInput.js.map +1 -0
  69. package/dist/ui/form.d.ts +34 -0
  70. package/dist/ui/form.d.ts.map +1 -0
  71. package/dist/ui/form.js +195 -0
  72. package/dist/ui/form.js.map +1 -0
  73. package/dist/ui/form.style.d.ts +2 -0
  74. package/dist/ui/form.style.d.ts.map +1 -0
  75. package/dist/ui/form.style.js +39 -0
  76. package/dist/ui/form.style.js.map +1 -0
  77. package/dist/ui/formContainer.d.ts +28 -0
  78. package/dist/ui/formContainer.d.ts.map +1 -0
  79. package/dist/ui/formContainer.js +178 -0
  80. package/dist/ui/formContainer.js.map +1 -0
  81. package/dist/ui/formContainer.style.d.ts +2 -0
  82. package/dist/ui/formContainer.style.d.ts.map +1 -0
  83. package/dist/ui/formContainer.style.js +48 -0
  84. package/dist/ui/formContainer.style.js.map +1 -0
  85. package/dist/ui/index.d.ts +4 -0
  86. package/dist/ui/index.d.ts.map +1 -0
  87. package/dist/ui/index.js +20 -0
  88. package/dist/ui/index.js.map +1 -0
  89. package/package.json +59 -0
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FormButton = void 0;
10
+ const core_1 = require("@omegagrid/core");
11
+ const lit_1 = require("lit");
12
+ const decorators_js_1 = require("lit/decorators.js");
13
+ const baseControl_1 = require("./baseControl");
14
+ let FormButton = class FormButton extends core_1.Button {
15
+ constructor() {
16
+ super();
17
+ this.value = null;
18
+ this.addEventListener('click', () => {
19
+ // just to trigger change event
20
+ this.updateValue(this.value);
21
+ });
22
+ }
23
+ updateValue(value, dispatchEvent = true) {
24
+ if (!this.model)
25
+ return;
26
+ this.value = value;
27
+ this.validate();
28
+ if (dispatchEvent) {
29
+ this.dispatchEvent(new baseControl_1.ControlEvent('change', this.model, value));
30
+ }
31
+ }
32
+ willUpdate(changedProps) {
33
+ if (changedProps.has('model')) {
34
+ if (this.value === null)
35
+ this.value = this.model.props.value;
36
+ if (this.model.props.options)
37
+ Object.assign(this, this.model.props.options);
38
+ }
39
+ if (changedProps.has('value'))
40
+ this.text = this.value;
41
+ }
42
+ reset() {
43
+ this.updateValue(this.model.props.value);
44
+ }
45
+ validate() {
46
+ this.model.errors = [];
47
+ }
48
+ get isValid() { return this.model.errors.length === 0; }
49
+ };
50
+ exports.FormButton = FormButton;
51
+ FormButton.styles = [...core_1.Button.styles, (0, lit_1.css) `
52
+ :host {
53
+ width: 100%;
54
+ text-align: center;
55
+ }
56
+ `];
57
+ __decorate([
58
+ (0, decorators_js_1.property)({ type: Object })
59
+ ], FormButton.prototype, "model", void 0);
60
+ __decorate([
61
+ (0, decorators_js_1.property)({ type: Object })
62
+ ], FormButton.prototype, "adapter", void 0);
63
+ __decorate([
64
+ (0, decorators_js_1.property)({ type: String })
65
+ ], FormButton.prototype, "value", void 0);
66
+ exports.FormButton = FormButton = __decorate([
67
+ (0, decorators_js_1.customElement)('og-form-button'),
68
+ (0, core_1.stylable)({ colorType: ['color', 'border', 'background'] })
69
+ ], FormButton);
70
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/ui/controls/button.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0CAAiE;AACjE,6BAA0B;AAC1B,qDAA4D;AAE5D,+CAAuD;AAIhD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,aAAU;IAkBzC;QACC,KAAK,EAAE,CAAC;QAHT,UAAK,GAAW,IAAI,CAAC;QAIpB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACnC,+BAA+B;YAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACJ,CAAC;IAES,WAAW,CAAC,KAAa,EAAE,aAAa,GAAG,IAAI;QACxD,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,a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AAE,MAAM,EAAC,CAAC;yCACJ;qBAhBT,UAAU;IAFtB,IAAA,6BAAa,EAAC,gBAAgB,CAAC;IAC/B,IAAA,eAAQ,EAAC,EAAC,SAAS,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAC,CAAC;GAC5C,UAAU,CAsDtB"}
@@ -0,0 +1,7 @@
1
+ import { BaseControl } from "./baseControl";
2
+ export declare class FormCheckbox extends BaseControl<boolean> {
3
+ get isValid(): boolean;
4
+ constructor();
5
+ render: () => import("lit-html").TemplateResult<1>;
6
+ }
7
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/checkbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,YAAa,SAAQ,WAAW,CAAC,OAAO,CAAC;IAErD,IAAI,OAAO,YAAkB;;IAS7B,MAAM,6CAEJ;CAEF"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FormCheckbox = void 0;
10
+ const lit_1 = require("lit");
11
+ const decorators_js_1 = require("lit/decorators.js");
12
+ const baseControl_1 = require("./baseControl");
13
+ let FormCheckbox = class FormCheckbox extends baseControl_1.BaseControl {
14
+ get isValid() { return true; }
15
+ constructor() {
16
+ super();
17
+ this.render = () => (0, lit_1.html) `
18
+ <og-checkbox .value="${this.value ? 'checked' : 'none'}"></og-checkbox>
19
+ `;
20
+ this.addEventListener('click', () => {
21
+ this.updateValue(!this.value);
22
+ });
23
+ }
24
+ };
25
+ exports.FormCheckbox = FormCheckbox;
26
+ exports.FormCheckbox = FormCheckbox = __decorate([
27
+ (0, decorators_js_1.customElement)('og-form-checkbox')
28
+ ], FormCheckbox);
29
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/ui/controls/checkbox.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6BAA2B;AAC3B,qDAAkD;AAClD,+CAA4C;AAGrC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,yBAAoB;IAErD,IAAI,OAAO,KAAK,OAAO,IAAI,CAAA,CAAC,CAAC;IAE7B;QACC,KAAK,EAAE,CAAC;QAMT,WAAM,GAAG,GAAG,EAAE,CAAC,IAAA,UAAI,EAAA;yBACK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;EACtD,CAAC;QAPD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACnC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACJ,CAAC;CAMD,CAAA;AAfY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,6BAAa,EAAC,kBAAkB,CAAC;GACrB,YAAY,CAexB"}
@@ -0,0 +1,8 @@
1
+ import { BaseControl } from "./baseControl";
2
+ import { ColorpickerEvent } from "@omegagrid/core";
3
+ export declare class FormColorInput extends BaseControl<string> {
4
+ static styles: import("lit").CSSResult[];
5
+ _onSelect: (e: ColorpickerEvent) => void;
6
+ render: () => import("lit-html").TemplateResult<1>;
7
+ }
8
+ //# sourceMappingURL=colorInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/colorInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAS,MAAM,iBAAiB,CAAC;AAE1D,qBACa,cAAe,SAAQ,WAAW,CAAC,MAAM,CAAC;IAEtD,MAAM,CAAC,MAAM,4BAA2B;IAExC,SAAS,MAAO,gBAAgB,UAE/B;IAED,MAAM,6CAYJ;CAEF"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FormColorInput = void 0;
10
+ const lit_1 = require("lit");
11
+ const decorators_js_1 = require("lit/decorators.js");
12
+ const baseControl_1 = require("./baseControl");
13
+ const style_map_js_1 = require("lit/directives/style-map.js");
14
+ const core_1 = require("@omegagrid/core");
15
+ let FormColorInput = class FormColorInput extends baseControl_1.BaseControl {
16
+ constructor() {
17
+ super(...arguments);
18
+ this._onSelect = (e) => {
19
+ this.updateValue(core_1.utils.trim(e.color, '#'));
20
+ };
21
+ this.render = () => (0, lit_1.html) `
22
+ <og-dropdown>
23
+ <div slot="label" style="${(0, style_map_js_1.styleMap)({ backgroundColor: this.value ? `#${this.value}` : 'transparent', marginRight: '4px' })}">
24
+ <og-fa-icon icon="fill"></og-fa-icon>
25
+ </div>
26
+
27
+ <og-colorpicker
28
+ .color="${this.value}"
29
+ @select="${this._onSelect}"
30
+ @mousedown="${(e) => e.stopPropagation()}">
31
+ </og-colorpicker>
32
+ </og-dropdown>
33
+ `;
34
+ }
35
+ };
36
+ exports.FormColorInput = FormColorInput;
37
+ FormColorInput.styles = [...baseControl_1.BaseControl.styles];
38
+ exports.FormColorInput = FormColorInput = __decorate([
39
+ (0, decorators_js_1.customElement)('og-form-colorinput')
40
+ ], FormColorInput);
41
+ //# sourceMappingURL=colorInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorInput.js","sourceRoot":"","sources":["../../../src/ui/controls/colorInput.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6BAA2B;AAC3B,qDAAkD;AAClD,+CAA4C;AAC5C,8DAAuD;AACvD,0CAA0D;AAGnD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,yBAAmB;IAAhD;;QAIN,cAAS,GAAG,CAAC,CAAmB,EAAE,EAAE;YACnC,IAAI,CAAC,WAAW,CAAC,YAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAA,UAAI,EAAA;;8BAEU,IAAA,uBAAQ,EAAC,EAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;;;;;cAK9G,IAAI,CAAC,KAAK;eACT,IAAI,CAAC,SAAS;kBACX,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;;;EAGtD,CAAC;IAEH,CAAC;;AAtBY,wCAAc;AAEnB,qBAAM,GAAG,CAAC,GAAG,yBAAW,CAAC,MAAM,CAAC,AAA1B,CAA2B;yBAF5B,cAAc;IAD1B,IAAA,6BAAa,EAAC,oBAAoB,CAAC;GACvB,cAAc,CAsB1B"}
@@ -0,0 +1,8 @@
1
+ export * from './textInput';
2
+ export * from './colorInput';
3
+ export * from './numericInput';
4
+ export * from './checkbox';
5
+ export * from './label';
6
+ export * from './list';
7
+ export * from './button';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./textInput"), exports);
18
+ __exportStar(require("./colorInput"), exports);
19
+ __exportStar(require("./numericInput"), exports);
20
+ __exportStar(require("./checkbox"), exports);
21
+ __exportStar(require("./label"), exports);
22
+ __exportStar(require("./list"), exports);
23
+ __exportStar(require("./button"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,iDAA+B;AAC/B,6CAA2B;AAC3B,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB"}
@@ -0,0 +1,6 @@
1
+ import { BaseControl } from "./baseControl";
2
+ export declare class FormLabel extends BaseControl<string> {
3
+ static styles: import("lit").CSSResult[];
4
+ render: () => import("lit-html").TemplateResult<1>;
5
+ }
6
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/label.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,SAAU,SAAQ,WAAW,CAAC,MAAM,CAAC;IAEjD,MAAM,CAAC,MAAM,4BAuBV;IAEH,MAAM,6CAMJ;CAEF"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FormLabel = void 0;
10
+ const lit_1 = require("lit");
11
+ const class_map_js_1 = require("lit-html/directives/class-map.js");
12
+ const decorators_js_1 = require("lit/decorators.js");
13
+ const baseControl_1 = require("./baseControl");
14
+ let FormLabel = class FormLabel extends baseControl_1.BaseControl {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.render = () => (0, lit_1.html) `
18
+ <label
19
+ for="${this.model.props.for}"
20
+ class="${(0, class_map_js_1.classMap)({ required: this.model.props.required })}">
21
+ ${this.value}
22
+ </label>
23
+ `;
24
+ }
25
+ };
26
+ exports.FormLabel = FormLabel;
27
+ FormLabel.styles = [...baseControl_1.BaseControl.styles, (0, lit_1.css) `
28
+ :host {
29
+ width: 100%;
30
+ border: none !important;
31
+ }
32
+
33
+ label {
34
+ display: block;
35
+ padding-right: 10px;
36
+ width: 100%;
37
+ text-align: right;
38
+ color: var(--text-color);
39
+ }
40
+
41
+ /*label.required::after {
42
+ content: '*';
43
+ color: red;
44
+ }
45
+ label.required {
46
+ font-weight: bold;
47
+ }
48
+ */
49
+
50
+ `];
51
+ exports.FormLabel = FormLabel = __decorate([
52
+ (0, decorators_js_1.customElement)('og-form-label')
53
+ ], FormLabel);
54
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/ui/controls/label.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6BAAgC;AAChC,mEAA4D;AAC5D,qDAAkD;AAClD,+CAA4C;AAGrC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,yBAAmB;IAA3C;;QA2BN,WAAM,GAAG,GAAG,EAAE,CAAC,IAAA,UAAI,EAAA;;UAEV,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG;YAClB,IAAA,uBAAQ,EAAC,EAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAC,CAAC;KACtD,IAAI,CAAC,KAAK;;EAEb,CAAC;IAEH,CAAC;;AAnCY,8BAAS;AAEd,gBAAM,GAAG,CAAC,GAAG,yBAAW,CAAC,MAAM,EAAE,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;EAuB1C,CAAC,AAvBW,CAuBV;oBAzBS,SAAS;IADrB,IAAA,6BAAa,EAAC,eAAe,CAAC;GAClB,SAAS,CAmCrB"}
@@ -0,0 +1,16 @@
1
+ import { BaseControl } from "./baseControl";
2
+ import { TreeAdapter, SerializedValue, TreeDropdown, TreeEvent } from "@omegagrid/tree";
3
+ export declare class FormList extends BaseControl<SerializedValue[] | string, TreeAdapter> {
4
+ dropdown: TreeDropdown;
5
+ private _firstOpen;
6
+ get isValid(): boolean;
7
+ private formatValue;
8
+ reset(): void;
9
+ _onChange: (e: TreeEvent) => void;
10
+ _onDropdownOpen: () => void;
11
+ getAdapter(): TreeAdapter;
12
+ willUpdate(): Promise<void>;
13
+ updated(): Promise<void>;
14
+ render: () => import("lit-html").TemplateResult<1>;
15
+ }
16
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/list.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAuC,MAAM,iBAAiB,CAAC;AAE7H,qBACa,QAAS,SAAQ,WAAW,CAAC,eAAe,EAAE,GAAC,MAAM,EAAE,WAAW,CAAC;IAG/E,QAAQ,EAAE,YAAY,CAAC;IAEvB,OAAO,CAAC,UAAU,CAAQ;IAE1B,IAAI,OAAO,YAAkB;IAE7B,OAAO,CAAC,WAAW;IAInB,KAAK;IAQL,SAAS,MAAO,SAAS,UAMxB;IAED,eAAe,aAGd;IAED,UAAU;IAIJ,UAAU;IAWV,OAAO;IAOb,MAAM,6CAUJ;CAEF"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.FormList = void 0;
10
+ const lit_1 = require("lit");
11
+ const decorators_js_1 = require("lit/decorators.js");
12
+ const baseControl_1 = require("./baseControl");
13
+ const tree_1 = require("@omegagrid/tree");
14
+ let FormList = class FormList extends baseControl_1.BaseControl {
15
+ constructor() {
16
+ super(...arguments);
17
+ this._firstOpen = true;
18
+ this._onChange = (e) => {
19
+ const values = e.component.selection.serialize();
20
+ if (this.dropdown.tree.options.selectMode == tree_1.SelectMode.Single)
21
+ this.updateValue(values.length > 0 ? values[0][0] : null, true);
22
+ else
23
+ this.updateValue(values, true);
24
+ };
25
+ this._onDropdownOpen = () => {
26
+ var _a;
27
+ if (this._firstOpen)
28
+ this._firstOpen = false;
29
+ else
30
+ (_a = this.adapter) === null || _a === void 0 ? void 0 : _a.attach(this.dropdown.tree);
31
+ };
32
+ this.render = () => (0, lit_1.html) `
33
+ <og-tree-dropdown
34
+ @change="${this._onChange}"
35
+ @dropdown.open="${this._onDropdownOpen}"
36
+ ?cross="${!this.model.props.required}"
37
+ .adapter="${this.getAdapter()}"
38
+ .value="${this.formatValue(this.value)}"
39
+ .caption="${this.model.props.caption}"
40
+ .placeholder="${this.model.props.placeholder}">
41
+ </og-tree-dropdown>
42
+ `;
43
+ }
44
+ get isValid() { return true; }
45
+ formatValue(value) {
46
+ return Array.isArray(value) ? value : (value == null ? null : [[value, 0, 1]]);
47
+ }
48
+ reset() {
49
+ super.reset();
50
+ if (this.dropdown) {
51
+ this.dropdown.value = null;
52
+ this.dropdown.value = this.formatValue(this.model.props.value);
53
+ }
54
+ }
55
+ getAdapter() {
56
+ var _a, _b;
57
+ return (_a = this.adapter) !== null && _a !== void 0 ? _a : (_b = this.formModel.options) === null || _b === void 0 ? void 0 : _b.treeAdapter;
58
+ }
59
+ async willUpdate() {
60
+ if (this.value) {
61
+ const adapter = this.getAdapter();
62
+ if (adapter) {
63
+ const [options] = await Promise.all([adapter.getOptions()]);
64
+ if (options && options.selectMode == tree_1.SelectMode.Single)
65
+ this.updateValue(Array.isArray(this.value) && this.value.length > 0 ? this.value[0][0] : this.value);
66
+ }
67
+ }
68
+ }
69
+ async updated() {
70
+ if (this.model.props.content) {
71
+ const content = this.model.props.content;
72
+ this.dropdown.setSourceData(content.sourceData, content.options);
73
+ }
74
+ }
75
+ };
76
+ exports.FormList = FormList;
77
+ __decorate([
78
+ (0, decorators_js_1.query)('og-tree-dropdown')
79
+ ], FormList.prototype, "dropdown", void 0);
80
+ exports.FormList = FormList = __decorate([
81
+ (0, decorators_js_1.customElement)('og-form-list')
82
+ ], FormList);
83
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/ui/controls/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6BAA2B;AAC3B,qDAAyD;AACzD,+CAA4C;AAC5C,0CAA6H;AAGtH,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,yBAAkD;IAAzE;;QAKE,eAAU,GAAG,IAAI,CAAC;QAgB1B,cAAS,GAAG,CAAC,CAAY,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;YACjD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,iBAAU,CAAC,MAAM;gBAC7D,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;gBAEhE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjC,CAAC,CAAA;QAED,oBAAe,GAAG,GAAG,EAAE;;YACtB,IAAI,IAAI,CAAC,UAAU;gBAAE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;;gBACxC,MAAA,IA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AAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,IAAI,OAAO,EAAE,CAAC;gBACb,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;gBAC5D,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,IAAI,iBAAU,CAAC,MAAM;oBACrD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvG,CAAC;QACF,CAAC;IACF,CAAC;IAED,KAAK,CAAC,OAAO;QACZ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAmD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAyD,CAAC;YAC3I,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAClE,CAAC;IACF,CAAC;CAcD,CAAA;AApEY,4BAAQ;AAGpB;IADC,IAAA,qBAAK,EAAC,kBAAkB,CAAC;0CACH;mBAHX,QAAQ;IADpB,IAAA,6BAAa,EAAC,cAAc,CAAC;GACjB,QAAQ,CAoEpB"}
@@ -0,0 +1,15 @@
1
+ import { BaseControl } from "./baseControl";
2
+ export declare class FormNumericInput extends BaseControl<number> {
3
+ static styles: import("lit").CSSResult[];
4
+ min: number;
5
+ max: number;
6
+ validate(): void;
7
+ constructor();
8
+ _onKeydown: (e: KeyboardEvent) => void;
9
+ _onChange: (e: InputEvent) => void;
10
+ updateValue(value: number): void;
11
+ up: () => void;
12
+ down: () => void;
13
+ render: () => import("lit-html").TemplateResult<1>;
14
+ }
15
+ //# sourceMappingURL=numericInput.d.ts.map
@@ -0,0 +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,4BA4DV;IAGH,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,EAAE,MAAM,CAAC;IAEZ,QAAQ;;IASR,UAAU,MAAO,aAAa,UAW7B;IAED,SAAS,MAAO,UAAU,UAEzB;IAED,WAAW,CAAC,KAAK,EAAE,MAAM;IAQzB,EAAE,aAAkD;IACpD,IAAI,aAAiD;IAErD,MAAM,6CAUJ;CAEF"}
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FormNumericInput = void 0;
13
+ const constants_1 = __importDefault(require("../../constants"));
14
+ const lit_1 = require("lit");
15
+ const decorators_js_1 = require("lit/decorators.js");
16
+ const baseControl_1 = require("./baseControl");
17
+ let FormNumericInput = class FormNumericInput extends baseControl_1.BaseControl {
18
+ validate() {
19
+ super.validate();
20
+ }
21
+ constructor() {
22
+ super();
23
+ this._onKeydown = (e) => {
24
+ switch (e.key) {
25
+ case 'ArrowUp':
26
+ e.preventDefault();
27
+ this.up();
28
+ break;
29
+ case 'ArrowDown':
30
+ e.preventDefault();
31
+ this.down();
32
+ break;
33
+ }
34
+ };
35
+ this._onChange = (e) => {
36
+ this.updateValue(parseFloat(e.target.value));
37
+ };
38
+ this.up = () => { var _a; return this.updateValue(((_a = this.value) !== null && _a !== void 0 ? _a : -1) + 1); };
39
+ this.down = () => { var _a; return this.updateValue(((_a = this.value) !== null && _a !== void 0 ? _a : 1) - 1); };
40
+ this.render = () => {
41
+ var _a;
42
+ return (0, lit_1.html) `
43
+ <input
44
+ type="text"
45
+ .value="${this.value == null ? '' : this.value.toString()}"
46
+ placeholder="${(_a = this.model) === null || _a === void 0 ? void 0 : _a.props.placeholder}"
47
+ @change="${this._onChange}" />
48
+ <div class="buttons">
49
+ <div id="btnUp" @click="${() => this.up()}"><og-fa-icon icon="caret-up"></og-fa-icon></div>
50
+ <div id="btnDown" @click="${() => this.down()}"><og-fa-icon icon="caret-down"></og-fa-icon></div>
51
+ </div>
52
+ `;
53
+ };
54
+ this.addEventListener('keydown', this._onKeydown);
55
+ }
56
+ updateValue(value) {
57
+ if (value != null) {
58
+ value = isNaN(this.min) ? value : Math.max(value, this.min);
59
+ value = isNaN(this.max) ? value : Math.min(value, this.max);
60
+ }
61
+ super.updateValue(value);
62
+ }
63
+ };
64
+ exports.FormNumericInput = FormNumericInput;
65
+ FormNumericInput.styles = [...baseControl_1.BaseControl.styles, (0, lit_1.css) `
66
+ input {
67
+ border: 1px solid var(--accent-color);
68
+ background-color: var(--form-background-color);
69
+ color: var(--text-color);
70
+ font-size: var(--font-size);
71
+ height: ${constants_1.default.FORM_CONTROL_HEIGHT}px;
72
+ line-height: ${constants_1.default.FORM_CONTROL_HEIGHT}px;
73
+ outline: none;
74
+ width: 100%;
75
+ position: relative;
76
+ text-align: right;
77
+ padding-right: 20px;
78
+ }
79
+
80
+ .buttons {
81
+ display: none;
82
+ position: absolute;
83
+ top: 0;
84
+ right: 0;
85
+ bottom: 0;
86
+ width: 15px;
87
+ background-color: var(--accent-color);
88
+ }
89
+
90
+ .buttons > div {
91
+ color: var(--text-color-2);
92
+ position: absolute;
93
+ left: 0;
94
+ right: 0;
95
+ height: 50%;
96
+ overflow: hidden;
97
+ text-align: center;
98
+ line-height: 10px;
99
+ }
100
+
101
+ .buttons > div:hover {
102
+ opacity: 0.5;
103
+ }
104
+
105
+ .buttons > div og-fa-icon {
106
+ height: 100%;
107
+ }
108
+
109
+ #btnUp {
110
+ top: 0;
111
+ }
112
+
113
+ #btnDown {
114
+ bottom: 0;
115
+ }
116
+
117
+ :host {
118
+ position: relative;
119
+ box-sizing: border-box;
120
+ }
121
+
122
+ :host(:hover) .buttons {
123
+ display: block;
124
+ }
125
+ `];
126
+ __decorate([
127
+ (0, decorators_js_1.property)({ type: Number })
128
+ ], FormNumericInput.prototype, "min", void 0);
129
+ __decorate([
130
+ (0, decorators_js_1.property)({ type: Number })
131
+ ], FormNumericInput.prototype, "max", void 0);
132
+ exports.FormNumericInput = FormNumericInput = __decorate([
133
+ (0, decorators_js_1.customElement)('og-form-numericinput')
134
+ ], FormNumericInput);
135
+ //# sourceMappingURL=numericInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numericInput.js","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAwC;AACxC,6BAAgC;AAChC,qDAA4D;AAC5D,+CAA4C;AAGrC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,yBAAmB;IAsExD,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;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CAAC;YACnB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5D,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7D,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;;AAtGW,4CAAgB;AAErB,uBAAM,GAAG,CAAC,GAAG,yBAAW,CAAC,MAAM,EAAE,IAAA,SAAG,EAAA;;;;;;aAM/B,mBAAS,CAAC,mBAAmB;kBACxB,mBAAS,CAAC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqD7C,CAAC,AA5DW,CA4DV;AAGH;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACb;AAGZ;IADC,IAAA,wBAAQ,EAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACb;2BApEA,gBAAgB;IAD5B,IAAA,6BAAa,EAAC,sBAAsB,CAAC;GACzB,gBAAgB,CAuH5B"}
@@ -0,0 +1,8 @@
1
+ import { BaseControl } from "./baseControl";
2
+ export declare class FormTextInput extends BaseControl<string> {
3
+ static styles: import("lit").CSSResult[];
4
+ validate(): void;
5
+ onChange(e: InputEvent): void;
6
+ render: () => import("lit-html").TemplateResult<1>;
7
+ }
8
+ //# sourceMappingURL=textInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/textInput.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,aAAc,SAAQ,WAAW,CAAC,MAAM,CAAC;IAErD,MAAM,CAAC,MAAM,4BAWV;IAEH,QAAQ;IAQR,QAAQ,CAAC,CAAC,EAAE,UAAU;IAItB,MAAM,6CAOJ;CAEF"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FormTextInput = void 0;
13
+ const constants_1 = __importDefault(require("../../constants"));
14
+ const lit_1 = require("lit");
15
+ const decorators_js_1 = require("lit/decorators.js");
16
+ const baseControl_1 = require("./baseControl");
17
+ let FormTextInput = class FormTextInput extends baseControl_1.BaseControl {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.render = () => {
21
+ var _a, _b;
22
+ return (0, lit_1.html) `
23
+ <input
24
+ type="text"
25
+ .value="${this.value == null ? '' : this.value}"
26
+ placeholder="${(_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.props.placeholder) !== null && _b !== void 0 ? _b : ''}"
27
+ @change="${this.onChange}"
28
+ >
29
+ `;
30
+ };
31
+ }
32
+ validate() {
33
+ var _a;
34
+ super.validate();
35
+ if (!this.model)
36
+ return;
37
+ if (this.model.props.pattern && !this.model.props.pattern.test((_a = this.value) !== null && _a !== void 0 ? _a : "")) {
38
+ this.model.errors.push('invalid value');
39
+ }
40
+ }
41
+ onChange(e) {
42
+ this.updateValue(e.target.value);
43
+ }
44
+ };
45
+ exports.FormTextInput = FormTextInput;
46
+ FormTextInput.styles = [...baseControl_1.BaseControl.styles, (0, lit_1.css) `
47
+ input {
48
+ border: 1px solid var(--accent-color);
49
+ background-color: var(--form-background-color);
50
+ color: var(--text-color);
51
+ font-size: var(--font-size);
52
+ height: ${constants_1.default.FORM_CONTROL_HEIGHT}px;
53
+ line-height: ${constants_1.default.FORM_CONTROL_HEIGHT}px;
54
+ outline: none;
55
+ width: 100%;
56
+ }
57
+ `];
58
+ exports.FormTextInput = FormTextInput = __decorate([
59
+ (0, decorators_js_1.customElement)('og-form-textinput')
60
+ ], FormTextInput);
61
+ //# sourceMappingURL=textInput.js.map