@operato/form 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 +18 -0
- package/package.json +7 -7
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/demo/index.html +0 -110
- package/src/components/ox-custom-input.ts +0 -102
- package/src/components/ox-custom-select.ts +0 -91
- package/src/components/ox-file-uploader.ts +0 -164
- package/src/components/ox-form-master.ts +0 -246
- package/src/components/ox-form-paginator.ts +0 -60
- package/src/components/ox-search-form-paginator.ts +0 -46
- package/src/components/ox-search-form.ts +0 -467
- package/src/filters/filter-checkbox.ts +0 -34
- package/src/filters/filter-input-barcode.ts +0 -35
- package/src/filters/filter-input.ts +0 -30
- package/src/filters/filter-range-date.ts +0 -81
- package/src/filters/filter-range-number.ts +0 -64
- package/src/filters/filter-select.ts +0 -56
- package/src/filters/filter-styles.ts +0 -127
- package/src/filters/index.ts +0 -10
- package/src/filters/ox-filter-personalizer.ts +0 -188
- package/src/filters/ox-filters-form-base.ts +0 -437
- package/src/filters/registry.ts +0 -54
- package/src/index.ts +0 -4
- package/src/styles/index.ts +0 -3
- package/src/styles/multi-column-form-styles.ts +0 -192
- package/src/styles/search-form-styles.ts +0 -160
- package/src/styles/single-column-form-styles.ts +0 -114
- package/src/types.ts +0 -106
- package/stories/ox-filters-form-barcode.stories.ts +0 -140
- package/stories/ox-filters-form-base-bounded.stories.ts +0 -208
- package/stories/ox-filters-form-base-change-handler.stories.ts +0 -220
- package/stories/ox-filters-form-base-page-preference.stories.ts +0 -177
- package/stories/ox-filters-form-base.stories.ts +0 -179
- package/stories/ox-search-form-change-handler.stories.ts +0 -253
- package/stories/ox-search-form.stories.ts +0 -258
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { CommonHeaderStyles } from '@operato/styles'
|
|
2
|
-
import '../src/filters/ox-filters-form-base.js'
|
|
3
|
-
|
|
4
|
-
import { html, TemplateResult } from 'lit'
|
|
5
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
|
6
|
-
|
|
7
|
-
import { OxFiltersFormBase, FilterConfig, FilterValue } from '../src/index.js'
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'ox-filters-form-base',
|
|
11
|
-
component: 'ox-filters-form-base',
|
|
12
|
-
argTypes: {
|
|
13
|
-
value: { control: 'object' },
|
|
14
|
-
filters: { control: 'object' },
|
|
15
|
-
urlParamsSensitive: { control: 'boolean' }
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface Story<T> {
|
|
20
|
-
(args: T): TemplateResult
|
|
21
|
-
args?: Partial<T>
|
|
22
|
-
argTypes?: Record<string, unknown>
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface ArgTypes {
|
|
26
|
-
value?: FilterValue[]
|
|
27
|
-
filters?: FilterConfig[]
|
|
28
|
-
urlParamsSensitive: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const Template: Story<ArgTypes> = ({ value, filters, urlParamsSensitive }: ArgTypes) => html`
|
|
32
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
|
33
|
-
|
|
34
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
35
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
36
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
37
|
-
<link href="/themes/form-theme.css" rel="stylesheet" />
|
|
38
|
-
|
|
39
|
-
<link
|
|
40
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
41
|
-
rel="stylesheet"
|
|
42
|
-
/>
|
|
43
|
-
<link
|
|
44
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
45
|
-
rel="stylesheet"
|
|
46
|
-
/>
|
|
47
|
-
<link
|
|
48
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
49
|
-
rel="stylesheet"
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
<style>
|
|
53
|
-
${MDTypeScaleStyles.cssText}
|
|
54
|
-
</style>
|
|
55
|
-
|
|
56
|
-
<style>
|
|
57
|
-
${CommonHeaderStyles.cssText}
|
|
58
|
-
</style>
|
|
59
|
-
|
|
60
|
-
<style>
|
|
61
|
-
body {
|
|
62
|
-
width: 100%;
|
|
63
|
-
height: 500px;
|
|
64
|
-
text-align: center;
|
|
65
|
-
|
|
66
|
-
background-color: var(--md-sys-color-background);
|
|
67
|
-
color: var(--md-sys-color-on-background);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.header {
|
|
71
|
-
padding: var(--spacing-medium);
|
|
72
|
-
background-color: var(--md-sys-color-primary-container);
|
|
73
|
-
color: var(--md-sys-color-on-primary-container);
|
|
74
|
-
}
|
|
75
|
-
</style>
|
|
76
|
-
|
|
77
|
-
<script>
|
|
78
|
-
setInterval(() => {
|
|
79
|
-
const filters = document.body.querySelector('ox-filters-form-base')
|
|
80
|
-
|
|
81
|
-
filters.value = filters.value.map(filter => {
|
|
82
|
-
const { name, value } = filter
|
|
83
|
-
if (name == 'test') {
|
|
84
|
-
return {
|
|
85
|
-
...filter,
|
|
86
|
-
value: value + 1
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
return filter
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
}, 10000)
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<div class="header">
|
|
96
|
-
<div class="filters">
|
|
97
|
-
<ox-filters-form-base
|
|
98
|
-
.value=${value!}
|
|
99
|
-
.filters=${filters!}
|
|
100
|
-
?url-params-sensitive=${urlParamsSensitive}
|
|
101
|
-
@filters-change=${(e: CustomEvent) => {
|
|
102
|
-
console.log('filters changed', e.detail)
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
</ox-filters-form-base>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
`
|
|
109
|
-
|
|
110
|
-
export const Regular = Template.bind({})
|
|
111
|
-
Regular.args = {
|
|
112
|
-
filters: [
|
|
113
|
-
{
|
|
114
|
-
name: 'search',
|
|
115
|
-
type: 'search',
|
|
116
|
-
label: 'search',
|
|
117
|
-
operator: 'eq',
|
|
118
|
-
value: ''
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'test',
|
|
122
|
-
type: 'string',
|
|
123
|
-
label: 'name',
|
|
124
|
-
operator: 'eq',
|
|
125
|
-
value: 'No Name'
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'active',
|
|
129
|
-
type: 'boolean',
|
|
130
|
-
label: 'active',
|
|
131
|
-
operator: 'eq',
|
|
132
|
-
value: true,
|
|
133
|
-
onchange: (value, formBase: OxFiltersFormBase) => {
|
|
134
|
-
const sss = formBase.getFieldByName('sss') as HTMLInputElement
|
|
135
|
-
sss.value = value ? 'DEF' : 'ABC'
|
|
136
|
-
|
|
137
|
-
return false
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: 'sss',
|
|
142
|
-
type: 'select',
|
|
143
|
-
label: 'sss',
|
|
144
|
-
operator: 'eq',
|
|
145
|
-
options: () => {
|
|
146
|
-
return [
|
|
147
|
-
{
|
|
148
|
-
display: '',
|
|
149
|
-
value: ''
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
display: 'ABC',
|
|
153
|
-
value: 'ABC'
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
display: 'DEF',
|
|
157
|
-
value: 'DEF'
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: 'range',
|
|
164
|
-
type: 'number',
|
|
165
|
-
label: 'range',
|
|
166
|
-
operator: 'between'
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: 'date-range',
|
|
170
|
-
type: 'date',
|
|
171
|
-
label: 'date',
|
|
172
|
-
operator: 'between',
|
|
173
|
-
value: [
|
|
174
|
-
{ name: 'week', params: { relativeWeeks: -1 } },
|
|
175
|
-
{ name: 'today', params: { relativeDays: +1 } }
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
]
|
|
179
|
-
}
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import { CommonHeaderStyles } from '@operato/styles'
|
|
2
|
-
import { sleep } from '@operato/utils'
|
|
3
|
-
import '../src/components/ox-search-form.js'
|
|
4
|
-
|
|
5
|
-
import { html, TemplateResult } from 'lit'
|
|
6
|
-
import { OxSearchForm, SearchFormField } from '../src/index.js'
|
|
7
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'ox-search-form change handler',
|
|
11
|
-
component: 'ox-search-form',
|
|
12
|
-
argTypes: {
|
|
13
|
-
value: { control: 'object' },
|
|
14
|
-
fields: { control: 'object' },
|
|
15
|
-
hideSearchButton: { control: 'boolean' },
|
|
16
|
-
autofocus: { control: 'boolean' }
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Story<T> {
|
|
21
|
-
(args: T): TemplateResult
|
|
22
|
-
args?: Partial<T>
|
|
23
|
-
argTypes?: Record<string, unknown>
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface ArgTypes {
|
|
27
|
-
fields?: SearchFormField[]
|
|
28
|
-
hideSearchButton?: boolean
|
|
29
|
-
autofocus?: boolean
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const Template: Story<ArgTypes> = ({ fields, hideSearchButton, autofocus }: ArgTypes) => html`
|
|
33
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
|
34
|
-
|
|
35
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
36
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
37
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
38
|
-
<link href="/themes/form-theme.css" rel="stylesheet" />
|
|
39
|
-
|
|
40
|
-
<link
|
|
41
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
42
|
-
rel="stylesheet"
|
|
43
|
-
/>
|
|
44
|
-
<link
|
|
45
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
46
|
-
rel="stylesheet"
|
|
47
|
-
/>
|
|
48
|
-
<link
|
|
49
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
50
|
-
rel="stylesheet"
|
|
51
|
-
/>
|
|
52
|
-
|
|
53
|
-
<style>
|
|
54
|
-
${MDTypeScaleStyles.cssText}
|
|
55
|
-
</style>
|
|
56
|
-
|
|
57
|
-
<style>
|
|
58
|
-
${CommonHeaderStyles.cssText}
|
|
59
|
-
</style>
|
|
60
|
-
|
|
61
|
-
<style>
|
|
62
|
-
body {
|
|
63
|
-
width: 100%;
|
|
64
|
-
height: 500px;
|
|
65
|
-
text-align: center;
|
|
66
|
-
|
|
67
|
-
background-color: var(--md-sys-color-background);
|
|
68
|
-
color: var(--md-sys-color-on-background);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.header {
|
|
72
|
-
padding: var(--spacing-medium);
|
|
73
|
-
background-color: var(--md-sys-color-primary-container);
|
|
74
|
-
color: var(--md-sys-color-on-primary-container);
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
77
|
-
|
|
78
|
-
<div class="header">
|
|
79
|
-
<div class="filters">
|
|
80
|
-
<ox-search-form
|
|
81
|
-
.fields=${fields!}
|
|
82
|
-
?autofocus=${autofocus}
|
|
83
|
-
?hideSearchButton=${hideSearchButton}
|
|
84
|
-
@change=${(e: CustomEvent) => {
|
|
85
|
-
console.log('search form changed', e.detail)
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
</ox-search-form>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
`
|
|
92
|
-
|
|
93
|
-
const WAREHOUSE = [
|
|
94
|
-
{
|
|
95
|
-
id: '01',
|
|
96
|
-
name: '제 1 창고',
|
|
97
|
-
zones: [
|
|
98
|
-
{
|
|
99
|
-
id: 'Z001',
|
|
100
|
-
name: 'Zone 01-001',
|
|
101
|
-
locations: ['L01-001-01', 'L01-001-02', 'L01-001-03', 'L01-001-04', 'L01-001-05']
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: 'Z002',
|
|
105
|
-
name: 'Zone 01-002',
|
|
106
|
-
locations: ['L01-002-01', 'L01-002-02', 'L01-002-03', 'L01-002-04', 'L01-002-05']
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: '02',
|
|
112
|
-
name: '제 2 창고',
|
|
113
|
-
zones: [
|
|
114
|
-
{
|
|
115
|
-
id: 'Z001',
|
|
116
|
-
name: 'Zone 02-001',
|
|
117
|
-
locations: ['L02-001-01', 'L02-001-02', 'L02-001-03', 'L02-001-04', 'L02-001-05']
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: 'Z002',
|
|
121
|
-
name: 'Zone 02-002',
|
|
122
|
-
locations: ['L02-002-01', 'L02-002-02', 'L02-002-03', 'L02-002-04', 'L02-002-05']
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
export const Regular = Template.bind({})
|
|
129
|
-
Regular.args = {
|
|
130
|
-
fields: [
|
|
131
|
-
{
|
|
132
|
-
type: 'select',
|
|
133
|
-
name: 'warehouse',
|
|
134
|
-
label: 'warehouse',
|
|
135
|
-
options: async (form: OxSearchForm) => {
|
|
136
|
-
await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기
|
|
137
|
-
return [
|
|
138
|
-
{
|
|
139
|
-
display: '',
|
|
140
|
-
value: ''
|
|
141
|
-
}
|
|
142
|
-
].concat(
|
|
143
|
-
WAREHOUSE.map(w => {
|
|
144
|
-
return {
|
|
145
|
-
display: w.name,
|
|
146
|
-
value: w.id
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
)
|
|
150
|
-
},
|
|
151
|
-
onchange: () => false
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
type: 'select',
|
|
155
|
-
name: 'zone',
|
|
156
|
-
label: 'zone',
|
|
157
|
-
boundTo: ['warehouse'],
|
|
158
|
-
options: async (form: OxSearchForm) => {
|
|
159
|
-
await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기
|
|
160
|
-
const formData = new FormData(await form.form)
|
|
161
|
-
const warehouse = formData?.get('warehouse')
|
|
162
|
-
console.log('warehouse', warehouse)
|
|
163
|
-
|
|
164
|
-
const targetWH = warehouse && WAREHOUSE.find(w => w.id == warehouse)
|
|
165
|
-
const zones = targetWH
|
|
166
|
-
? targetWH.zones
|
|
167
|
-
: WAREHOUSE.reduce((sum, warehouse) => {
|
|
168
|
-
sum = sum.concat(warehouse.zones)
|
|
169
|
-
return sum
|
|
170
|
-
}, [] as any[])
|
|
171
|
-
|
|
172
|
-
return [
|
|
173
|
-
{
|
|
174
|
-
display: '',
|
|
175
|
-
value: ''
|
|
176
|
-
}
|
|
177
|
-
].concat(
|
|
178
|
-
zones.map((z: any) => {
|
|
179
|
-
return {
|
|
180
|
-
display: z.name,
|
|
181
|
-
value: z.id
|
|
182
|
-
}
|
|
183
|
-
})
|
|
184
|
-
)
|
|
185
|
-
},
|
|
186
|
-
onchange: () => false
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
name: 'location',
|
|
190
|
-
type: 'select',
|
|
191
|
-
label: 'location',
|
|
192
|
-
boundTo: ['warehouse', 'zone'],
|
|
193
|
-
options: async (form: OxSearchForm) => {
|
|
194
|
-
await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기
|
|
195
|
-
const formData = new FormData(await form.form)
|
|
196
|
-
const warehouse = formData?.get('warehouse')
|
|
197
|
-
const zone = formData?.get('zone')
|
|
198
|
-
console.log('warehouse, zone', warehouse, zone)
|
|
199
|
-
|
|
200
|
-
const targetWH = (warehouse && WAREHOUSE.find(w => w.id == warehouse)) || null
|
|
201
|
-
const targetZone = zone && targetWH?.zones.find(z => z.id == zone)
|
|
202
|
-
return targetZone ? ['', ...targetZone.locations] : []
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
],
|
|
206
|
-
hideSearchButton: true,
|
|
207
|
-
autofocus: true
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export const RegularContact = Template.bind({})
|
|
211
|
-
RegularContact.args = {
|
|
212
|
-
fields: [
|
|
213
|
-
{
|
|
214
|
-
label: 'name',
|
|
215
|
-
name: 'name',
|
|
216
|
-
type: 'text',
|
|
217
|
-
value: 'My Name',
|
|
218
|
-
placeholder: 'type your name.',
|
|
219
|
-
readonly: true,
|
|
220
|
-
props: { searchOper: 'i_like' },
|
|
221
|
-
onchange: value => {
|
|
222
|
-
console.log('changed', value)
|
|
223
|
-
return false
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
label: 'email',
|
|
228
|
-
name: 'email',
|
|
229
|
-
type: 'text',
|
|
230
|
-
props: { searchOper: 'i_like' }
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
label: 'fax',
|
|
234
|
-
name: 'fax',
|
|
235
|
-
type: 'text',
|
|
236
|
-
props: { searchOper: 'i_like' }
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
label: 'phone',
|
|
240
|
-
name: 'phone',
|
|
241
|
-
type: 'text',
|
|
242
|
-
props: { searchOper: 'i_like' }
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
label: 'description',
|
|
246
|
-
name: 'description',
|
|
247
|
-
type: 'text',
|
|
248
|
-
props: { searchOper: 'i_like' }
|
|
249
|
-
}
|
|
250
|
-
],
|
|
251
|
-
hideSearchButton: true,
|
|
252
|
-
autofocus: true
|
|
253
|
-
}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { CommonHeaderStyles } from '@operato/styles'
|
|
2
|
-
import { sleep } from '@operato/utils'
|
|
3
|
-
import '../src/components/ox-search-form.js'
|
|
4
|
-
|
|
5
|
-
import { html, TemplateResult } from 'lit'
|
|
6
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
|
7
|
-
|
|
8
|
-
import { OxSearchForm, SearchFormField } from '../src/index.js'
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'ox-search-form',
|
|
12
|
-
component: 'ox-search-form',
|
|
13
|
-
argTypes: {
|
|
14
|
-
value: { control: 'object' },
|
|
15
|
-
fields: { control: 'object' },
|
|
16
|
-
hideSearchButton: { control: 'boolean' },
|
|
17
|
-
autofocus: { control: 'boolean' },
|
|
18
|
-
resetTarget: { control: 'object' }
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface Story<T> {
|
|
23
|
-
(args: T): TemplateResult
|
|
24
|
-
args?: Partial<T>
|
|
25
|
-
argTypes?: Record<string, unknown>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface ArgTypes {
|
|
29
|
-
fields?: SearchFormField[]
|
|
30
|
-
hideSearchButton?: boolean
|
|
31
|
-
autofocus?: boolean
|
|
32
|
-
resetTarget: string[] | { [field: string]: any }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Template: Story<ArgTypes> = ({ fields, hideSearchButton, autofocus, resetTarget }: ArgTypes) => html`
|
|
36
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
|
37
|
-
|
|
38
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
39
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
40
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
41
|
-
<link href="/themes/form-theme.css" rel="stylesheet" />
|
|
42
|
-
|
|
43
|
-
<link
|
|
44
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
45
|
-
rel="stylesheet"
|
|
46
|
-
/>
|
|
47
|
-
<link
|
|
48
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
49
|
-
rel="stylesheet"
|
|
50
|
-
/>
|
|
51
|
-
<link
|
|
52
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
53
|
-
rel="stylesheet"
|
|
54
|
-
/>
|
|
55
|
-
|
|
56
|
-
<style>
|
|
57
|
-
${MDTypeScaleStyles.cssText}
|
|
58
|
-
</style>
|
|
59
|
-
|
|
60
|
-
<style>
|
|
61
|
-
${CommonHeaderStyles.cssText}
|
|
62
|
-
</style>
|
|
63
|
-
|
|
64
|
-
<style>
|
|
65
|
-
body {
|
|
66
|
-
width: 100%;
|
|
67
|
-
height: 500px;
|
|
68
|
-
text-align: center;
|
|
69
|
-
|
|
70
|
-
background-color: var(--md-sys-color-background);
|
|
71
|
-
color: var(--md-sys-color-on-background);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.header {
|
|
75
|
-
padding: var(--spacing-medium);
|
|
76
|
-
background-color: var(--md-sys-color-primary-container);
|
|
77
|
-
color: var(--md-sys-color-on-primary-container);
|
|
78
|
-
}
|
|
79
|
-
</style>
|
|
80
|
-
|
|
81
|
-
<div class="header">
|
|
82
|
-
<div class="filters">
|
|
83
|
-
<ox-search-form
|
|
84
|
-
.fields=${fields!}
|
|
85
|
-
?autofocus=${autofocus}
|
|
86
|
-
?hideSearchButton=${hideSearchButton}
|
|
87
|
-
@change=${(e: CustomEvent) => {
|
|
88
|
-
console.log('search form changed', e.detail)
|
|
89
|
-
}}
|
|
90
|
-
>
|
|
91
|
-
</ox-search-form>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<button @click=${() => (document.querySelector('ox-search-form') as any)?.reset(resetTarget)}>Partial Reset</button>
|
|
96
|
-
<button @click=${() => (document.querySelector('ox-search-form') as any)?.reset()}>Full Reset</button>
|
|
97
|
-
`
|
|
98
|
-
|
|
99
|
-
const WAREHOUSE = [
|
|
100
|
-
{
|
|
101
|
-
id: '01',
|
|
102
|
-
name: '제 1 창고',
|
|
103
|
-
zones: [
|
|
104
|
-
{
|
|
105
|
-
id: 'Z001',
|
|
106
|
-
name: 'Zone 01-001',
|
|
107
|
-
locations: ['L01-001-01', 'L01-001-02', 'L01-001-03', 'L01-001-04', 'L01-001-05']
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
id: 'Z002',
|
|
111
|
-
name: 'Zone 01-002',
|
|
112
|
-
locations: ['L01-002-01', 'L01-002-02', 'L01-002-03', 'L01-002-04', 'L01-002-05']
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: '02',
|
|
118
|
-
name: '제 2 창고',
|
|
119
|
-
zones: [
|
|
120
|
-
{
|
|
121
|
-
id: 'Z001',
|
|
122
|
-
name: 'Zone 02-001',
|
|
123
|
-
locations: ['L02-001-01', 'L02-001-02', 'L02-001-03', 'L02-001-04', 'L02-001-05']
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: 'Z002',
|
|
127
|
-
name: 'Zone 02-002',
|
|
128
|
-
locations: ['L02-002-01', 'L02-002-02', 'L02-002-03', 'L02-002-04', 'L02-002-05']
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
|
|
134
|
-
export const Regular = Template.bind({})
|
|
135
|
-
Regular.args = {
|
|
136
|
-
fields: [
|
|
137
|
-
{
|
|
138
|
-
type: 'select',
|
|
139
|
-
name: 'warehouse',
|
|
140
|
-
label: 'warehouse',
|
|
141
|
-
options: async (form: OxSearchForm) => {
|
|
142
|
-
await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기
|
|
143
|
-
return [
|
|
144
|
-
{
|
|
145
|
-
display: '',
|
|
146
|
-
value: ''
|
|
147
|
-
}
|
|
148
|
-
].concat(
|
|
149
|
-
WAREHOUSE.map(w => {
|
|
150
|
-
return {
|
|
151
|
-
display: w.name,
|
|
152
|
-
value: w.id
|
|
153
|
-
}
|
|
154
|
-
})
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
type: 'select',
|
|
160
|
-
name: 'zone',
|
|
161
|
-
label: 'zone',
|
|
162
|
-
boundTo: ['warehouse'],
|
|
163
|
-
options: async (form: OxSearchForm) => {
|
|
164
|
-
await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기
|
|
165
|
-
const formData = new FormData(await form.form)
|
|
166
|
-
const warehouse = formData?.get('warehouse')
|
|
167
|
-
console.log('warehouse', warehouse)
|
|
168
|
-
|
|
169
|
-
const targetWH = warehouse && WAREHOUSE.find(w => w.id == warehouse)
|
|
170
|
-
const zones = targetWH
|
|
171
|
-
? targetWH.zones
|
|
172
|
-
: WAREHOUSE.reduce((sum, warehouse) => {
|
|
173
|
-
sum = sum.concat(warehouse.zones)
|
|
174
|
-
return sum
|
|
175
|
-
}, [] as any[])
|
|
176
|
-
|
|
177
|
-
return [
|
|
178
|
-
{
|
|
179
|
-
display: '',
|
|
180
|
-
value: ''
|
|
181
|
-
}
|
|
182
|
-
].concat(
|
|
183
|
-
zones.map((z: any) => {
|
|
184
|
-
return {
|
|
185
|
-
display: z.name,
|
|
186
|
-
value: z.id
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
)
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: 'location',
|
|
194
|
-
type: 'select',
|
|
195
|
-
label: 'location',
|
|
196
|
-
boundTo: ['warehouse', 'zone'],
|
|
197
|
-
options: async (form: OxSearchForm) => {
|
|
198
|
-
await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기
|
|
199
|
-
const formData = new FormData(await form.form)
|
|
200
|
-
const warehouse = formData?.get('warehouse')
|
|
201
|
-
const zone = formData?.get('zone')
|
|
202
|
-
console.log('warehouse, zone', warehouse, zone)
|
|
203
|
-
|
|
204
|
-
const targetWH = (warehouse && WAREHOUSE.find(w => w.id == warehouse)) || null
|
|
205
|
-
const targetZone = zone && targetWH?.zones.find(z => z.id == zone)
|
|
206
|
-
return targetZone ? ['', ...targetZone.locations] : []
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
],
|
|
210
|
-
hideSearchButton: true,
|
|
211
|
-
resetTarget: {
|
|
212
|
-
location: ''
|
|
213
|
-
},
|
|
214
|
-
autofocus: true
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export const RegularContact = Template.bind({})
|
|
218
|
-
RegularContact.args = {
|
|
219
|
-
fields: [
|
|
220
|
-
{
|
|
221
|
-
label: 'name',
|
|
222
|
-
name: 'name',
|
|
223
|
-
type: 'text',
|
|
224
|
-
readonly: true,
|
|
225
|
-
value: '남상혁',
|
|
226
|
-
placeholder: 'type your name.',
|
|
227
|
-
props: { searchOper: 'i_like' }
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
label: 'email',
|
|
231
|
-
name: 'email',
|
|
232
|
-
type: 'text',
|
|
233
|
-
props: { searchOper: 'i_like' }
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
label: 'fax',
|
|
237
|
-
name: 'fax',
|
|
238
|
-
type: 'text',
|
|
239
|
-
props: { searchOper: 'i_like' }
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
label: 'phone',
|
|
243
|
-
name: 'phone',
|
|
244
|
-
type: 'text',
|
|
245
|
-
readonly: true,
|
|
246
|
-
props: { searchOper: 'i_like' }
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
label: 'description',
|
|
250
|
-
name: 'description',
|
|
251
|
-
type: 'text',
|
|
252
|
-
props: { searchOper: 'i_like' }
|
|
253
|
-
}
|
|
254
|
-
],
|
|
255
|
-
hideSearchButton: true,
|
|
256
|
-
resetTarget: ['name', 'email'],
|
|
257
|
-
autofocus: true
|
|
258
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2018",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": ["es2017", "dom"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"useDefineForClassFields": false,
|
|
13
|
-
"importHelpers": true,
|
|
14
|
-
"outDir": "dist",
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
"inlineSources": true,
|
|
17
|
-
"rootDir": "./",
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"incremental": true,
|
|
20
|
-
"skipLibCheck": true,
|
|
21
|
-
"types": ["node", "mocha"]
|
|
22
|
-
},
|
|
23
|
-
"include": ["**/*.ts"]
|
|
24
|
-
}
|