@operato/attribute 1.2.41

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 (68) hide show
  1. package/.editorconfig +29 -0
  2. package/.storybook/main.js +3 -0
  3. package/.storybook/server.mjs +8 -0
  4. package/CHANGELOG.md +11 -0
  5. package/README.md +75 -0
  6. package/dist/src/grist-editor/index.d.ts +1 -0
  7. package/dist/src/grist-editor/index.js +7 -0
  8. package/dist/src/grist-editor/index.js.map +1 -0
  9. package/dist/src/grist-editor/ox-grist-editor-attribute.d.ts +12 -0
  10. package/dist/src/grist-editor/ox-grist-editor-attribute.js +81 -0
  11. package/dist/src/grist-editor/ox-grist-editor-attribute.js.map +1 -0
  12. package/dist/src/grist-editor/ox-grist-editor-attributes.d.ts +12 -0
  13. package/dist/src/grist-editor/ox-grist-editor-attributes.js +81 -0
  14. package/dist/src/grist-editor/ox-grist-editor-attributes.js.map +1 -0
  15. package/dist/src/grist-editor/ox-popup-attribute.d.ts +13 -0
  16. package/dist/src/grist-editor/ox-popup-attribute.js +92 -0
  17. package/dist/src/grist-editor/ox-popup-attribute.js.map +1 -0
  18. package/dist/src/grist-editor/ox-popup-attributes.d.ts +13 -0
  19. package/dist/src/grist-editor/ox-popup-attributes.js +92 -0
  20. package/dist/src/grist-editor/ox-popup-attributes.js.map +1 -0
  21. package/dist/src/index.d.ts +1 -0
  22. package/dist/src/index.js +2 -0
  23. package/dist/src/index.js.map +1 -0
  24. package/dist/src/ox-attribute-form.d.ts +14 -0
  25. package/dist/src/ox-attribute-form.js +199 -0
  26. package/dist/src/ox-attribute-form.js.map +1 -0
  27. package/dist/src/ox-attribute-view.d.ts +12 -0
  28. package/dist/src/ox-attribute-view.js +176 -0
  29. package/dist/src/ox-attribute-view.js.map +1 -0
  30. package/dist/src/types.d.ts +23 -0
  31. package/dist/src/types.js +2 -0
  32. package/dist/src/types.js.map +1 -0
  33. package/dist/stories/ox-attribute-form.stories.d.ts +18 -0
  34. package/dist/stories/ox-attribute-form.stories.js +80 -0
  35. package/dist/stories/ox-attribute-form.stories.js.map +1 -0
  36. package/dist/stories/ox-attribute-view.stories.d.ts +18 -0
  37. package/dist/stories/ox-attribute-view.stories.js +73 -0
  38. package/dist/stories/ox-attribute-view.stories.js.map +1 -0
  39. package/dist/stories/ox-grist-editor-attribute.stories.d.ts +25 -0
  40. package/dist/stories/ox-grist-editor-attribute.stories.js +310 -0
  41. package/dist/stories/ox-grist-editor-attribute.stories.js.map +1 -0
  42. package/dist/stories/ox-grist-editor-attributes.stories.d.ts +25 -0
  43. package/dist/stories/ox-grist-editor-attributes.stories.js +310 -0
  44. package/dist/stories/ox-grist-editor-attributes.stories.js.map +1 -0
  45. package/dist/tsconfig.tsbuildinfo +1 -0
  46. package/package.json +106 -0
  47. package/src/grist-editor/index.ts +10 -0
  48. package/src/grist-editor/ox-grist-editor-attributes.ts +94 -0
  49. package/src/grist-editor/ox-popup-attributes.ts +93 -0
  50. package/src/index.ts +1 -0
  51. package/src/ox-attribute-form.ts +218 -0
  52. package/src/ox-attribute-view.ts +182 -0
  53. package/src/types.ts +23 -0
  54. package/stories/ox-attribute-form.stories.ts +94 -0
  55. package/stories/ox-attribute-view.stories.ts +87 -0
  56. package/stories/ox-grist-editor-attributes.stories.ts +328 -0
  57. package/themes/app-theme.css +142 -0
  58. package/themes/form-theme.css +75 -0
  59. package/themes/grist-theme.css +194 -0
  60. package/themes/oops-theme.css +26 -0
  61. package/themes/report-theme.css +47 -0
  62. package/translations/en.json +4 -0
  63. package/translations/ko.json +4 -0
  64. package/translations/ms.json +4 -0
  65. package/translations/zh.json +1 -0
  66. package/tsconfig.json +23 -0
  67. package/web-dev-server.config.mjs +27 -0
  68. package/web-test-runner.config.mjs +41 -0
@@ -0,0 +1,199 @@
1
+ import { __decorate } from "tslib";
2
+ import '@operato/input/ox-input-file.js';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { customElement, property } from 'lit/decorators.js';
5
+ let OxAttributeForm = class OxAttributeForm extends LitElement {
6
+ render() {
7
+ var _a, _b;
8
+ return html ` <form @change=${(e) => this.onChange(e)}>
9
+ <h2>${((_a = this.attributeSet) === null || _a === void 0 ? void 0 : _a.entity) || ''}</h2>
10
+ <h3>${((_b = this.attributeSet) === null || _b === void 0 ? void 0 : _b.description) || ''}</h3>
11
+ ${this.buildInputs()}
12
+ </form>`;
13
+ }
14
+ onChange(e) {
15
+ this.value = this.buildValue();
16
+ this.dispatchEvent(new CustomEvent('change', {
17
+ bubbles: true,
18
+ composed: true,
19
+ detail: this.value
20
+ }));
21
+ }
22
+ buildInputs() {
23
+ var _a;
24
+ const items = (_a = this.attributeSet) === null || _a === void 0 ? void 0 : _a.items.filter(item => item.active);
25
+ return (items || []).map(item => {
26
+ const { name, description, tag, type, options = {} } = item;
27
+ const value = this.value && this.value[tag];
28
+ switch (type) {
29
+ case 'select':
30
+ var element = html ` <select .name=${tag}>
31
+ <option value=""></option>
32
+ ${(options.options || []).map(option => html `<option value=${option.value} ?selected=${option.value === value}>${option.text}</option>`)}
33
+ </select>`;
34
+ break;
35
+ case 'boolean':
36
+ var element = html ` <input type="checkbox" name=${tag} .checked=${value} />`;
37
+ break;
38
+ case 'number':
39
+ var element = html ` <input type="number" name=${tag} value=${value} />`;
40
+ break;
41
+ case 'date':
42
+ var element = html ` <input type="date" name=${tag} value=${value} />`;
43
+ break;
44
+ case 'datetime':
45
+ var element = html ` <input type="datetime-local" name=${tag} value=${value} />`;
46
+ break;
47
+ case 'file':
48
+ var element = html `<ox-input-file
49
+ name=${tag}
50
+ label="Attach Files"
51
+ accept="*/*"
52
+ multiple="true"
53
+ hide-filelist
54
+ ></ox-input-file>`;
55
+ case 'string':
56
+ default:
57
+ var element = html ` <input type="text" name=${tag} value=${value} />`;
58
+ }
59
+ return html ` <label .title=${description}>
60
+ <div name>${name}</div>
61
+ <div description><mwc-icon>info_outline</mwc-icon> ${description}</div>
62
+ <div elements>${element}</div>
63
+ </label>`;
64
+ });
65
+ }
66
+ buildValue() {
67
+ const items = this.attributeSet.items;
68
+ return (items || []).reduce((sum, item) => {
69
+ const { tag, type } = item;
70
+ const editors = Array.prototype.slice.call(this.renderRoot.querySelectorAll(`[name=${tag}]`));
71
+ if (editors.length > 0) {
72
+ sum[tag] = editors.map(editor => (type === 'boolean' ? editor.checked : editor.value));
73
+ }
74
+ return sum;
75
+ }, {});
76
+ }
77
+ };
78
+ OxAttributeForm.styles = css `
79
+ :host {
80
+ display: flex;
81
+ flex-direction: row;
82
+ --item-description-font: normal 0.8rem/1rem var(--theme-font);
83
+ --item-description-color: var(--page-description-color);
84
+ }
85
+
86
+ h2 {
87
+ margin: var(--title-margin);
88
+ font: var(--title-font);
89
+ color: var(--title-text-color);
90
+ text-transform: capitalize;
91
+ text-align: center;
92
+ }
93
+
94
+ h3 {
95
+ margin: var(--page-description-margin);
96
+ font: var(--page-description-font);
97
+ color: var(--page-description-color);
98
+ text-transform: capitalize;
99
+ text-align: center;
100
+ }
101
+
102
+ form {
103
+ flex: 1;
104
+
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+
109
+ label {
110
+ display: grid;
111
+
112
+ grid-template-rows: auto 1fr;
113
+ grid-template-columns: 1fr 5fr;
114
+ grid-template-areas: 'name description' 'empty inputs';
115
+
116
+ grid-gap: 9px;
117
+ align-items: center;
118
+ margin-bottom: var(--margin-default);
119
+ }
120
+
121
+ label:nth-child(odd) {
122
+ background-color: var(--main-section-background-color);
123
+ padding: var(--padding-default) 0;
124
+ }
125
+
126
+ div[name] {
127
+ grid-area: name;
128
+ font: var(--label-font);
129
+ color: var(--label-color);
130
+ text-align: right;
131
+ }
132
+
133
+ div[description] {
134
+ grid-area: description;
135
+ opacity: 0.7;
136
+ font: var(--item-description-font);
137
+ color: var(--item-description-color);
138
+ text-align: left;
139
+ }
140
+
141
+ div[description] * {
142
+ vertical-align: middle;
143
+ }
144
+
145
+ div[description] mwc-icon {
146
+ margin-top: -3px;
147
+ font-size: 0.9rem;
148
+ }
149
+
150
+ div[elements] {
151
+ grid-area: inputs;
152
+ display: flex;
153
+ flex-direction: row;
154
+ flex-wrap: wrap;
155
+ gap: 10px;
156
+ padding-right: var(--padding-default);
157
+ }
158
+
159
+ div[elements] * {
160
+ flex: 1;
161
+ }
162
+
163
+ div[elements] input,
164
+ div[elements] select {
165
+ border: var(--input-field-border);
166
+ border-radius: var(--input-field-border-radius);
167
+ padding: var(--input-field-padding);
168
+ font: var(--input-field-font);
169
+ }
170
+
171
+ @media only screen and (max-width: 460px) {
172
+ label {
173
+ display: grid;
174
+
175
+ grid-template-rows: auto auto 1fr;
176
+ grid-template-columns: 1fr;
177
+ grid-template-areas: 'name' 'description' 'inputs';
178
+
179
+ grid-gap: 9px;
180
+ align-items: center;
181
+ margin-bottom: var(--margin-default);
182
+ }
183
+
184
+ div[name] {
185
+ text-align: left;
186
+ }
187
+ }
188
+ `;
189
+ __decorate([
190
+ property({ type: Object })
191
+ ], OxAttributeForm.prototype, "attributeSet", void 0);
192
+ __decorate([
193
+ property({ type: Object })
194
+ ], OxAttributeForm.prototype, "value", void 0);
195
+ OxAttributeForm = __decorate([
196
+ customElement('ox-attribute-form')
197
+ ], OxAttributeForm);
198
+ export { OxAttributeForm };
199
+ //# sourceMappingURL=ox-attribute-form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-attribute-form.js","sourceRoot":"","sources":["../../src/ox-attribute-form.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAK3D,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IAoH7C,MAAM;;QACJ,OAAO,IAAI,CAAA,kBAAkB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnD,CAAA,M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I,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;aACvF;YAED,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAA4B,CAAC,CAAA;IAClC,CAAC;;AA/MM,sBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8GlB,AA9GY,CA8GZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA+B;AAlH/C,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAiN3B;SAjNY,eAAe","sourcesContent":["import '@operato/input/ox-input-file.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { AttributeSet } from './types.js'\n\n@customElement('ox-attribute-form')\nexport class OxAttributeForm extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n --item-description-font: normal 0.8rem/1rem var(--theme-font);\n --item-description-color: var(--page-description-color);\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n h3 {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n form {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n label {\n display: grid;\n\n grid-template-rows: auto 1fr;\n grid-template-columns: 1fr 5fr;\n grid-template-areas: 'name description' 'empty inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--margin-default);\n }\n\n label:nth-child(odd) {\n background-color: var(--main-section-background-color);\n padding: var(--padding-default) 0;\n }\n\n div[name] {\n grid-area: name;\n font: var(--label-font);\n color: var(--label-color);\n text-align: right;\n }\n\n div[description] {\n grid-area: description;\n opacity: 0.7;\n font: var(--item-description-font);\n color: var(--item-description-color);\n text-align: left;\n }\n\n div[description] * {\n vertical-align: middle;\n }\n\n div[description] mwc-icon {\n margin-top: -3px;\n font-size: 0.9rem;\n }\n\n div[elements] {\n grid-area: inputs;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 10px;\n padding-right: var(--padding-default);\n }\n\n div[elements] * {\n flex: 1;\n }\n\n div[elements] input,\n div[elements] select {\n border: var(--input-field-border);\n border-radius: var(--input-field-border-radius);\n padding: var(--input-field-padding);\n font: var(--input-field-font);\n }\n\n @media only screen and (max-width: 460px) {\n label {\n display: grid;\n\n grid-template-rows: auto auto 1fr;\n grid-template-columns: 1fr;\n grid-template-areas: 'name' 'description' 'inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--margin-default);\n }\n\n div[name] {\n text-align: left;\n }\n }\n `\n\n @property({ type: Object }) attributeSet?: AttributeSet\n @property({ type: Object }) value?: { [tag: string]: any }\n\n render() {\n return html` <form @change=${(e: Event) => this.onChange(e)}>\n <h2>${this.attributeSet?.entity || ''}</h2>\n <h3>${this.attributeSet?.description || ''}</h3>\n ${this.buildInputs()}\n </form>`\n }\n\n private onChange(e: Event) {\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n\n private buildInputs() {\n const items = this.attributeSet?.items.filter(item => item.active)\n\n return (items || []).map(item => {\n const { name, description, tag, type, options = {} } = item\n\n const value = this.value && this.value[tag]\n\n switch (type) {\n case 'select':\n var element = html` <select .name=${tag}>\n <option value=\"\"></option>\n ${(options.options || []).map(\n option => html`<option value=${option.value} ?selected=${option.value === value}>${option.text}</option>`\n )}\n </select>`\n break\n\n case 'boolean':\n var element = html` <input type=\"checkbox\" name=${tag} .checked=${value} />`\n break\n\n case 'number':\n var element = html` <input type=\"number\" name=${tag} value=${value} />`\n break\n\n case 'date':\n var element = html` <input type=\"date\" name=${tag} value=${value} />`\n break\n\n case 'datetime':\n var element = html` <input type=\"datetime-local\" name=${tag} value=${value} />`\n break\n\n case 'file':\n var element = html`<ox-input-file\n name=${tag}\n label=\"Attach Files\"\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n ></ox-input-file>`\n\n case 'string':\n default:\n var element = html` <input type=\"text\" name=${tag} value=${value} />`\n }\n\n return html` <label .title=${description}>\n <div name>${name}</div>\n <div description><mwc-icon>info_outline</mwc-icon> ${description}</div>\n <div elements>${element}</div>\n </label>`\n })\n }\n\n private buildValue() {\n const items = this.attributeSet!.items\n\n return (items || []).reduce((sum, item) => {\n const { tag, type } = item\n\n const editors = Array.prototype.slice.call(\n this.renderRoot.querySelectorAll(`[name=${tag}]`) as NodeListOf<HTMLInputElement>\n ) as HTMLInputElement[]\n\n if (editors.length > 0) {\n sum[tag] = editors.map(editor => (type === 'boolean' ? editor.checked : editor.value))\n }\n\n return sum\n }, {} as { [tag: string]: any })\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import '@operato/input/ox-input-file.js';
2
+ import { LitElement } from 'lit';
3
+ import { AttributeSet } from './types.js';
4
+ export declare class OxAttributeView extends LitElement {
5
+ static styles: import("lit").CSSResult;
6
+ attributeSet?: AttributeSet;
7
+ value?: {
8
+ [tag: string]: any;
9
+ };
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ private buildEntryViews;
12
+ }
@@ -0,0 +1,176 @@
1
+ import { __decorate } from "tslib";
2
+ import '@operato/input/ox-input-file.js';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { customElement, property } from 'lit/decorators.js';
5
+ let OxAttributeView = class OxAttributeView extends LitElement {
6
+ render() {
7
+ var _a, _b;
8
+ return html `<form>
9
+ <h2>${((_a = this.attributeSet) === null || _a === void 0 ? void 0 : _a.entity) || ''}</h2>
10
+ <h3>${((_b = this.attributeSet) === null || _b === void 0 ? void 0 : _b.description) || ''}</h3>
11
+ ${this.buildEntryViews()}
12
+ </form> `;
13
+ }
14
+ buildEntryViews() {
15
+ var _a;
16
+ const items = (_a = this.attributeSet) === null || _a === void 0 ? void 0 : _a.items.filter(item => item.active);
17
+ return (items || []).map(item => {
18
+ const { name, description, tag, type, options = {} } = item;
19
+ const value = this.value && this.value[tag];
20
+ switch (type) {
21
+ case 'select':
22
+ var element = html ` <select .name=${tag} disabled>
23
+ <option value=""></option>
24
+ ${(options.options || []).map(option => html `<option value=${option.value} ?selected=${option.value === value}>${option.text}</option>`)}
25
+ </select>`;
26
+ break;
27
+ case 'boolean':
28
+ var element = html ` <input type="checkbox" name=${tag} .checked=${value} disabled />`;
29
+ break;
30
+ case 'number':
31
+ var element = html ` <input type="number" name=${tag} value=${value} disabled />`;
32
+ break;
33
+ case 'file':
34
+ var element = html `<ox-input-file
35
+ name=${tag}
36
+ label="Attach Files"
37
+ accept="*/*"
38
+ multiple="true"
39
+ hide-filelist
40
+ disabled
41
+ ></ox-input-file>`;
42
+ case 'string':
43
+ default:
44
+ var element = html ` <input type="text" name=${tag} value=${value} disabled />`;
45
+ }
46
+ return html ` <label .title=${description}>
47
+ <div name>${name}</div>
48
+ <div description><mwc-icon>info_outline</mwc-icon> ${description}</div>
49
+ <div elements>${element}</div>
50
+ </label>`;
51
+ });
52
+ }
53
+ };
54
+ OxAttributeView.styles = css `
55
+ :host {
56
+ display: flex;
57
+ flex-direction: row;
58
+
59
+ --item-description-font: normal 0.8rem/1rem var(--theme-font);
60
+ --item-description-color: var(--page-description-color);
61
+ }
62
+
63
+ h2 {
64
+ margin: var(--title-margin);
65
+ font: var(--title-font);
66
+ color: var(--title-text-color);
67
+ text-transform: capitalize;
68
+ text-align: center;
69
+ }
70
+
71
+ h3 {
72
+ margin: var(--page-description-margin);
73
+ font: var(--page-description-font);
74
+ color: var(--page-description-color);
75
+ text-transform: capitalize;
76
+ text-align: center;
77
+ }
78
+
79
+ form {
80
+ flex: 1;
81
+
82
+ display: flex;
83
+ flex-direction: column;
84
+ }
85
+
86
+ label {
87
+ display: grid;
88
+
89
+ grid-template-rows: auto 1fr;
90
+ grid-template-columns: 1fr 5fr;
91
+ grid-template-areas: 'name description' 'empty inputs';
92
+
93
+ grid-gap: 9px;
94
+ align-items: center;
95
+ margin-bottom: var(--margin-default);
96
+ }
97
+
98
+ label:nth-child(odd) {
99
+ background-color: var(--main-section-background-color);
100
+ padding: var(--padding-default) 0;
101
+ }
102
+
103
+ div[name] {
104
+ grid-area: name;
105
+ font: var(--label-font);
106
+ color: var(--label-color);
107
+ text-align: right;
108
+ }
109
+
110
+ div[description] {
111
+ grid-area: description;
112
+ opacity: 0.7;
113
+ font: var(--item-description-font);
114
+ color: var(--item-description-color);
115
+ text-align: left;
116
+ }
117
+
118
+ div[description] * {
119
+ vertical-align: middle;
120
+ }
121
+
122
+ div[description] mwc-icon {
123
+ margin-top: -3px;
124
+ font-size: 0.9rem;
125
+ }
126
+
127
+ div[elements] {
128
+ grid-area: inputs;
129
+ display: flex;
130
+ flex-direction: row;
131
+ flex-wrap: wrap;
132
+ gap: 10px;
133
+ padding-right: var(--padding-default);
134
+ }
135
+
136
+ div[elements] * {
137
+ flex: 1;
138
+ }
139
+
140
+ div[elements] input,
141
+ div[elements] select {
142
+ border: var(--input-field-border);
143
+ border-radius: var(--input-field-border-radius);
144
+ padding: var(--input-field-padding);
145
+ font: var(--input-field-font);
146
+ }
147
+
148
+ @media only screen and (max-width: 460px) {
149
+ label {
150
+ display: grid;
151
+
152
+ grid-template-rows: auto auto 1fr;
153
+ grid-template-columns: 1fr;
154
+ grid-template-areas: 'name' 'description' 'inputs';
155
+
156
+ grid-gap: 9px;
157
+ align-items: center;
158
+ margin-bottom: var(--margin-default);
159
+ }
160
+
161
+ div[name] {
162
+ text-align: left;
163
+ }
164
+ }
165
+ `;
166
+ __decorate([
167
+ property({ type: Object })
168
+ ], OxAttributeView.prototype, "attributeSet", void 0);
169
+ __decorate([
170
+ property({ type: Object })
171
+ ], OxAttributeView.prototype, "value", void 0);
172
+ OxAttributeView = __decorate([
173
+ customElement('ox-attribute-view')
174
+ ], OxAttributeView);
175
+ export { OxAttributeView };
176
+ //# sourceMappingURL=ox-attribute-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-attribute-view.js","sourceRoot":"","sources":["../../src/ox-attribute-view.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAK3D,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IAqH7C,MAAM;;QACJ,OAAO,IAAI,CAAA;YACH,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,MAAM,KAAI,EAAE;YAC/B,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,KAAI,EAAE;QACxC,IAAI,CAAC,eAAe,EAAE;aACjB,CAAA;IACX,CAAC;IAEO,eAAe;;QACrB,MAAM,KAAK,GAAG,MAAA,IAAI,CAAC,YAAY,0CAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAElE,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC9B,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,IAAI,CAAA;YAE3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAE3C,QAAQ,IAAI,EAAE;gBACZ,KAAK,QAAQ;oBACX,IAAI,OAAO,GAAG,IAAI,CAAA,kBA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\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { AttributeSet } from './types.js'\n\n@customElement('ox-attribute-view')\nexport class OxAttributeView extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: row;\n\n --item-description-font: normal 0.8rem/1rem var(--theme-font);\n --item-description-color: var(--page-description-color);\n }\n\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n h3 {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n text-transform: capitalize;\n text-align: center;\n }\n\n form {\n flex: 1;\n\n display: flex;\n flex-direction: column;\n }\n\n label {\n display: grid;\n\n grid-template-rows: auto 1fr;\n grid-template-columns: 1fr 5fr;\n grid-template-areas: 'name description' 'empty inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--margin-default);\n }\n\n label:nth-child(odd) {\n background-color: var(--main-section-background-color);\n padding: var(--padding-default) 0;\n }\n\n div[name] {\n grid-area: name;\n font: var(--label-font);\n color: var(--label-color);\n text-align: right;\n }\n\n div[description] {\n grid-area: description;\n opacity: 0.7;\n font: var(--item-description-font);\n color: var(--item-description-color);\n text-align: left;\n }\n\n div[description] * {\n vertical-align: middle;\n }\n\n div[description] mwc-icon {\n margin-top: -3px;\n font-size: 0.9rem;\n }\n\n div[elements] {\n grid-area: inputs;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 10px;\n padding-right: var(--padding-default);\n }\n\n div[elements] * {\n flex: 1;\n }\n\n div[elements] input,\n div[elements] select {\n border: var(--input-field-border);\n border-radius: var(--input-field-border-radius);\n padding: var(--input-field-padding);\n font: var(--input-field-font);\n }\n\n @media only screen and (max-width: 460px) {\n label {\n display: grid;\n\n grid-template-rows: auto auto 1fr;\n grid-template-columns: 1fr;\n grid-template-areas: 'name' 'description' 'inputs';\n\n grid-gap: 9px;\n align-items: center;\n margin-bottom: var(--margin-default);\n }\n\n div[name] {\n text-align: left;\n }\n }\n `\n\n @property({ type: Object }) attributeSet?: AttributeSet\n @property({ type: Object }) value?: { [tag: string]: any }\n\n render() {\n return html`<form>\n <h2>${this.attributeSet?.entity || ''}</h2>\n <h3>${this.attributeSet?.description || ''}</h3>\n ${this.buildEntryViews()}\n </form> `\n }\n\n private buildEntryViews() {\n const items = this.attributeSet?.items.filter(item => item.active)\n\n return (items || []).map(item => {\n const { name, description, tag, type, options = {} } = item\n\n const value = this.value && this.value[tag]\n\n switch (type) {\n case 'select':\n var element = html` <select .name=${tag} disabled>\n <option value=\"\"></option>\n ${(options.options || []).map(\n option => html`<option value=${option.value} ?selected=${option.value === value}>${option.text}</option>`\n )}\n </select>`\n break\n\n case 'boolean':\n var element = html` <input type=\"checkbox\" name=${tag} .checked=${value} disabled />`\n break\n\n case 'number':\n var element = html` <input type=\"number\" name=${tag} value=${value} disabled />`\n break\n\n case 'file':\n var element = html`<ox-input-file\n name=${tag}\n label=\"Attach Files\"\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n disabled\n ></ox-input-file>`\n\n case 'string':\n default:\n var element = html` <input type=\"text\" name=${tag} value=${value} disabled />`\n }\n\n return html` <label .title=${description}>\n <div name>${name}</div>\n <div description><mwc-icon>info_outline</mwc-icon> ${description}</div>\n <div elements>${element}</div>\n </label>`\n })\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ export type SelectOption = {
2
+ text: string;
3
+ value: string;
4
+ };
5
+ export type SelectOptions = SelectOption[];
6
+ export type TypeOptions = {
7
+ options?: SelectOptions;
8
+ [prop: string]: any;
9
+ };
10
+ export type AttributeItem = {
11
+ name: string;
12
+ description: string;
13
+ tag: string;
14
+ type: string;
15
+ active: boolean;
16
+ hidden: boolean;
17
+ options: TypeOptions;
18
+ };
19
+ export type AttributeSet = {
20
+ entity: string;
21
+ description: string;
22
+ items: AttributeItem[];
23
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type SelectOption = { text: string; value: string }\nexport type SelectOptions = SelectOption[]\n\nexport type TypeOptions = {\n options?: SelectOptions\n [prop: string]: any\n}\n\nexport type AttributeItem = {\n name: string\n description: string\n tag: string\n type: string\n active: boolean\n hidden: boolean\n options: TypeOptions\n}\n\nexport type AttributeSet = {\n entity: string\n description: string\n items: AttributeItem[]\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import '@operato/i18n';
2
+ import '../src/ox-attribute-form.js';
3
+ import '@material/mwc-icon';
4
+ import { TemplateResult } from 'lit';
5
+ declare const _default: {
6
+ title: string;
7
+ component: string;
8
+ argTypes: {};
9
+ };
10
+ export default _default;
11
+ interface Story<T> {
12
+ (args: T): TemplateResult;
13
+ args?: Partial<T>;
14
+ argTypes?: Record<string, unknown>;
15
+ }
16
+ interface ArgTypes {
17
+ }
18
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,80 @@
1
+ import '@operato/i18n';
2
+ import '../src/ox-attribute-form.js';
3
+ import '@material/mwc-icon';
4
+ import { html } from 'lit';
5
+ export default {
6
+ title: 'ox-attribute-form',
7
+ component: 'ox-attribute-form',
8
+ argTypes: {}
9
+ };
10
+ const attributeSet = {
11
+ entity: 'Domain',
12
+ description: 'Attributes for Domain Entity',
13
+ items: [
14
+ {
15
+ name: '등록정보',
16
+ description: '회사 등록 정보',
17
+ tag: 'brn',
18
+ type: 'text',
19
+ active: true,
20
+ hidden: false
21
+ },
22
+ {
23
+ name: '주소',
24
+ description: '회사 주소',
25
+ tag: 'address',
26
+ type: 'text',
27
+ active: true,
28
+ hidden: false
29
+ },
30
+ {
31
+ name: '신용도',
32
+ description: '회사의 신용도',
33
+ tag: 'credit',
34
+ type: 'select',
35
+ options: {
36
+ options: [
37
+ { text: '최우수', value: '최우수' },
38
+ { text: '우수', value: '우수' },
39
+ { text: '보통', value: '보통' },
40
+ { text: '미달', value: '미달' }
41
+ ]
42
+ },
43
+ active: true,
44
+ hidden: false
45
+ },
46
+ {
47
+ name: '정보파일',
48
+ description: '참조 첨부 파일.',
49
+ tag: 'file',
50
+ type: 'file',
51
+ active: true,
52
+ hidden: false
53
+ }
54
+ ]
55
+ };
56
+ var value = {
57
+ brn: '1234567890-1234-1',
58
+ address: '경기도 성남시 분당구.',
59
+ credit: '최우수'
60
+ };
61
+ const Template = ({}) => html `
62
+ <link href="/themes/app-theme.css" rel="stylesheet" />
63
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
64
+ <style>
65
+ body {
66
+ }
67
+ </style>
68
+
69
+ <ox-attribute-form
70
+ .attributeSet=${attributeSet}
71
+ .value=${value}
72
+ @change=${(e) => {
73
+ value = e.detail;
74
+ console.log('change', value);
75
+ }}
76
+ ></ox-attribute-form>
77
+ `;
78
+ export const Regular = Template.bind({});
79
+ Regular.args = {};
80
+ //# sourceMappingURL=ox-attribute-form.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-attribute-form.stories.js","sourceRoot":"","sources":["../../stories/ox-attribute-form.stories.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,6BAA6B,CAAA;AACpC,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,mBAAmB;IAC9B,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,8BAA8B;IAC3C,KAAK,EAAE;QACL;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,UAAU;YACvB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;SACd;QACD;YACE,IAAI,EAA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E,CAAA","sourcesContent":["import '@operato/i18n'\nimport '../src/ox-attribute-form.js'\nimport '@material/mwc-icon'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-attribute-form',\n component: 'ox-attribute-form',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nconst attributeSet = {\n entity: 'Domain',\n description: 'Attributes for Domain Entity',\n items: [\n {\n name: '등록정보',\n description: '회사 등록 정보',\n tag: 'brn',\n type: 'text',\n active: true,\n hidden: false\n },\n {\n name: '주소',\n description: '회사 주소',\n tag: 'address',\n type: 'text',\n active: true,\n hidden: false\n },\n {\n name: '신용도',\n description: '회사의 신용도',\n tag: 'credit',\n type: 'select',\n options: {\n options: [\n { text: '최우수', value: '최우수' },\n { text: '우수', value: '우수' },\n { text: '보통', value: '보통' },\n { text: '미달', value: '미달' }\n ]\n },\n active: true,\n hidden: false\n },\n {\n name: '정보파일',\n description: '참조 첨부 파일.',\n tag: 'file',\n type: 'file',\n active: true,\n hidden: false\n }\n ]\n}\n\nvar value = {\n brn: '1234567890-1234-1',\n address: '경기도 성남시 분당구.',\n credit: '최우수'\n}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <ox-attribute-form\n .attributeSet=${attributeSet}\n .value=${value}\n @change=${(e: CustomEvent) => {\n value = e.detail\n console.log('change', value)\n }}\n ></ox-attribute-form>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}
@@ -0,0 +1,18 @@
1
+ import '@operato/i18n';
2
+ import '../src/ox-attribute-view.js';
3
+ import '@material/mwc-icon';
4
+ import { TemplateResult } from 'lit';
5
+ declare const _default: {
6
+ title: string;
7
+ component: string;
8
+ argTypes: {};
9
+ };
10
+ export default _default;
11
+ interface Story<T> {
12
+ (args: T): TemplateResult;
13
+ args?: Partial<T>;
14
+ argTypes?: Record<string, unknown>;
15
+ }
16
+ interface ArgTypes {
17
+ }
18
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,73 @@
1
+ import '@operato/i18n';
2
+ import '../src/ox-attribute-view.js';
3
+ import '@material/mwc-icon';
4
+ import { html } from 'lit';
5
+ export default {
6
+ title: 'ox-attribute-view',
7
+ component: 'ox-attribute-view',
8
+ argTypes: {}
9
+ };
10
+ const attributeSet = {
11
+ entity: 'Domain',
12
+ description: 'Attributes for Domain Entity',
13
+ items: [
14
+ {
15
+ name: '등록정보',
16
+ description: '회사 등록 정보',
17
+ tag: 'brn',
18
+ type: 'text',
19
+ active: true,
20
+ hidden: false
21
+ },
22
+ {
23
+ name: '주소',
24
+ description: '회사 주소',
25
+ tag: 'address',
26
+ type: 'text',
27
+ active: true,
28
+ hidden: false
29
+ },
30
+ {
31
+ name: '신용도',
32
+ description: '회사의 신용도',
33
+ tag: 'credit',
34
+ type: 'select',
35
+ options: {
36
+ options: [
37
+ { text: '최우수', value: '최우수' },
38
+ { text: '우수', value: '우수' },
39
+ { text: '보통', value: '보통' },
40
+ { text: '미달', value: '미달' }
41
+ ]
42
+ },
43
+ active: true,
44
+ hidden: false
45
+ },
46
+ {
47
+ name: '정보파일',
48
+ description: '참조 첨부 파일.',
49
+ tag: 'file',
50
+ type: 'file',
51
+ active: true,
52
+ hidden: false
53
+ }
54
+ ]
55
+ };
56
+ var value = {
57
+ brn: '1234567890-1234-1',
58
+ address: '경기도 성남시 분당구.',
59
+ credit: '최우수'
60
+ };
61
+ const Template = ({}) => html `
62
+ <link href="/themes/app-theme.css" rel="stylesheet" />
63
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
64
+ <style>
65
+ body {
66
+ }
67
+ </style>
68
+
69
+ <ox-attribute-view .attributeSet=${attributeSet} .value=${value}></ox-attribute-view>
70
+ `;
71
+ export const Regular = Template.bind({});
72
+ Regular.args = {};
73
+ //# sourceMappingURL=ox-attribute-view.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-attribute-view.stories.js","sourceRoot":"","sources":["../../stories/ox-attribute-view.stories.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,6BAA6B,CAAA;AACpC,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,mBAAmB;IAC9B,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,8BAA8B;IAC3C,KAAK,EAAE;QACL;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,UAAU;YACvB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;SACd;QACD;YACE,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,OAAO;YACpB,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;SACd;QACD;YACE,IAAI,EAAE,KAAK;YACX,WAAW,EAAE,SAAS;YACtB,GAAG,EAAE,QAAQ;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC7B,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC3B,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC3B,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;iBAC5B;aACF;YACD,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;SACd;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,WAAW;YACxB,GAAG,EAAE,MAAM;YACX,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;SACd;KACF;CACF,CAAA;AAED,IAAI,KAAK,GAAG;IACV,GAAG,EAAE,mBAAmB;IACxB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,KAAK;CACd,CAAA;AAED,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CACjD,IAAI,CAAA;;;;;;;;uCAQiC,YAAY,WAAW,KAAK;GAChE,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import '@operato/i18n'\nimport '../src/ox-attribute-view.js'\nimport '@material/mwc-icon'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-attribute-view',\n component: 'ox-attribute-view',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nconst attributeSet = {\n entity: 'Domain',\n description: 'Attributes for Domain Entity',\n items: [\n {\n name: '등록정보',\n description: '회사 등록 정보',\n tag: 'brn',\n type: 'text',\n active: true,\n hidden: false\n },\n {\n name: '주소',\n description: '회사 주소',\n tag: 'address',\n type: 'text',\n active: true,\n hidden: false\n },\n {\n name: '신용도',\n description: '회사의 신용도',\n tag: 'credit',\n type: 'select',\n options: {\n options: [\n { text: '최우수', value: '최우수' },\n { text: '우수', value: '우수' },\n { text: '보통', value: '보통' },\n { text: '미달', value: '미달' }\n ]\n },\n active: true,\n hidden: false\n },\n {\n name: '정보파일',\n description: '참조 첨부 파일.',\n tag: 'file',\n type: 'file',\n active: true,\n hidden: false\n }\n ]\n}\n\nvar value = {\n brn: '1234567890-1234-1',\n address: '경기도 성남시 분당구.',\n credit: '최우수'\n}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <ox-attribute-view .attributeSet=${attributeSet} .value=${value}></ox-attribute-view>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}