@operato/data-grist 1.12.0 → 1.12.1
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 +9 -0
- package/dist/src/renderers/ox-grist-renderer-tree.js +6 -3
- package/dist/src/renderers/ox-grist-renderer-tree.js.map +1 -1
- package/dist/stories/tree-column-with-checkbox.stories.d.ts +26 -0
- package/dist/stories/tree-column-with-checkbox.stories.js +328 -0
- package/dist/stories/tree-column-with-checkbox.stories.js.map +1 -0
- package/dist/stories/tree-column.stories copy.d.ts +26 -0
- package/dist/stories/tree-column.stories copy.js +326 -0
- package/dist/stories/tree-column.stories copy.js.map +1 -0
- package/dist/stories/tree-column.stories.js +4 -1
- package/dist/stories/tree-column.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/renderers/ox-grist-renderer-tree.ts +6 -3
- package/stories/tree-column-with-checkbox.stories.ts +356 -0
- package/stories/tree-column.stories.ts +4 -1
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
|
+
### [1.12.1](https://github.com/hatiolab/operato/compare/v1.12.0...v1.12.1) (2023-12-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* tree-column option - selectable ([248eb92](https://github.com/hatiolab/operato/commit/248eb92126ca300c57d031bb4f6ea69dbd92f56a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [1.12.0](https://github.com/hatiolab/operato/compare/v1.11.23...v1.12.0) (2023-12-29)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { css, html } from 'lit';
|
|
2
|
+
import { css, html, nothing } from 'lit';
|
|
3
3
|
import { customElement, state } from 'lit/decorators.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
5
|
import { OxGristRenderer } from './ox-grist-renderer';
|
|
@@ -9,7 +9,7 @@ let OxGristRendererTree = class OxGristRendererTree extends OxGristRenderer {
|
|
|
9
9
|
this.expanded = false;
|
|
10
10
|
}
|
|
11
11
|
get rendererTemplate() {
|
|
12
|
-
var { childrenProperty = 'children' } = this.column.record.options || {};
|
|
12
|
+
var { childrenProperty = 'children', selectable = false } = this.column.record.options || {};
|
|
13
13
|
var { [childrenProperty]: children } = this.record;
|
|
14
14
|
const expandable = children && children.length > 0;
|
|
15
15
|
return html `
|
|
@@ -24,7 +24,10 @@ let OxGristRendererTree = class OxGristRendererTree extends OxGristRenderer {
|
|
|
24
24
|
></span>
|
|
25
25
|
`
|
|
26
26
|
: html `<span expander></span>`}
|
|
27
|
-
|
|
27
|
+
${selectable
|
|
28
|
+
? html ` <span checkbox @click=${this.onClickCheckbox.bind(this)} checked=${ifDefined(this.checked)}></span>`
|
|
29
|
+
: nothing}
|
|
30
|
+
|
|
28
31
|
<span label>${this.value}</span>
|
|
29
32
|
</div>
|
|
30
33
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-renderer-tree.js","sourceRoot":"","sources":["../../../src/renderers/ox-grist-renderer-tree.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"ox-grist-renderer-tree.js","sourceRoot":"","sources":["../../../src/renderers/ox-grist-renderer-tree.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxD,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AA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AAC;IAED,eAAe,CAAC,CAAa;QAC3B,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CACH,CAAA;QAED,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,eAAe,CAAC,CAAa;QAC3B,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,EAAE;YACnE,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CACH,CAAA;QAED,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;;AA/KM,0BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GlB,AA7GY,CA6GZ;AAEgB;IAAhB,KAAK,EAAE;oDAA2D;AAClD;IAAhB,KAAK,EAAE;qDAAmC;AAjHhC,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAiL/B","sourcesContent":["import { PropertyValues, css, html, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { OxGristRenderer } from './ox-grist-renderer'\n\n@customElement('ox-grist-tree-renderer')\nexport class OxGristRendererTree extends OxGristRenderer {\n static styles = css`\n :host {\n overflow: hidden;\n }\n\n div[wrap] {\n position: relative;\n\n display: flex;\n align-items: center;\n gap: 6px;\n\n width: 100%;\n padding-left: calc(var(--tree-depth, 0) * 18px);\n }\n\n span[expander] {\n display: inline-block;\n vertical-align: middle;\n width: 12px;\n height: 20px;\n cursor: pointer;\n position: relative;\n }\n\n span[expander][collapsed]::before {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-25%, -50%) rotate(-90deg);\n content: ' ';\n border: 5px solid transparent;\n border-top: 5px solid var(--primary-color, #1890ff);\n }\n\n span[expander][expanded]::before {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -25%);\n content: ' ';\n border: 5px solid transparent;\n border-top: 5px solid var(--primary-color, #1890ff);\n }\n\n span[checkbox] {\n display: inline-block;\n vertical-align: middle;\n width: 12px;\n height: 20px;\n cursor: pointer;\n position: relative;\n }\n\n span[checkbox]::before {\n cursor: pointer;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n content: ' ';\n display: block;\n width: 10px;\n height: 10px;\n border: 1px solid var(--primary-color, #1890ff);\n border-radius: 2px;\n }\n\n span[label][selected] {\n background-color: var(--primary-color, #1890ff);\n }\n\n span[checkbox][checked='checked']::before {\n background-color: var(--primary-color, #1890ff);\n border-color: var(--primary-color, #1890ff);\n }\n\n span[checkbox][checked='checked']::after {\n position: absolute;\n content: ' ';\n display: block;\n top: 50%;\n left: 50%;\n width: 3px;\n height: 7px;\n border: 2px solid #fff;\n border-top: none;\n border-left: none;\n -webkit-transform: translate(-50%, -50%) rotate(45deg);\n -ms-transform: translate(-50%, -50%) rotate(45deg);\n transform: translate(-50%, -50%) rotate(45deg);\n }\n\n span[checkbox][checked='half-checked']::before {\n background-color: var(--primary-color, #1890ff);\n border-color: var(--primary-color, #1890ff);\n }\n\n span[checkbox][checked='half-checked']::after {\n position: absolute;\n content: ' ';\n display: block;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 10px;\n height: 2px;\n background-color: #fff;\n }\n `\n\n @state() private checked?: 'checked' | 'half-checked' | 'unchecked'\n @state() private expanded?: boolean = false\n\n get rendererTemplate() {\n var { childrenProperty = 'children', selectable = false } = this.column.record.options || {}\n var { [childrenProperty]: children } = this.record\n\n const expandable = children && children.length > 0\n\n return html`\n <div wrap>\n ${expandable\n ? html`\n <span\n expander\n @click=${this.onClickExpander.bind(this)}\n ?expanded=${this.expanded}\n ?collapsed=${!this.expanded}\n ></span>\n `\n : html`<span expander></span>`}\n ${selectable\n ? html` <span checkbox @click=${this.onClickCheckbox.bind(this)} checked=${ifDefined(this.checked)}></span>`\n : nothing}\n\n <span label>${this.value}</span>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n var { __depth__, __check_in_tree__, __expanded__ } = this.record\n this.checked = __check_in_tree__\n this.expanded = __expanded__\n\n this.style.setProperty('--tree-depth', String(__depth__))\n }\n\n onClickCheckbox(e: MouseEvent) {\n e.stopPropagation()\n\n this.dispatchEvent(\n new CustomEvent('check-in-tree', {\n bubbles: true,\n composed: true,\n detail: this.record\n })\n )\n\n this.requestUpdate()\n }\n\n onClickExpander(e: MouseEvent) {\n e.stopPropagation()\n\n this.dispatchEvent(\n new CustomEvent(this.record.__expanded__ ? 'collapsed' : 'expanded', {\n bubbles: true,\n composed: true,\n detail: this.record\n })\n )\n\n this.requestUpdate()\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '../src/index.js';
|
|
2
|
+
import '../src/filters/filters-form.js';
|
|
3
|
+
import '../src/sorters/sorters-control.js';
|
|
4
|
+
import '../src/record-view/record-creator.js';
|
|
5
|
+
import '@operato/popup/ox-popup-list.js';
|
|
6
|
+
import '@material/mwc-icon';
|
|
7
|
+
import { TemplateResult } from 'lit';
|
|
8
|
+
declare const _default: {
|
|
9
|
+
title: string;
|
|
10
|
+
component: string;
|
|
11
|
+
argTypes: {
|
|
12
|
+
config: {
|
|
13
|
+
control: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
interface Story<T> {
|
|
19
|
+
(args: T): TemplateResult;
|
|
20
|
+
args?: Partial<T>;
|
|
21
|
+
argTypes?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface ArgTypes {
|
|
24
|
+
config: object;
|
|
25
|
+
}
|
|
26
|
+
export declare const Regular: Story<ArgTypes>;
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import '../src/index.js';
|
|
2
|
+
import '../src/filters/filters-form.js';
|
|
3
|
+
import '../src/sorters/sorters-control.js';
|
|
4
|
+
import '../src/record-view/record-creator.js';
|
|
5
|
+
import '@operato/popup/ox-popup-list.js';
|
|
6
|
+
import '@material/mwc-icon';
|
|
7
|
+
import { html } from 'lit';
|
|
8
|
+
const fetchHandler = async ({ page, limit }) => {
|
|
9
|
+
var total = 120993;
|
|
10
|
+
var start = (page - 1) * limit;
|
|
11
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
12
|
+
var records = Array(limit * page > total ? total % limit : limit)
|
|
13
|
+
.fill('')
|
|
14
|
+
.map((item, idx) => {
|
|
15
|
+
return {
|
|
16
|
+
id: String(idx),
|
|
17
|
+
name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,
|
|
18
|
+
description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,
|
|
19
|
+
active: Math.round(Math.random() * 2) % 2 ? true : false,
|
|
20
|
+
accval: Math.random(),
|
|
21
|
+
createdAt: Date.now(),
|
|
22
|
+
updatedAt: Date.now(),
|
|
23
|
+
children: [
|
|
24
|
+
...Array.from({ length: 3 }, (_, idx) => {
|
|
25
|
+
return {
|
|
26
|
+
id: `sub:${idx}`,
|
|
27
|
+
name: 'subitem' + idx,
|
|
28
|
+
description: 'sub items...',
|
|
29
|
+
active: Math.round(Math.random() * 2) % 2 ? true : false,
|
|
30
|
+
children: [
|
|
31
|
+
...Array.from({ length: 3 }, (_, idx2) => {
|
|
32
|
+
return {
|
|
33
|
+
id: `sub-sub:${idx}:${idx2}`,
|
|
34
|
+
name: 'sub-subitem:' + idx2,
|
|
35
|
+
description: 'sub sub items...',
|
|
36
|
+
active: Math.round(Math.random() * 2) % 2 ? true : false,
|
|
37
|
+
accval: Math.random(),
|
|
38
|
+
children: [],
|
|
39
|
+
createdAt: Date.now(),
|
|
40
|
+
updatedAt: Date.now()
|
|
41
|
+
};
|
|
42
|
+
})
|
|
43
|
+
],
|
|
44
|
+
createdAt: Date.now(),
|
|
45
|
+
updatedAt: Date.now()
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
total,
|
|
53
|
+
records
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const config = {
|
|
57
|
+
list: {
|
|
58
|
+
thumbnail: 'thumbnail',
|
|
59
|
+
fields: ['name', 'description'],
|
|
60
|
+
details: ['role', 'email']
|
|
61
|
+
},
|
|
62
|
+
columns: [
|
|
63
|
+
{
|
|
64
|
+
type: 'gutter',
|
|
65
|
+
gutterName: 'dirty',
|
|
66
|
+
fixed: true
|
|
67
|
+
},
|
|
68
|
+
// {
|
|
69
|
+
// type: 'gutter',
|
|
70
|
+
// gutterName: 'sequence',
|
|
71
|
+
// fixed: true
|
|
72
|
+
// },
|
|
73
|
+
{
|
|
74
|
+
type: 'tree',
|
|
75
|
+
name: 'name',
|
|
76
|
+
label: true,
|
|
77
|
+
header: 'name',
|
|
78
|
+
record: {
|
|
79
|
+
editable: false,
|
|
80
|
+
options: {
|
|
81
|
+
selectable: true /* with checkbox */,
|
|
82
|
+
childrenProperty: 'children'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
filter: 'search',
|
|
86
|
+
sortable: true,
|
|
87
|
+
width: 200,
|
|
88
|
+
fixed: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'gutter',
|
|
92
|
+
gutterName: 'row-selector',
|
|
93
|
+
multiple: true
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: 'string',
|
|
97
|
+
name: 'description',
|
|
98
|
+
header: 'description',
|
|
99
|
+
filter: 'search',
|
|
100
|
+
record: {
|
|
101
|
+
editable: true,
|
|
102
|
+
align: 'left'
|
|
103
|
+
},
|
|
104
|
+
width: 200
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'boolean',
|
|
108
|
+
name: 'active',
|
|
109
|
+
header: 'active',
|
|
110
|
+
record: {
|
|
111
|
+
editable: true
|
|
112
|
+
},
|
|
113
|
+
filter: true,
|
|
114
|
+
sortable: true,
|
|
115
|
+
width: 60
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'number',
|
|
119
|
+
name: 'accval',
|
|
120
|
+
label: true,
|
|
121
|
+
header: 'accval',
|
|
122
|
+
record: {
|
|
123
|
+
editable: true,
|
|
124
|
+
align: 'right'
|
|
125
|
+
},
|
|
126
|
+
accumulator: 'sum',
|
|
127
|
+
sortable: true,
|
|
128
|
+
width: 130
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: 'datetime',
|
|
132
|
+
name: 'updatedAt',
|
|
133
|
+
header: 'updated at',
|
|
134
|
+
record: {
|
|
135
|
+
editable: true,
|
|
136
|
+
defaultValue: {
|
|
137
|
+
name: 'now'
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
filter: 'between',
|
|
141
|
+
sortable: true,
|
|
142
|
+
width: 180
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
rows: {
|
|
146
|
+
selectable: {
|
|
147
|
+
multiple: true
|
|
148
|
+
},
|
|
149
|
+
handlers: {
|
|
150
|
+
// focus: 'select-row-toggle'
|
|
151
|
+
},
|
|
152
|
+
classifier: function (record, rowIndex) {
|
|
153
|
+
const rate = record['rate'];
|
|
154
|
+
const emphasized = rate < 10 ? ['black', 'white'] : rate < 25 ? ['yellow', 'blue'] : rate < 40 ? ['cyan', 'red'] : undefined;
|
|
155
|
+
return {
|
|
156
|
+
emphasized
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
accumulator: true
|
|
160
|
+
},
|
|
161
|
+
sorters: [
|
|
162
|
+
{
|
|
163
|
+
name: 'name',
|
|
164
|
+
desc: true
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'email'
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
pagination: {
|
|
171
|
+
pages: [20, 30, 50, 100, 200]
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
export default {
|
|
175
|
+
title: 'tree column with checkbox',
|
|
176
|
+
component: 'ox-grist',
|
|
177
|
+
argTypes: {
|
|
178
|
+
config: { control: 'object' }
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const Template = ({ config }) => html ` <link
|
|
182
|
+
href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
|
|
183
|
+
rel="stylesheet"
|
|
184
|
+
/>
|
|
185
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
186
|
+
<link href="/themes/oops-theme.css" rel="stylesheet" />
|
|
187
|
+
<link href="/themes/grist-theme.css" rel="stylesheet" />
|
|
188
|
+
|
|
189
|
+
<style>
|
|
190
|
+
ox-grist {
|
|
191
|
+
width: 100%;
|
|
192
|
+
height: 600px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
[slot='headroom'] {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: row;
|
|
198
|
+
align-items: center;
|
|
199
|
+
padding: var(--padding-default) var(--padding-wide);
|
|
200
|
+
background-color: var(--theme-white-color);
|
|
201
|
+
box-shadow: var(--box-shadow);
|
|
202
|
+
|
|
203
|
+
--mdc-icon-size: 24px;
|
|
204
|
+
}
|
|
205
|
+
#sorters mwc-icon,
|
|
206
|
+
#modes mwc-icon {
|
|
207
|
+
--mdc-icon-size: 18px;
|
|
208
|
+
}
|
|
209
|
+
#sorters {
|
|
210
|
+
margin-left: auto;
|
|
211
|
+
margin-right: var(--margin-default);
|
|
212
|
+
padding-left: var(--padding-narrow);
|
|
213
|
+
border-bottom: var(--border-dark-color);
|
|
214
|
+
position: relative;
|
|
215
|
+
color: var(--secondary-color);
|
|
216
|
+
font-size: var(--fontsize-default);
|
|
217
|
+
user-select: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
#sorters > * {
|
|
221
|
+
padding: var(--padding-narrow);
|
|
222
|
+
vertical-align: middle;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
#modes > * {
|
|
226
|
+
padding: var(--padding-narrow);
|
|
227
|
+
opacity: 0.5;
|
|
228
|
+
color: var(--primary-text-color);
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#modes > mwc-icon[active] {
|
|
233
|
+
border-radius: 9px;
|
|
234
|
+
background-color: rgba(var(--primary-color-rgb), 0.05);
|
|
235
|
+
opacity: 1;
|
|
236
|
+
color: var(--secondary-text-color);
|
|
237
|
+
cursor: default;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
#modes > mwc-icon:hover {
|
|
241
|
+
opacity: 1;
|
|
242
|
+
color: var(--secondary-text-color);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
#add {
|
|
246
|
+
width: 50px;
|
|
247
|
+
text-align: right;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#add button {
|
|
251
|
+
background-color: var(--primary-color);
|
|
252
|
+
border: 0;
|
|
253
|
+
border-radius: 50%;
|
|
254
|
+
padding: 5px;
|
|
255
|
+
width: 36px;
|
|
256
|
+
height: 36px;
|
|
257
|
+
cursor: pointer;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
#add button:hover {
|
|
261
|
+
background-color: var(--focus-background-color);
|
|
262
|
+
box-shadow: var(--box-shadow);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
#add button mwc-icon {
|
|
266
|
+
font-size: 2em;
|
|
267
|
+
color: var(--theme-white-color);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
#filters {
|
|
271
|
+
display: flex;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
align-items: center;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
#filters * {
|
|
277
|
+
margin-right: var(--margin-default);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@media only screen and (max-width: 460px) {
|
|
281
|
+
#filters {
|
|
282
|
+
flex-direction: column;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
#modes {
|
|
286
|
+
display: none;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
</style>
|
|
290
|
+
|
|
291
|
+
<ox-grist
|
|
292
|
+
mode="GRID"
|
|
293
|
+
.config=${config}
|
|
294
|
+
.fetchHandler=${fetchHandler}
|
|
295
|
+
@filters-change=${(e) => console.log('filters', e.target.filters)}
|
|
296
|
+
>
|
|
297
|
+
<div slot="headroom">
|
|
298
|
+
<div id="filters">
|
|
299
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<div id="sorters">
|
|
303
|
+
Sort
|
|
304
|
+
<mwc-icon
|
|
305
|
+
@click=${(e) => {
|
|
306
|
+
const target = e.currentTarget;
|
|
307
|
+
target.closest('#sorters').querySelector('#sorter-control').open({
|
|
308
|
+
right: 0,
|
|
309
|
+
top: target.offsetTop + target.offsetHeight
|
|
310
|
+
});
|
|
311
|
+
}}
|
|
312
|
+
>expand_more</mwc-icon
|
|
313
|
+
>
|
|
314
|
+
<ox-popup id="sorter-control">
|
|
315
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
316
|
+
</ox-popup>
|
|
317
|
+
</div>
|
|
318
|
+
|
|
319
|
+
<ox-record-creator id="add" light-popup>
|
|
320
|
+
<button><mwc-icon>add</mwc-icon></button>
|
|
321
|
+
</ox-record-creator>
|
|
322
|
+
</div>
|
|
323
|
+
</ox-grist>`;
|
|
324
|
+
export const Regular = Template.bind({});
|
|
325
|
+
Regular.args = {
|
|
326
|
+
config
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=tree-column-with-checkbox.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-column-with-checkbox.stories.js","sourceRoot":"","sources":["../../stories/tree-column-with-checkbox.stories.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,gCAAgC,CAAA;AACvC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,iCAAiC,CAAA;AACxC,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAW1C,MAAM,YAAY,GAAiB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3D,IAAI,KAAK,GAAG,MAAM,CAAA;IAClB,IAAI,KAAK,GAAG,CAAC,IAAK,GAAG,CAAC,CAAC,GAAG,KAAM,CAAA;IAEhC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;IAEtD,IAAI,OAAO,GAAG,KAAK,CAAC,KAAM,GAAG,IAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAM,CAAC,CAAC,CAAC,KAAK,CAAC;SACjE,IAAI,CAAC,EAAE,CAAC;SACR,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACjB,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;YACf,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE;YAC1E,WAAW,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,KAAK,GAAG,GAAG,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AC,IAAI,GAAG;IACb,MAAM;CACP,CAAA","sourcesContent":["import '../src/index.js'\nimport '../src/filters/filters-form.js'\nimport '../src/sorters/sorters-control.js'\nimport '../src/record-view/record-creator.js'\nimport '@operato/popup/ox-popup-list.js'\nimport '@material/mwc-icon'\n\nimport { html, TemplateResult } from 'lit'\n\nimport {\n ColumnConfig,\n FetchHandler,\n GristClassifier,\n GristEventHandlerSet,\n GristRecord,\n ValidationCallback\n} from '../src/types.js'\n\nconst fetchHandler: FetchHandler = async ({ page, limit }) => {\n var total = 120993\n var start = (page! - 1) * limit!\n\n await new Promise(resolve => setTimeout(resolve, 500))\n\n var records = Array(limit! * page! > total ? total % limit! : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: String(idx),\n name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,\n description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,\n active: Math.round(Math.random() * 2) % 2 ? true : false,\n accval: Math.random(),\n createdAt: Date.now(),\n updatedAt: Date.now(),\n children: [\n ...Array.from({ length: 3 }, (_, idx) => {\n return {\n id: `sub:${idx}`,\n name: 'subitem' + idx,\n description: 'sub items...',\n active: Math.round(Math.random() * 2) % 2 ? true : false,\n children: [\n ...Array.from({ length: 3 }, (_, idx2) => {\n return {\n id: `sub-sub:${idx}:${idx2}`,\n name: 'sub-subitem:' + idx2,\n description: 'sub sub items...',\n active: Math.round(Math.random() * 2) % 2 ? true : false,\n accval: Math.random(),\n children: [],\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n ],\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n ]\n }\n })\n\n return {\n total,\n records\n }\n}\n\nconst config = {\n list: {\n thumbnail: 'thumbnail',\n fields: ['name', 'description'],\n details: ['role', 'email']\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty',\n fixed: true\n },\n // {\n // type: 'gutter',\n // gutterName: 'sequence',\n // fixed: true\n // },\n {\n type: 'tree',\n name: 'name',\n label: true,\n header: 'name',\n record: {\n editable: false,\n options: {\n selectable: true /* with checkbox */,\n childrenProperty: 'children'\n }\n },\n filter: 'search',\n sortable: true,\n width: 200,\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true\n },\n {\n type: 'string',\n name: 'description',\n header: 'description',\n filter: 'search',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200\n },\n {\n type: 'boolean',\n name: 'active',\n header: 'active',\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'number',\n name: 'accval',\n label: true,\n header: 'accval',\n record: {\n editable: true,\n align: 'right'\n },\n accumulator: 'sum',\n sortable: true,\n width: 130\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true,\n defaultValue: {\n name: 'now'\n }\n },\n filter: 'between',\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n },\n handlers: {\n // focus: 'select-row-toggle'\n },\n classifier: function (record, rowIndex) {\n const rate = record['rate']\n const emphasized =\n rate < 10 ? ['black', 'white'] : rate < 25 ? ['yellow', 'blue'] : rate < 40 ? ['cyan', 'red'] : undefined\n return {\n emphasized\n }\n } as GristClassifier,\n accumulator: true\n },\n sorters: [\n {\n name: 'name',\n desc: true\n },\n {\n name: 'email'\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n}\n\nexport default {\n title: 'tree column with checkbox',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n config: object\n}\n\nconst Template: Story<ArgTypes> = ({ config }: ArgTypes) => html` <link\n href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\"\n rel=\"stylesheet\"\n />\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"/themes/oops-theme.css\" rel=\"stylesheet\" />\n <link href=\"/themes/grist-theme.css\" rel=\"stylesheet\" />\n\n <style>\n ox-grist {\n width: 100%;\n height: 600px;\n }\n\n [slot='headroom'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n\n --mdc-icon-size: 24px;\n }\n #sorters mwc-icon,\n #modes mwc-icon {\n --mdc-icon-size: 18px;\n }\n #sorters {\n margin-left: auto;\n margin-right: var(--margin-default);\n padding-left: var(--padding-narrow);\n border-bottom: var(--border-dark-color);\n position: relative;\n color: var(--secondary-color);\n font-size: var(--fontsize-default);\n user-select: none;\n }\n\n #sorters > * {\n padding: var(--padding-narrow);\n vertical-align: middle;\n }\n\n #modes > * {\n padding: var(--padding-narrow);\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-icon[active] {\n border-radius: 9px;\n background-color: rgba(var(--primary-color-rgb), 0.05);\n opacity: 1;\n color: var(--secondary-text-color);\n cursor: default;\n }\n\n #modes > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add {\n width: 50px;\n text-align: right;\n }\n\n #add button {\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\n cursor: pointer;\n }\n\n #add button:hover {\n background-color: var(--focus-background-color);\n box-shadow: var(--box-shadow);\n }\n\n #add button mwc-icon {\n font-size: 2em;\n color: var(--theme-white-color);\n }\n\n #filters {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n #filters * {\n margin-right: var(--margin-default);\n }\n\n @media only screen and (max-width: 460px) {\n #filters {\n flex-direction: column;\n }\n\n #modes {\n display: none;\n }\n }\n </style>\n\n <ox-grist\n mode=\"GRID\"\n .config=${config}\n .fetchHandler=${fetchHandler}\n @filters-change=${(e: Event) => console.log('filters', (e.target as any).filters)}\n >\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <mwc-icon\n @click=${(e: Event) => {\n const target = e.currentTarget as HTMLElement\n ;(target.closest('#sorters')!.querySelector('#sorter-control') as any).open({\n right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <ox-record-creator id=\"add\" light-popup>\n <button><mwc-icon>add</mwc-icon></button>\n </ox-record-creator>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '../src/index.js';
|
|
2
|
+
import '../src/filters/filters-form.js';
|
|
3
|
+
import '../src/sorters/sorters-control.js';
|
|
4
|
+
import '../src/record-view/record-creator.js';
|
|
5
|
+
import '@operato/popup/ox-popup-list.js';
|
|
6
|
+
import '@material/mwc-icon';
|
|
7
|
+
import { TemplateResult } from 'lit';
|
|
8
|
+
declare const _default: {
|
|
9
|
+
title: string;
|
|
10
|
+
component: string;
|
|
11
|
+
argTypes: {
|
|
12
|
+
config: {
|
|
13
|
+
control: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
interface Story<T> {
|
|
19
|
+
(args: T): TemplateResult;
|
|
20
|
+
args?: Partial<T>;
|
|
21
|
+
argTypes?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface ArgTypes {
|
|
24
|
+
config: object;
|
|
25
|
+
}
|
|
26
|
+
export declare const Regular: Story<ArgTypes>;
|