@operato/attribute 7.1.31 → 7.1.33

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/src/types.ts DELETED
@@ -1,23 +0,0 @@
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
- }
@@ -1,105 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import '@operato/i18n'
3
- import '../src/ox-attribute-form.js'
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) => html`
75
- <link href="/themes/app-theme.css" rel="stylesheet" />
76
- <link
77
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
78
- rel="stylesheet"
79
- />
80
- <link
81
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
82
- rel="stylesheet"
83
- />
84
- <link
85
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
86
- rel="stylesheet"
87
- />
88
-
89
- <style>
90
- body {
91
- }
92
- </style>
93
-
94
- <ox-attribute-form
95
- .attributeSet=${attributeSet}
96
- .value=${value}
97
- @change=${(e: CustomEvent) => {
98
- value = e.detail
99
- console.log('change', value)
100
- }}
101
- ></ox-attribute-form>
102
- `
103
-
104
- export const Regular = Template.bind({})
105
- Regular.args = {}
@@ -1,98 +0,0 @@
1
- import '@operato/i18n'
2
- import '../src/ox-attribute-view.js'
3
- import '@material/web/icon/icon.js'
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) => html`
75
- <link href="/themes/app-theme.css" rel="stylesheet" />
76
- <link
77
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
78
- rel="stylesheet"
79
- />
80
- <link
81
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
82
- rel="stylesheet"
83
- />
84
- <link
85
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
86
- rel="stylesheet"
87
- />
88
-
89
- <style>
90
- body {
91
- }
92
- </style>
93
-
94
- <ox-attribute-view .attributeSet=${attributeSet} .value=${value}></ox-attribute-view>
95
- `
96
-
97
- export const Regular = Template.bind({})
98
- Regular.args = {}
@@ -1,338 +0,0 @@
1
- import '@material/md-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(--spacing-medium);
74
- }
75
-
76
- #tailer a {
77
- padding: 0 var(--padding-default) 0 var(--padding-default);
78
- margin: 0 var(--spacing-small);
79
- border-right: 1px solid rgba(0, 0, 0, 0.1);
80
- font-size: var(--fontsize-default);
81
- color: var(--md-sys-color-on-primary-container);
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
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</md-icon>
239
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</md-icon>
240
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-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) => html`
265
- <link
266
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
267
- rel="stylesheet"
268
- />
269
- <link
270
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
271
- rel="stylesheet"
272
- />
273
- <link
274
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
275
- rel="stylesheet"
276
- />
277
-
278
- <link href="/themes/app-theme.css" rel="stylesheet" />
279
- <link href="/themes/oops-theme.css" rel="stylesheet" />
280
- <link href="/themes/grist-theme.css" rel="stylesheet" />
281
-
282
- <style>
283
- [slot='headroom'] {
284
- display: flex;
285
- flex-direction: row;
286
- align-items: center;
287
- padding: var(--padding-default) var(--spacing-large);
288
- background-color: var(--md-sys-color-surface);
289
- box-shadow: var(--box-shadow);
290
-
291
- --md-icon-size: 24px;
292
- }
293
- #sorters md-icon,
294
- #modes md-icon {
295
- --md-icon-size: 18px;
296
- }
297
- #sorters {
298
- margin-left: auto;
299
- margin-right: var(--spacing-medium);
300
- padding-left: var(--spacing-small);
301
- border-bottom: var(--border-dim-color);
302
- position: relative;
303
- color: var(--md-sys-color-on-secondary-container);
304
- font-size: var(--fontsize-default);
305
- user-select: none;
306
- }
307
-
308
- #sorters > * {
309
- padding: var(--spacing-small);
310
- vertical-align: middle;
311
- }
312
-
313
- #filters {
314
- display: flex;
315
- justify-content: center;
316
- align-items: center;
317
- }
318
-
319
- #filters * {
320
- margin-right: var(--spacing-medium);
321
- }
322
-
323
- @media only screen and (max-width: 460px) {
324
- #filters {
325
- flex-direction: column;
326
- }
327
-
328
- #modes {
329
- display: none;
330
- }
331
- }
332
- </style>
333
-
334
- <ox-attributes mode="LIST"></ox-attributes>
335
- `
336
-
337
- export const Regular = Template.bind({})
338
- Regular.args = {}
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
- }
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'dist/test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });