@omegagrid/form 0.10.55 → 0.10.57
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.
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/controls/baseControl.d.ts.map +1 -1
- package/dist/ui/controls/baseControl.js +2 -0
- package/dist/ui/controls/baseControl.js.map +1 -1
- package/dist/ui/controls/textInput.d.ts +1 -1
- package/dist/ui/controls/textInput.d.ts.map +1 -1
- package/dist/ui/controls/textInput.js +25 -4
- package/dist/ui/controls/textInput.js.map +1 -1
- package/dist/ui/form.style.d.ts.map +1 -1
- package/dist/ui/form.style.js +0 -4
- package/dist/ui/form.style.js.map +1 -1
- package/package.json +5 -5
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,oBAAY,eAAe;IAC1B,SAAS,SAAS;IAClB,aAAa,aAAa;IAC1B,MAAM,WAAW;IACjB,YAAY,WAAW;IACvB,SAAS,SAAS;IAClB,iBAAiB,aAAa;IAC9B,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,UAAU,UAAU;IACpB,SAAS,SAAS;CAClB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IACnC,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,G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,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,GAAC,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAC,OAAO,GAAC,UAAU,GAAC,QAAQ,GAAC,OAAO,GAAC,gBAAgB,CAAC;AAEzF,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,eAYX;AAZD,WAAY,eAAe;IAC1B,qCAAkB,CAAA;IAClB,6CAA0B,CAAA;IAC1B,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;IACvB,qCAAkB,CAAA;IAClB,iDAA8B,CAAA;IAC9B,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,gCAAa,CAAA;IACb,uCAAoB,CAAA;IACpB,qCAAkB,CAAA;AACnB,CAAC,EAZW,eAAe,KAAf,eAAe,QAY1B","sourcesContent":["import { ComponentAdapter, CommonOptions, ColorTypes, AlertType, VerticalPosition, IconSpec } from \"@omegagrid/core\";\nimport { TreeAdapter } from \"@omegagrid/tree\";\n\nexport enum FormControlType {\n\tTextInput = 'text',\n\tPasswordInput = 'password',\n\tButton = 'button',\n\tNumericInput = 'number',\n\tDateInput = 'date',\n\tCalendarDateInput = 'calendar',\n\tCheckbox = 'checkbox',\n\tLabel = 'label',\n\tList = 'list',\n\tColorInput = 'color',\n\tFileInput = 'file',\n}\n\nexport type ValidationResult = {\n\tvalid: boolean;\n\tmessage?: string;\n};\n\nexport type FormControlProperties = {\n\t/** Row index within form grid */\n\trow: number,\n\t/** Column index within form grid */\n\tcol: number,\n\t/** Unique field identifier */\n\tkey?: string,\n\t/** Key of bound form control */\n\tfor?: string,\n\t/** Value validation pattern */\n\tpattern?: RegExp,\n\t/** Form control type */\n\ttype?: FormControlType,\n\t/** Required field */\n\trequired?: boolean,\n\t/** Readonly control */\n\treadOnly?: boolean,\n\t/** Current control value */\n\tvalue?: unknown,\n\t/** Key of parent element */\n\tdependsOn?: string,\n\t/** Component adapter where applicable (eg. TreeSelect) */\n\tadapter?: ComponentAdapter,\n\t/** Component item definition */\n\tcontent?: unknown,\n\t/** colspan */\n\tcs?: number,\n\t/** rowspan */\n\trs?: number,\n\t/** control-specific options */\n\toptions?: Record<string, unknown>,\n\tplaceholder?: string,\n\tcaption?: string,\n\n\t/** validation callback */\n\tvalidate?: (value: unknown, props: FormControlProperties) => ValidationResult|boolean|Promise<ValidationResult|boolean>,\n};\n\nexport type FormAlert = {\n\ttext: string,\n\ttype: AlertType\n};\n\nexport type FormRow = {\n\theight?: number\n}\n\nexport type FormColumn = {\n\twidth?: number\n}\n\nexport type FormGridModel = {\n\trows: FormRow[],\n\tcolumns: FormColumn[],\n}\n\nexport type FormOptions = {\n\ttreeAdapter?: TreeAdapter\n}\n\nexport type FormContainerOptions = {\n\tcaption?: string,\n\tbuttonsPosition?: VerticalPosition,\n\talertsPosition?: VerticalPosition,\n\tbuttons?: FormButtonType[],\n\tformOptions?: FormOptions,\n\tcloseAfterSave?: boolean\n} & CommonOptions;\n\nexport type FormSettings = {\n\tkey?: string|number,\n\tcaption?: string,\n\ttreeAdapter?: TreeAdapter,\n\tcontrols?: FormControlProperties[],\n\tcolumns?: FormColumn[],\n\trows?: FormRow[],\n\toptions?: FormOptions\n}\n\nexport type FormButtonConfig = {\n\tkey?: string,\n\ticon?: IconSpec|string,\n\ttext: string,\n\tdefault?: boolean,\n\tcolor?: ColorTypes\n}\n\nexport type FormButtonType = \"save\"|\"reset\"|\"validate\"|\"storno\"|\"close\"|FormButtonConfig;\n\nexport type FormAction = FormButtonType;\n\nexport type FormValues = Record<string, unknown>;"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,eAYX;AAZD,WAAY,eAAe;IAC1B,qCAAkB,CAAA;IAClB,6CAA0B,CAAA;IAC1B,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;IACvB,qCAAkB,CAAA;IAClB,iDAA8B,CAAA;IAC9B,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,gCAAa,CAAA;IACb,uCAAoB,CAAA;IACpB,qCAAkB,CAAA;AACnB,CAAC,EAZW,eAAe,KAAf,eAAe,QAY1B","sourcesContent":["import { ComponentAdapter, CommonOptions, ColorTypes, AlertType, VerticalPosition, IconSpec } from \"@omegagrid/core\";\nimport { TreeAdapter } from \"@omegagrid/tree\";\n\nexport enum FormControlType {\n\tTextInput = 'text',\n\tPasswordInput = 'password',\n\tButton = 'button',\n\tNumericInput = 'number',\n\tDateInput = 'date',\n\tCalendarDateInput = 'calendar',\n\tCheckbox = 'checkbox',\n\tLabel = 'label',\n\tList = 'list',\n\tColorInput = 'color',\n\tFileInput = 'file',\n}\n\nexport type ValidationResult = {\n\tvalid: boolean;\n\tmessage?: string;\n};\n\nexport type FormControlProperties = {\n\t/** Row index within form grid */\n\trow: number,\n\t/** Column index within form grid */\n\tcol: number,\n\t/** Unique field identifier */\n\tkey?: string,\n\t/** Key of bound form control */\n\tfor?: string,\n\t/** Value validation pattern */\n\tpattern?: RegExp,\n\t/** Form control type */\n\ttype?: FormControlType,\n\t/** Required field */\n\trequired?: boolean,\n\t/** Readonly control */\n\treadOnly?: boolean,\n\t/** Multiline text input */\n\tmultiline?: boolean,\n\t/** Current control value */\n\tvalue?: unknown,\n\t/** Key of parent element */\n\tdependsOn?: string,\n\t/** Component adapter where applicable (eg. TreeSelect) */\n\tadapter?: ComponentAdapter,\n\t/** Component item definition */\n\tcontent?: unknown,\n\t/** colspan */\n\tcs?: number,\n\t/** rowspan */\n\trs?: number,\n\t/** control-specific options */\n\toptions?: Record<string, unknown>,\n\tplaceholder?: string,\n\tcaption?: string,\n\n\t/** validation callback */\n\tvalidate?: (value: unknown, props: FormControlProperties) => ValidationResult|boolean|Promise<ValidationResult|boolean>,\n};\n\nexport type FormAlert = {\n\ttext: string,\n\ttype: AlertType\n};\n\nexport type FormRow = {\n\theight?: number\n}\n\nexport type FormColumn = {\n\twidth?: number\n}\n\nexport type FormGridModel = {\n\trows: FormRow[],\n\tcolumns: FormColumn[],\n}\n\nexport type FormOptions = {\n\ttreeAdapter?: TreeAdapter\n}\n\nexport type FormContainerOptions = {\n\tcaption?: string,\n\tbuttonsPosition?: VerticalPosition,\n\talertsPosition?: VerticalPosition,\n\tbuttons?: FormButtonType[],\n\tformOptions?: FormOptions,\n\tcloseAfterSave?: boolean\n} & CommonOptions;\n\nexport type FormSettings = {\n\tkey?: string|number,\n\tcaption?: string,\n\ttreeAdapter?: TreeAdapter,\n\tcontrols?: FormControlProperties[],\n\tcolumns?: FormColumn[],\n\trows?: FormRow[],\n\toptions?: FormOptions\n}\n\nexport type FormButtonConfig = {\n\tkey?: string,\n\ticon?: IconSpec|string,\n\ttext: string,\n\tdefault?: boolean,\n\tcolor?: ColorTypes\n}\n\nexport type FormButtonType = \"save\"|\"reset\"|\"validate\"|\"storno\"|\"close\"|FormButtonConfig;\n\nexport type FormAction = FormButtonType;\n\nexport type FormValues = Record<string, unknown>;"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseControl.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/baseControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"baseControl.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/baseControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,UAAU,EAAE,MAAM,KAAK,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG1D,qBAAa,YAAY,CAAC,MAAM,CAAE,SAAQ,KAAK;aAG7B,KAAK,EAAE,gBAAgB;aACvB,KAAK,EAAE,MAAM;gBAF7B,IAAI,EAAE,MAAM,EACI,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM;CAI9B;AAED,MAAM,WAAW,QAAQ,CAAC,MAAM,GAAG,OAAO,EAAE,QAAQ,SAAS,gBAAgB,GAAG,IAAI,CAAE,SAAQ,WAAW;IACxG,KAAK,EAAE,gBAAgB,CAAC;IACxB,OAAO,EAAE,QAAQ,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,IAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,OAAO,IAAK,OAAO,CAAC;CACxB;AAED,8BAAsB,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,QAAQ,SAAS,gBAAgB,GAAG,IAAI,CAC3F,SAAQ,UAAW,YAAW,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAExD,MAAM,CAAC,MAAM,4BAoBV;IAGH,KAAK,EAAE,gBAAgB,CAAC;IAGxB,SAAS,EAAE,SAAS,CAAC;IAGrB,OAAO,EAAE,QAAQ,CAAC;IAElB,OAAO,CAAC,MAAM,CAAgB;IAC9B,IACI,KAAK,IACQ,MAAM,CADY;IACnC,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAMtB;IAGD,QAAQ,UAAS;IAGjB,QAAQ,UAAS;cAED,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,UAAO;IAQ/D,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI;IAUnD,KAAK,CAAC,aAAa,UAAO;IAM1B,QAAQ;IAgBd,IAAI,OAAO,YAA2C;CAEtD"}
|
|
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { css, LitElement } from 'lit';
|
|
8
|
+
import constants from "../../constants";
|
|
8
9
|
import { property } from "lit/decorators.js";
|
|
9
10
|
export class ControlEvent extends Event {
|
|
10
11
|
constructor(type, model, value) {
|
|
@@ -70,6 +71,7 @@ BaseControl.styles = [css `
|
|
|
70
71
|
:host {
|
|
71
72
|
display: block;
|
|
72
73
|
box-sizing: border-box;
|
|
74
|
+
height: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
* {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseControl.js","sourceRoot":"","sources":["../../../src/ui/controls/baseControl.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,MAAM,OAAO,YAAqB,SAAQ,KAAK;IAC9C,YACC,IAAY,EACI,KAAuB,EACvB,KAAa;QAE7B,KAAK,CAAC,IAAI,EAAE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AQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB","sourcesContent":["import { css, LitElement } from 'lit';\nimport constants from \"../../constants\";\nimport { property } from \"lit/decorators.js\";\nimport { ComponentAdapter } from '@omegagrid/core';\nimport { FormControlModel, FormModel } from '../../model';\nimport { ValidationResult } from '../../types';\n\nexport class ControlEvent<TValue> extends Event {\n\tconstructor(\n\t\ttype: string,\n\t\tpublic readonly model: FormControlModel,\n\t\tpublic readonly value: TValue\n\t) {\n\t\tsuper(type, {bubbles: true, cancelable: true, composed: true});\n\t}\n}\n\nexport interface IControl<TValue = unknown, TAdapter extends ComponentAdapter = null> extends HTMLElement {\n\tmodel: FormControlModel;\n\tadapter: TAdapter;\n\tvalue: TValue;\n\treset(dispatchEvent?: boolean): Promise<void>;\n\tvalidate() : Promise<void>;\n\tget isValid() : boolean;\n}\n\nexport abstract class BaseControl<TValue = unknown, TAdapter extends ComponentAdapter = null> \n\textends LitElement implements IControl<TValue, TAdapter> {\n\n\tstatic styles = [css`\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t\tbox-sizing: border-box;\n\t\t\theight: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;\n\t\t}\n\n\t\t* {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\t:host([required]) {\n\t\t\tborder: 2px solid var(--og-accent-color);\n\t\t\tborder-radius: var(--og-base-radius);\n\t\t}\n\n\t\t:host([readOnly]) {\n\t\t\topacity: 0.7;\n\t\t\tpointer-events: none;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\tmodel: FormControlModel;\n\n\t@property({type: Object})\n\tformModel: FormModel;\n\n\t@property({type: Object})\n\tadapter: TAdapter;\n\n\tprivate _value: TValue = null;\n\t@property({type: Object})\n\tget value() { return this._value; }\n\tset value(value: TValue) {\n\t\tconst oldValue = this._value;\n\t\tthis._value = value;\n\t\tif (oldValue !== value) {\n\t\t\tthis.requestUpdate('value', oldValue);\n\t\t}\n\t}\n\t\n\t@property({type: Boolean, reflect: true})\n\trequired = false;\n\n\t@property({type: Boolean, reflect: true})\n\treadOnly = false;\n\n\tprotected async updateValue(value: TValue, dispatchEvent = true) {\n\t\tthis._value = value;\n\t\tawait this.validate();\n\t\tif (dispatchEvent) {\n\t\t\tthis.dispatchEvent(new ControlEvent<TValue>('change', this.model, value));\n\t\t}\n\t}\n\n\twillUpdate(changedProps: Map<PropertyKey, unknown>): void {\n\t\tif (changedProps.has('model')) {\n\t\t\tif (this.value === null) {\n\t\t\t\tthis.value = this.model.props.value as TValue;\n\t\t\t}\n\t\t\tthis.required = this.model.props.required;\n\t\t\tthis.readOnly = !!this.model.props.readOnly;\n\t\t}\n\t}\n\n\tasync reset(dispatchEvent = true) {\n\t\tconst oldValue = this._value;\n\t\tawait this.updateValue(this.model.props.value as TValue, dispatchEvent);\n\t\tthis.requestUpdate('value', oldValue);\n\t}\n\n\tasync validate() {\n\t\tif (!this.model) return;\n\n\t\tthis.model.errors = [];\n\n\t\tif (this.required && (this.value == null || this.value === '')) {\n\t\t\tthis.model.errors = ['this field is required'];\n\t\t} else if (this.model.props?.validate) {\n\t\t\tconst result = await this.model.props.validate(this.value, this.model.props);\n\t\t\tconst validationResult = typeof result == 'boolean' ? {valid: result} as ValidationResult : result;\n\t\t\tif (!validationResult.valid) {\n\t\t\t\tthis.model.errors.push(validationResult.message || 'Invalid value');\n\t\t\t}\n\t\t}\n\t}\n\n\tget isValid() { return this.model.errors.length == 0 }\n\t\n}"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseControl } from "./baseControl";
|
|
2
2
|
export declare class FormTextInput extends BaseControl<string> {
|
|
3
3
|
static styles: import("lit").CSSResult[];
|
|
4
|
-
input: HTMLInputElement;
|
|
4
|
+
input: HTMLInputElement | HTMLTextAreaElement;
|
|
5
5
|
validate(): Promise<void>;
|
|
6
6
|
_onChange: (e: InputEvent) => void;
|
|
7
7
|
_onKeyDown: (e: KeyboardEvent) => void;
|
|
@@ -1 +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,
|
|
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,4BAkCV;IAGH,KAAK,EAAE,gBAAgB,GAAC,mBAAmB,CAAC;IAEtC,QAAQ;IAQd,SAAS,GAAI,GAAG,UAAU,UAEzB;IAED,UAAU,GAAI,GAAG,aAAa,UAI7B;IAED,OAAO;IAIP,MAAM,6CAeJ;CAEF"}
|
|
@@ -19,7 +19,14 @@ let FormTextInput = class FormTextInput extends BaseControl {
|
|
|
19
19
|
this.updateValue(e.target.value);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
this.render = () => html `
|
|
22
|
+
this.render = () => this.model?.props.multiline ? html `
|
|
23
|
+
<textarea
|
|
24
|
+
placeholder="${this.model?.props.placeholder ?? ''}"
|
|
25
|
+
?readonly="${this.readOnly}"
|
|
26
|
+
@change="${this._onChange}"
|
|
27
|
+
@keydown="${this._onKeyDown}">
|
|
28
|
+
</textarea>
|
|
29
|
+
` : html `
|
|
23
30
|
<input
|
|
24
31
|
type="text"
|
|
25
32
|
placeholder="${this.model?.props.placeholder ?? ''}"
|
|
@@ -41,17 +48,31 @@ let FormTextInput = class FormTextInput extends BaseControl {
|
|
|
41
48
|
this.input.value = this.value == null ? '' : this.value;
|
|
42
49
|
}
|
|
43
50
|
};
|
|
44
|
-
FormTextInput.styles = [...BaseControl.styles, css `
|
|
51
|
+
FormTextInput.styles = [...BaseControl.styles, css `
|
|
52
|
+
:host {
|
|
53
|
+
height: auto;
|
|
54
|
+
}
|
|
55
|
+
|
|
45
56
|
input {
|
|
57
|
+
height: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
textarea {
|
|
61
|
+
height: 100%;
|
|
62
|
+
resize: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
input, textarea {
|
|
46
66
|
border: 1px solid var(--og-accent-color);
|
|
47
67
|
background-color: var(--og-form-background-color);
|
|
48
68
|
color: var(--og-text-color);
|
|
49
69
|
font-size: var(--og-font-size);
|
|
50
|
-
|
|
70
|
+
font-family: var(--og-font-family);
|
|
51
71
|
line-height: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;
|
|
52
72
|
outline: none;
|
|
53
73
|
width: 100%;
|
|
54
74
|
border-radius: var(--og-base-radius);
|
|
75
|
+
padding: 1px 2px;
|
|
55
76
|
}
|
|
56
77
|
|
|
57
78
|
:host([required]) input {
|
|
@@ -63,7 +84,7 @@ FormTextInput.styles = [...BaseControl.styles, css `
|
|
|
63
84
|
}
|
|
64
85
|
`];
|
|
65
86
|
__decorate([
|
|
66
|
-
query('input')
|
|
87
|
+
query('input,textarea')
|
|
67
88
|
], FormTextInput.prototype, "input", void 0);
|
|
68
89
|
FormTextInput = __decorate([
|
|
69
90
|
customElement('og-form-textinput')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textInput.js","sourceRoot":"","sources":["../../../src/ui/controls/textInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrC,IAAM,aAAa,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,QAAQ,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO;QACxB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;YAClF,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;IAYD,OAAO;QACN,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACzD,CAAC;;AA3DM,oBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;aAM/B,SAAS,CAAC,uBAAuB;;;;;;;;;;;;;;kBAc5B,SAAS,CAAC,uBAAuB;;;;;;;;;;;;;;EAcjD,CAAC,AAlCW,CAkCV;AAGH;IADC,KAAK,CAAC,gBAAgB,CAAC;4CACoB;AAvChC,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAgFzB","sourcesContent":["import constants from \"../../constants\";\nimport { css, html } from \"lit\";\nimport { customElement, query } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\n\n@customElement('og-form-textinput')\nexport class FormTextInput extends BaseControl<string> {\n\n\tstatic styles = [...BaseControl.styles, css`\t\n\t\t:host {\n\t\t\theight: auto;\n\t\t}\n\n\t\tinput {\n\t\t\theight: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;\n\t\t}\n\n\t\ttextarea {\n\t\t\theight: 100%;\n\t\t\tresize: none;\n\t\t}\n\n\t\tinput, textarea {\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\tfont-size: var(--og-font-size);\n\t\t\tfont-family: var(--og-font-family);\n\t\t\tline-height: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;\n\t\t\toutline: none;\n\t\t\twidth: 100%;\n\t\t\tborder-radius: var(--og-base-radius);\n\t\t\tpadding: 1px 2px;\n\t\t}\n\n\t\t:host([required]) input {\n\t\t\tborder: none;\n\t\t}\n\n\t\t:host([readOnly]) {\n\t\t\tpointer-events: auto;\n\t\t}\n\t`];\n\n\t@query('input,textarea')\n\tinput: HTMLInputElement|HTMLTextAreaElement;\n\n\tasync validate() {\n\t\tawait super.validate();\n\t\tif (!this.model) return;\n\t\tif (this.model.props.pattern && !this.model.props.pattern.test(this.value ?? \"\")) {\n\t\t\tthis.model.errors.push('invalid value');\n\t\t}\n\t}\n\n\t_onChange = (e: InputEvent) => {\n\t\tthis.updateValue((e.target as HTMLInputElement).value);\n\t}\n\n\t_onKeyDown = (e: KeyboardEvent) => {\n\t\tif (e.key == 'Enter') {\n\t\t\tthis.updateValue((e.target as HTMLInputElement).value);\n\t\t}\n\t}\n\n\tupdated() {\n\t\tthis.input.value = this.value == null ? '' : this.value;\n\t}\n\n\trender = () => this.model?.props.multiline ? html`\n\t\t<textarea\n\t\t\tplaceholder=\"${this.model?.props.placeholder ?? ''}\"\n\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t@keydown=\"${this._onKeyDown}\">\n\t\t</textarea>\n\t` : html`\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\tplaceholder=\"${this.model?.props.placeholder ?? ''}\"\n\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t@keydown=\"${this._onKeyDown}\"\n\t\t>\n\t`;\n\t\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.style.d.ts","sourceRoot":"","sources":["../../src/ui/form.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"form.style.d.ts","sourceRoot":"","sources":["../../src/ui/form.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,yBAqCjB,CAAC"}
|
package/dist/ui/form.style.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.style.js","sourceRoot":"","sources":["../../src/ui/form.style.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;YAsBZ,SAAS,CAAC,uBAAuB;;;;aAIhC,SAAS,CAAC,yBAAyB
|
|
1
|
+
{"version":3,"file":"form.style.js","sourceRoot":"","sources":["../../src/ui/form.style.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;YAsBZ,SAAS,CAAC,uBAAuB;;;;aAIhC,SAAS,CAAC,yBAAyB;;;;;;;;;;;CAW/C,CAAC","sourcesContent":["import constants from \"../constants\";\nimport { css } from \"lit\";\n\nexport const style = css`\n\t:host {\n\t\tdisplay: block;\n\t\tfont-size: var(--og-font-size);\n\t\tposition: relative;\n\t}\n\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t.body {\n\t\tpadding: 4px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\ttable-layout: fixed;\n\t}\n\n\ttable tr td {\n\t\theight: ${constants.DEFAULT_FORM_ROW_HEIGHT}px;\n\t}\n\n\ttable td {\n\t\tpadding: ${constants.DEFAULT_FORM_CELL_PADDING}px;\n\t\toverflow: hidden;\n\t}\n\n\t.error {\n\t\tcolor: red;\n\t}\n\n\tog-overlay {\n\t\tmin-height: 200px;\n\t}\n`;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/form",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.57",
|
|
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.10.
|
|
31
|
-
"@omegagrid/core": "^0.10.
|
|
32
|
-
"@omegagrid/localize": "^0.10.
|
|
33
|
-
"@omegagrid/tree": "^0.10.
|
|
30
|
+
"@omegagrid/calendar": "^0.10.57",
|
|
31
|
+
"@omegagrid/core": "^0.10.57",
|
|
32
|
+
"@omegagrid/localize": "^0.10.57",
|
|
33
|
+
"@omegagrid/tree": "^0.10.57",
|
|
34
34
|
"lit": "^3.1.1",
|
|
35
35
|
"lit-html": "^3.1.1",
|
|
36
36
|
"ts-debounce": "^4.0.0"
|