@omegagrid/form 0.10.2 → 0.10.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 (101) hide show
  1. package/dist/constants.d.ts +52 -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 +4 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/model/formAdapter.d.ts +14 -0
  10. package/dist/model/formAdapter.d.ts.map +1 -0
  11. package/dist/model/formAdapter.js +21 -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 +9 -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 +42 -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 +4 -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 +17 -0
  28. package/dist/options.js.map +1 -0
  29. package/dist/types.d.ts +99 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/dist/types.js +14 -0
  32. package/dist/types.js.map +1 -0
  33. package/dist/ui/controls/baseControl.d.ts +32 -0
  34. package/dist/ui/controls/baseControl.d.ts.map +1 -0
  35. package/dist/ui/controls/baseControl.js +97 -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 +80 -0
  40. package/dist/ui/controls/button.js.map +1 -0
  41. package/dist/ui/controls/calendarDateInput.d.ts +11 -0
  42. package/dist/ui/controls/calendarDateInput.d.ts.map +1 -0
  43. package/dist/ui/controls/calendarDateInput.js +67 -0
  44. package/dist/ui/controls/calendarDateInput.js.map +1 -0
  45. package/dist/ui/controls/checkbox.d.ts +8 -0
  46. package/dist/ui/controls/checkbox.d.ts.map +1 -0
  47. package/dist/ui/controls/checkbox.js +38 -0
  48. package/dist/ui/controls/checkbox.js.map +1 -0
  49. package/dist/ui/controls/colorInput.d.ts +9 -0
  50. package/dist/ui/controls/colorInput.d.ts.map +1 -0
  51. package/dist/ui/controls/colorInput.js +48 -0
  52. package/dist/ui/controls/colorInput.js.map +1 -0
  53. package/dist/ui/controls/dateInput.d.ts +11 -0
  54. package/dist/ui/controls/dateInput.d.ts.map +1 -0
  55. package/dist/ui/controls/dateInput.js +80 -0
  56. package/dist/ui/controls/dateInput.js.map +1 -0
  57. package/dist/ui/controls/fileInput.d.ts +6 -0
  58. package/dist/ui/controls/fileInput.d.ts.map +1 -0
  59. package/dist/ui/controls/fileInput.js +28 -0
  60. package/dist/ui/controls/fileInput.js.map +1 -0
  61. package/dist/ui/controls/index.d.ts +11 -0
  62. package/dist/ui/controls/index.d.ts.map +1 -0
  63. package/dist/ui/controls/index.js +11 -0
  64. package/dist/ui/controls/index.js.map +1 -0
  65. package/dist/ui/controls/label.d.ts +6 -0
  66. package/dist/ui/controls/label.d.ts.map +1 -0
  67. package/dist/ui/controls/label.js +53 -0
  68. package/dist/ui/controls/label.js.map +1 -0
  69. package/dist/ui/controls/list.d.ts +17 -0
  70. package/dist/ui/controls/list.d.ts.map +1 -0
  71. package/dist/ui/controls/list.js +83 -0
  72. package/dist/ui/controls/list.js.map +1 -0
  73. package/dist/ui/controls/numericInput.d.ts +14 -0
  74. package/dist/ui/controls/numericInput.d.ts.map +1 -0
  75. package/dist/ui/controls/numericInput.js +81 -0
  76. package/dist/ui/controls/numericInput.js.map +1 -0
  77. package/dist/ui/controls/textInput.d.ts +11 -0
  78. package/dist/ui/controls/textInput.d.ts.map +1 -0
  79. package/dist/ui/controls/textInput.js +67 -0
  80. package/dist/ui/controls/textInput.js.map +1 -0
  81. package/dist/ui/form.d.ts +38 -0
  82. package/dist/ui/form.d.ts.map +1 -0
  83. package/dist/ui/form.js +201 -0
  84. package/dist/ui/form.js.map +1 -0
  85. package/dist/ui/form.style.d.ts +2 -0
  86. package/dist/ui/form.style.d.ts.map +1 -0
  87. package/dist/ui/form.style.js +45 -0
  88. package/dist/ui/form.style.js.map +1 -0
  89. package/dist/ui/formContainer.d.ts +31 -0
  90. package/dist/ui/formContainer.d.ts.map +1 -0
  91. package/dist/ui/formContainer.js +197 -0
  92. package/dist/ui/formContainer.js.map +1 -0
  93. package/dist/ui/formContainer.style.d.ts +2 -0
  94. package/dist/ui/formContainer.style.d.ts.map +1 -0
  95. package/dist/ui/formContainer.style.js +39 -0
  96. package/dist/ui/formContainer.style.js.map +1 -0
  97. package/dist/ui/index.d.ts +4 -0
  98. package/dist/ui/index.d.ts.map +1 -0
  99. package/dist/ui/index.js +4 -0
  100. package/dist/ui/index.js.map +1 -0
  101. package/package.json +5 -5
@@ -0,0 +1,80 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { colorable, Button as CoreButton, utils } from "@omegagrid/core";
8
+ import { css } from "lit";
9
+ import { customElement, property } from "lit/decorators.js";
10
+ import { ControlEvent } from "./baseControl";
11
+ let FormButton = class FormButton extends CoreButton {
12
+ constructor() {
13
+ super();
14
+ this.value = null;
15
+ this.addEventListener('click', () => {
16
+ // just to trigger change event
17
+ this.updateValue(this.value);
18
+ });
19
+ }
20
+ updateValue(value, dispatchEvent = true) {
21
+ if (!this.model)
22
+ return;
23
+ this.value = value;
24
+ this.validate();
25
+ if (dispatchEvent) {
26
+ this.dispatchEvent(new ControlEvent('change', this.model, value));
27
+ }
28
+ }
29
+ willUpdate(props) {
30
+ if (props.has('model')) {
31
+ if (this.value === null)
32
+ this.value = this.model.props.value;
33
+ if (this.model.props.options)
34
+ Object.assign(this, this.model.props.options);
35
+ }
36
+ if (this.type == 'toggle' && this.state == null) {
37
+ this.state = 'unchecked';
38
+ }
39
+ if (this.icon) {
40
+ if (utils.isObject(this.icon)) {
41
+ this.buttonIcon = this.icon;
42
+ }
43
+ else if (this.icon) {
44
+ this.buttonIcon = { icon: this.icon };
45
+ }
46
+ else {
47
+ this.buttonIcon = null;
48
+ }
49
+ }
50
+ this.text = this.value;
51
+ }
52
+ async reset() {
53
+ await this.updateValue(this.model.props.value);
54
+ }
55
+ async validate() {
56
+ this.model.errors = [];
57
+ }
58
+ get isValid() { return this.model.errors.length === 0; }
59
+ };
60
+ FormButton.styles = [...CoreButton.styles, css `
61
+ :host {
62
+ width: 100%;
63
+ text-align: center;
64
+ }
65
+ `];
66
+ __decorate([
67
+ property({ type: Object })
68
+ ], FormButton.prototype, "model", void 0);
69
+ __decorate([
70
+ property({ type: Object })
71
+ ], FormButton.prototype, "adapter", void 0);
72
+ __decorate([
73
+ property({ type: String })
74
+ ], FormButton.prototype, "value", void 0);
75
+ FormButton = __decorate([
76
+ customElement('og-form-button'),
77
+ colorable({ props: ['color', 'border', 'background'] })
78
+ ], FormButton);
79
+ export { FormButton };
80
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/ui/controls/button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,UAAU,EAAY,KAAK,EAAE,MA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EAAC,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAC,CAAC;GACzC,UAAU,CAoEtB","sourcesContent":["import { colorable, Button as CoreButton, IconSpec, utils } from \"@omegagrid/core\";\nimport { css } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { FormControlModel } from \"../../model\";\nimport { ControlEvent, IControl } from \"./baseControl\";\n\n@customElement('og-form-button')\n@colorable({props: ['color', 'border', 'background']})\nexport class FormButton extends CoreButton implements IControl<string> {\n\n\tstatic styles = [...CoreButton.styles, css`\n\t\t:host {\n\t\t\twidth: 100%;\n\t\t\ttext-align: center;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\tmodel: FormControlModel;\n\n\t@property({type: Object})\n\tadapter: null;\n\n\t@property({type: String})\n\tvalue: string = null;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('click', () => {\n\t\t\t// just to trigger change event\n\t\t\tthis.updateValue(this.value);\n\t\t});\n\t}\n\n\tprotected updateValue(value: string, dispatchEvent = true) {\n\t\tif (!this.model) return;\n\t\tthis.value = value;\n\t\tthis.validate();\n\t\tif (dispatchEvent) {\n\t\t\tthis.dispatchEvent(new ControlEvent<string>('change', this.model, value));\n\t\t}\n\t}\n\n\twillUpdate(props: Map<PropertyKey, unknown>): void {\n\t\tif (props.has('model')) {\n\t\t\tif (this.value === null) this.value = this.model.props.value as string;\n\t\t\tif (this.model.props.options) Object.assign(this, this.model.props.options);\n\t\t}\n\n\t\tif (this.type == 'toggle' && this.state == null) {\n\t\t\tthis.state = 'unchecked';\n\t\t}\n\n\t\tif (this.icon) {\n\t\t\tif (utils.isObject(this.icon)) {\n\t\t\t\tthis.buttonIcon = this.icon as IconSpec;\n\t\t\t} else if (this.icon) {\n\t\t\t\tthis.buttonIcon = {icon: this.icon as string};\n\t\t\t} else {\n\t\t\t\tthis.buttonIcon = null;\n\t\t\t}\n\t\t}\n\n\t\tthis.text = this.value;\n\t}\n\n\tasync reset() {\n\t\tawait this.updateValue(this.model.props.value as string);\n\t}\n\n\tasync validate() {\n\t\tthis.model.errors = [];\n\t}\n\n\tget isValid() { return this.model.errors.length === 0 }\n\t\n}"]}
@@ -0,0 +1,11 @@
1
+ import { BaseControl } from "./baseControl";
2
+ import { SerializedValue } from "@omegagrid/tree";
3
+ import { events } from "@omegagrid/core";
4
+ export declare class CalendarDateInput extends BaseControl<Date | string> {
5
+ static styles: import("lit").CSSResult[];
6
+ get formattedValue(): SerializedValue[];
7
+ _onChange: (e: events.ChangeEvent) => void;
8
+ get date(): Date;
9
+ render: () => import("lit-html").TemplateResult<1>;
10
+ }
11
+ //# sourceMappingURL=calendarDateInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendarDateInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/calendarDateInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAS,MAAM,EAAS,MAAM,iBAAiB,CAAC;AAGvD,qBACa,iBAAkB,SAAQ,WAAW,CAAC,IAAI,GAAC,MAAM,CAAC;IAE9D,MAAM,CAAC,MAAM,4BAIV;IAEH,IAAI,cAAc,sBAUjB;IAED,SAAS,GAAI,GAAG,MAAM,CAAC,WAAW,UAEjC;IAED,IAAI,IAAI,SASP;IAED,MAAM,6CAaJ;CAEF"}
@@ -0,0 +1,67 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html } from "lit";
8
+ import { customElement } from "lit/decorators.js";
9
+ import { BaseControl } from "./baseControl";
10
+ import { dates, utils } from "@omegagrid/core";
11
+ import { getLocale } from "@omegagrid/localize";
12
+ let CalendarDateInput = class CalendarDateInput extends BaseControl {
13
+ constructor() {
14
+ super(...arguments);
15
+ this._onChange = (e) => {
16
+ this.updateValue(e.value);
17
+ };
18
+ this.render = () => html `
19
+ <og-calendar-dropdown
20
+ @change="${this._onChange}"
21
+ .options="${{
22
+ selectMode: 'single',
23
+ autoClose: true,
24
+ allowEmpty: true
25
+ }}"
26
+ ?cross="${!this.model?.props?.required}"
27
+ .value="${this.date}"
28
+ .caption="${this.model?.props?.caption}"
29
+ .placeholder="${this.model?.props?.placeholder}">
30
+ </og-calendar-dropdown>
31
+ `;
32
+ }
33
+ get formattedValue() {
34
+ if (!this.value)
35
+ return null;
36
+ if (this.value instanceof Date) {
37
+ this.value = [
38
+ this.value.getFullYear(),
39
+ (this.value.getMonth() + 1).toString().padStart(2, '0'),
40
+ this.value.getDate().toString().padStart(2, '0')
41
+ ].join('');
42
+ }
43
+ return [[this.value, 0, 1]];
44
+ }
45
+ get date() {
46
+ if (utils.isString(this.value)) {
47
+ dates.parse(this.value, getLocale());
48
+ return new Date(this.value);
49
+ }
50
+ else if (this.value instanceof Date) {
51
+ return this.value;
52
+ }
53
+ else {
54
+ return null;
55
+ }
56
+ }
57
+ };
58
+ CalendarDateInput.styles = [...BaseControl.styles, css `
59
+ og-calendar-dropdown {
60
+ height: 100%;
61
+ }
62
+ `];
63
+ CalendarDateInput = __decorate([
64
+ customElement('og-form-calendardateinput')
65
+ ], CalendarDateInput);
66
+ export { CalendarDateInput };
67
+ //# sourceMappingURL=calendarDateInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendarDateInput.js","sourceRoot":"","sources":["../../../src/ui/controls/calendarDateInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,E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G,CAAC;aAChD,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,CAAC;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAsB,CAAC;IAClD,CAAC;IAMD,IAAI,IAAI;QACP,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAe,EAAE,SAAS,EAAE,CAAC,CAAC;YAC/C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,YAAY,IAAI,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;aAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;;AA/BM,wBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;EAI1C,CAAC,AAJW,CAIV;AANS,iBAAiB;IAD7B,aAAa,CAAC,2BAA2B,CAAC;GAC9B,iBAAiB,CAkD7B","sourcesContent":["import { css, html } from \"lit\";\nimport { customElement } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\nimport { SerializedValue } from \"@omegagrid/tree\";\nimport { dates, events, utils } from \"@omegagrid/core\";\nimport { getLocale } from \"@omegagrid/localize\";\n\n@customElement('og-form-calendardateinput')\nexport class CalendarDateInput extends BaseControl<Date|string> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\tog-calendar-dropdown {\n\t\t\theight: 100%;\n\t\t}\t\n\t`];\n\n\tget formattedValue() {\n\t\tif (!this.value) return null;\n\t\tif (this.value instanceof Date) {\n\t\t\tthis.value = [\n\t\t\t\tthis.value.getFullYear(),\n\t\t\t\t(this.value.getMonth() + 1).toString().padStart(2, '0'),\n\t\t\t\tthis.value.getDate().toString().padStart(2, '0')\n\t\t\t].join('');\n\t\t} \n\t\treturn [[this.value, 0, 1]] as SerializedValue[];\n\t}\n\n\t_onChange = (e: events.ChangeEvent) => {\n\t\tthis.updateValue(e.value);\n\t}\n\n\tget date() {\n\t\tif (utils.isString(this.value)) {\n\t\t\tdates.parse(this.value as string, getLocale());\n\t\t\treturn new Date(this.value);\n\t\t} else if (this.value instanceof Date) {\n\t\t\treturn this.value;\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\trender = () => html`\n\t\t<og-calendar-dropdown\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t.options=\"${{\n\t\t\t\tselectMode: 'single', \n\t\t\t\tautoClose: true, \n\t\t\t\tallowEmpty: true\n\t\t\t}}\"\n\t\t\t?cross=\"${!this.model?.props?.required}\"\n\t\t\t.value=\"${this.date}\"\n\t\t\t.caption=\"${this.model?.props?.caption}\"\n\t\t\t.placeholder=\"${this.model?.props?.placeholder}\">\n\t\t</og-calendar-dropdown>\n\t`;\n\t\n}"]}
@@ -0,0 +1,8 @@
1
+ import { BaseControl } from "./baseControl";
2
+ export declare class FormCheckbox extends BaseControl<boolean> {
3
+ static styles: import("lit").CSSResult[];
4
+ get isValid(): boolean;
5
+ constructor();
6
+ render: () => import("lit-html").TemplateResult<1>;
7
+ }
8
+ //# 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,MAAM,CAAC,MAAM,4BAUV;IAEH,IAAI,OAAO,YAAkB;;IAU7B,MAAM,6CAEJ;CAEF"}
@@ -0,0 +1,38 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html } from "lit";
8
+ import { customElement } from "lit/decorators.js";
9
+ import { BaseControl } from "./baseControl";
10
+ let FormCheckbox = class FormCheckbox extends BaseControl {
11
+ get isValid() { return true; }
12
+ constructor() {
13
+ super();
14
+ this.render = () => html `
15
+ <og-checkbox .value="${this.value ? 'checked' : 'none'}"></og-checkbox>
16
+ `;
17
+ this.addEventListener('click', () => {
18
+ this.updateValue(!this.value);
19
+ this.requestUpdate();
20
+ });
21
+ }
22
+ };
23
+ FormCheckbox.styles = [...BaseControl.styles, css `
24
+ :host {
25
+ display: inline-flex;
26
+ align-items: center;
27
+ height: 100%;
28
+ }
29
+
30
+ og-checkbox {
31
+ cursor: pointer;
32
+ }
33
+ `];
34
+ FormCheckbox = __decorate([
35
+ customElement('og-form-checkbox')
36
+ ], FormCheckbox);
37
+ export { FormCheckbox };
38
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/ui/controls/checkbox.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,WAAoB;IAcrD,IAAI,OAAO,KAAK,OAAO,IAAI,CAAA,CAAC,CAAC;IAE7B;QACC,KAAK,EAAE,CAAC;QAOT,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;yBACK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;EACtD,CAAC;QARD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACnC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,aAAa,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACJ,CAAC;;AApBM,mBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;EAU1C,CAAC,AAVW,CAUV;AAZS,YAAY;IADxB,aAAa,CAAC,kBAAkB,CAAC;GACrB,YAAY,CA4BxB","sourcesContent":["import { css, html } from \"lit\";\nimport { customElement } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\n\n@customElement('og-form-checkbox')\nexport class FormCheckbox extends BaseControl<boolean> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\talign-items: center;\n\t\t\theight: 100%;\n\t\t}\n\t\t\n\t\tog-checkbox {\n\t\t\tcursor: pointer;\n\t\t}\n\t`];\n\n\tget isValid() { return true }\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('click', () => {\n\t\t\tthis.updateValue(!this.value);\n\t\t\tthis.requestUpdate();\n\t\t});\n\t}\n\n\trender = () => html`\n\t\t<og-checkbox .value=\"${this.value ? 'checked' : 'none'}\"></og-checkbox>\n\t`;\n\t\n}"]}
@@ -0,0 +1,9 @@
1
+ import { BaseControl } from "./baseControl";
2
+ import { Dropdown, events } from "@omegagrid/core";
3
+ export declare class FormColorInput extends BaseControl<string> {
4
+ static styles: import("lit").CSSResult[];
5
+ dropdown: Dropdown;
6
+ _onChange: (e: events.ChangeEvent<string>) => void;
7
+ render: () => import("lit-html").TemplateResult<1>;
8
+ }
9
+ //# 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,QAAQ,EAAE,MAAM,EAAS,MAAM,iBAAiB,CAAC;AAE1D,qBACa,cAAe,SAAQ,WAAW,CAAC,MAAM,CAAC;IAEtD,MAAM,CAAC,MAAM,4BAA2B;IAGxC,QAAQ,EAAE,QAAQ,CAAC;IAEnB,SAAS,GAAI,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAIzC;IAED,MAAM,6CAiBJ;CAEF"}
@@ -0,0 +1,48 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html } from "lit";
8
+ import { customElement, query } from "lit/decorators.js";
9
+ import { BaseControl } from "./baseControl";
10
+ import { styleMap } from "lit/directives/style-map.js";
11
+ import { utils } from "@omegagrid/core";
12
+ let FormColorInput = class FormColorInput extends BaseControl {
13
+ constructor() {
14
+ super(...arguments);
15
+ this._onChange = (e) => {
16
+ this.dropdown.close();
17
+ this.updateValue(e.value == null ? null : utils.trim(e.value, '#'));
18
+ this.requestUpdate();
19
+ };
20
+ this.render = () => html `
21
+ <og-dropdown style="${styleMap({ backgroundColor: this.value ? `#${this.value}` : null })}">
22
+ <div
23
+ slot="label"
24
+ style="${styleMap({
25
+ backgroundColor: this.value ? `#${this.value}` : 'transparent',
26
+ padding: '2px'
27
+ })}">&nbsp;
28
+ </div>
29
+
30
+ <og-colorpicker
31
+ slot="content"
32
+ .color="${this.value}"
33
+ @change="${this._onChange}"
34
+ @mousedown="${(e) => e.stopPropagation()}">
35
+ </og-colorpicker>
36
+ </og-dropdown>
37
+ `;
38
+ }
39
+ };
40
+ FormColorInput.styles = [...BaseControl.styles];
41
+ __decorate([
42
+ query('og-dropdown')
43
+ ], FormColorInput.prototype, "dropdown", void 0);
44
+ FormColorInput = __decorate([
45
+ customElement('og-form-colorinput')
46
+ ], FormColorInput);
47
+ export { FormColorInput };
48
+ //# sourceMappingURL=colorInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorInput.js","sourceRoot":"","sources":["../../../src/ui/controls/colorInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAoB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGnD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAmB;IAAhD;;QAON,cAAS,GAAG,CAAC,CAA6B,EAAE,EAAE;YAC7C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;YACpE,IAAI,CAAC,aAAa,EAAE,CAAC;QACtB,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;wBACI,QAAQ,CAAC,EAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAC,CAAC;;;aAG5E,QAAQ,CAAC;YACjB,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,aAAa;YAC9D,OAAO,EAAE,KAAK;SACd,CAAC;;;;;cAKQ,IAAI,CAAC,KAAK;eACT,IAAI,CAAC,SAAS;kBACX,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;;;EAGtD,CAAC;IAEH,CAAC;;AA9BO,qBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,AAA1B,CAA2B;AAGxC;IADC,KAAK,CAAC,aAAa,CAAC;gDACF;AALP,cAAc;IAD1B,aAAa,CAAC,oBAAoB,CAAC;GACvB,cAAc,CAgC1B","sourcesContent":["import { html } from \"lit\";\nimport { customElement, query } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { Dropdown, events, utils } from \"@omegagrid/core\";\n\n@customElement('og-form-colorinput')\nexport class FormColorInput extends BaseControl<string> {\n\n\tstatic styles = [...BaseControl.styles];\n\n\t@query('og-dropdown')\n\tdropdown: Dropdown;\n\n\t_onChange = (e: events.ChangeEvent<string>) => {\n\t\tthis.dropdown.close();\n\t\tthis.updateValue(e.value == null ? null : utils.trim(e.value, '#'));\n\t\tthis.requestUpdate();\n\t}\n\n\trender = () => html`\n\t\t<og-dropdown style=\"${styleMap({backgroundColor: this.value ? `#${this.value}` : null})}\">\n\t\t\t<div\n\t\t\t\tslot=\"label\" \n\t\t\t\tstyle=\"${styleMap({\n\t\t\t\t\tbackgroundColor: this.value ? `#${this.value}` : 'transparent', \n\t\t\t\t\tpadding: '2px'\n\t\t\t\t})}\">&nbsp;\n\t\t\t</div>\n\n\t\t\t<og-colorpicker\n\t\t\t\tslot=\"content\"\n\t\t\t\t.color=\"${this.value}\"\n\t\t\t\t@change=\"${this._onChange}\"\n\t\t\t\t@mousedown=\"${(e: MouseEvent) => e.stopPropagation()}\">\n\t\t\t</og-colorpicker>\n\t\t</og-dropdown>\n\t`;\n\t\n}"]}
@@ -0,0 +1,11 @@
1
+ import { BaseControl } from "./baseControl";
2
+ import { DateTreeAdapter, SerializedValue, TreeEvent } from "@omegagrid/tree";
3
+ export declare class FormDateInput extends BaseControl<Date | string> {
4
+ #private;
5
+ static styles: import("lit").CSSResult[];
6
+ get dateAdapter(): DateTreeAdapter;
7
+ get treeValue(): SerializedValue[];
8
+ _onChange: (e: TreeEvent) => void;
9
+ render: () => import("lit-html").TemplateResult<1>;
10
+ }
11
+ //# sourceMappingURL=dateInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/dateInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI9E,qBACa,aAAc,SAAQ,WAAW,CAAC,IAAI,GAAC,MAAM,CAAC;;IAE1D,MAAM,CAAC,MAAM,4BAIV;IAGH,IAAI,WAAW,oBAA8F;IAE7G,IAAI,SAAS,sBAeZ;IAED,SAAS,GAAI,GAAG,SAAS,UASxB;IAED,MAAM,6CAcJ;CAEF"}
@@ -0,0 +1,80 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
+ if (kind === "m") throw new TypeError("Private method is not writable");
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
+ };
18
+ var _FormDateInput_adapter;
19
+ import { css, html } from "lit";
20
+ import { customElement } from "lit/decorators.js";
21
+ import { BaseControl } from "./baseControl";
22
+ import { DateTreeAdapter } from "@omegagrid/tree";
23
+ import { dates } from "@omegagrid/core";
24
+ import { getLocale } from "@omegagrid/localize";
25
+ let FormDateInput = class FormDateInput extends BaseControl {
26
+ constructor() {
27
+ super(...arguments);
28
+ _FormDateInput_adapter.set(this, void 0);
29
+ this._onChange = (e) => {
30
+ if (!e.node)
31
+ return;
32
+ const strDate = e.node.key;
33
+ this.updateValue(new Date(parseInt(strDate.substring(0, 4)), parseInt(strDate.substring(4, 6)) - 1, parseInt(strDate.substring(6, 8)), 0, 0, 0));
34
+ };
35
+ this.render = () => html `
36
+ <og-tree-dropdown
37
+ @change="${this._onChange}"
38
+ .adapter="${this.dateAdapter}"
39
+ .options="${{
40
+ selectMode: 'single',
41
+ autoClose: true,
42
+ allowEmpty: true
43
+ }}"
44
+ ?cross="${!this.model.props.required}"
45
+ .value="${this.treeValue}"
46
+ .caption="${this.model.props.caption}"
47
+ .placeholder="${this.model.props.placeholder}">
48
+ </og-tree-dropdown>
49
+ `;
50
+ }
51
+ get dateAdapter() { return __classPrivateFieldGet(this, _FormDateInput_adapter, "f") ?? (__classPrivateFieldSet(this, _FormDateInput_adapter, new DateTreeAdapter(this.model.props.options), "f")); }
52
+ get treeValue() {
53
+ if (!this.value)
54
+ return null;
55
+ let date;
56
+ if (this.value instanceof Date) {
57
+ date = this.value;
58
+ this.value = [
59
+ this.value.getFullYear(),
60
+ (this.value.getMonth() + 1).toString().padStart(2, '0'),
61
+ this.value.getDate().toString().padStart(2, '0')
62
+ ].join('-');
63
+ }
64
+ else {
65
+ date = dates.parse(this.value, getLocale());
66
+ }
67
+ return [[this.value, 0, 1, { value: dates.getDateFormatter(getLocale())(date) }]];
68
+ }
69
+ };
70
+ _FormDateInput_adapter = new WeakMap();
71
+ FormDateInput.styles = [...BaseControl.styles, css `
72
+ og-tree-dropdown {
73
+ height: 100%;
74
+ }
75
+ `];
76
+ FormDateInput = __decorate([
77
+ customElement('og-form-dateinput')
78
+ ], FormDateInput);
79
+ export { FormDateInput };
80
+ //# sourceMappingURL=dateInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateInput.js","sourceRoot":"","sources":["../../../src/ui/controls/dateInput.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAA8B,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGzC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,WAAwB;IAApD;;QAQN,yCAA0B;QAoB1B,cAAS,GAAG,CAAC,CAAY,EAAE,EAAE;YAC5B,IAAI,CAAC,C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Z,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;gBACxB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;gBACvD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;aAChD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;aAAM,CAAC;YACP,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAe,EAAE,SAAS,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,EAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,EAAC,CAAC,CAAsB,CAAC;IACtG,CAAC;;;AAxBM,oBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;EAI1C,CAAC,AAJW,CAIV;AANS,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAuDzB","sourcesContent":["import { css, html } from \"lit\";\nimport { customElement } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\nimport { DateTreeAdapter, SerializedValue, TreeEvent } from \"@omegagrid/tree\";\nimport { dates } from \"@omegagrid/core\";\nimport { getLocale } from \"@omegagrid/localize\";\n\n@customElement('og-form-dateinput')\nexport class FormDateInput extends BaseControl<Date|string> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\tog-tree-dropdown {\n\t\t\theight: 100%;\n\t\t}\t\n\t`];\n\n\t#adapter: DateTreeAdapter;\n\tget dateAdapter() { return this.#adapter ?? (this.#adapter = new DateTreeAdapter(this.model.props.options)) }\n\n\tget treeValue() {\n\t\tif (!this.value) return null;\n\t\tlet date: Date;\n\t\tif (this.value instanceof Date) {\n\t\t\tdate = this.value;\n\t\t\tthis.value = [\n\t\t\t\tthis.value.getFullYear(),\n\t\t\t\t(this.value.getMonth() + 1).toString().padStart(2, '0'),\n\t\t\t\tthis.value.getDate().toString().padStart(2, '0')\n\t\t\t].join('-');\n\t\t} else {\n\t\t\tdate = dates.parse(this.value as string, getLocale());\n\t\t}\n\n\t\treturn [[this.value, 0, 1, {value: dates.getDateFormatter(getLocale())(date)}]] as SerializedValue[];\n\t}\n\n\t_onChange = (e: TreeEvent) => {\n\t\tif (!e.node) return;\n\t\tconst strDate = e.node.key;\n\t\tthis.updateValue(new Date(\n\t\t\tparseInt(strDate.substring(0, 4)), \n\t\t\tparseInt(strDate.substring(4, 6)) - 1, \n\t\t\tparseInt(strDate.substring(6, 8)),\n\t\t\t0, 0, 0\n\t\t));\n\t}\n\n\trender = () => html`\n\t\t<og-tree-dropdown\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t.adapter=\"${this.dateAdapter}\"\n\t\t\t.options=\"${{\n\t\t\t\tselectMode: 'single', \n\t\t\t\tautoClose: true, \n\t\t\t\tallowEmpty: true\n\t\t\t}}\"\n\t\t\t?cross=\"${!this.model.props.required}\"\n\t\t\t.value=\"${this.treeValue}\"\n\t\t\t.caption=\"${this.model.props.caption}\"\n\t\t\t.placeholder=\"${this.model.props.placeholder}\">\n\t\t</og-tree-dropdown>\n\t`;\n\t\n}"]}
@@ -0,0 +1,6 @@
1
+ import { BaseControl } from "./baseControl";
2
+ export declare class FormFileInput extends BaseControl<File> {
3
+ static styles: import("lit").CSSResult[];
4
+ render: () => import("lit-html").TemplateResult<1>;
5
+ }
6
+ //# sourceMappingURL=fileInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/fileInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,qBACa,aAAc,SAAQ,WAAW,CAAC,IAAI,CAAC;IAEnD,MAAM,CAAC,MAAM,4BAKV;IAEH,MAAM,6CAEJ;CAEF"}
@@ -0,0 +1,28 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html } from "lit";
8
+ import { customElement } from "lit/decorators.js";
9
+ import { BaseControl } from "./baseControl";
10
+ let FormFileInput = class FormFileInput extends BaseControl {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.render = () => html `
14
+ <og-fileinput @change="${(e) => this.updateValue(e.value)}"></og-fileinput>
15
+ `;
16
+ }
17
+ };
18
+ FormFileInput.styles = [...BaseControl.styles, css `
19
+ og-fileinput {
20
+ border-color: var(--og-accent-color);
21
+ width: 100%;
22
+ }
23
+ `];
24
+ FormFileInput = __decorate([
25
+ customElement('og-form-fileinput')
26
+ ], FormFileInput);
27
+ export { FormFileInput };
28
+ //# sourceMappingURL=fileInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileInput.js","sourceRoot":"","sources":["../../../src/ui/controls/fileInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIrC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,WAAiB;IAA7C;;QASN,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;2BACO,CAAC,CAAqB,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;EAC7E,CAAC;IAEH,CAAC;;AAXO,oBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;EAK1C,CAAC,AALW,CAKV;AAPS,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAazB","sourcesContent":["import { css, html } from \"lit\";\nimport { customElement } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\nimport { events } from \"@omegagrid/core\";\n\n@customElement('og-form-fileinput')\nexport class FormFileInput extends BaseControl<File> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\tog-fileinput {\n\t\t\tborder-color: var(--og-accent-color);\n\t\t\twidth: 100%;\n\t\t}\t\n\t`];\n\n\trender = () => html`\n\t\t<og-fileinput @change=\"${(e: events.ChangeEvent) => this.updateValue(e.value)}\"></og-fileinput>\n\t`;\n\t\n}"]}
@@ -0,0 +1,11 @@
1
+ export * from './textInput';
2
+ export * from './colorInput';
3
+ export * from './dateInput';
4
+ export * from './calendarDateInput';
5
+ export * from './numericInput';
6
+ export * from './fileInput';
7
+ export * from './checkbox';
8
+ export * from './label';
9
+ export * from './list';
10
+ export * from './button';
11
+ //# 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,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from './textInput';
2
+ export * from './colorInput';
3
+ export * from './dateInput';
4
+ export * from './calendarDateInput';
5
+ export * from './numericInput';
6
+ export * from './fileInput';
7
+ export * from './checkbox';
8
+ export * from './label';
9
+ export * from './list';
10
+ export * from './button';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","sourcesContent":["export * from './textInput';\nexport * from './colorInput';\nexport * from './dateInput';\nexport * from './calendarDateInput';\nexport * from './numericInput';\nexport * from './fileInput';\nexport * from './checkbox';\nexport * from './label';\nexport * from './list';\nexport * from './button';"]}
@@ -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,4BAyBV;IAEH,MAAM,6CAMJ;CAEF"}
@@ -0,0 +1,53 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html } from "lit";
8
+ import { classMap } from "lit-html/directives/class-map.js";
9
+ import { customElement } from "lit/decorators.js";
10
+ import { BaseControl } from "./baseControl";
11
+ let FormLabel = class FormLabel extends BaseControl {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.render = () => html `
15
+ <label
16
+ for="${this.model.props.for}"
17
+ class="${classMap({ required: this.model.props.required })}">
18
+ ${this.value}
19
+ </label>
20
+ `;
21
+ }
22
+ };
23
+ FormLabel.styles = [...BaseControl.styles, css `
24
+ :host {
25
+ width: 100%;
26
+ border: none !important;
27
+ display: flex;
28
+ align-items: center;
29
+ flex-direction: row;
30
+ }
31
+
32
+ label {
33
+ padding-right: 10px;
34
+ width: 100%;
35
+ text-align: right;
36
+ color: var(--og-text-color);
37
+ }
38
+
39
+ /*label.required::after {
40
+ content: '*';
41
+ color: red;
42
+ }
43
+ label.required {
44
+ font-weight: bold;
45
+ }
46
+ */
47
+
48
+ `];
49
+ FormLabel = __decorate([
50
+ customElement('og-form-label')
51
+ ], FormLabel);
52
+ export { FormLabel };
53
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/ui/controls/label.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,WAAmB;IAA3C;;QA6BN,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;;UAEV,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG;YAClB,QAAQ,CAAC,EAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAC,CAAC;KACtD,IAAI,CAAC,KAAK;;EAEb,CAAC;IAEH,CAAC;;AAnCO,gBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAyB1C,CAAC,AAzBW,CAyBV;AA3BS,SAAS;IADrB,aAAa,CAAC,eAAe,CAAC;GAClB,SAAS,CAqCrB","sourcesContent":["import { css, html } from \"lit\";\nimport { classMap } from \"lit-html/directives/class-map.js\";\nimport { customElement } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\n\n@customElement('og-form-label')\nexport class FormLabel extends BaseControl<string> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\t:host {\n\t\t\twidth: 100%;\n\t\t\tborder: none !important;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tflex-direction: row;\n\t\t}\n\n\t\tlabel {\n\t\t\tpadding-right: 10px;\n\t\t\twidth: 100%;\n\t\t\ttext-align: right;\n\t\t\tcolor: var(--og-text-color);\n\t\t}\n\n\t\t/*label.required::after {\n\t\t\tcontent: '*';\n\t\t\tcolor: red;\n\t\t}\n\t\tlabel.required {\n\t\t\tfont-weight: bold;\n\t\t}\n\t\t*/\n\n\t`];\n\n\trender = () => html`\n\t\t<label\n\t\t\tfor=\"${this.model.props.for}\"\n\t\t\tclass=\"${classMap({required: this.model.props.required})}\">\n\t\t\t${this.value}\n\t\t</label>\n\t`;\n\t\n}"]}
@@ -0,0 +1,17 @@
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
+ static styles: import("lit").CSSResult[];
5
+ dropdown: TreeDropdown;
6
+ private _firstOpen;
7
+ get isValid(): boolean;
8
+ private formatValue;
9
+ reset(dispatchEvent?: boolean): Promise<void>;
10
+ _onChange: (e: TreeEvent) => void;
11
+ _onDropdownOpen: () => void;
12
+ getAdapter(): TreeAdapter;
13
+ willUpdate(): Promise<void>;
14
+ updated(): Promise<void>;
15
+ render: () => import("lit-html").TemplateResult<1>;
16
+ }
17
+ //# 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;IAE/E,MAAM,CAAC,MAAM,4BAIV;IAGH,QAAQ,EAAE,YAAY,CAAC;IAEvB,OAAO,CAAC,UAAU,CAAQ;IAE1B,IAAI,OAAO,YAAkB;IAE7B,OAAO,CAAC,WAAW;IAIb,KAAK,CAAC,aAAa,UAAO;IAQhC,SAAS,GAAI,GAAG,SAAS,UAMxB;IAED,eAAe,aAGd;IAED,UAAU;IAIJ,UAAU;IAWV,OAAO;IAOb,MAAM,6CAUJ;CAEF"}