@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.
- package/.editorconfig +29 -0
- package/.storybook/main.js +3 -0
- package/.storybook/server.mjs +8 -0
- package/CHANGELOG.md +11 -0
- package/README.md +75 -0
- package/dist/src/grist-editor/index.d.ts +1 -0
- package/dist/src/grist-editor/index.js +7 -0
- package/dist/src/grist-editor/index.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-attribute.d.ts +12 -0
- package/dist/src/grist-editor/ox-grist-editor-attribute.js +81 -0
- package/dist/src/grist-editor/ox-grist-editor-attribute.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-attributes.d.ts +12 -0
- package/dist/src/grist-editor/ox-grist-editor-attributes.js +81 -0
- package/dist/src/grist-editor/ox-grist-editor-attributes.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-attribute.d.ts +13 -0
- package/dist/src/grist-editor/ox-popup-attribute.js +92 -0
- package/dist/src/grist-editor/ox-popup-attribute.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-attributes.d.ts +13 -0
- package/dist/src/grist-editor/ox-popup-attributes.js +92 -0
- package/dist/src/grist-editor/ox-popup-attributes.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ox-attribute-form.d.ts +14 -0
- package/dist/src/ox-attribute-form.js +199 -0
- package/dist/src/ox-attribute-form.js.map +1 -0
- package/dist/src/ox-attribute-view.d.ts +12 -0
- package/dist/src/ox-attribute-view.js +176 -0
- package/dist/src/ox-attribute-view.js.map +1 -0
- package/dist/src/types.d.ts +23 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/stories/ox-attribute-form.stories.d.ts +18 -0
- package/dist/stories/ox-attribute-form.stories.js +80 -0
- package/dist/stories/ox-attribute-form.stories.js.map +1 -0
- package/dist/stories/ox-attribute-view.stories.d.ts +18 -0
- package/dist/stories/ox-attribute-view.stories.js +73 -0
- package/dist/stories/ox-attribute-view.stories.js.map +1 -0
- package/dist/stories/ox-grist-editor-attribute.stories.d.ts +25 -0
- package/dist/stories/ox-grist-editor-attribute.stories.js +310 -0
- package/dist/stories/ox-grist-editor-attribute.stories.js.map +1 -0
- package/dist/stories/ox-grist-editor-attributes.stories.d.ts +25 -0
- package/dist/stories/ox-grist-editor-attributes.stories.js +310 -0
- package/dist/stories/ox-grist-editor-attributes.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +106 -0
- package/src/grist-editor/index.ts +10 -0
- package/src/grist-editor/ox-grist-editor-attributes.ts +94 -0
- package/src/grist-editor/ox-popup-attributes.ts +93 -0
- package/src/index.ts +1 -0
- package/src/ox-attribute-form.ts +218 -0
- package/src/ox-attribute-view.ts +182 -0
- package/src/types.ts +23 -0
- package/stories/ox-attribute-form.stories.ts +94 -0
- package/stories/ox-attribute-view.stories.ts +87 -0
- package/stories/ox-grist-editor-attributes.stories.ts +328 -0
- package/themes/app-theme.css +142 -0
- package/themes/form-theme.css +75 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/translations/en.json +4 -0
- package/translations/ko.json +4 -0
- package/translations/ms.json +4 -0
- package/translations/zh.json +1 -0
- package/tsconfig.json +23 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SelectOption = { text: string; value: string }
|
|
2
|
+
export type SelectOptions = SelectOption[]
|
|
3
|
+
|
|
4
|
+
export type TypeOptions = {
|
|
5
|
+
options?: SelectOptions
|
|
6
|
+
[prop: string]: any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type AttributeItem = {
|
|
10
|
+
name: string
|
|
11
|
+
description: string
|
|
12
|
+
tag: string
|
|
13
|
+
type: string
|
|
14
|
+
active: boolean
|
|
15
|
+
hidden: boolean
|
|
16
|
+
options: TypeOptions
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type AttributeSet = {
|
|
20
|
+
entity: string
|
|
21
|
+
description: string
|
|
22
|
+
items: AttributeItem[]
|
|
23
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import '@operato/i18n'
|
|
2
|
+
import '../src/ox-attribute-form.js'
|
|
3
|
+
import '@material/mwc-icon'
|
|
4
|
+
|
|
5
|
+
import { html, TemplateResult } from 'lit'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'ox-attribute-form',
|
|
9
|
+
component: 'ox-attribute-form',
|
|
10
|
+
argTypes: {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Story<T> {
|
|
14
|
+
(args: T): TemplateResult
|
|
15
|
+
args?: Partial<T>
|
|
16
|
+
argTypes?: Record<string, unknown>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ArgTypes {}
|
|
20
|
+
|
|
21
|
+
const attributeSet = {
|
|
22
|
+
entity: 'Domain',
|
|
23
|
+
description: 'Attributes for Domain Entity',
|
|
24
|
+
items: [
|
|
25
|
+
{
|
|
26
|
+
name: '등록정보',
|
|
27
|
+
description: '회사 등록 정보',
|
|
28
|
+
tag: 'brn',
|
|
29
|
+
type: 'text',
|
|
30
|
+
active: true,
|
|
31
|
+
hidden: false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: '주소',
|
|
35
|
+
description: '회사 주소',
|
|
36
|
+
tag: 'address',
|
|
37
|
+
type: 'text',
|
|
38
|
+
active: true,
|
|
39
|
+
hidden: false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: '신용도',
|
|
43
|
+
description: '회사의 신용도',
|
|
44
|
+
tag: 'credit',
|
|
45
|
+
type: 'select',
|
|
46
|
+
options: {
|
|
47
|
+
options: [
|
|
48
|
+
{ text: '최우수', value: '최우수' },
|
|
49
|
+
{ text: '우수', value: '우수' },
|
|
50
|
+
{ text: '보통', value: '보통' },
|
|
51
|
+
{ text: '미달', value: '미달' }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
active: true,
|
|
55
|
+
hidden: false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: '정보파일',
|
|
59
|
+
description: '참조 첨부 파일.',
|
|
60
|
+
tag: 'file',
|
|
61
|
+
type: 'file',
|
|
62
|
+
active: true,
|
|
63
|
+
hidden: false
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var value = {
|
|
69
|
+
brn: '1234567890-1234-1',
|
|
70
|
+
address: '경기도 성남시 분당구.',
|
|
71
|
+
credit: '최우수'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const Template: Story<ArgTypes> = ({}: ArgTypes) =>
|
|
75
|
+
html`
|
|
76
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
77
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
78
|
+
<style>
|
|
79
|
+
body {
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
82
|
+
|
|
83
|
+
<ox-attribute-form
|
|
84
|
+
.attributeSet=${attributeSet}
|
|
85
|
+
.value=${value}
|
|
86
|
+
@change=${(e: CustomEvent) => {
|
|
87
|
+
value = e.detail
|
|
88
|
+
console.log('change', value)
|
|
89
|
+
}}
|
|
90
|
+
></ox-attribute-form>
|
|
91
|
+
`
|
|
92
|
+
|
|
93
|
+
export const Regular = Template.bind({})
|
|
94
|
+
Regular.args = {}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import '@operato/i18n'
|
|
2
|
+
import '../src/ox-attribute-view.js'
|
|
3
|
+
import '@material/mwc-icon'
|
|
4
|
+
|
|
5
|
+
import { html, TemplateResult } from 'lit'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'ox-attribute-view',
|
|
9
|
+
component: 'ox-attribute-view',
|
|
10
|
+
argTypes: {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Story<T> {
|
|
14
|
+
(args: T): TemplateResult
|
|
15
|
+
args?: Partial<T>
|
|
16
|
+
argTypes?: Record<string, unknown>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ArgTypes {}
|
|
20
|
+
|
|
21
|
+
const attributeSet = {
|
|
22
|
+
entity: 'Domain',
|
|
23
|
+
description: 'Attributes for Domain Entity',
|
|
24
|
+
items: [
|
|
25
|
+
{
|
|
26
|
+
name: '등록정보',
|
|
27
|
+
description: '회사 등록 정보',
|
|
28
|
+
tag: 'brn',
|
|
29
|
+
type: 'text',
|
|
30
|
+
active: true,
|
|
31
|
+
hidden: false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: '주소',
|
|
35
|
+
description: '회사 주소',
|
|
36
|
+
tag: 'address',
|
|
37
|
+
type: 'text',
|
|
38
|
+
active: true,
|
|
39
|
+
hidden: false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: '신용도',
|
|
43
|
+
description: '회사의 신용도',
|
|
44
|
+
tag: 'credit',
|
|
45
|
+
type: 'select',
|
|
46
|
+
options: {
|
|
47
|
+
options: [
|
|
48
|
+
{ text: '최우수', value: '최우수' },
|
|
49
|
+
{ text: '우수', value: '우수' },
|
|
50
|
+
{ text: '보통', value: '보통' },
|
|
51
|
+
{ text: '미달', value: '미달' }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
active: true,
|
|
55
|
+
hidden: false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: '정보파일',
|
|
59
|
+
description: '참조 첨부 파일.',
|
|
60
|
+
tag: 'file',
|
|
61
|
+
type: 'file',
|
|
62
|
+
active: true,
|
|
63
|
+
hidden: false
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var value = {
|
|
69
|
+
brn: '1234567890-1234-1',
|
|
70
|
+
address: '경기도 성남시 분당구.',
|
|
71
|
+
credit: '최우수'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const Template: Story<ArgTypes> = ({}: ArgTypes) =>
|
|
75
|
+
html`
|
|
76
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
77
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
78
|
+
<style>
|
|
79
|
+
body {
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
82
|
+
|
|
83
|
+
<ox-attribute-view .attributeSet=${attributeSet} .value=${value}></ox-attribute-view>
|
|
84
|
+
`
|
|
85
|
+
|
|
86
|
+
export const Regular = Template.bind({})
|
|
87
|
+
Regular.args = {}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js'
|
|
3
|
+
import '@operato/property-editor/ox-property-editor-number.js'
|
|
4
|
+
import '@operato/property-editor/ox-property-editor-string.js'
|
|
5
|
+
import '@operato/property-editor/ox-property-editor-options.js'
|
|
6
|
+
import '@operato/property-editor/ox-properties-dynamic-view.js'
|
|
7
|
+
import '@operato/data-grist/ox-filters-form.js'
|
|
8
|
+
import '@operato/data-grist/ox-sorters-control.js'
|
|
9
|
+
import '@operato/grist-editor' /* regiester grist editors */
|
|
10
|
+
/* set grist-editors */
|
|
11
|
+
import '../src/grist-editor/index.js'
|
|
12
|
+
|
|
13
|
+
import { css, html, LitElement, TemplateResult } from 'lit'
|
|
14
|
+
import { state } from 'lit/decorators.js'
|
|
15
|
+
|
|
16
|
+
import { FetchOption, GristRecord } from '@operato/data-grist'
|
|
17
|
+
// import { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'
|
|
18
|
+
// import { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'
|
|
19
|
+
// import { OxGristEditorPartitionKeys } from '@operato/grist-editor/ox-grist-editor-partition-keys.js'
|
|
20
|
+
// // import { OxGristRendererCrontab } from '@operato/grist-editor/ox-grist-renderer-crontab.js'
|
|
21
|
+
// import { OxGristEditorValueMap } from '@operato/grist-editor/ox-grist-editor-value-map.js'
|
|
22
|
+
import { i18next } from '@operato/i18n'
|
|
23
|
+
import { OxPropertyEditor } from '@operato/property-editor'
|
|
24
|
+
import { CommonGristStyles } from '@operato/styles'
|
|
25
|
+
|
|
26
|
+
OxPropertyEditor.register({
|
|
27
|
+
number: 'ox-property-editor-number',
|
|
28
|
+
string: 'ox-property-editor-string',
|
|
29
|
+
boolean: 'ox-property-editor-checkbox',
|
|
30
|
+
options: 'ox-property-editor-options'
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// registerEditor('parameters', OxGristEditorParameters)
|
|
34
|
+
// registerEditor('crontab', OxGristEditorCrontab)
|
|
35
|
+
// registerEditor('value-map', OxGristEditorValueMap)
|
|
36
|
+
// registerEditor('partition-keys', OxGristEditorPartitionKeys)
|
|
37
|
+
|
|
38
|
+
const fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) => {
|
|
39
|
+
var total = 10
|
|
40
|
+
var start = (page - 1) * limit
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
total,
|
|
44
|
+
records: Array(limit * page > total ? total % limit : limit)
|
|
45
|
+
.fill('')
|
|
46
|
+
.map((item, idx) => {
|
|
47
|
+
return {
|
|
48
|
+
id: idx,
|
|
49
|
+
entity: `entity-${start + idx + 1}`,
|
|
50
|
+
description: `description-${start + idx + 1}`,
|
|
51
|
+
attributes: {
|
|
52
|
+
brn: '1234567890-1234-1',
|
|
53
|
+
address: '경기도 성남시 분당구.',
|
|
54
|
+
credit: '최우수'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class GristDemo extends LitElement {
|
|
62
|
+
static styles = [
|
|
63
|
+
CommonGristStyles,
|
|
64
|
+
css`
|
|
65
|
+
:host {
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#tailer {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
margin: 0 var(--margin-default);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#tailer a {
|
|
77
|
+
padding: 0 var(--padding-default) 0 var(--padding-default);
|
|
78
|
+
margin: 0 var(--margin-narrow);
|
|
79
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
80
|
+
font-size: var(--fontsize-default);
|
|
81
|
+
color: var(--primary-color);
|
|
82
|
+
}
|
|
83
|
+
`
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
@state() mode: String = 'CARD'
|
|
87
|
+
|
|
88
|
+
get grist() {
|
|
89
|
+
return this.renderRoot.querySelector('ox-grist')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
config: any = {
|
|
93
|
+
list: { fields: ['name', 'description', 'active'] },
|
|
94
|
+
columns: [
|
|
95
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
96
|
+
{
|
|
97
|
+
type: 'gutter',
|
|
98
|
+
gutterName: 'button',
|
|
99
|
+
icon: 'add',
|
|
100
|
+
handlers: {
|
|
101
|
+
click: 'record-copy'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
105
|
+
{
|
|
106
|
+
type: 'gutter',
|
|
107
|
+
gutterName: 'button',
|
|
108
|
+
icon: 'arrow_upward',
|
|
109
|
+
handlers: {
|
|
110
|
+
click: 'move-up'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: 'gutter',
|
|
115
|
+
gutterName: 'button',
|
|
116
|
+
icon: 'arrow_downward',
|
|
117
|
+
handlers: {
|
|
118
|
+
click: 'move-down'
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'string',
|
|
123
|
+
name: 'id',
|
|
124
|
+
hidden: true
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'string',
|
|
128
|
+
name: 'entity',
|
|
129
|
+
header: i18next.t('field.entity'),
|
|
130
|
+
record: {
|
|
131
|
+
editable: true
|
|
132
|
+
},
|
|
133
|
+
width: 140
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'string',
|
|
137
|
+
name: 'description',
|
|
138
|
+
header: i18next.t('field.description'),
|
|
139
|
+
record: {
|
|
140
|
+
editable: true
|
|
141
|
+
},
|
|
142
|
+
width: 180
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: 'select',
|
|
146
|
+
name: 'type',
|
|
147
|
+
header: i18next.t('field.type'),
|
|
148
|
+
record: {
|
|
149
|
+
options: ['', 'number', 'text', 'select', 'boolean', 'file'],
|
|
150
|
+
editable: true
|
|
151
|
+
},
|
|
152
|
+
width: 120
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: 'attributes',
|
|
156
|
+
name: 'attributes',
|
|
157
|
+
header: i18next.t('field.attributes'),
|
|
158
|
+
record: {
|
|
159
|
+
editable: true,
|
|
160
|
+
options: {
|
|
161
|
+
attributeSet: {
|
|
162
|
+
entity: 'Domain',
|
|
163
|
+
description: 'Attributes for Domain Entity',
|
|
164
|
+
items: [
|
|
165
|
+
{
|
|
166
|
+
name: '등록정보',
|
|
167
|
+
description: '회사 등록 정보',
|
|
168
|
+
tag: 'brn',
|
|
169
|
+
type: 'text',
|
|
170
|
+
active: true,
|
|
171
|
+
hidden: false
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: '주소',
|
|
175
|
+
description: '회사 주소',
|
|
176
|
+
tag: 'address',
|
|
177
|
+
type: 'text',
|
|
178
|
+
active: true,
|
|
179
|
+
hidden: false
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: '신용도',
|
|
183
|
+
description: '회사의 신용도',
|
|
184
|
+
tag: 'credit',
|
|
185
|
+
type: 'select',
|
|
186
|
+
options: {
|
|
187
|
+
options: [
|
|
188
|
+
{ text: '최우수', value: '최우수' },
|
|
189
|
+
{ text: '우수', value: '우수' },
|
|
190
|
+
{ text: '보통', value: '보통' },
|
|
191
|
+
{ text: '미달', value: '미달' }
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
active: true,
|
|
195
|
+
hidden: false
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: '정보파일',
|
|
199
|
+
description: '참조 첨부 파일.',
|
|
200
|
+
tag: 'file',
|
|
201
|
+
type: 'file',
|
|
202
|
+
active: true,
|
|
203
|
+
hidden: false
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
width: 200
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
rows: {
|
|
213
|
+
selectable: {
|
|
214
|
+
multiple: true
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
pagination: {
|
|
218
|
+
infinite: true
|
|
219
|
+
},
|
|
220
|
+
sorters: [
|
|
221
|
+
{
|
|
222
|
+
name: 'sequence'
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
render() {
|
|
228
|
+
const mode = this.mode || 'CARD'
|
|
229
|
+
|
|
230
|
+
return html`
|
|
231
|
+
<ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
|
|
232
|
+
<div id="filters" slot="headroom">
|
|
233
|
+
<ox-filters-form @filters-change=${(e: CustomEvent) => console.log('changed', e.detail)}></ox-filters-form>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div slot="headroom" id="headroom">
|
|
237
|
+
<div id="modes">
|
|
238
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>
|
|
239
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>
|
|
240
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
</ox-grist>
|
|
244
|
+
`
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
customElements.define('ox-attributes', GristDemo)
|
|
249
|
+
|
|
250
|
+
export default {
|
|
251
|
+
title: 'ox-grist-editor-attributes',
|
|
252
|
+
component: 'ox-grist-editor-attributes',
|
|
253
|
+
argTypes: {}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
interface Story<T> {
|
|
257
|
+
(args: T): TemplateResult
|
|
258
|
+
args?: Partial<T>
|
|
259
|
+
argTypes?: Record<string, unknown>
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
interface ArgTypes {}
|
|
263
|
+
|
|
264
|
+
const Template: Story<ArgTypes> = ({}: ArgTypes) =>
|
|
265
|
+
html`
|
|
266
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
267
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
268
|
+
<link href="/themes/oops-theme.css" rel="stylesheet" />
|
|
269
|
+
<link href="/themes/grist-theme.css" rel="stylesheet" />
|
|
270
|
+
|
|
271
|
+
<style>
|
|
272
|
+
[slot='headroom'] {
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: row;
|
|
275
|
+
align-items: center;
|
|
276
|
+
padding: var(--padding-default) var(--padding-wide);
|
|
277
|
+
border-top: 2px solid rgba(0, 0, 0, 0.2);
|
|
278
|
+
background-color: var(--theme-white-color);
|
|
279
|
+
box-shadow: var(--box-shadow);
|
|
280
|
+
|
|
281
|
+
--mdc-icon-size: 24px;
|
|
282
|
+
}
|
|
283
|
+
#sorters mwc-icon,
|
|
284
|
+
#modes mwc-icon {
|
|
285
|
+
--mdc-icon-size: 18px;
|
|
286
|
+
}
|
|
287
|
+
#sorters {
|
|
288
|
+
margin-left: auto;
|
|
289
|
+
margin-right: var(--margin-default);
|
|
290
|
+
padding-left: var(--padding-narrow);
|
|
291
|
+
border-bottom: var(--border-dark-color);
|
|
292
|
+
position: relative;
|
|
293
|
+
color: var(--secondary-color);
|
|
294
|
+
font-size: var(--fontsize-default);
|
|
295
|
+
user-select: none;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#sorters > * {
|
|
299
|
+
padding: var(--padding-narrow);
|
|
300
|
+
vertical-align: middle;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
#filters {
|
|
304
|
+
display: flex;
|
|
305
|
+
justify-content: center;
|
|
306
|
+
align-items: center;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
#filters * {
|
|
310
|
+
margin-right: var(--margin-default);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@media only screen and (max-width: 460px) {
|
|
314
|
+
#filters {
|
|
315
|
+
flex-direction: column;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
#modes {
|
|
319
|
+
display: none;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
</style>
|
|
323
|
+
|
|
324
|
+
<ox-attributes mode="LIST"></ox-attributes>
|
|
325
|
+
`
|
|
326
|
+
|
|
327
|
+
export const Regular = Template.bind({})
|
|
328
|
+
Regular.args = {}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
body {
|
|
2
|
+
/* theme color */
|
|
3
|
+
--primary-color-rgb: 56, 162, 91;
|
|
4
|
+
--primary-color: rgb(var(--primary-color-rgb));
|
|
5
|
+
--secondary-color-rgb: 71, 97, 114;
|
|
6
|
+
--secondary-color: rgb(var(--secondary-color-rgb));
|
|
7
|
+
--focus-color: var(--theme-white-color);
|
|
8
|
+
--primary-background-color: var(--secondary-color);
|
|
9
|
+
--secondary-background-color: #183936;
|
|
10
|
+
--main-section-background-color: #f7f6f4;
|
|
11
|
+
--theme-white-color: #fff;
|
|
12
|
+
--theme-black-color: rgba(0, 0, 0, 0.9);
|
|
13
|
+
|
|
14
|
+
--focus-background-color: var(--primary-color);
|
|
15
|
+
--primary-text-color: var(--theme-black-color);
|
|
16
|
+
--secondary-text-color: #218f62;
|
|
17
|
+
|
|
18
|
+
--opacity-dark-color: rgba(0, 0, 0, 0.4);
|
|
19
|
+
--opacity-light-color: rgba(255, 255, 255, 0.8);
|
|
20
|
+
|
|
21
|
+
/* status color */
|
|
22
|
+
--status-success-color: #35a24a;
|
|
23
|
+
--status-warning-color: #ee8d03;
|
|
24
|
+
--status-danger-color: #d14946;
|
|
25
|
+
--status-info-color: #398ace;
|
|
26
|
+
|
|
27
|
+
/* common style */
|
|
28
|
+
--border-radius: 4px;
|
|
29
|
+
--border-dark-color: 1px solid rgba(0, 0, 0, 0.15);
|
|
30
|
+
--border-light-color: 1px solid rgba(255, 255, 255, 0.3);
|
|
31
|
+
|
|
32
|
+
--box-shadow: 2px 2px 3px 0px rgba(0, 0, 0, 0.1);
|
|
33
|
+
|
|
34
|
+
--theme-font: 'Noto', Helvetica;
|
|
35
|
+
|
|
36
|
+
--margin-default: 9px;
|
|
37
|
+
--margin-narrow: 4px;
|
|
38
|
+
--margin-wide: 15px;
|
|
39
|
+
--padding-default: var(--margin-default);
|
|
40
|
+
--padding-narrow: var(--margin-narrow);
|
|
41
|
+
--padding-wide: var(--margin-wide);
|
|
42
|
+
|
|
43
|
+
--scrollbar-thumb-color: rgba(57, 78, 100, 0.5);
|
|
44
|
+
--scrollbar-thumb-hover-color: var(--primary-color);
|
|
45
|
+
|
|
46
|
+
--fontsize-default: 14px;
|
|
47
|
+
--fontsize-small: 13px;
|
|
48
|
+
--fontsize-large: 16px;
|
|
49
|
+
|
|
50
|
+
/* app layout style */
|
|
51
|
+
--app-grid-template-area: 'header header header' 'nav main aside' 'nav footer aside';
|
|
52
|
+
|
|
53
|
+
/* title & description style */
|
|
54
|
+
--title-margin: var(--margin-narrow) 0;
|
|
55
|
+
--title-font: bold 24px var(--theme-font);
|
|
56
|
+
--title-text-color: var(--secondary-color);
|
|
57
|
+
--title-font-mobile: bold 20px var(--theme-font);
|
|
58
|
+
|
|
59
|
+
--page-description-margin: var(--margin-narrow) 0 var(--margin-wide) 0;
|
|
60
|
+
--page-description-font: normal var(--fontsize-default) / 1.2rem var(--theme-font);
|
|
61
|
+
--page-description-color: var(--secondary-text-color);
|
|
62
|
+
|
|
63
|
+
--subtitle-padding: 12px 5px 3px 5px;
|
|
64
|
+
--subtitle-font: bold 18px var(--theme-font);
|
|
65
|
+
--subtitle-text-color: var(--primary-color);
|
|
66
|
+
--subtitle-border-bottom: 1px solid var(--primary-color);
|
|
67
|
+
|
|
68
|
+
/* icon style */
|
|
69
|
+
--icon-tiny-size: 24px;
|
|
70
|
+
--icon-default-size: 36px;
|
|
71
|
+
--icon-big-size: 48px;
|
|
72
|
+
--icon-default-color: var(--theme-white-color);
|
|
73
|
+
|
|
74
|
+
/* material design component themes */
|
|
75
|
+
--mdc-theme-on-primary: var(--theme-white-color);
|
|
76
|
+
--mdc-theme-primary: var(--secondary-text-color);
|
|
77
|
+
--mdc-theme-on-secondary: var(--theme-white-color);
|
|
78
|
+
--mdc-theme-secondary: var(--primary-color);
|
|
79
|
+
--mdc-button-outline-color: var(--primary-color);
|
|
80
|
+
--mdc-danger-button-primary-color: var(--status-danger-color);
|
|
81
|
+
--mdc-danger-button-outline-color: var(--status-danger-color);
|
|
82
|
+
--mdc-button-outline-width: 1px;
|
|
83
|
+
--mdc-button-horizontal-padding: 16px;
|
|
84
|
+
|
|
85
|
+
/* button style */
|
|
86
|
+
--button-background-color: #fafbfc;
|
|
87
|
+
--button-background-focus-color: var(--primary-color);
|
|
88
|
+
--button-border: var(--border-dark-color);
|
|
89
|
+
--button-border-radius: var(--border-radius);
|
|
90
|
+
--button-margin: var(--margin-default) var(--margin-default) var(--margin-default) 0;
|
|
91
|
+
--button-padding: var(--padding-default);
|
|
92
|
+
--button-color: var(--secondary-color);
|
|
93
|
+
--button-font: normal 15px var(--theme-font);
|
|
94
|
+
--button-text-transform: capitalize;
|
|
95
|
+
--button-active-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);
|
|
96
|
+
--button-activ-border: 1px solid var(--primary-color);
|
|
97
|
+
|
|
98
|
+
--button-primary-background-color: var(--primary-color);
|
|
99
|
+
--button-primary-active-background-color: var(--status-success-color);
|
|
100
|
+
--button-primary-padding: var(--margin-default) var(--margin-wide);
|
|
101
|
+
--button-primary-color: var(--theme-white-color);
|
|
102
|
+
--button-primary-font: bold 16px var(--theme-font);
|
|
103
|
+
|
|
104
|
+
/* table style */
|
|
105
|
+
--th-padding: var(--padding-default) 0 var(--padding-default) var(--padding-default);
|
|
106
|
+
--th-border-top: 2px solid var(--secondary-color);
|
|
107
|
+
--th-text-transform: capitalize;
|
|
108
|
+
--th-font: bold var(--fontsize-small) var(--theme-font);
|
|
109
|
+
--th-color: rgba(var(--secondary-color-rgb), 0.8);
|
|
110
|
+
|
|
111
|
+
--tr-background-color: var(--theme-white-color);
|
|
112
|
+
--tr-background-odd-color: rgba(255, 255, 255, 0.4);
|
|
113
|
+
--tr-background-hover-color: #e1f5fe;
|
|
114
|
+
--td-border-bottom: 1px solid rgba(0, 0, 0, 0.09);
|
|
115
|
+
--td-padding: var(--padding-default);
|
|
116
|
+
--td-font: normal 13px var(--theme-font);
|
|
117
|
+
--td-color: var(--secondary-color);
|
|
118
|
+
|
|
119
|
+
/* form style */
|
|
120
|
+
--label-font: normal var(--fontsize-default) var(--theme-font);
|
|
121
|
+
--label-color: var(--secondary-color);
|
|
122
|
+
--label-text-transform: capitalize;
|
|
123
|
+
--input-margin: var(--margin-narrow) 0;
|
|
124
|
+
--input-padding: var(--padding-default);
|
|
125
|
+
--input-min-width: 200px;
|
|
126
|
+
--input-font: normal var(--fontsize-default) var(--theme-font);
|
|
127
|
+
--input-hint-font: normal var(--fontsize-small) var(--theme-font);
|
|
128
|
+
--input-hint-color: #666;
|
|
129
|
+
--input-container-max-width: 900px;
|
|
130
|
+
--fieldset-margin: var(--padding-wide) 0;
|
|
131
|
+
--fieldset-padding: 0 var(--padding-wide) var(--padding-wide) var(--padding-wide);
|
|
132
|
+
--legend-padding: var(--padding-default) 0;
|
|
133
|
+
--legend-color: var(--secondary-text-color);
|
|
134
|
+
--legend-font: bold 16px var(--theme-font);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media only screen and (max-width: 460px) {
|
|
138
|
+
body {
|
|
139
|
+
/* subtitle style */
|
|
140
|
+
--subtitle-margin: 0;
|
|
141
|
+
}
|
|
142
|
+
}
|