@operato/data-tree 8.0.0-beta.0 β†’ 8.0.0-beta.2

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,24 @@
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
+ ## [8.0.0-beta.2](https://github.com/hatiolab/operato/compare/v8.0.0-beta.1...v8.0.0-beta.2) (2025-01-08)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * typo .npmignore ([d9c0c8c](https://github.com/hatiolab/operato/commit/d9c0c8c79abc688c3c2cfb6c37fcb689483a5977))
12
+
13
+
14
+
15
+ ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
21
+
22
+
23
+
6
24
  ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
7
25
 
8
26
  **Note:** Version bump only for package @operato/data-tree
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/data-tree",
3
- "version": "8.0.0-beta.0",
3
+ "version": "8.0.0-beta.2",
4
4
  "description": "User interface for tree structure data",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "storybook:build": "tsc && build-storybook"
50
50
  },
51
51
  "dependencies": {
52
- "@operato/styles": "^8.0.0-beta.0",
52
+ "@operato/styles": "^8.0.0-beta.2",
53
53
  "i18next": "^23.11.5",
54
54
  "lit": "^3.1.2",
55
55
  "lodash-es": "^4.17.21"
@@ -87,5 +87,5 @@
87
87
  "prettier --write"
88
88
  ]
89
89
  },
90
- "gitHead": "c4e9cc245659d050a9ffd66542083a6daad4bcb9"
90
+ "gitHead": "ee1b5124995accb99272d3b5854f3df1d8746dda"
91
91
  }
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -1,52 +0,0 @@
1
- import { i18next } from '@operato/i18n'
2
-
3
- export const globalTypes = {
4
- locale: {
5
- name: 'Locale',
6
- description: 'Internationalization locale',
7
- toolbar: {
8
- icon: 'globe',
9
- items: [
10
- { value: 'en', right: 'πŸ‡ΊπŸ‡Έ', title: 'English' },
11
- { value: 'ko', right: 'πŸ‡°πŸ‡·', title: 'ν•œκ΅­μ–΄' },
12
- { value: 'zh', right: 'πŸ‡¨πŸ‡³', title: 'δΈ­ζ–‡' },
13
- { value: 'ja', right: 'πŸ‡―πŸ‡΅', title: 'ζ—₯本θͺž' },
14
- { value: 'ms', right: 'πŸ‡²πŸ‡Ύ', title: 'Bahasa Melayu' }
15
- ],
16
- showName: true
17
- }
18
- },
19
- theme: {
20
- name: 'Theme',
21
- description: 'Global theme for components',
22
- toolbar: {
23
- icon: 'paintbrush',
24
- items: [
25
- { value: 'light', title: 'Light' },
26
- { value: 'dark', title: 'Dark' }
27
- ],
28
- showName: true
29
- }
30
- }
31
- }
32
-
33
- export const decorators = [
34
- (Story, context) => {
35
- const { locale, theme } = context.globals
36
-
37
- if (locale) {
38
- i18next.changeLanguage(locale)
39
- }
40
-
41
- // Set the theme class for the document
42
- if (theme === 'dark') {
43
- document.documentElement.classList.add('dark')
44
- document.documentElement.classList.remove('light')
45
- } else {
46
- document.documentElement.classList.add('light')
47
- document.documentElement.classList.remove('dark')
48
- }
49
-
50
- return Story()
51
- }
52
- ]
@@ -1,8 +0,0 @@
1
- import { storybookPlugin } from '@web/dev-server-storybook';
2
- import baseConfig from '../web-dev-server.config.mjs';
3
-
4
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
- ...baseConfig,
6
- open: '/',
7
- plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
- });
package/demo/favicon.ico DELETED
Binary file
@@ -1,144 +0,0 @@
1
- <!doctype html>
2
- <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
6
-
7
- <style>
8
- body {
9
- /* box-sizing: border-box; */
10
- margin: 0;
11
- padding: 0;
12
- overflow: hidden;
13
-
14
- /* This is a font-stack that tries to use the system-default sans-serifs first */
15
- font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
16
- line-height: 1.5;
17
- -webkit-font-smoothing: antialiased;
18
- }
19
-
20
- #app {
21
- width: 100vw;
22
- height: 100dvh;
23
-
24
- display: flex;
25
- flex-direction: column;
26
- }
27
-
28
- #demo {
29
- flex: 1;
30
-
31
- display: flex;
32
- flex-direction: column;
33
- overflow: hidden;
34
- }
35
-
36
- grist-demo {
37
- flex: 1;
38
- overflow: auto;
39
- }
40
- </style>
41
- <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
42
- <link
43
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
44
- rel="stylesheet"
45
- />
46
- <link
47
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
48
- rel="stylesheet"
49
- />
50
- <link
51
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
52
- rel="stylesheet"
53
- />
54
-
55
- <link href="/themes/app-theme.css" rel="stylesheet" />
56
- <link href="/themes/oops-theme.css" rel="stylesheet" />
57
- <link href="/themes/grist-theme.css" rel="stylesheet" />
58
- </head>
59
-
60
- <body>
61
- <script type="module">
62
- import { LitElement, html, css, render } from 'lit'
63
- import '../dist/src/ox-tree-vertical.js'
64
-
65
- const data = {
66
- label: 'Home',
67
- children: [
68
- {
69
- label: 'About us',
70
- children: [
71
- {
72
- label: 'Our history',
73
- children: [
74
- {
75
- label: 'Founder'
76
- }
77
- ]
78
- },
79
- {
80
- label: 'Our board',
81
- children: [
82
- {
83
- label: 'Brad Whiteman'
84
- },
85
- {
86
- label: 'Cynthia Tolken'
87
- },
88
- {
89
- label: 'Bobby Founderson'
90
- }
91
- ]
92
- }
93
- ]
94
- },
95
- {
96
- label: 'Our products',
97
- children: [
98
- {
99
- label: 'The Widget 2000β„’',
100
- children: [
101
- {
102
- label: 'Order form'
103
- }
104
- ]
105
- },
106
- {
107
- label: 'The McGuffin V2',
108
- children: [
109
- {
110
- label: 'Order form'
111
- }
112
- ]
113
- }
114
- ]
115
- },
116
- {
117
- label: 'Contact us',
118
- children: [
119
- {
120
- label: 'Social media',
121
- children: [
122
- {
123
- label: 'Facebook'
124
- }
125
- ]
126
- }
127
- ]
128
- }
129
- ]
130
- }
131
-
132
- setTimeout(() => {
133
- render(
134
- html` <ox-tree-vertical .data=${data} id-property="label"></ox-tree-vertical> `,
135
- document.querySelector('#demo')
136
- )
137
- })
138
- </script>
139
-
140
- <div id="app">
141
- <div id="demo"></div>
142
- </div>
143
- </body>
144
- </html>
package/demo/index.html DELETED
@@ -1,107 +0,0 @@
1
- <!doctype html>
2
- <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
6
-
7
- <style>
8
- body {
9
- /* box-sizing: border-box; */
10
- margin: 0;
11
- padding: 0;
12
- overflow: hidden;
13
-
14
- /* This is a font-stack that tries to use the system-default sans-serifs first */
15
- font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
16
- line-height: 1.5;
17
- -webkit-font-smoothing: antialiased;
18
- }
19
-
20
- #app {
21
- width: 100vw;
22
- height: 100dvh;
23
-
24
- display: flex;
25
- flex-direction: column;
26
- }
27
-
28
- #demo {
29
- flex: 1;
30
-
31
- display: flex;
32
- flex-direction: column;
33
- overflow: hidden;
34
- }
35
-
36
- grist-demo {
37
- flex: 1;
38
- overflow: auto;
39
- }
40
- </style>
41
- <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
42
- <link
43
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
44
- rel="stylesheet"
45
- />
46
- <link
47
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
48
- rel="stylesheet"
49
- />
50
- <link
51
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
52
- rel="stylesheet"
53
- />
54
-
55
- <link href="/themes/app-theme.css" rel="stylesheet" />
56
- <link href="/themes/oops-theme.css" rel="stylesheet" />
57
- <link href="/themes/grist-theme.css" rel="stylesheet" />
58
- </head>
59
-
60
- <body>
61
- <script type="module">
62
- import { LitElement, html, css, render } from 'lit'
63
- import '../dist/src/ox-tree.js'
64
-
65
- const data = {
66
- label: 'AAAAA',
67
- children: [
68
- {
69
- label: 'AAAAA-1',
70
- children: [
71
- {
72
- label: 'AAAAA-2'
73
- }
74
- ]
75
- },
76
- {
77
- label: 'BBBBB-1',
78
- children: [
79
- {
80
- label: 'BBBBB-2'
81
- },
82
- {
83
- label: 'BBBBB-21'
84
- }
85
- ]
86
- },
87
- {
88
- label: 'CCCCC-1',
89
- children: [
90
- {
91
- label: 'CCCCC-2'
92
- }
93
- ]
94
- }
95
- ]
96
- }
97
-
98
- setTimeout(() => {
99
- render(html` <ox-tree .data=${data} id-property="label"></ox-tree> `, document.querySelector('#demo'))
100
- })
101
- </script>
102
-
103
- <div id="app">
104
- <div id="demo"></div>
105
- </div>
106
- </body>
107
- </html>
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './ox-tree'
2
- export * from './ox-tree-vertical'
3
- export * from './ox-tree-horizontal'
@@ -1,260 +0,0 @@
1
- import { html, css, LitElement, TemplateResult, nothing } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
- import { ScrollbarStyles } from '@operato/styles'
4
-
5
- type TreeItem = {
6
- [key: string]: any
7
- __status__?: { [state: string]: boolean | string }
8
- }
9
-
10
- @customElement('ox-tree-horizontal')
11
- export class TreeViewHorizontal extends LitElement {
12
- static styles = [
13
- ScrollbarStyles,
14
- css`
15
- :host {
16
- display: block;
17
- overflow: auto;
18
- padding: 1em;
19
- }
20
-
21
- ul,
22
- li {
23
- list-style: none;
24
- margin: 0;
25
- padding: 0;
26
- position: relative;
27
- }
28
-
29
- ul[root] {
30
- margin: 0 0 1em;
31
- text-align: left;
32
- }
33
-
34
- ul[root]:before {
35
- display: none;
36
- }
37
-
38
- ul {
39
- display: flex;
40
- flex-direction: column;
41
- align-items: flex-start;
42
- justify-content: center;
43
- }
44
-
45
- ul {
46
- width: 100%;
47
- }
48
-
49
- li {
50
- display: flex;
51
- flex-direction: row;
52
- position: relative;
53
- align-items: center;
54
- }
55
-
56
- li:before,
57
- li:after {
58
- content: '';
59
- position: absolute;
60
- left: -1em;
61
- border-left: 1px solid #666;
62
- }
63
-
64
- li:before {
65
- top: 0;
66
- bottom: 50%;
67
- }
68
-
69
- li:after {
70
- top: 50%;
71
- bottom: 0;
72
- border-top: 1px solid #666;
73
- width: 1em;
74
- }
75
-
76
- ul[root] > li:after {
77
- content: none;
78
- }
79
-
80
- li:first-child:before {
81
- top: 50%;
82
- }
83
-
84
- li:last-child:after {
85
- bottom: 50%;
86
- }
87
-
88
- li > ul {
89
- padding-left: 2em;
90
- position: relative;
91
- }
92
-
93
- li > ul:before {
94
- content: '';
95
- position: absolute;
96
- top: 0;
97
- bottom: -2px;
98
- left: 0;
99
- border-bottom: 1px solid #666;
100
- }
101
-
102
- code,
103
- span {
104
- border: solid 0.1em #666;
105
- border-radius: 0.2em;
106
- display: inline-block;
107
- margin: 0.3em 0;
108
- position: relative;
109
- min-width: 120px;
110
- background-color: #f9f9f9;
111
- }
112
-
113
- span[selected] {
114
- color: var(--md-sys-color-on-tertiary);
115
- background-color: var(--md-sys-color-tertiary);
116
- }
117
-
118
- ul:before,
119
- code:before,
120
- span:before {
121
- content: '';
122
- width: 1em;
123
- top: 50%;
124
- position: absolute;
125
- transform: translateY(-50%);
126
- }
127
-
128
- ul:before {
129
- left: -1em;
130
- }
131
-
132
- code:before,
133
- span:before {
134
- left: -1.1em;
135
- }
136
-
137
- ul[root] > li {
138
- margin-left: 0;
139
- }
140
-
141
- ul[root] > li:before,
142
- ul[root] > li:after,
143
- ul[root] > li > code:before,
144
- ul[root] > li > span:before {
145
- outline: none;
146
- }
147
-
148
- span {
149
- display: inline-block;
150
- background-color: var(--md-sys-color-surface);
151
-
152
- div[header] {
153
- font-weight: bold;
154
- font-size: 0.8em;
155
- color: var(--md-sys-color-on-primary, #fff);
156
- background-color: var(--md-sys-color-primary, #333);
157
- padding: 0.5em 1em;
158
- text-align: center;
159
- width: 100%;
160
- box-sizing: border-box;
161
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
162
- }
163
-
164
- div[label] {
165
- font-size: 1em;
166
- background-color: transparent;
167
- padding: 0.5em;
168
- text-align: left;
169
- }
170
-
171
- div[description] {
172
- font-size: 0.8em;
173
- background-color: transparent;
174
- padding: 0.5em;
175
- text-align: left;
176
- }
177
- }
178
- `
179
- ]
180
-
181
- @property({ type: Object }) data?: TreeItem | TreeItem[]
182
- @property({ type: Object }) selected?: TreeItem
183
- @property({ type: String, attribute: 'id-property' }) idProperty: string = 'id'
184
- @property({ type: String, attribute: 'label-property' }) labelProperty: string = 'label'
185
- @property({ type: String, attribute: 'description-property' }) descriptionProperty?: string
186
- @property({ type: String, attribute: 'children-property' }) childrenProperty: string = 'children'
187
-
188
- render() {
189
- if (!this.data) return html``
190
-
191
- const dataArray = Array.isArray(this.data) ? this.data : [this.data]
192
-
193
- return html`
194
- ${dataArray.map(
195
- root => html`
196
- <ul root>
197
- ${this.renderItem(root)}
198
- </ul>
199
- `
200
- )}
201
- `
202
- }
203
-
204
- renderItem(item: TreeItem): TemplateResult {
205
- const id = item[this.idProperty]
206
- const label = item[this.labelProperty]
207
- const children = item[this.childrenProperty] as TreeItem[]
208
-
209
- const expandable = children && children.length > 0
210
- const selected = id === this.selected?.[this.idProperty]
211
-
212
- return html`
213
- <li .item=${item}>
214
- <span
215
- ?selected=${selected}
216
- @click=${this.onClickSelect.bind(this)}
217
- @dblclick=${this.onClickSelectConfirm.bind(this)}
218
- >
219
- <div header>${id}</div>
220
- <div label>${label}</div>
221
- ${this.descriptionProperty ? html` <div description>${item[this.descriptionProperty]}&nbsp;</div>` : nothing}
222
- </span>
223
-
224
- ${expandable
225
- ? html`
226
- <ul>
227
- ${children.map(child => this.renderItem(child))}
228
- </ul>
229
- `
230
- : html``}
231
- </li>
232
- `
233
- }
234
-
235
- onClickSelect(e: MouseEvent) {
236
- e.stopPropagation()
237
-
238
- const target = e.target as HTMLElement
239
- this.selected = (target.closest('li') as any)?.item
240
-
241
- this.dispatchEvent(
242
- new CustomEvent('select', {
243
- detail: this.selected
244
- })
245
- )
246
- }
247
-
248
- onClickSelectConfirm(e: MouseEvent) {
249
- e.stopPropagation()
250
-
251
- const target = e.target as HTMLElement
252
- this.selected = (target.closest('li') as any)?.item
253
-
254
- this.dispatchEvent(
255
- new CustomEvent('select-confirm', {
256
- detail: this.selected
257
- })
258
- )
259
- }
260
- }