@operato/input 2.0.0-beta.16 → 2.0.0-beta.17

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.0-beta.17](https://github.com/hatiolab/operato/compare/v2.0.0-beta.16...v2.0.0-beta.17) (2024-06-11)
7
+
8
+
9
+ ### :rocket: New Features
10
+
11
+ * ox-input-table-column-config ([0b84541](https://github.com/hatiolab/operato/commit/0b84541ec63fc71538292abd9e81d8c38baee44c))
12
+
13
+
14
+
6
15
  ## [2.0.0-beta.16](https://github.com/hatiolab/operato/compare/v2.0.0-beta.15...v2.0.0-beta.16) (2024-06-10)
7
16
 
8
17
  **Note:** Version bump only for package @operato/input
@@ -28,3 +28,4 @@ export * from './ox-input-quantifier.js';
28
28
  export * from './ox-input-select-buttons.js';
29
29
  export * from './ox-input-textarea.js';
30
30
  export * from './ox-input-direction.js';
31
+ export * from './ox-input-table-column-config.js';
package/dist/src/index.js CHANGED
@@ -28,4 +28,5 @@ export * from './ox-input-quantifier.js';
28
28
  export * from './ox-input-select-buttons.js';
29
29
  export * from './ox-input-textarea.js';
30
30
  export * from './ox-input-direction.js';
31
+ export * from './ox-input-table-column-config.js';
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-color-stops.js'\nexport * from './ox-input-color-gradient.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-table.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-color-stops.js'\nexport * from './ox-input-color-gradient.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-table.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\n"]}
@@ -0,0 +1,22 @@
1
+ import { OxFormField } from './ox-form-field';
2
+ import '@material/web/checkbox/checkbox.js';
3
+ import '@material/web/icon/icon.js';
4
+ export interface ColumnConfig {
5
+ name: string;
6
+ label: string;
7
+ visible: boolean;
8
+ width: string;
9
+ order: number;
10
+ }
11
+ export declare class OxInputTableColumnConfig extends OxFormField {
12
+ static styles: import("lit").CSSResult[];
13
+ value: ColumnConfig[];
14
+ render(): import("lit-html").TemplateResult<1>;
15
+ private _updateVisibility;
16
+ private _updateLabel;
17
+ private _updateWidth;
18
+ private _moveUp;
19
+ private _moveDown;
20
+ private _updateOrder;
21
+ private _notifyChange;
22
+ }
@@ -0,0 +1,174 @@
1
+ import { __decorate } from "tslib";
2
+ import { css, html } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { OxFormField } from './ox-form-field';
5
+ import '@material/web/checkbox/checkbox.js';
6
+ import '@material/web/icon/icon.js';
7
+ let OxInputTableColumnConfig = class OxInputTableColumnConfig extends OxFormField {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.value = [];
11
+ }
12
+ static { this.styles = [
13
+ css `
14
+ :host {
15
+ display: block;
16
+ padding: 4px;
17
+ border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
18
+ background-color: var(--ox-input-table-column-config-background-color, white);
19
+ }
20
+
21
+ table {
22
+ width: auto;
23
+ border-collapse: collapse;
24
+ font-size: 12px;
25
+ }
26
+
27
+ th,
28
+ td {
29
+ border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
30
+ padding: 0;
31
+ text-align: left;
32
+ }
33
+
34
+ th {
35
+ background-color: var(
36
+ --ox-input-table-column-config-header-background-color,
37
+ var(--md-sys-color-secondary-container)
38
+ );
39
+ white-space: nowrap;
40
+ }
41
+
42
+ input {
43
+ font-size: 12px;
44
+ padding: 0;
45
+ margin: 0;
46
+ border: none;
47
+ width: 100%;
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ .icon-button {
52
+ cursor: pointer;
53
+ display: inline-flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ padding: 0;
57
+ margin: 0;
58
+ border: none;
59
+ background: none;
60
+ font-size: 16px;
61
+ width: 24px;
62
+ height: 24px;
63
+ box-sizing: border-box;
64
+ }
65
+
66
+ .icon-button[disabled] {
67
+ cursor: not-allowed;
68
+ }
69
+ `
70
+ ]; }
71
+ render() {
72
+ return html `
73
+ <table>
74
+ <thead>
75
+ <tr>
76
+ <th></th>
77
+ <th>Name</th>
78
+ <th>Label</th>
79
+ <th>Width</th>
80
+ <th>Order</th>
81
+ </tr>
82
+ </thead>
83
+ <tbody>
84
+ ${this.value.map((col, index) => html `
85
+ <tr name=${col.name}>
86
+ <td>
87
+ <md-checkbox .checked=${col.visible} @change=${(e) => this._updateVisibility(e, index)}>
88
+ </md-checkbox>
89
+ </td>
90
+ <td>${col.name}</td>
91
+ <td>
92
+ <input type="text" .value=${col.label} @input=${(e) => this._updateLabel(e, index)} />
93
+ </td>
94
+ <td>
95
+ <input type="text" .value=${col.width} @input=${(e) => this._updateWidth(e, index)} />
96
+ </td>
97
+ <td>
98
+ <md-icon class="icon-button" @click=${() => this._moveUp(index)} ?disabled=${index === 0}>
99
+ arrow_upward
100
+ </md-icon>
101
+ <md-icon
102
+ class="icon-button"
103
+ @click=${() => this._moveDown(index)}
104
+ ?disabled=${index === this.value.length - 1}
105
+ >
106
+ arrow_downward
107
+ </md-icon>
108
+ </td>
109
+ </tr>
110
+ `)}
111
+ </tbody>
112
+ </table>
113
+ `;
114
+ }
115
+ _updateVisibility(event, index) {
116
+ const target = event.target;
117
+ this.value[index].visible = target.checked;
118
+ this.requestUpdate();
119
+ this._notifyChange();
120
+ }
121
+ _updateLabel(event, index) {
122
+ const target = event.target;
123
+ this.value[index].label = target.value;
124
+ this.requestUpdate();
125
+ this._notifyChange();
126
+ }
127
+ _updateWidth(event, index) {
128
+ const target = event.target;
129
+ this.value[index].width = target.value;
130
+ this.requestUpdate();
131
+ this._notifyChange();
132
+ }
133
+ _moveUp(index) {
134
+ if (index === 0)
135
+ return;
136
+ const temp = this.value[index];
137
+ this.value[index] = this.value[index - 1];
138
+ this.value[index - 1] = temp;
139
+ this._updateOrder();
140
+ this.requestUpdate();
141
+ this._notifyChange();
142
+ }
143
+ _moveDown(index) {
144
+ if (index === this.value.length - 1)
145
+ return;
146
+ const temp = this.value[index];
147
+ this.value[index] = this.value[index + 1];
148
+ this.value[index + 1] = temp;
149
+ this._updateOrder();
150
+ this.requestUpdate();
151
+ this._notifyChange();
152
+ }
153
+ _updateOrder() {
154
+ this.value = this.value.map((col, index) => ({
155
+ ...col,
156
+ order: index + 1
157
+ }));
158
+ }
159
+ _notifyChange() {
160
+ this.dispatchEvent(new CustomEvent('change', {
161
+ detail: this.value,
162
+ bubbles: true,
163
+ composed: true
164
+ }));
165
+ }
166
+ };
167
+ __decorate([
168
+ property({ type: Array })
169
+ ], OxInputTableColumnConfig.prototype, "value", void 0);
170
+ OxInputTableColumnConfig = __decorate([
171
+ customElement('ox-input-table-column-config')
172
+ ], OxInputTableColumnConfig);
173
+ export { OxInputTableColumnConfig };
174
+ //# sourceMappingURL=ox-input-table-column-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-table-column-config.js","sourceRoot":"","sources":["../../src/ox-input-table-column-config.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,4BAA4B,CAAA;AAW5B,IAAM,wBAAwB,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C,KAAK,GAAG,CAAC,CAAC,CAAA;QACzC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAA;QACnB,IAAI,CAAC,aAAa,EAAE,CAAA;QACpB,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,GAAG,GAAG;YACN,KAAK,EAAE,KAAK,GAAG,CAAC;SACjB,CAAC,CAAC,CAAA;IACL,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAA;IACH,CAAC;;AAzG0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uDAA2B;AA7D1C,wBAAwB;IADpC,aAAa,CAAC,8BAA8B,CAAC;GACjC,wBAAwB,CAuKpC","sourcesContent":["import { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { OxFormField } from './ox-form-field'\nimport '@material/web/checkbox/checkbox.js'\nimport '@material/web/icon/icon.js'\n\nexport interface ColumnConfig {\n name: string\n label: string\n visible: boolean\n width: string\n order: number\n}\n\n@customElement('ox-input-table-column-config')\nexport class OxInputTableColumnConfig extends OxFormField {\n static styles = [\n css`\n :host {\n display: block;\n padding: 4px;\n border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));\n background-color: var(--ox-input-table-column-config-background-color, white);\n }\n\n table {\n width: auto;\n border-collapse: collapse;\n font-size: 12px;\n }\n\n th,\n td {\n border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));\n padding: 0;\n text-align: left;\n }\n\n th {\n background-color: var(\n --ox-input-table-column-config-header-background-color,\n var(--md-sys-color-secondary-container)\n );\n white-space: nowrap;\n }\n\n input {\n font-size: 12px;\n padding: 0;\n margin: 0;\n border: none;\n width: 100%;\n box-sizing: border-box;\n }\n\n .icon-button {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n font-size: 16px;\n width: 24px;\n height: 24px;\n box-sizing: border-box;\n }\n\n .icon-button[disabled] {\n cursor: not-allowed;\n }\n `\n ]\n\n @property({ type: Array }) value: ColumnConfig[] = []\n\n render() {\n return html`\n <table>\n <thead>\n <tr>\n <th></th>\n <th>Name</th>\n <th>Label</th>\n <th>Width</th>\n <th>Order</th>\n </tr>\n </thead>\n <tbody>\n ${this.value.map(\n (col, index) => html`\n <tr name=${col.name}>\n <td>\n <md-checkbox .checked=${col.visible} @change=${(e: Event) => this._updateVisibility(e, index)}>\n </md-checkbox>\n </td>\n <td>${col.name}</td>\n <td>\n <input type=\"text\" .value=${col.label} @input=${(e: Event) => this._updateLabel(e, index)} />\n </td>\n <td>\n <input type=\"text\" .value=${col.width} @input=${(e: Event) => this._updateWidth(e, index)} />\n </td>\n <td>\n <md-icon class=\"icon-button\" @click=${() => this._moveUp(index)} ?disabled=${index === 0}>\n arrow_upward\n </md-icon>\n <md-icon\n class=\"icon-button\"\n @click=${() => this._moveDown(index)}\n ?disabled=${index === this.value.length - 1}\n >\n arrow_downward\n </md-icon>\n </td>\n </tr>\n `\n )}\n </tbody>\n </table>\n `\n }\n\n private _updateVisibility(event: Event, index: number) {\n const target = event.target as HTMLInputElement\n this.value[index].visible = target.checked\n this.requestUpdate()\n this._notifyChange()\n }\n\n private _updateLabel(event: Event, index: number) {\n const target = event.target as HTMLInputElement\n this.value[index].label = target.value\n this.requestUpdate()\n this._notifyChange()\n }\n\n private _updateWidth(event: Event, index: number) {\n const target = event.target as HTMLInputElement\n this.value[index].width = target.value\n this.requestUpdate()\n this._notifyChange()\n }\n\n private _moveUp(index: number) {\n if (index === 0) return\n const temp = this.value[index]\n this.value[index] = this.value[index - 1]\n this.value[index - 1] = temp\n this._updateOrder()\n this.requestUpdate()\n this._notifyChange()\n }\n\n private _moveDown(index: number) {\n if (index === this.value.length - 1) return\n const temp = this.value[index]\n this.value[index] = this.value[index + 1]\n this.value[index + 1] = temp\n this._updateOrder()\n this.requestUpdate()\n this._notifyChange()\n }\n\n private _updateOrder() {\n this.value = this.value.map((col, index) => ({\n ...col,\n order: index + 1\n }))\n }\n\n private _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.value,\n bubbles: true,\n composed: true\n })\n )\n }\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import '../src/ox-input-table-column-config.js';
2
+ import { TemplateResult } from 'lit';
3
+ declare const _default: {
4
+ title: string;
5
+ component: string;
6
+ argTypes: {
7
+ name: {
8
+ control: string;
9
+ };
10
+ value: {
11
+ control: string;
12
+ };
13
+ disabled: {
14
+ control: string;
15
+ };
16
+ theme: {
17
+ control: string;
18
+ options: string[];
19
+ };
20
+ };
21
+ };
22
+ export default _default;
23
+ interface Story<T> {
24
+ (args: T): TemplateResult;
25
+ args?: Partial<T>;
26
+ argTypes?: Record<string, unknown>;
27
+ }
28
+ interface ArgTypes {
29
+ name?: string;
30
+ value?: object;
31
+ disabled?: boolean;
32
+ theme?: string;
33
+ }
34
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,99 @@
1
+ import '../src/ox-input-table-column-config.js';
2
+ import { html } from 'lit';
3
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles';
4
+ export default {
5
+ title: 'ox-input-table-column-config',
6
+ component: 'ox-input-table-column-config',
7
+ argTypes: {
8
+ name: { control: 'text' },
9
+ value: { control: 'object' },
10
+ disabled: { control: 'boolean' },
11
+ theme: { control: 'select', options: ['light', 'dark'] }
12
+ }
13
+ };
14
+ const Template = ({ name = 'table-column-config', value = {}, disabled, theme = 'light' }) => html `
15
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
16
+
17
+ <link href="/themes/light.css" rel="stylesheet" />
18
+ <link href="/themes/dark.css" rel="stylesheet" />
19
+ <link href="/themes/spacing.css" rel="stylesheet" />
20
+
21
+ <link
22
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
23
+ rel="stylesheet"
24
+ />
25
+ <link
26
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
27
+ rel="stylesheet"
28
+ />
29
+ <link
30
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
31
+ rel="stylesheet"
32
+ />
33
+
34
+ <style>
35
+ ${MDTypeScaleStyles.cssText}
36
+ </style>
37
+
38
+ <style>
39
+ .container {
40
+ height: 500px;
41
+ text-align: center;
42
+ padding: 20px;
43
+
44
+ background-color: var(--md-sys-color-primary-container);
45
+ color: var(--md-sys-color-on-primary-container);
46
+ }
47
+ </style>
48
+
49
+ <script>
50
+ document.body.classList.add('${theme}')
51
+ </script>
52
+
53
+ <div class="container md-typescale-body-large-prominent">
54
+ <ox-input-table-column-config
55
+ @change=${(e) => {
56
+ console.log(e.target.value);
57
+ }}
58
+ name=${name}
59
+ .value=${value}
60
+ ?disabled=${disabled}
61
+ >
62
+ </ox-input-table-column-config>
63
+ </div>
64
+ `;
65
+ export const Regular = Template.bind({});
66
+ Regular.args = {
67
+ name: 'table-column-config',
68
+ value: [
69
+ {
70
+ name: 'section',
71
+ label: 'Section',
72
+ visible: true,
73
+ width: 100,
74
+ order: 1
75
+ },
76
+ {
77
+ name: 'title',
78
+ label: 'Title',
79
+ visible: true,
80
+ width: 110,
81
+ order: 2
82
+ },
83
+ {
84
+ name: 'startDate',
85
+ label: 'Start Date',
86
+ visible: true,
87
+ width: 150,
88
+ order: 3
89
+ },
90
+ {
91
+ name: 'endDate',
92
+ label: 'End Date',
93
+ visible: true,
94
+ width: 200,
95
+ order: 4
96
+ }
97
+ ]
98
+ };
99
+ //# sourceMappingURL=ox-input-table-column-config.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-table-column-config.stories.js","sourceRoot":"","sources":["../../stories/ox-input-table-column-config.stories.ts"],"names":[],"mappings":"AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAE1F,eAAe;IACb,KAAK,EAAE,8BAA8B;IACrC,SAAS,EAAE,8BAA8B;IACzC,QAAQ,EAAE;QACR,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACzB,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC5B,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QAChC,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;KACzD;CACF,CAAA;AAeD,MAAM,QAAQ,GAAoB,CAAC,EACjC,IAAI,GAAG,qBAAqB,EAC5B,KAAK,GAAG,EAAE,EACV,QAAQ,EACR,KAAK,GAAG,OAAO,EACN,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;MAqBd,iBAAiB,CAAC,OAAO;;;;;;;;;;;;;;;mCAeI,KAAK;;;;;gBAKxB,CAAC,CAAQ,EAAE,EAAE;IACrB,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;aACM,IAAI;eACF,KAAK;kBACF,QAAQ;;;;CAIzB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE;QACL;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,CAAC;SACT;QACD;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,CAAC;SACT;QACD;YACE,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,CAAC;SACT;QACD;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,CAAC;SACT;KACF;CACF,CAAA","sourcesContent":["import '../src/ox-input-table-column-config.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\n\nexport default {\n title: 'ox-input-table-column-config',\n component: 'ox-input-table-column-config',\n argTypes: {\n name: { control: 'text' },\n value: { control: 'object' },\n disabled: { control: 'boolean' },\n theme: { control: 'select', options: ['light', 'dark'] }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n name?: string\n value?: object\n disabled?: boolean\n theme?: string\n}\n\nconst Template: Story<ArgTypes> = ({\n name = 'table-column-config',\n value = {},\n disabled,\n theme = 'light'\n}: ArgTypes) => html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n .container {\n height: 500px;\n text-align: center;\n padding: 20px;\n\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n </style>\n\n <script>\n document.body.classList.add('${theme}')\n </script>\n\n <div class=\"container md-typescale-body-large-prominent\">\n <ox-input-table-column-config\n @change=${(e: Event) => {\n console.log((e.target as HTMLInputElement).value)\n }}\n name=${name}\n .value=${value}\n ?disabled=${disabled}\n >\n </ox-input-table-column-config>\n </div>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n name: 'table-column-config',\n value: [\n {\n name: 'section',\n label: 'Section',\n visible: true,\n width: 100,\n order: 1\n },\n {\n name: 'title',\n label: 'Title',\n visible: true,\n width: 110,\n order: 2\n },\n {\n name: 'startDate',\n label: 'Start Date',\n visible: true,\n width: 150,\n order: 3\n },\n {\n name: 'endDate',\n label: 'End Date',\n visible: true,\n width: 200,\n order: 4\n }\n ]\n}\n"]}