@operato/form 9.0.0-beta.7 → 9.0.0-beta.70

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +7 -7
  4. package/dist/stories/ox-filters-form-barcode.stories.d.ts +0 -29
  5. package/dist/stories/ox-filters-form-barcode.stories.js +0 -125
  6. package/dist/stories/ox-filters-form-barcode.stories.js.map +0 -1
  7. package/dist/stories/ox-filters-form-base-bounded.stories.d.ts +0 -30
  8. package/dist/stories/ox-filters-form-base-bounded.stories.js +0 -183
  9. package/dist/stories/ox-filters-form-base-bounded.stories.js.map +0 -1
  10. package/dist/stories/ox-filters-form-base-change-handler.stories.d.ts +0 -30
  11. package/dist/stories/ox-filters-form-base-change-handler.stories.js +0 -195
  12. package/dist/stories/ox-filters-form-base-change-handler.stories.js.map +0 -1
  13. package/dist/stories/ox-filters-form-base-page-preference.stories.d.ts +0 -31
  14. package/dist/stories/ox-filters-form-base-page-preference.stories.js +0 -158
  15. package/dist/stories/ox-filters-form-base-page-preference.stories.js.map +0 -1
  16. package/dist/stories/ox-filters-form-base.stories.d.ts +0 -30
  17. package/dist/stories/ox-filters-form-base.stories.js +0 -161
  18. package/dist/stories/ox-filters-form-base.stories.js.map +0 -1
  19. package/dist/stories/ox-search-form-change-handler.stories.d.ts +0 -34
  20. package/dist/stories/ox-search-form-change-handler.stories.js +0 -228
  21. package/dist/stories/ox-search-form-change-handler.stories.js.map +0 -1
  22. package/dist/stories/ox-search-form.stories.d.ts +0 -40
  23. package/dist/stories/ox-search-form.stories.js +0 -231
  24. package/dist/stories/ox-search-form.stories.js.map +0 -1
@@ -1,228 +0,0 @@
1
- import { CommonHeaderStyles } from '@operato/styles';
2
- import { sleep } from '@operato/utils';
3
- import '../src/components/ox-search-form.js';
4
- import { html } from 'lit';
5
- import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js';
6
- export default {
7
- title: 'ox-search-form change handler',
8
- component: 'ox-search-form',
9
- argTypes: {
10
- value: { control: 'object' },
11
- fields: { control: 'object' },
12
- hideSearchButton: { control: 'boolean' },
13
- autofocus: { control: 'boolean' }
14
- }
15
- };
16
- const Template = ({ fields, hideSearchButton, autofocus }) => html `
17
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
18
-
19
- <link href="/themes/light.css" rel="stylesheet" />
20
- <link href="/themes/dark.css" rel="stylesheet" />
21
- <link href="/themes/spacing.css" rel="stylesheet" />
22
- <link href="/themes/form-theme.css" rel="stylesheet" />
23
-
24
- <link
25
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
26
- rel="stylesheet"
27
- />
28
- <link
29
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
30
- rel="stylesheet"
31
- />
32
- <link
33
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
34
- rel="stylesheet"
35
- />
36
-
37
- <style>
38
- ${MDTypeScaleStyles.cssText}
39
- </style>
40
-
41
- <style>
42
- ${CommonHeaderStyles.cssText}
43
- </style>
44
-
45
- <style>
46
- body {
47
- width: 100%;
48
- height: 500px;
49
- text-align: center;
50
-
51
- background-color: var(--md-sys-color-background);
52
- color: var(--md-sys-color-on-background);
53
- }
54
-
55
- .header {
56
- padding: var(--spacing-medium);
57
- background-color: var(--md-sys-color-primary-container);
58
- color: var(--md-sys-color-on-primary-container);
59
- }
60
- </style>
61
-
62
- <div class="header">
63
- <div class="filters">
64
- <ox-search-form
65
- .fields=${fields}
66
- ?autofocus=${autofocus}
67
- ?hideSearchButton=${hideSearchButton}
68
- @change=${(e) => {
69
- console.log('search form changed', e.detail);
70
- }}
71
- >
72
- </ox-search-form>
73
- </div>
74
- </div>
75
- `;
76
- const WAREHOUSE = [
77
- {
78
- id: '01',
79
- name: '제 1 창고',
80
- zones: [
81
- {
82
- id: 'Z001',
83
- name: 'Zone 01-001',
84
- locations: ['L01-001-01', 'L01-001-02', 'L01-001-03', 'L01-001-04', 'L01-001-05']
85
- },
86
- {
87
- id: 'Z002',
88
- name: 'Zone 01-002',
89
- locations: ['L01-002-01', 'L01-002-02', 'L01-002-03', 'L01-002-04', 'L01-002-05']
90
- }
91
- ]
92
- },
93
- {
94
- id: '02',
95
- name: '제 2 창고',
96
- zones: [
97
- {
98
- id: 'Z001',
99
- name: 'Zone 02-001',
100
- locations: ['L02-001-01', 'L02-001-02', 'L02-001-03', 'L02-001-04', 'L02-001-05']
101
- },
102
- {
103
- id: 'Z002',
104
- name: 'Zone 02-002',
105
- locations: ['L02-002-01', 'L02-002-02', 'L02-002-03', 'L02-002-04', 'L02-002-05']
106
- }
107
- ]
108
- }
109
- ];
110
- export const Regular = Template.bind({});
111
- Regular.args = {
112
- fields: [
113
- {
114
- type: 'select',
115
- name: 'warehouse',
116
- label: 'warehouse',
117
- options: async (form) => {
118
- await sleep(1000); // 테스트를 위해서 강제로 1초 쉬기
119
- return [
120
- {
121
- display: '',
122
- value: ''
123
- }
124
- ].concat(WAREHOUSE.map(w => {
125
- return {
126
- display: w.name,
127
- value: w.id
128
- };
129
- }));
130
- },
131
- onchange: () => false
132
- },
133
- {
134
- type: 'select',
135
- name: 'zone',
136
- label: 'zone',
137
- boundTo: ['warehouse'],
138
- options: async (form) => {
139
- await sleep(1000); // 테스트를 위해서 강제로 1초 쉬기
140
- const formData = new FormData(await form.form);
141
- const warehouse = formData === null || formData === void 0 ? void 0 : formData.get('warehouse');
142
- console.log('warehouse', warehouse);
143
- const targetWH = warehouse && WAREHOUSE.find(w => w.id == warehouse);
144
- const zones = targetWH
145
- ? targetWH.zones
146
- : WAREHOUSE.reduce((sum, warehouse) => {
147
- sum = sum.concat(warehouse.zones);
148
- return sum;
149
- }, []);
150
- return [
151
- {
152
- display: '',
153
- value: ''
154
- }
155
- ].concat(zones.map((z) => {
156
- return {
157
- display: z.name,
158
- value: z.id
159
- };
160
- }));
161
- },
162
- onchange: () => false
163
- },
164
- {
165
- name: 'location',
166
- type: 'select',
167
- label: 'location',
168
- boundTo: ['warehouse', 'zone'],
169
- options: async (form) => {
170
- await sleep(1000); // 테스트를 위해서 강제로 1초 쉬기
171
- const formData = new FormData(await form.form);
172
- const warehouse = formData === null || formData === void 0 ? void 0 : formData.get('warehouse');
173
- const zone = formData === null || formData === void 0 ? void 0 : formData.get('zone');
174
- console.log('warehouse, zone', warehouse, zone);
175
- const targetWH = (warehouse && WAREHOUSE.find(w => w.id == warehouse)) || null;
176
- const targetZone = zone && (targetWH === null || targetWH === void 0 ? void 0 : targetWH.zones.find(z => z.id == zone));
177
- return targetZone ? ['', ...targetZone.locations] : [];
178
- }
179
- }
180
- ],
181
- hideSearchButton: true,
182
- autofocus: true
183
- };
184
- export const RegularContact = Template.bind({});
185
- RegularContact.args = {
186
- fields: [
187
- {
188
- label: 'name',
189
- name: 'name',
190
- type: 'text',
191
- value: 'My Name',
192
- placeholder: 'type your name.',
193
- readonly: true,
194
- props: { searchOper: 'i_like' },
195
- onchange: value => {
196
- console.log('changed', value);
197
- return false;
198
- }
199
- },
200
- {
201
- label: 'email',
202
- name: 'email',
203
- type: 'text',
204
- props: { searchOper: 'i_like' }
205
- },
206
- {
207
- label: 'fax',
208
- name: 'fax',
209
- type: 'text',
210
- props: { searchOper: 'i_like' }
211
- },
212
- {
213
- label: 'phone',
214
- name: 'phone',
215
- type: 'text',
216
- props: { searchOper: 'i_like' }
217
- },
218
- {
219
- label: 'description',
220
- name: 'description',
221
- type: 'text',
222
- props: { searchOper: 'i_like' }
223
- }
224
- ],
225
- hideSearchButton: true,
226
- autofocus: true
227
- };
228
- //# sourceMappingURL=ox-search-form-change-handler.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ox-search-form-change-handler.stories.js","sourceRoot":"","sources":["../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E,SAAS;YAChB,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;YAC/B,QAAQ,EAAE,KAAK,CAAC,EAAE;gBAChB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;gBAC7B,OAAO,KAAK,CAAA;YACd,CAAC;SACF;QACD;YACE,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;SAChC;QACD;YACE,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;SAChC;QACD;YACE,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;SAChC;QACD;YACE,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;SAChC;KACF;IACD,gBAAgB,EAAE,IAAI;IACtB,SAAS,EAAE,IAAI;CAChB,CAAA","sourcesContent":["import { CommonHeaderStyles } from '@operato/styles'\nimport { sleep } from '@operato/utils'\nimport '../src/components/ox-search-form.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { OxSearchForm, SearchFormField } from '../src/index.js'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js'\n\nexport default {\n title: 'ox-search-form change handler',\n component: 'ox-search-form',\n argTypes: {\n value: { control: 'object' },\n fields: { control: 'object' },\n hideSearchButton: { control: 'boolean' },\n autofocus: { control: 'boolean' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n fields?: SearchFormField[]\n hideSearchButton?: boolean\n autofocus?: boolean\n}\n\nconst Template: Story<ArgTypes> = ({ fields, hideSearchButton, autofocus }: ArgTypes) => html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/form-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonHeaderStyles.cssText}\n </style>\n\n <style>\n body {\n width: 100%;\n height: 500px;\n text-align: center;\n\n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n }\n\n .header {\n padding: var(--spacing-medium);\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n </style>\n\n <div class=\"header\">\n <div class=\"filters\">\n <ox-search-form\n .fields=${fields!}\n ?autofocus=${autofocus}\n ?hideSearchButton=${hideSearchButton}\n @change=${(e: CustomEvent) => {\n console.log('search form changed', e.detail)\n }}\n >\n </ox-search-form>\n </div>\n </div>\n`\n\nconst WAREHOUSE = [\n {\n id: '01',\n name: '제 1 창고',\n zones: [\n {\n id: 'Z001',\n name: 'Zone 01-001',\n locations: ['L01-001-01', 'L01-001-02', 'L01-001-03', 'L01-001-04', 'L01-001-05']\n },\n {\n id: 'Z002',\n name: 'Zone 01-002',\n locations: ['L01-002-01', 'L01-002-02', 'L01-002-03', 'L01-002-04', 'L01-002-05']\n }\n ]\n },\n {\n id: '02',\n name: '제 2 창고',\n zones: [\n {\n id: 'Z001',\n name: 'Zone 02-001',\n locations: ['L02-001-01', 'L02-001-02', 'L02-001-03', 'L02-001-04', 'L02-001-05']\n },\n {\n id: 'Z002',\n name: 'Zone 02-002',\n locations: ['L02-002-01', 'L02-002-02', 'L02-002-03', 'L02-002-04', 'L02-002-05']\n }\n ]\n }\n]\n\nexport const Regular = Template.bind({})\nRegular.args = {\n fields: [\n {\n type: 'select',\n name: 'warehouse',\n label: 'warehouse',\n options: async (form: OxSearchForm) => {\n await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기\n return [\n {\n display: '',\n value: ''\n }\n ].concat(\n WAREHOUSE.map(w => {\n return {\n display: w.name,\n value: w.id\n }\n })\n )\n },\n onchange: () => false\n },\n {\n type: 'select',\n name: 'zone',\n label: 'zone',\n boundTo: ['warehouse'],\n options: async (form: OxSearchForm) => {\n await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기\n const formData = new FormData(await form.form)\n const warehouse = formData?.get('warehouse')\n console.log('warehouse', warehouse)\n\n const targetWH = warehouse && WAREHOUSE.find(w => w.id == warehouse)\n const zones = targetWH\n ? targetWH.zones\n : WAREHOUSE.reduce((sum, warehouse) => {\n sum = sum.concat(warehouse.zones)\n return sum\n }, [] as any[])\n\n return [\n {\n display: '',\n value: ''\n }\n ].concat(\n zones.map((z: any) => {\n return {\n display: z.name,\n value: z.id\n }\n })\n )\n },\n onchange: () => false\n },\n {\n name: 'location',\n type: 'select',\n label: 'location',\n boundTo: ['warehouse', 'zone'],\n options: async (form: OxSearchForm) => {\n await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기\n const formData = new FormData(await form.form)\n const warehouse = formData?.get('warehouse')\n const zone = formData?.get('zone')\n console.log('warehouse, zone', warehouse, zone)\n\n const targetWH = (warehouse && WAREHOUSE.find(w => w.id == warehouse)) || null\n const targetZone = zone && targetWH?.zones.find(z => z.id == zone)\n return targetZone ? ['', ...targetZone.locations] : []\n }\n }\n ],\n hideSearchButton: true,\n autofocus: true\n}\n\nexport const RegularContact = Template.bind({})\nRegularContact.args = {\n fields: [\n {\n label: 'name',\n name: 'name',\n type: 'text',\n value: 'My Name',\n placeholder: 'type your name.',\n readonly: true,\n props: { searchOper: 'i_like' },\n onchange: value => {\n console.log('changed', value)\n return false\n }\n },\n {\n label: 'email',\n name: 'email',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: 'fax',\n name: 'fax',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: 'phone',\n name: 'phone',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: 'description',\n name: 'description',\n type: 'text',\n props: { searchOper: 'i_like' }\n }\n ],\n hideSearchButton: true,\n autofocus: true\n}\n"]}
@@ -1,40 +0,0 @@
1
- import '../src/components/ox-search-form.js';
2
- import { TemplateResult } from 'lit';
3
- import { SearchFormField } from '../src/index.js';
4
- declare const _default: {
5
- title: string;
6
- component: string;
7
- argTypes: {
8
- value: {
9
- control: string;
10
- };
11
- fields: {
12
- control: string;
13
- };
14
- hideSearchButton: {
15
- control: string;
16
- };
17
- autofocus: {
18
- control: string;
19
- };
20
- resetTarget: {
21
- control: string;
22
- };
23
- };
24
- };
25
- export default _default;
26
- interface Story<T> {
27
- (args: T): TemplateResult;
28
- args?: Partial<T>;
29
- argTypes?: Record<string, unknown>;
30
- }
31
- interface ArgTypes {
32
- fields?: SearchFormField[];
33
- hideSearchButton?: boolean;
34
- autofocus?: boolean;
35
- resetTarget: string[] | {
36
- [field: string]: any;
37
- };
38
- }
39
- export declare const Regular: Story<ArgTypes>;
40
- export declare const RegularContact: Story<ArgTypes>;
@@ -1,231 +0,0 @@
1
- import { CommonHeaderStyles } from '@operato/styles';
2
- import { sleep } from '@operato/utils';
3
- import '../src/components/ox-search-form.js';
4
- import { html } from 'lit';
5
- import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js';
6
- export default {
7
- title: 'ox-search-form',
8
- component: 'ox-search-form',
9
- argTypes: {
10
- value: { control: 'object' },
11
- fields: { control: 'object' },
12
- hideSearchButton: { control: 'boolean' },
13
- autofocus: { control: 'boolean' },
14
- resetTarget: { control: 'object' }
15
- }
16
- };
17
- const Template = ({ fields, hideSearchButton, autofocus, resetTarget }) => html `
18
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
19
-
20
- <link href="/themes/light.css" rel="stylesheet" />
21
- <link href="/themes/dark.css" rel="stylesheet" />
22
- <link href="/themes/spacing.css" rel="stylesheet" />
23
- <link href="/themes/form-theme.css" rel="stylesheet" />
24
-
25
- <link
26
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
27
- rel="stylesheet"
28
- />
29
- <link
30
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
31
- rel="stylesheet"
32
- />
33
- <link
34
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
35
- rel="stylesheet"
36
- />
37
-
38
- <style>
39
- ${MDTypeScaleStyles.cssText}
40
- </style>
41
-
42
- <style>
43
- ${CommonHeaderStyles.cssText}
44
- </style>
45
-
46
- <style>
47
- body {
48
- width: 100%;
49
- height: 500px;
50
- text-align: center;
51
-
52
- background-color: var(--md-sys-color-background);
53
- color: var(--md-sys-color-on-background);
54
- }
55
-
56
- .header {
57
- padding: var(--spacing-medium);
58
- background-color: var(--md-sys-color-primary-container);
59
- color: var(--md-sys-color-on-primary-container);
60
- }
61
- </style>
62
-
63
- <div class="header">
64
- <div class="filters">
65
- <ox-search-form
66
- .fields=${fields}
67
- ?autofocus=${autofocus}
68
- ?hideSearchButton=${hideSearchButton}
69
- @change=${(e) => {
70
- console.log('search form changed', e.detail);
71
- }}
72
- >
73
- </ox-search-form>
74
- </div>
75
- </div>
76
-
77
- <button @click=${() => { var _a; return (_a = document.querySelector('ox-search-form')) === null || _a === void 0 ? void 0 : _a.reset(resetTarget); }}>Partial Reset</button>
78
- <button @click=${() => { var _a; return (_a = document.querySelector('ox-search-form')) === null || _a === void 0 ? void 0 : _a.reset(); }}>Full Reset</button>
79
- `;
80
- const WAREHOUSE = [
81
- {
82
- id: '01',
83
- name: '제 1 창고',
84
- zones: [
85
- {
86
- id: 'Z001',
87
- name: 'Zone 01-001',
88
- locations: ['L01-001-01', 'L01-001-02', 'L01-001-03', 'L01-001-04', 'L01-001-05']
89
- },
90
- {
91
- id: 'Z002',
92
- name: 'Zone 01-002',
93
- locations: ['L01-002-01', 'L01-002-02', 'L01-002-03', 'L01-002-04', 'L01-002-05']
94
- }
95
- ]
96
- },
97
- {
98
- id: '02',
99
- name: '제 2 창고',
100
- zones: [
101
- {
102
- id: 'Z001',
103
- name: 'Zone 02-001',
104
- locations: ['L02-001-01', 'L02-001-02', 'L02-001-03', 'L02-001-04', 'L02-001-05']
105
- },
106
- {
107
- id: 'Z002',
108
- name: 'Zone 02-002',
109
- locations: ['L02-002-01', 'L02-002-02', 'L02-002-03', 'L02-002-04', 'L02-002-05']
110
- }
111
- ]
112
- }
113
- ];
114
- export const Regular = Template.bind({});
115
- Regular.args = {
116
- fields: [
117
- {
118
- type: 'select',
119
- name: 'warehouse',
120
- label: 'warehouse',
121
- options: async (form) => {
122
- await sleep(1000); // 테스트를 위해서 강제로 1초 쉬기
123
- return [
124
- {
125
- display: '',
126
- value: ''
127
- }
128
- ].concat(WAREHOUSE.map(w => {
129
- return {
130
- display: w.name,
131
- value: w.id
132
- };
133
- }));
134
- }
135
- },
136
- {
137
- type: 'select',
138
- name: 'zone',
139
- label: 'zone',
140
- boundTo: ['warehouse'],
141
- options: async (form) => {
142
- await sleep(1000); // 테스트를 위해서 강제로 1초 쉬기
143
- const formData = new FormData(await form.form);
144
- const warehouse = formData === null || formData === void 0 ? void 0 : formData.get('warehouse');
145
- console.log('warehouse', warehouse);
146
- const targetWH = warehouse && WAREHOUSE.find(w => w.id == warehouse);
147
- const zones = targetWH
148
- ? targetWH.zones
149
- : WAREHOUSE.reduce((sum, warehouse) => {
150
- sum = sum.concat(warehouse.zones);
151
- return sum;
152
- }, []);
153
- return [
154
- {
155
- display: '',
156
- value: ''
157
- }
158
- ].concat(zones.map((z) => {
159
- return {
160
- display: z.name,
161
- value: z.id
162
- };
163
- }));
164
- }
165
- },
166
- {
167
- name: 'location',
168
- type: 'select',
169
- label: 'location',
170
- boundTo: ['warehouse', 'zone'],
171
- options: async (form) => {
172
- await sleep(1000); // 테스트를 위해서 강제로 1초 쉬기
173
- const formData = new FormData(await form.form);
174
- const warehouse = formData === null || formData === void 0 ? void 0 : formData.get('warehouse');
175
- const zone = formData === null || formData === void 0 ? void 0 : formData.get('zone');
176
- console.log('warehouse, zone', warehouse, zone);
177
- const targetWH = (warehouse && WAREHOUSE.find(w => w.id == warehouse)) || null;
178
- const targetZone = zone && (targetWH === null || targetWH === void 0 ? void 0 : targetWH.zones.find(z => z.id == zone));
179
- return targetZone ? ['', ...targetZone.locations] : [];
180
- }
181
- }
182
- ],
183
- hideSearchButton: true,
184
- resetTarget: {
185
- location: ''
186
- },
187
- autofocus: true
188
- };
189
- export const RegularContact = Template.bind({});
190
- RegularContact.args = {
191
- fields: [
192
- {
193
- label: 'name',
194
- name: 'name',
195
- type: 'text',
196
- readonly: true,
197
- value: '남상혁',
198
- placeholder: 'type your name.',
199
- props: { searchOper: 'i_like' }
200
- },
201
- {
202
- label: 'email',
203
- name: 'email',
204
- type: 'text',
205
- props: { searchOper: 'i_like' }
206
- },
207
- {
208
- label: 'fax',
209
- name: 'fax',
210
- type: 'text',
211
- props: { searchOper: 'i_like' }
212
- },
213
- {
214
- label: 'phone',
215
- name: 'phone',
216
- type: 'text',
217
- readonly: true,
218
- props: { searchOper: 'i_like' }
219
- },
220
- {
221
- label: 'description',
222
- name: 'description',
223
- type: 'text',
224
- props: { searchOper: 'i_like' }
225
- }
226
- ],
227
- hideSearchButton: true,
228
- resetTarget: ['name', 'email'],
229
- autofocus: true
230
- };
231
- //# sourceMappingURL=ox-search-form.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ox-search-form.stories.js","sourceRoot":"","sources":["../../stories/ox-search-form.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iDAAiD,CAAA;AAI7F,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC5B,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC7B,gBAAgB,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QACxC,SAAS,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QACjC,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;KACnC;CACF,CAAA;AAeD,MAAM,QAAQ,GAAoB,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;MAsBpG,iBAAiB,CAAC,OAAO;;;;MAIzB,kBAAkB,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;kBAuBd,MAAO;qBACJ,SAAS;4BACF,gBAAgB;kBAC1B,CAAC,CAAc,EAAE,EAAE;IAC3B,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,CAAC,MAA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E,IAAI;CAChB,CAAA","sourcesContent":["import { CommonHeaderStyles } from '@operato/styles'\nimport { sleep } from '@operato/utils'\nimport '../src/components/ox-search-form.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js'\n\nimport { OxSearchForm, SearchFormField } from '../src/index.js'\n\nexport default {\n title: 'ox-search-form',\n component: 'ox-search-form',\n argTypes: {\n value: { control: 'object' },\n fields: { control: 'object' },\n hideSearchButton: { control: 'boolean' },\n autofocus: { control: 'boolean' },\n resetTarget: { 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 fields?: SearchFormField[]\n hideSearchButton?: boolean\n autofocus?: boolean\n resetTarget: string[] | { [field: string]: any }\n}\n\nconst Template: Story<ArgTypes> = ({ fields, hideSearchButton, autofocus, resetTarget }: ArgTypes) => html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/form-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonHeaderStyles.cssText}\n </style>\n\n <style>\n body {\n width: 100%;\n height: 500px;\n text-align: center;\n\n background-color: var(--md-sys-color-background);\n color: var(--md-sys-color-on-background);\n }\n\n .header {\n padding: var(--spacing-medium);\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n </style>\n\n <div class=\"header\">\n <div class=\"filters\">\n <ox-search-form\n .fields=${fields!}\n ?autofocus=${autofocus}\n ?hideSearchButton=${hideSearchButton}\n @change=${(e: CustomEvent) => {\n console.log('search form changed', e.detail)\n }}\n >\n </ox-search-form>\n </div>\n </div>\n\n <button @click=${() => (document.querySelector('ox-search-form') as any)?.reset(resetTarget)}>Partial Reset</button>\n <button @click=${() => (document.querySelector('ox-search-form') as any)?.reset()}>Full Reset</button>\n`\n\nconst WAREHOUSE = [\n {\n id: '01',\n name: '제 1 창고',\n zones: [\n {\n id: 'Z001',\n name: 'Zone 01-001',\n locations: ['L01-001-01', 'L01-001-02', 'L01-001-03', 'L01-001-04', 'L01-001-05']\n },\n {\n id: 'Z002',\n name: 'Zone 01-002',\n locations: ['L01-002-01', 'L01-002-02', 'L01-002-03', 'L01-002-04', 'L01-002-05']\n }\n ]\n },\n {\n id: '02',\n name: '제 2 창고',\n zones: [\n {\n id: 'Z001',\n name: 'Zone 02-001',\n locations: ['L02-001-01', 'L02-001-02', 'L02-001-03', 'L02-001-04', 'L02-001-05']\n },\n {\n id: 'Z002',\n name: 'Zone 02-002',\n locations: ['L02-002-01', 'L02-002-02', 'L02-002-03', 'L02-002-04', 'L02-002-05']\n }\n ]\n }\n]\n\nexport const Regular = Template.bind({})\nRegular.args = {\n fields: [\n {\n type: 'select',\n name: 'warehouse',\n label: 'warehouse',\n options: async (form: OxSearchForm) => {\n await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기\n return [\n {\n display: '',\n value: ''\n }\n ].concat(\n WAREHOUSE.map(w => {\n return {\n display: w.name,\n value: w.id\n }\n })\n )\n }\n },\n {\n type: 'select',\n name: 'zone',\n label: 'zone',\n boundTo: ['warehouse'],\n options: async (form: OxSearchForm) => {\n await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기\n const formData = new FormData(await form.form)\n const warehouse = formData?.get('warehouse')\n console.log('warehouse', warehouse)\n\n const targetWH = warehouse && WAREHOUSE.find(w => w.id == warehouse)\n const zones = targetWH\n ? targetWH.zones\n : WAREHOUSE.reduce((sum, warehouse) => {\n sum = sum.concat(warehouse.zones)\n return sum\n }, [] as any[])\n\n return [\n {\n display: '',\n value: ''\n }\n ].concat(\n zones.map((z: any) => {\n return {\n display: z.name,\n value: z.id\n }\n })\n )\n }\n },\n {\n name: 'location',\n type: 'select',\n label: 'location',\n boundTo: ['warehouse', 'zone'],\n options: async (form: OxSearchForm) => {\n await sleep(1000) // 테스트를 위해서 강제로 1초 쉬기\n const formData = new FormData(await form.form)\n const warehouse = formData?.get('warehouse')\n const zone = formData?.get('zone')\n console.log('warehouse, zone', warehouse, zone)\n\n const targetWH = (warehouse && WAREHOUSE.find(w => w.id == warehouse)) || null\n const targetZone = zone && targetWH?.zones.find(z => z.id == zone)\n return targetZone ? ['', ...targetZone.locations] : []\n }\n }\n ],\n hideSearchButton: true,\n resetTarget: {\n location: ''\n },\n autofocus: true\n}\n\nexport const RegularContact = Template.bind({})\nRegularContact.args = {\n fields: [\n {\n label: 'name',\n name: 'name',\n type: 'text',\n readonly: true,\n value: '남상혁',\n placeholder: 'type your name.',\n props: { searchOper: 'i_like' }\n },\n {\n label: 'email',\n name: 'email',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: 'fax',\n name: 'fax',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: 'phone',\n name: 'phone',\n type: 'text',\n readonly: true,\n props: { searchOper: 'i_like' }\n },\n {\n label: 'description',\n name: 'description',\n type: 'text',\n props: { searchOper: 'i_like' }\n }\n ],\n hideSearchButton: true,\n resetTarget: ['name', 'email'],\n autofocus: true\n}\n"]}