@omegagrid/form 0.10.23 → 0.10.25
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 +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/controls/baseControl.d.ts +1 -0
- package/dist/ui/controls/baseControl.d.ts.map +1 -1
- package/dist/ui/controls/baseControl.js +10 -0
- package/dist/ui/controls/baseControl.js.map +1 -1
- package/dist/ui/controls/checkbox.d.ts.map +1 -1
- package/dist/ui/controls/checkbox.js +2 -0
- package/dist/ui/controls/checkbox.js.map +1 -1
- package/dist/ui/controls/colorInput.js +1 -1
- package/dist/ui/controls/colorInput.js.map +1 -1
- package/dist/ui/controls/dateInput.d.ts.map +1 -1
- package/dist/ui/controls/dateInput.js +1 -0
- package/dist/ui/controls/dateInput.js.map +1 -1
- package/dist/ui/controls/fileInput.js +1 -1
- package/dist/ui/controls/fileInput.js.map +1 -1
- package/dist/ui/controls/index.d.ts +1 -0
- package/dist/ui/controls/index.d.ts.map +1 -1
- package/dist/ui/controls/index.js +1 -0
- package/dist/ui/controls/index.js.map +1 -1
- package/dist/ui/controls/list.d.ts +1 -1
- package/dist/ui/controls/list.d.ts.map +1 -1
- package/dist/ui/controls/list.js +4 -2
- package/dist/ui/controls/list.js.map +1 -1
- package/dist/ui/controls/numericInput.d.ts.map +1 -1
- package/dist/ui/controls/numericInput.js +1 -0
- package/dist/ui/controls/numericInput.js.map +1 -1
- package/dist/ui/controls/passwordInput.d.ts +9 -0
- package/dist/ui/controls/passwordInput.d.ts.map +1 -0
- package/dist/ui/controls/passwordInput.js +76 -0
- package/dist/ui/controls/passwordInput.js.map +1 -0
- package/dist/ui/controls/textInput.d.ts.map +1 -1
- package/dist/ui/controls/textInput.js +5 -0
- package/dist/ui/controls/textInput.js.map +1 -1
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +1 -0
- package/dist/ui/form.js.map +1 -1
- package/package.json +5 -5
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ComponentAdapter, CommonOptions, ColorTypes, AlertType, VerticalPositio
|
|
|
2
2
|
import { TreeAdapter } from "@omegagrid/tree";
|
|
3
3
|
export declare enum FormControlType {
|
|
4
4
|
TextInput = "text",
|
|
5
|
+
PasswordInput = "password",
|
|
5
6
|
Button = "button",
|
|
6
7
|
NumericInput = "number",
|
|
7
8
|
DateInput = "date",
|
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,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,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,IAAI,CAAC,EAAE,eAAe,CA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AAC,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
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var FormControlType;
|
|
2
2
|
(function (FormControlType) {
|
|
3
3
|
FormControlType["TextInput"] = "text";
|
|
4
|
+
FormControlType["PasswordInput"] = "password";
|
|
4
5
|
FormControlType["Button"] = "button";
|
|
5
6
|
FormControlType["NumericInput"] = "number";
|
|
6
7
|
FormControlType["DateInput"] = "date";
|
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,
|
|
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>;"]}
|
|
@@ -23,6 +23,7 @@ export declare abstract class BaseControl<TValue = unknown, TAdapter extends Com
|
|
|
23
23
|
get value(): TValue;
|
|
24
24
|
set value(value: TValue);
|
|
25
25
|
required: boolean;
|
|
26
|
+
readOnly: boolean;
|
|
26
27
|
protected updateValue(value: TValue, dispatchEvent?: boolean): Promise<void>;
|
|
27
28
|
willUpdate(changedProps: Map<PropertyKey, unknown>): void;
|
|
28
29
|
reset(dispatchEvent?: boolean): Promise<void>;
|
|
@@ -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;AAEtC,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,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E,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,4BAmBV;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"}
|
|
@@ -18,6 +18,7 @@ export class BaseControl extends LitElement {
|
|
|
18
18
|
super(...arguments);
|
|
19
19
|
this._value = null;
|
|
20
20
|
this.required = false;
|
|
21
|
+
this.readOnly = false;
|
|
21
22
|
}
|
|
22
23
|
get value() { return this._value; }
|
|
23
24
|
set value(value) {
|
|
@@ -40,6 +41,7 @@ export class BaseControl extends LitElement {
|
|
|
40
41
|
this.value = this.model.props.value;
|
|
41
42
|
}
|
|
42
43
|
this.required = this.model.props.required;
|
|
44
|
+
this.readOnly = !!this.model.props.readOnly;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
async reset(dispatchEvent = true) {
|
|
@@ -78,6 +80,11 @@ BaseControl.styles = [css `
|
|
|
78
80
|
border: 2px solid var(--og-accent-color);
|
|
79
81
|
border-radius: var(--og-base-radius);
|
|
80
82
|
}
|
|
83
|
+
|
|
84
|
+
:host([readOnly]) {
|
|
85
|
+
opacity: 0.7;
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
}
|
|
81
88
|
`];
|
|
82
89
|
__decorate([
|
|
83
90
|
property({ type: Object })
|
|
@@ -94,4 +101,7 @@ __decorate([
|
|
|
94
101
|
__decorate([
|
|
95
102
|
property({ type: Boolean, reflect: true })
|
|
96
103
|
], BaseControl.prototype, "required", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: Boolean, reflect: true })
|
|
106
|
+
], BaseControl.prototype, "readOnly", void 0);
|
|
97
107
|
//# sourceMappingURL=baseControl.js.map
|
|
@@ -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,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;QAH/C,UAAK,GAAL,KAAK,CAAkB;QACvB,UAAK,GAAL,KAAK,CAAQ;IAG9B,CAAC;CACD;AAWD,MAAM,OAAgB,WACrB,SAAQ,UAAU;IADnB;;
|
|
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,mBA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YACnG,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;YACrE,CAAC;QACF,CAAC;IACF,CAAC;IAED,IAAI,OAAO,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAA,CAAC,CAAC;;AAvF/C,kBAAM,GAAG,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;EAmBnB,CAAC,AAnBW,CAmBV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACD;AAGxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8CACJ;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;4CACP;AAIlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCACU;AAUnC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;6CACxB","sourcesContent":["import { css, LitElement } from 'lit';\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}\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 +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;;
|
|
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;;IAW7B,MAAM,6CAEJ;CAEF"}
|
|
@@ -15,6 +15,8 @@ let FormCheckbox = class FormCheckbox extends BaseControl {
|
|
|
15
15
|
<og-checkbox .value="${this.value ? 'checked' : 'none'}"></og-checkbox>
|
|
16
16
|
`;
|
|
17
17
|
this.addEventListener('click', () => {
|
|
18
|
+
if (this.readOnly)
|
|
19
|
+
return;
|
|
18
20
|
this.updateValue(!this.value);
|
|
19
21
|
this.requestUpdate();
|
|
20
22
|
});
|
|
@@ -1 +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;
|
|
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;QAQT,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;yBACK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;EACtD,CAAC;QATD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,aAAa,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACJ,CAAC;;AArBM,mBAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;EAU1C,CAAC,AAVW,CAUV;AAZS,YAAY;IADxB,aAAa,CAAC,kBAAkB,CAAC;GACrB,YAAY,CA6BxB","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\tif (this.readOnly) return;\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}"]}
|
|
@@ -18,7 +18,7 @@ let FormColorInput = class FormColorInput extends BaseControl {
|
|
|
18
18
|
this.requestUpdate();
|
|
19
19
|
};
|
|
20
20
|
this.render = () => html `
|
|
21
|
-
<og-dropdown style="${styleMap({ backgroundColor: this.value ? `#${this.value}` : null })}">
|
|
21
|
+
<og-dropdown ?disabled="${this.readOnly}" style="${styleMap({ backgroundColor: this.value ? `#${this.value}` : null })}">
|
|
22
22
|
<div
|
|
23
23
|
slot="label"
|
|
24
24
|
style="${styleMap({
|
|
@@ -1 +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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tB,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;4BACQ,IAAI,CAAC,QAAQ,YAAY,QAAQ,CAAC,EAAC,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAC,CAAC;;;aAGzG,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 ?disabled=\"${this.readOnly}\" 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})}\"> \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}"]}
|
|
@@ -1 +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,
|
|
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,6CAeJ;CAEF"}
|
|
@@ -1 +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,CAAC,CAAC,IAAI;gBAAE,OAAO;YACpB,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAC3B,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CACxB,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EACjC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EACrC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EACjC,CAAC,EAAE,CAAC,EAAE,CAAC,CACP,CAAC,CAAC;QACJ,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;;cAEN,IAAI,CAAC,SAAS;
|
|
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,a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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?disabled=\"${this.readOnly}\"\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}"]}
|
|
@@ -11,7 +11,7 @@ let FormFileInput = class FormFileInput extends BaseControl {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.render = () => html `
|
|
14
|
-
<og-fileinput @change="${(e) => this.updateValue(e.value)}"></og-fileinput>
|
|
14
|
+
<og-fileinput ?disabled="${this.readOnly}" @change="${(e) => this.updateValue(e.value)}"></og-fileinput>
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
@@ -1 +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;
|
|
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;6BACS,IAAI,CAAC,QAAQ,cAAc,CAAC,CAAqB,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;EAC1G,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 ?disabled=\"${this.readOnly}\" @change=\"${(e: events.ChangeEvent) => this.updateValue(e.value)}\"></og-fileinput>\n\t`;\n\t\n}"]}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,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"}
|
|
@@ -1 +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';"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,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 './passwordInput';\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';"]}
|
|
@@ -10,7 +10,7 @@ export declare class FormList extends BaseControl<SerializedValue[] | string, Tr
|
|
|
10
10
|
_onChange: (e: TreeEvent) => void;
|
|
11
11
|
_onDropdownOpen: () => void;
|
|
12
12
|
getAdapter(): TreeAdapter;
|
|
13
|
-
willUpdate(): Promise<void>;
|
|
13
|
+
willUpdate(changedProps: Map<PropertyKey, unknown>): Promise<void>;
|
|
14
14
|
updated(): Promise<void>;
|
|
15
15
|
render: () => import("lit-html").TemplateResult<1>;
|
|
16
16
|
}
|
|
@@ -1 +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;
|
|
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,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IAYlD,OAAO;IAOb,MAAM,6CAWJ;CAEF"}
|
package/dist/ui/controls/list.js
CHANGED
|
@@ -26,9 +26,10 @@ let FormList = class FormList extends BaseControl {
|
|
|
26
26
|
this.adapter?.attach(this.dropdown.tree);
|
|
27
27
|
};
|
|
28
28
|
this.render = () => html `
|
|
29
|
-
<og-tree-dropdown
|
|
29
|
+
<og-tree-dropdown
|
|
30
30
|
@change="${this._onChange}"
|
|
31
31
|
@dropdown.open="${this._onDropdownOpen}"
|
|
32
|
+
?disabled="${this.readOnly}"
|
|
32
33
|
?cross="${!this.model.props.required}"
|
|
33
34
|
.adapter="${this.getAdapter()}"
|
|
34
35
|
.value="${this.formatValue(this.value)}"
|
|
@@ -51,7 +52,8 @@ let FormList = class FormList extends BaseControl {
|
|
|
51
52
|
getAdapter() {
|
|
52
53
|
return this.adapter ?? this.formModel.options?.treeAdapter;
|
|
53
54
|
}
|
|
54
|
-
async willUpdate() {
|
|
55
|
+
async willUpdate(changedProps) {
|
|
56
|
+
super.willUpdate(changedProps);
|
|
55
57
|
if (this.value) {
|
|
56
58
|
const adapter = this.getAdapter();
|
|
57
59
|
if (adapter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/ui/controls/list.ts"],"names":[],"mappings":";;;;;;AAAA,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;AAC5C,OAAO,EAAkF,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGtH,IAAM,QAAQ,GAAd,MAAM,QAAS,SAA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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;;AA3DM,eAAM,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAA;;;;EAI1C,CAAC,AAJW,CAIV;AAGH;IADC,KAAK,CAAC,kBAAkB,CAAC;0CACH;AATX,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CA4EpB","sourcesContent":["import { css, html } from \"lit\";\nimport { customElement, query } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\nimport { TreeAdapter, SerializedValue, TreeDropdown, TreeEvent, TreeSource, TreeOptions, SelectMode } from \"@omegagrid/tree\";\n\n@customElement('og-form-list')\nexport class FormList extends BaseControl<SerializedValue[]|string, TreeAdapter> {\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@query('og-tree-dropdown')\n\tdropdown: TreeDropdown;\n\n\tprivate _firstOpen = true;\n\n\tget isValid() { return true }\n\n\tprivate formatValue(value: unknown) {\n\t\treturn Array.isArray(value) ? value : (value == null ? null : [[value, 0, 1]]) as SerializedValue[];\n\t}\n\n\tasync reset(dispatchEvent = true) {\n\t\tawait super.reset(dispatchEvent);\n\t\tif (this.dropdown) {\n\t\t\tthis.dropdown.value = null;\n\t\t\tthis.dropdown.value = this.formatValue(this.model.props.value);\n\t\t}\n\t}\n\n\t_onChange = (e: TreeEvent) => {\n\t\tconst values = e.component.selection.serialize(['v']);\n\t\tif (this.dropdown.tree.options.selectMode == SelectMode.Single)\n\t\t\tthis.updateValue(values.length > 0 ? values[0][0] : null, true);\n\t\telse\n\t\t\tthis.updateValue(values, true);\n\t}\n\n\t_onDropdownOpen = () => {\n\t\tif (this._firstOpen) this._firstOpen = false;\n\t\telse this.adapter?.attach(this.dropdown.tree);\n\t}\n\n\tgetAdapter() {\n\t\treturn this.adapter ?? this.formModel.options?.treeAdapter;\n\t}\n\n\tasync willUpdate(changedProps: Map<PropertyKey, unknown>) {\n\t\tsuper.willUpdate(changedProps);\n\t\tif (this.value) {\n\t\t\tconst adapter = this.getAdapter();\n\t\t\tif (adapter) {\n\t\t\t\tconst [options] = await Promise.all([adapter.getOptions()]);\n\t\t\t\tif (options && options.selectMode == SelectMode.Single)\n\t\t\t\t\tthis.updateValue(Array.isArray(this.value) && this.value.length > 0 ? this.value[0][0] : this.value);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updated() {\n\t\tif (this.model.props.content) {\n\t\t\tconst content: {sourceData: TreeSource, options: TreeOptions} = this.model.props.content as {sourceData: TreeSource, options: TreeOptions};\n\t\t\tthis.dropdown.setSourceData(content.sourceData, content.options);\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@dropdown.open=\"${this._onDropdownOpen}\"\n\t\t\t?disabled=\"${this.readOnly}\"\n\t\t\t?cross=\"${!this.model.props.required}\"\n\t\t\t.adapter=\"${this.getAdapter()}\"\n\t\t\t.value=\"${this.formatValue(this.value)}\"\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}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numericInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,gBAAiB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAExD,MAAM,CAAC,MAAM,4BA4BV;IAGH,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,EAAE,MAAM,CAAC;IAEN,QAAQ;;IAQd,SAAS,GAAI,GAAG,UAAU,UAEzB;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,UAAO;IASrD,EAAE,sBAAkD;IACpD,IAAI,sBAAiD;IAErD,MAAM,
|
|
1
|
+
{"version":3,"file":"numericInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBACa,gBAAiB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAExD,MAAM,CAAC,MAAM,4BA4BV;IAGH,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,EAAE,MAAM,CAAC;IAEN,QAAQ;;IAQd,SAAS,GAAI,GAAG,UAAU,UAEzB;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,UAAO;IASrD,EAAE,sBAAkD;IACpD,IAAI,sBAAiD;IAErD,MAAM,6CAUJ;CAEF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numericInput.js","sourceRoot":"","sources":["../../../src/ui/controls/numericInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAmB;IAsCxD,KAAK,CAAC,QAAQ;QACb,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED;QACC,KAAK,EAAE,CAAC;QAGT,cAAS,GAAG,CAAC,CAAa,E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sBAAsB,CAAC;GACzB,gBAAgB,CA0E5B","sourcesContent":["import constants from \"../../constants\";\nimport { css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { BaseControl } from \"./baseControl\";\n\n@customElement('og-form-numericinput')\nexport class FormNumericInput extends BaseControl<number> {\n\n\tstatic styles = [...BaseControl.styles, css`\n\t\tog-numericinput {\n\t\t\tborder: 1px solid var(--og-accent-color);\n\t\t\tbackground-color: var(--og-form-background-color);\n\t\t\tcolor: var(--og-text-color);\n\t\t\theight: 100%;\n\t\t\tline-height: ${constants.DEFAULT_FORM_LINE_HEIGHT}px;\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t.buttons {\n\t\t\tdisplay: none;\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t\twidth: 15px;\n\t\t\tbackground-color: var(--og-accent-color);\n\t\t}\n\n\t\t:host {\n\t\t\tposition: relative;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\t:host(:hover) .buttons {\n\t\t\tdisplay: block;\n\t\t}\n\t`];\n\n\t@property({type: Number})\n\tmin: number;\n\n\t@property({type: Number})\n\tmax: number;\n\n\tasync validate() {\n\t\tawait super.validate();\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t_onChange = (e: InputEvent) => {\n\t\tthis.updateValue(parseFloat((e.target as HTMLInputElement).value));\n\t}\n\n\tasync updateValue(value: number, dispatchEvent = true) {\n\t\tif (value != null) {\n\t\t\tvalue = isNaN(this.min) ? value : Math.max(value, this.min);\n\t\t\tvalue = isNaN(this.max) ? value : Math.min(value, this.max);\n\t\t}\n\t\tawait super.updateValue(value, dispatchEvent);\n\t\tthis.requestUpdate();\n\t}\n\n\tup = () => this.updateValue((this.value ?? -1) + 1);\n\tdown = () => this.updateValue((this.value ?? 1) - 1);\n\n\trender = () => html`\n\t\t<og-numericinput\n\t\t\t?buttons=\"${true}\"\n\t\t\t?disabled=\"${this.readOnly}\"\n\t\t\t.min=\"${this.min}\"\n\t\t\t.max=\"${this.max}\"\n\t\t\t.value=\"${this.value}\"\n\t\t\t.placeholder=\"${this.model?.props.placeholder}\"\n\t\t\t@change=\"${this._onChange}\">\n\t\t</og-numericinput>\n\t`;\n\t\n}"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormTextInput } from "./textInput";
|
|
2
|
+
export declare class FormPasswordInput extends FormTextInput {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
private _visible;
|
|
5
|
+
get showToggle(): boolean;
|
|
6
|
+
private _toggleVisibility;
|
|
7
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=passwordInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passwordInput.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/passwordInput.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,qBACa,iBAAkB,SAAQ,aAAa;IAEnD,MAAM,CAAC,MAAM,4BA0BV;IAGH,OAAO,CAAC,QAAQ,CAAS;IAEzB,IAAI,UAAU,YAEb;IAED,OAAO,CAAC,iBAAiB,CAExB;IAED,MAAM,6CAmBJ;CAEF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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, state } from "lit/decorators.js";
|
|
9
|
+
import { FormTextInput } from "./textInput";
|
|
10
|
+
let FormPasswordInput = class FormPasswordInput extends FormTextInput {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this._visible = false;
|
|
14
|
+
this._toggleVisibility = () => {
|
|
15
|
+
this._visible = !this._visible;
|
|
16
|
+
};
|
|
17
|
+
this.render = () => html `
|
|
18
|
+
<div class="wrapper">
|
|
19
|
+
<input
|
|
20
|
+
type="${this._visible ? 'text' : 'password'}"
|
|
21
|
+
placeholder="${this.model?.props.placeholder ?? ''}"
|
|
22
|
+
?readonly="${this.readOnly}"
|
|
23
|
+
@change="${this._onChange}"
|
|
24
|
+
@keydown="${this._onKeyDown}"
|
|
25
|
+
>
|
|
26
|
+
${this.showToggle ? html `
|
|
27
|
+
<button
|
|
28
|
+
type="button"
|
|
29
|
+
class="toggle"
|
|
30
|
+
tabindex="-1"
|
|
31
|
+
@click="${this._toggleVisibility}">
|
|
32
|
+
<og-icon icon="${this._visible ? 'eye-slash' : 'eye'}"></og-icon>
|
|
33
|
+
</button>
|
|
34
|
+
` : ''}
|
|
35
|
+
</div>
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
get showToggle() {
|
|
39
|
+
return !!(this.model?.props.options?.showToggle);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
FormPasswordInput.styles = [...FormTextInput.styles, css `
|
|
43
|
+
.wrapper {
|
|
44
|
+
position: relative;
|
|
45
|
+
height: 100%;
|
|
46
|
+
width: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.wrapper input {
|
|
50
|
+
padding-right: 28px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.toggle {
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 0;
|
|
56
|
+
right: 0;
|
|
57
|
+
bottom: 0;
|
|
58
|
+
width: 28px;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
color: var(--og-text-color);
|
|
64
|
+
background: transparent;
|
|
65
|
+
border: none;
|
|
66
|
+
outline: none;
|
|
67
|
+
}
|
|
68
|
+
`];
|
|
69
|
+
__decorate([
|
|
70
|
+
state()
|
|
71
|
+
], FormPasswordInput.prototype, "_visible", void 0);
|
|
72
|
+
FormPasswordInput = __decorate([
|
|
73
|
+
customElement('og-form-passwordinput')
|
|
74
|
+
], FormPasswordInput);
|
|
75
|
+
export { FormPasswordInput };
|
|
76
|
+
//# sourceMappingURL=passwordInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passwordInput.js","sourceRoot":"","sources":["../../../src/ui/controls/passwordInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,aAAa;IAA7C;;QA+BE,aAAQ,GAAG,KAAK,CAAC;QAMjB,sBAAiB,GAAG,GAAG,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAChC,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;;;YAGR,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;mBAC5B,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,IAAI,EAAE;iBACrC,IAAI,CAAC,QAAQ;eACf,IAAI,CAAC,SAAS;gBACb,IAAI,CAAC,UAAU;;KAE1B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA;;;;;eAKZ,IAAI,CAAC,iBAAiB;sBACf,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;;IAErD,CAAC,CAAC,CAAC,EAAE;;EAEP,CAAC;IAEH,CAAC;IA7BA,IAAI,UAAU;QACb,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC;;AAjCM,wBAAM,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B5C,CAAC,AA1BW,CA0BV;AAGK;IADP,KAAK,EAAE;mDACiB;AA/Bb,iBAAiB;IAD7B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,iBAAiB,CA8D7B","sourcesContent":["import { css, html } from \"lit\";\nimport { customElement, state } from \"lit/decorators.js\";\nimport { FormTextInput } from \"./textInput\";\n\n@customElement('og-form-passwordinput')\nexport class FormPasswordInput extends FormTextInput {\n\n\tstatic styles = [...FormTextInput.styles, css`\n\t\t.wrapper {\n\t\t\tposition: relative;\n\t\t\theight: 100%;\n\t\t\twidth: 100%;\n\t\t}\n\n\t\t.wrapper input {\n\t\t\tpadding-right: 28px;\n\t\t}\n\n\t\t.toggle {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t\twidth: 28px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tcursor: pointer;\n\t\t\tcolor: var(--og-text-color);\n\t\t\tbackground: transparent;\n\t\t\tborder: none;\n\t\t\toutline: none;\n\t\t}\n\t`];\n\n\t@state()\n\tprivate _visible = false;\n\n\tget showToggle() {\n\t\treturn !!(this.model?.props.options?.showToggle);\n\t}\n\n\tprivate _toggleVisibility = () => {\n\t\tthis._visible = !this._visible;\n\t}\n\n\trender = () => html`\n\t\t<div class=\"wrapper\">\n\t\t\t<input\n\t\t\t\ttype=\"${this._visible ? 'text' : 'password'}\"\n\t\t\t\tplaceholder=\"${this.model?.props.placeholder ?? ''}\"\n\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t@change=\"${this._onChange}\"\n\t\t\t\t@keydown=\"${this._onKeyDown}\"\n\t\t\t>\n\t\t\t${this.showToggle ? html`\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"toggle\"\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t@click=\"${this._toggleVisibility}\">\n\t\t\t\t\t<og-icon icon=\"${this._visible ? 'eye-slash' : 'eye'}\"></og-icon>\n\t\t\t\t</button>\n\t\t\t` : ''}\n\t\t</div>\n\t`;\n\n}\n"]}
|
|
@@ -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,4BAoBV;IAGH,KAAK,EAAE,gBAAgB,CAAC;IAElB,QAAQ;IAQd,SAAS,GAAI,GAAG,UAAU,UAEzB;IAED,UAAU,GAAI,GAAG,aAAa,UAI7B;IAED,OAAO;IAIP,MAAM,6CAQJ;CAEF"}
|
|
@@ -23,6 +23,7 @@ let FormTextInput = class FormTextInput extends BaseControl {
|
|
|
23
23
|
<input
|
|
24
24
|
type="text"
|
|
25
25
|
placeholder="${this.model?.props.placeholder ?? ''}"
|
|
26
|
+
?readonly="${this.readOnly}"
|
|
26
27
|
@change="${this._onChange}"
|
|
27
28
|
@keydown="${this._onKeyDown}"
|
|
28
29
|
>
|
|
@@ -56,6 +57,10 @@ FormTextInput.styles = [...BaseControl.styles, css `
|
|
|
56
57
|
:host([required]) input {
|
|
57
58
|
border: none;
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
:host([readOnly]) {
|
|
62
|
+
pointer-events: auto;
|
|
63
|
+
}
|
|
59
64
|
`];
|
|
60
65
|
__decorate([
|
|
61
66
|
query('input')
|
|
@@ -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,GAAnB,MAAM,aAAc,SAAQ,WAAmB;IAA/C;;
|
|
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,GAAnB,MAAM,aAAc,SAAQ,WAAmB;IAA/C;;QAmCN,cAAS,GAAG,CAAC,CAAa,EAAE,EAAE;YAC7B,IAAI,CAAC,WAAW,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC,CAAA;QAED,eAAU,GAAG,CAAC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";\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`\n\t\tinput {\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\theight: 100%;\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}\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')\n\tinput: HTMLInputElement;\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 = () => 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}"]}
|
package/dist/ui/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/ui/form.ts"],"names":[],"mappings":"AAAA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EnC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAGhC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAG/B,OAAO,EAAE,OAAO,CAAC;IAGjB,MAAM,EAAE,UAAU,CAAM;IAExB,OAAO,CAAC,WAAW,CAA8B;IAEjD,WAAW,aAAkC;IAC7C,WAAW,oBAA8B;IAEzC,aAAa,CAAC,UAAU,EAAE,YAAY;IAItC,WAAW;IAMX,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAM9B,KAAK;IAKX,QAAQ;IAKR,OAAO;IAQD,WAAW;IAUX,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IA+BrD,cAAc,CAAC,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC;IAavC,MAAM,0CA+CJ;CAEF"}
|
package/dist/ui/form.js
CHANGED
|
@@ -17,6 +17,7 @@ import { msg } from '@omegagrid/localize';
|
|
|
17
17
|
const controlTypeMap = new Map([
|
|
18
18
|
[FormControlType.Label, literal `og-form-label`],
|
|
19
19
|
[FormControlType.TextInput, literal `og-form-textinput`],
|
|
20
|
+
[FormControlType.PasswordInput, literal `og-form-passwordinput`],
|
|
20
21
|
[FormControlType.ColorInput, literal `og-form-colorinput`],
|
|
21
22
|
[FormControlType.Checkbox, literal `og-form-checkbox`],
|
|
22
23
|
[FormControlType.List, literal `og-form-list`],
|
package/dist/ui/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/ui/form.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAe,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7E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EAAE,CAAC;YAC5D,IAAI,CAAC,aAAa,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,QAAQ,EAAE;YAC1C,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG;YAChB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC;SACjC,CAAC,CAAC,CAAC;IACL,CAAC;;AAvHM,WAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,QAAQ,EAAE;iCACQ;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCACJ;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mCACR;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCACT;AAGhB;IADC,QAAQ,CAAC,UAAU,CAAC;0CACc;AAKnC;IADC,QAAQ,CAAC,MAAM,CAAC;qCACc;AAG/B;IADC,KAAK,CAAC,YAAY,CAAC;qCACH;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oCACD;AA5BZ,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CA4KhB","sourcesContent":["import { LitElement } from \"lit\";\nimport { literal, html, StaticValue } from 'lit/static-html.js';\nimport { customElement, property, query, queryAll } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { map } from \"lit/directives/map.js\";\nimport { FormControlType, FormSettings, FormValues } from \"../types\";\nimport { FormModel } from \"../model/formModel\";\nimport { dom, Overlay } from '@omegagrid/core';\nimport { IControl, ControlEvent } from \"./controls/baseControl\";\nimport { style } from './form.style';\nimport { FormAdapter } from \"../model\";\nimport { msg } from '@omegagrid/localize';\n\nconst controlTypeMap = new Map<FormControlType, StaticValue>([\n\t[FormControlType.Label, literal`og-form-label`],\n\t[FormControlType.TextInput, literal`og-form-textinput`],\n\t[FormControlType.ColorInput, literal`og-form-colorinput`],\n\t[FormControlType.Checkbox, literal`og-form-checkbox`],\n\t[FormControlType.List, literal`og-form-list`],\n\t[FormControlType.Button, literal`og-form-button`],\n\t[FormControlType.NumericInput, literal`og-form-numericinput`],\n\t[FormControlType.FileInput, literal`og-form-fileinput`],\n\t[FormControlType.DateInput, literal`og-form-dateinput`],\n\t[FormControlType.CalendarDateInput, literal`og-form-calendardateinput`],\n]);\n\nexport class FormEvent extends Event {\n\n\treadonly key: string;\n\treadonly value: unknown;\n\treadonly valid?: boolean;\n\n\tconstructor(type: string, args?: Partial<FormEvent>) {\n\t\tsuper(`form.${type}`, {bubbles: true, cancelable: true, composed: true});\n\t\tObject.assign(this, args || {});\n\t}\n}\n\n@customElement('og-form')\nexport class Form extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property()\n\tkey: string|number;\n\n\t@property({type: Object})\n\tadapter: FormAdapter;\n\n\t@property({type: Object})\n\tmodel: FormModel;\n\n\t@property({type: String})\n\tcaption: string;\n\n\t@queryAll('.control')\n\tcontrolNodes: NodeListOf<IControl>;\n\n\tcontrols: Map<string, IControl>;\n\n\t@queryAll('.row')\n\trowElms: HTMLTableRowElement[];\n\n\t@query('og-overlay')\n\toverlay: Overlay;\n\n\t@property({type: Object})\n\tvalues: FormValues = {};\n\n\tprivate errorCounts: Record<string, number> = {};\n\n\tshowOverlay = () => this.overlay?.show(this);\n\thideOverlay = () => this.overlay?.hide();\n\t\n\tsetSourceData(sourceData: FormSettings) {\n\t\tthis.model = new FormModel(sourceData);\n\t}\n\n\tresetValues() {\n\t\tconst values: FormValues = {}\n\t\tthis.model?.controlMap.forEach(c => values[c.key] = c.props.value);\n\t\tthis.values = values;\n\t}\n\n\tsetValue(key: string, value: unknown) {\n\t\tthis.values[key] = value;\n\t\tconst control = this.shadowRoot.querySelector(`#${key}`) as unknown as IControl;\n\t\tcontrol.value = value;\n\t}\n\n\tasync reset() {\n\t\tthis.resetValues();\n\t\tthis.controls.forEach(c => c.reset(false));\n\t}\n\t\n\tvalidate() {\n\t\tthis.controls.forEach(c => c.validate());\n\t\tthis.requestUpdate();\n\t}\n\n\tisValid() {\n\t\tthis.validate();\n\t\tfor (const c of this.controlNodes) {\n\t\t\tif (!c.isValid) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tasync initAdapter() {\n\t\tthis.showOverlay();\n\t\tthis.model = new FormModel({\n\t\t\trows: await this.adapter.getRows(this.key),\n\t\t\tcolumns: await this.adapter.getColumns(this.key),\n\t\t\tcontrols: await this.adapter.getControls(this.key)\n\t\t});\n\t\tthis.hideOverlay();\n\t}\n\n\tasync updated(changedProps: Map<PropertyKey, unknown>) {\n\t\tif (changedProps.has('adapter')) {\n\t\t\tthis.adapter?.attach(this);\n\t\t\tawait this.initAdapter();\n\t\t}\n\n\t\tif (changedProps.has('model')) {\n\t\t\tthis.resetValues();\n\t\t}\n\n\t\tthis.controls = new Map();\n\t\tthis.controlNodes.forEach(c => this.controls.set(c.id, c));\n\t\tthis.model?.controls.forEach((row, r) => row.forEach((control, c) => {\n\t\t\tconst cs = control.props.cs || 1;\n\t\t\tconst rs = control.props.rs || 1;\n\t\t\tif (cs > 1 || rs > 1) {\n\t\t\t\tfor (let ri = r; ri <= r + rs - 1; ri++) {\n\t\t\t\t\tfor (let ci = c; ci <= c + cs - 1; ci++) {\n\t\t\t\t\t\tconst cell = this.rowElms[ri].children[ci] as HTMLTableCellElement;\n\t\t\t\t\t\tif (cell) {\n\t\t\t\t\t\t\tif (ci != c || ri != r) dom.hideCell(cell);\n\t\t\t\t\t\t\telse dom.showCell(cell);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdom.showCell(this.rowElms[r].children[c] as HTMLTableCellElement);\n\t\t\t}\n\t\t}));\n\t}\n\n\t_onValueChange(e: ControlEvent<unknown>) {\n\t\tthis.values[e.model.key] = e.value;\n\t\tif (this.errorCounts[e.model.key] != e.model.errors.length) {\n\t\t\tthis.requestUpdate();\n\t\t}\n\t\tthis.errorCounts[e.model.key] = e.model.errors.length;\n\t\tthis.dispatchEvent(new FormEvent('change', {\n\t\t\tkey: e.model.key, \n\t\t\tvalue: e.value,\n\t\t\tvalid: e.model.errors.length == 0\n\t\t}));\n\t}\n\n\trender = () => {\n\t\tconst overlay = html`<og-overlay defaultLoader></og-overlay>`;\n\t\tif (!this.model) return overlay;\n\t\tconst columns = map(this.model.columns, column => { \n\t\t\tconst colStyle = styleMap({width: column?.width ? dom.numToPixels(column.width) : 'auto'});\n\t\t\treturn html`<col style=\"${colStyle}\">`; \n\t\t});\n\n\t\tconst rows = map(this.model.controls, (row, r) => {\n\t\t\tconst cellStyle = styleMap({\n\t\t\t\theight: (this.model.rows && this.model.rows[r] && this.model.rows[r].height \n\t\t\t\t\t? dom.numToPixels(this.model.rows[r].height) : null)\n\t\t\t});\n\t\t\treturn html`\n\t\t\t\t<tr class=\"row\">\n\t\t\t\t\t${map(row, (control) => html`\n\t\t\t\t\t<td colspan=\"${control?.props.cs || 1}\" rowspan=\"${control?.props.rs || 1}\" style=\"${cellStyle}\">\n\t\t\t\t\t\t${control ? html`\n\t\t\t\t\t\t\t<${controlTypeMap.get(control.props.type)}\n\t\t\t\t\t\t\t\tid=\"${control.props.key}\"\n\t\t\t\t\t\t\t\t@change=${this._onValueChange}\n\t\t\t\t\t\t\t\tclass=\"control\"\n\t\t\t\t\t\t\t\t.value=\"${this.values && this.values[control.props.key] != null ? this.values[control.props.key] : control.props.value}\"\n\t\t\t\t\t\t\t\t.model=\"${control}\"\n\t\t\t\t\t\t\t\t.formModel=\"${this.model}\"\n\t\t\t\t\t\t\t\t.adapter=\"${control.props.adapter || this.model.options.treeAdapter}\">\n\t\t\t\t\t\t\t</${controlTypeMap.get(control.props.type)}>\n\t\t\t\t\t\t\t${map(control.errors, err => html`\n\t\t\t\t\t\t\t\t<div class=\"error\">${msg(err)}</div>\n\t\t\t\t\t\t\t`)}\n\t\t\t\t\t\t` : ``}\n\t\t\t\t\t</td>\n\t\t\t\t\t`)}\n\t\t\t\t</tr>\n\t\t\t`\n\t\t});\n\n\t\treturn html`\n\t\t\t${overlay}\n\t\t\t${this.caption ? html`<div class=\"title\">${this.caption}</div>` : ``}\n\t\t\t<div class=\"body\">${this.model ? html`\n\t\t\t\t<table>\n\t\t\t\t\t<colgroup>${columns}</colgroup>\n\t\t\t\t\t<tbody>${rows}</tbody>\n\t\t\t\t</table>\n\t\t\t` : ``}</div>\n\t\t`;\n\t};\n\n}"]}
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/ui/form.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAe,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAA4B,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAW,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,cAAc,GAAG,IAAI,GAAG,CAA+B;IAC5D,CAAC,eAAe,CAAC,KAAK,E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AAC,MAAM,CAAC,MAAM,IAAI,CAAC;SACjC,CAAC,CAAC,CAAC;IACL,CAAC;;AAvHM,WAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,QAAQ,EAAE;iCACQ;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCACJ;AAGrB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mCACR;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;qCACT;AAGhB;IADC,QAAQ,CAAC,UAAU,CAAC;0CACc;AAKnC;IADC,QAAQ,CAAC,MAAM,CAAC;qCACc;AAG/B;IADC,KAAK,CAAC,YAAY,CAAC;qCACH;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oCACD;AA5BZ,IAAI;IADhB,aAAa,CAAC,SAAS,CAAC;GACZ,IAAI,CA4KhB","sourcesContent":["import { LitElement } from \"lit\";\nimport { literal, html, StaticValue } from 'lit/static-html.js';\nimport { customElement, property, query, queryAll } from \"lit/decorators.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport { map } from \"lit/directives/map.js\";\nimport { FormControlType, FormSettings, FormValues } from \"../types\";\nimport { FormModel } from \"../model/formModel\";\nimport { dom, Overlay } from '@omegagrid/core';\nimport { IControl, ControlEvent } from \"./controls/baseControl\";\nimport { style } from './form.style';\nimport { FormAdapter } from \"../model\";\nimport { msg } from '@omegagrid/localize';\n\nconst controlTypeMap = new Map<FormControlType, StaticValue>([\n\t[FormControlType.Label, literal`og-form-label`],\n\t[FormControlType.TextInput, literal`og-form-textinput`],\n\t[FormControlType.PasswordInput, literal`og-form-passwordinput`],\n\t[FormControlType.ColorInput, literal`og-form-colorinput`],\n\t[FormControlType.Checkbox, literal`og-form-checkbox`],\n\t[FormControlType.List, literal`og-form-list`],\n\t[FormControlType.Button, literal`og-form-button`],\n\t[FormControlType.NumericInput, literal`og-form-numericinput`],\n\t[FormControlType.FileInput, literal`og-form-fileinput`],\n\t[FormControlType.DateInput, literal`og-form-dateinput`],\n\t[FormControlType.CalendarDateInput, literal`og-form-calendardateinput`],\n]);\n\nexport class FormEvent extends Event {\n\n\treadonly key: string;\n\treadonly value: unknown;\n\treadonly valid?: boolean;\n\n\tconstructor(type: string, args?: Partial<FormEvent>) {\n\t\tsuper(`form.${type}`, {bubbles: true, cancelable: true, composed: true});\n\t\tObject.assign(this, args || {});\n\t}\n}\n\n@customElement('og-form')\nexport class Form extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property()\n\tkey: string|number;\n\n\t@property({type: Object})\n\tadapter: FormAdapter;\n\n\t@property({type: Object})\n\tmodel: FormModel;\n\n\t@property({type: String})\n\tcaption: string;\n\n\t@queryAll('.control')\n\tcontrolNodes: NodeListOf<IControl>;\n\n\tcontrols: Map<string, IControl>;\n\n\t@queryAll('.row')\n\trowElms: HTMLTableRowElement[];\n\n\t@query('og-overlay')\n\toverlay: Overlay;\n\n\t@property({type: Object})\n\tvalues: FormValues = {};\n\n\tprivate errorCounts: Record<string, number> = {};\n\n\tshowOverlay = () => this.overlay?.show(this);\n\thideOverlay = () => this.overlay?.hide();\n\t\n\tsetSourceData(sourceData: FormSettings) {\n\t\tthis.model = new FormModel(sourceData);\n\t}\n\n\tresetValues() {\n\t\tconst values: FormValues = {}\n\t\tthis.model?.controlMap.forEach(c => values[c.key] = c.props.value);\n\t\tthis.values = values;\n\t}\n\n\tsetValue(key: string, value: unknown) {\n\t\tthis.values[key] = value;\n\t\tconst control = this.shadowRoot.querySelector(`#${key}`) as unknown as IControl;\n\t\tcontrol.value = value;\n\t}\n\n\tasync reset() {\n\t\tthis.resetValues();\n\t\tthis.controls.forEach(c => c.reset(false));\n\t}\n\t\n\tvalidate() {\n\t\tthis.controls.forEach(c => c.validate());\n\t\tthis.requestUpdate();\n\t}\n\n\tisValid() {\n\t\tthis.validate();\n\t\tfor (const c of this.controlNodes) {\n\t\t\tif (!c.isValid) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tasync initAdapter() {\n\t\tthis.showOverlay();\n\t\tthis.model = new FormModel({\n\t\t\trows: await this.adapter.getRows(this.key),\n\t\t\tcolumns: await this.adapter.getColumns(this.key),\n\t\t\tcontrols: await this.adapter.getControls(this.key)\n\t\t});\n\t\tthis.hideOverlay();\n\t}\n\n\tasync updated(changedProps: Map<PropertyKey, unknown>) {\n\t\tif (changedProps.has('adapter')) {\n\t\t\tthis.adapter?.attach(this);\n\t\t\tawait this.initAdapter();\n\t\t}\n\n\t\tif (changedProps.has('model')) {\n\t\t\tthis.resetValues();\n\t\t}\n\n\t\tthis.controls = new Map();\n\t\tthis.controlNodes.forEach(c => this.controls.set(c.id, c));\n\t\tthis.model?.controls.forEach((row, r) => row.forEach((control, c) => {\n\t\t\tconst cs = control.props.cs || 1;\n\t\t\tconst rs = control.props.rs || 1;\n\t\t\tif (cs > 1 || rs > 1) {\n\t\t\t\tfor (let ri = r; ri <= r + rs - 1; ri++) {\n\t\t\t\t\tfor (let ci = c; ci <= c + cs - 1; ci++) {\n\t\t\t\t\t\tconst cell = this.rowElms[ri].children[ci] as HTMLTableCellElement;\n\t\t\t\t\t\tif (cell) {\n\t\t\t\t\t\t\tif (ci != c || ri != r) dom.hideCell(cell);\n\t\t\t\t\t\t\telse dom.showCell(cell);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdom.showCell(this.rowElms[r].children[c] as HTMLTableCellElement);\n\t\t\t}\n\t\t}));\n\t}\n\n\t_onValueChange(e: ControlEvent<unknown>) {\n\t\tthis.values[e.model.key] = e.value;\n\t\tif (this.errorCounts[e.model.key] != e.model.errors.length) {\n\t\t\tthis.requestUpdate();\n\t\t}\n\t\tthis.errorCounts[e.model.key] = e.model.errors.length;\n\t\tthis.dispatchEvent(new FormEvent('change', {\n\t\t\tkey: e.model.key, \n\t\t\tvalue: e.value,\n\t\t\tvalid: e.model.errors.length == 0\n\t\t}));\n\t}\n\n\trender = () => {\n\t\tconst overlay = html`<og-overlay defaultLoader></og-overlay>`;\n\t\tif (!this.model) return overlay;\n\t\tconst columns = map(this.model.columns, column => { \n\t\t\tconst colStyle = styleMap({width: column?.width ? dom.numToPixels(column.width) : 'auto'});\n\t\t\treturn html`<col style=\"${colStyle}\">`; \n\t\t});\n\n\t\tconst rows = map(this.model.controls, (row, r) => {\n\t\t\tconst cellStyle = styleMap({\n\t\t\t\theight: (this.model.rows && this.model.rows[r] && this.model.rows[r].height \n\t\t\t\t\t? dom.numToPixels(this.model.rows[r].height) : null)\n\t\t\t});\n\t\t\treturn html`\n\t\t\t\t<tr class=\"row\">\n\t\t\t\t\t${map(row, (control) => html`\n\t\t\t\t\t<td colspan=\"${control?.props.cs || 1}\" rowspan=\"${control?.props.rs || 1}\" style=\"${cellStyle}\">\n\t\t\t\t\t\t${control ? html`\n\t\t\t\t\t\t\t<${controlTypeMap.get(control.props.type)}\n\t\t\t\t\t\t\t\tid=\"${control.props.key}\"\n\t\t\t\t\t\t\t\t@change=${this._onValueChange}\n\t\t\t\t\t\t\t\tclass=\"control\"\n\t\t\t\t\t\t\t\t.value=\"${this.values && this.values[control.props.key] != null ? this.values[control.props.key] : control.props.value}\"\n\t\t\t\t\t\t\t\t.model=\"${control}\"\n\t\t\t\t\t\t\t\t.formModel=\"${this.model}\"\n\t\t\t\t\t\t\t\t.adapter=\"${control.props.adapter || this.model.options.treeAdapter}\">\n\t\t\t\t\t\t\t</${controlTypeMap.get(control.props.type)}>\n\t\t\t\t\t\t\t${map(control.errors, err => html`\n\t\t\t\t\t\t\t\t<div class=\"error\">${msg(err)}</div>\n\t\t\t\t\t\t\t`)}\n\t\t\t\t\t\t` : ``}\n\t\t\t\t\t</td>\n\t\t\t\t\t`)}\n\t\t\t\t</tr>\n\t\t\t`\n\t\t});\n\n\t\treturn html`\n\t\t\t${overlay}\n\t\t\t${this.caption ? html`<div class=\"title\">${this.caption}</div>` : ``}\n\t\t\t<div class=\"body\">${this.model ? html`\n\t\t\t\t<table>\n\t\t\t\t\t<colgroup>${columns}</colgroup>\n\t\t\t\t\t<tbody>${rows}</tbody>\n\t\t\t\t</table>\n\t\t\t` : ``}</div>\n\t\t`;\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.25",
|
|
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.25",
|
|
31
|
+
"@omegagrid/core": "^0.10.25",
|
|
32
|
+
"@omegagrid/localize": "^0.10.25",
|
|
33
|
+
"@omegagrid/tree": "^0.10.25",
|
|
34
34
|
"lit": "^3.1.1",
|
|
35
35
|
"lit-html": "^3.1.1",
|
|
36
36
|
"ts-debounce": "^4.0.0"
|