@things-factory/meta-ui 7.0.1-alpha.31 → 7.0.1-alpha.34
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/client/bootstrap.ts +1 -1
- package/client/component/filter/filter-form-meta-code-select.ts +99 -0
- package/client/component/filter/filter-form-meta-object-select.ts +104 -0
- package/client/component/filter/filter-grist-meta-code-select.ts +97 -0
- package/client/component/filter/filter-grist-meta-object-select.ts +102 -0
- package/client/component/popup/code-input-editor-popup.js +1 -1
- package/client/component/popup/{meta-object-selector-popup.js → meta-object-selector-popup.ts} +73 -46
- package/client/component/popup/{record-based-code-editor-popup.js → record-based-code-editor-popup.ts} +19 -18
- package/client/utils/meta-api.js +13 -1
- package/client/utils/meta-ui-util.js +21 -7
- package/client/utils/service-util.js +39 -3
- package/client/utils/{terms-util.js → terms-util.ts} +13 -13
- package/dist-client/bootstrap.js +1 -1
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/component/filter/filter-form-meta-code-select.d.ts +4 -1
- package/dist-client/component/filter/filter-form-meta-code-select.js +22 -19
- package/dist-client/component/filter/filter-form-meta-code-select.js.map +1 -1
- package/dist-client/component/filter/filter-form-meta-object-select.d.ts +4 -1
- package/dist-client/component/filter/filter-form-meta-object-select.js +28 -20
- package/dist-client/component/filter/filter-form-meta-object-select.js.map +1 -1
- package/dist-client/component/filter/filter-grist-meta-code-select.d.ts +3 -1
- package/dist-client/component/filter/filter-grist-meta-code-select.js +20 -19
- package/dist-client/component/filter/filter-grist-meta-code-select.js.map +1 -1
- package/dist-client/component/filter/filter-grist-meta-object-select.d.ts +3 -1
- package/dist-client/component/filter/filter-grist-meta-object-select.js +26 -20
- package/dist-client/component/filter/filter-grist-meta-object-select.js.map +1 -1
- package/dist-client/component/popup/code-input-editor-popup.js +1 -1
- package/dist-client/component/popup/code-input-editor-popup.js.map +1 -1
- package/dist-client/component/popup/meta-object-selector-popup.d.ts +27 -22
- package/dist-client/component/popup/meta-object-selector-popup.js +76 -47
- package/dist-client/component/popup/meta-object-selector-popup.js.map +1 -1
- package/dist-client/component/popup/record-based-code-editor-popup.d.ts +10 -11
- package/dist-client/component/popup/record-based-code-editor-popup.js +59 -17
- package/dist-client/component/popup/record-based-code-editor-popup.js.map +1 -1
- package/dist-client/pages/history/history-copy-list-popup.d.ts +1 -1
- package/dist-client/pages/history/history-json-list-popup.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/meta-api.d.ts +11 -2
- package/dist-client/utils/meta-api.js +12 -1
- package/dist-client/utils/meta-api.js.map +1 -1
- package/dist-client/utils/meta-ui-util.js +18 -7
- package/dist-client/utils/meta-ui-util.js.map +1 -1
- package/dist-client/utils/service-util.d.ts +11 -1
- package/dist-client/utils/service-util.js +37 -3
- package/dist-client/utils/service-util.js.map +1 -1
- package/dist-client/utils/terms-util.d.ts +7 -7
- package/dist-client/utils/terms-util.js +4 -4
- package/dist-client/utils/terms-util.js.map +1 -1
- package/package.json +9 -8
- package/client/component/filter/filter-form-meta-code-select.js +0 -94
- package/client/component/filter/filter-form-meta-object-select.js +0 -94
- package/client/component/filter/filter-grist-meta-code-select.js +0 -95
- package/client/component/filter/filter-grist-meta-object-select.js +0 -95
package/client/bootstrap.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@operato/data-grist'
|
|
12
12
|
import { registerFilterRenderer as formRegisterFilterRenderer } from '@operato/form'
|
|
13
13
|
|
|
14
|
-
import { auth } from '@things-factory/auth-base/dist-client
|
|
14
|
+
import { auth } from '@things-factory/auth-base/dist-client'
|
|
15
15
|
import { ADD_MORENDA } from '@things-factory/more-base/client'
|
|
16
16
|
|
|
17
17
|
import { updateMenuTemplate } from './actions/main'
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '../popup/meta-object-selector-popup'
|
|
3
|
+
|
|
4
|
+
import { html } from 'lit-html'
|
|
5
|
+
|
|
6
|
+
import { openPopup } from '@operato/layout'
|
|
7
|
+
import { FilterSelectRenderer } from '@operato/form'
|
|
8
|
+
import { TermsUtil } from './../../utils/terms-util'
|
|
9
|
+
|
|
10
|
+
function openMetaCodeSelector(filter, value, confirmCallback) {
|
|
11
|
+
var template = html` <meta-object-selector-popup .value=${value} .options=${filter.options} .confirmCallback=${confirmCallback}> </meta-object-selector-popup> `
|
|
12
|
+
|
|
13
|
+
openPopup(template, {
|
|
14
|
+
backdrop: true,
|
|
15
|
+
size: 'large',
|
|
16
|
+
title: filter.options.selectorName ? String(TermsUtil.tMenu(filter.options.selectorName)) : String(TermsUtil.tTitle('select_item'))
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const FilterFormMetaCodeSelect: FilterSelectRenderer = (filter, value, owner) => {
|
|
21
|
+
const options = filter.options || {}
|
|
22
|
+
const codes = options.codes && options.codes.length > 0 ? options.codes : undefined
|
|
23
|
+
const { operator = 'eq' } = filter
|
|
24
|
+
const hiddenText = value ? value : ''
|
|
25
|
+
|
|
26
|
+
var text = value ? value : ''
|
|
27
|
+
|
|
28
|
+
if (options.dispField && value && codes) {
|
|
29
|
+
let dispCode = codes.filter(x => x.value == value)
|
|
30
|
+
|
|
31
|
+
if (dispCode && dispCode.length > 0) {
|
|
32
|
+
text = dispCode[0].display
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return operator === 'eq'
|
|
37
|
+
? html`
|
|
38
|
+
<input name='${filter.name}' .value=${hiddenText} type="text" hidden></input>
|
|
39
|
+
<input
|
|
40
|
+
type="text"
|
|
41
|
+
readonly
|
|
42
|
+
name='${filter.name}_disp'
|
|
43
|
+
.value=${text}
|
|
44
|
+
@click=${e => {
|
|
45
|
+
e.stopPropagation()
|
|
46
|
+
|
|
47
|
+
const input = e.target
|
|
48
|
+
|
|
49
|
+
const confirmCallback = selected => {
|
|
50
|
+
let code = selected ? selected[options.codeField] : ''
|
|
51
|
+
let disp = code
|
|
52
|
+
|
|
53
|
+
if (selected && options.dispField) {
|
|
54
|
+
let fields = options.dispField.split(',')
|
|
55
|
+
disp = selected[fields[0]]
|
|
56
|
+
|
|
57
|
+
if (fields.length > 1) {
|
|
58
|
+
disp += `(${fields
|
|
59
|
+
.splice(1)
|
|
60
|
+
.map(field => {
|
|
61
|
+
return selected[field]
|
|
62
|
+
})
|
|
63
|
+
.join(',')})`
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
input.value = disp
|
|
68
|
+
|
|
69
|
+
let codeInput =
|
|
70
|
+
owner.tagName.toLowerCase() == 'ox-grid-header'
|
|
71
|
+
? //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
72
|
+
owner.renderRoot.querySelector(`[name="${filter.name}"]`)
|
|
73
|
+
: //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
74
|
+
owner.renderRoot.querySelector(`form [name="${filter.name}"]`)
|
|
75
|
+
|
|
76
|
+
codeInput.value = code
|
|
77
|
+
|
|
78
|
+
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
79
|
+
|
|
80
|
+
input.dispatchEvent(
|
|
81
|
+
new CustomEvent('filter-change', {
|
|
82
|
+
bubbles: true,
|
|
83
|
+
composed: true,
|
|
84
|
+
detail: {
|
|
85
|
+
name: filter.name,
|
|
86
|
+
operator,
|
|
87
|
+
value: code
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
openMetaCodeSelector(filter, value, confirmCallback)
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
<md-icon style="--md-icon-size: 18px;margin-left: -24px;">manage_search</md-icon>
|
|
97
|
+
`
|
|
98
|
+
: html``
|
|
99
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '../popup/meta-object-selector-popup'
|
|
3
|
+
|
|
4
|
+
import { html } from 'lit-html'
|
|
5
|
+
|
|
6
|
+
import { openPopup } from '@operato/layout'
|
|
7
|
+
import { FilterSelectRenderer } from '@operato/form'
|
|
8
|
+
import { TermsUtil } from '../../utils/terms-util'
|
|
9
|
+
|
|
10
|
+
function openMetaObjectSelector(filter, value, confirmCallback) {
|
|
11
|
+
var template = html` <meta-object-selector-popup .value=${value} .options=${filter.options} .confirmCallback=${confirmCallback}></meta-object-selector-popup> `
|
|
12
|
+
|
|
13
|
+
openPopup(template, {
|
|
14
|
+
backdrop: true,
|
|
15
|
+
size: 'large',
|
|
16
|
+
title: filter.options.selectorName ? String(TermsUtil.tMenu(filter.options.selectorName)) : String(TermsUtil.tTitle('select_item'))
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const FilterFormMetaObjectSelect: FilterSelectRenderer = (filter, value, owner) => {
|
|
21
|
+
const options = filter.options
|
|
22
|
+
const { operator = 'eq' } = filter
|
|
23
|
+
const hiddenText = value ? value.id : ''
|
|
24
|
+
|
|
25
|
+
var text = ''
|
|
26
|
+
|
|
27
|
+
if (value) {
|
|
28
|
+
let fields = options!.nameField.split(',')
|
|
29
|
+
text = value[fields[0]]
|
|
30
|
+
|
|
31
|
+
if (fields.length > 1) {
|
|
32
|
+
text += `(${fields
|
|
33
|
+
.splice(1)
|
|
34
|
+
.map(field => {
|
|
35
|
+
return value[field]
|
|
36
|
+
})
|
|
37
|
+
.join(',')})`
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return operator === 'eq'
|
|
42
|
+
? html`
|
|
43
|
+
<input name='${filter.name}' .value=${hiddenText} type="text" hidden></input>
|
|
44
|
+
<input
|
|
45
|
+
type="text"
|
|
46
|
+
readonly
|
|
47
|
+
name='${filter.name}_disp'
|
|
48
|
+
.value=${text}
|
|
49
|
+
@click=${e => {
|
|
50
|
+
e.stopPropagation()
|
|
51
|
+
|
|
52
|
+
const input = e.target
|
|
53
|
+
|
|
54
|
+
const confirmCallback = selected => {
|
|
55
|
+
let code = selected ? selected.id : ''
|
|
56
|
+
let disp = ''
|
|
57
|
+
|
|
58
|
+
if (selected) {
|
|
59
|
+
let fields = options!.nameField.split(',')
|
|
60
|
+
disp = selected[fields[0]]
|
|
61
|
+
|
|
62
|
+
if (fields.length > 1) {
|
|
63
|
+
disp += `(${fields
|
|
64
|
+
.splice(1)
|
|
65
|
+
.map(field => {
|
|
66
|
+
return selected[field]
|
|
67
|
+
})
|
|
68
|
+
.join(',')})`
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input.value = disp
|
|
73
|
+
|
|
74
|
+
let codeInput =
|
|
75
|
+
owner.tagName.toLowerCase() == 'ox-grid-header'
|
|
76
|
+
? //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
77
|
+
owner.renderRoot.querySelector(`[name="${filter.name}"]`)
|
|
78
|
+
: //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
79
|
+
owner.renderRoot.querySelector(`form [name="${filter.name}"]`)
|
|
80
|
+
|
|
81
|
+
codeInput.value = code
|
|
82
|
+
|
|
83
|
+
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
84
|
+
|
|
85
|
+
input.dispatchEvent(
|
|
86
|
+
new CustomEvent('filter-change', {
|
|
87
|
+
bubbles: true,
|
|
88
|
+
composed: true,
|
|
89
|
+
detail: {
|
|
90
|
+
name: filter.name,
|
|
91
|
+
operator,
|
|
92
|
+
value: code
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
openMetaObjectSelector(filter, value, confirmCallback)
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
<md-icon style="--md-icon-size: 18px;margin-left: -24px;">manage_search</md-icon>
|
|
102
|
+
`
|
|
103
|
+
: html``
|
|
104
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import '../popup/meta-object-selector-popup'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit-html'
|
|
4
|
+
|
|
5
|
+
import { openPopup } from '@operato/layout'
|
|
6
|
+
import { FilterConfigObject, FilterSelectRenderer } from '@operato/data-grist'
|
|
7
|
+
import { TermsUtil } from '../../utils/terms-util'
|
|
8
|
+
|
|
9
|
+
function openMetaCodeSelector(column, value, confirmCallback) {
|
|
10
|
+
var template = html` <meta-object-selector-popup .value=${value} .options=${column.record.options} .confirmCallback=${confirmCallback}></meta-object-selector-popup> `
|
|
11
|
+
|
|
12
|
+
openPopup(template, {
|
|
13
|
+
backdrop: true,
|
|
14
|
+
size: 'large',
|
|
15
|
+
title: column.record.options.selectorName ? String(TermsUtil.tMenu(column.record.options.selectorName)) : String(TermsUtil.tTitle('select_item'))
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const FilterGristMetaCodeSelect: FilterSelectRenderer = (column, value, owner) => {
|
|
20
|
+
const filter = column.filter
|
|
21
|
+
const options = column.record.options
|
|
22
|
+
const codes = options.codes && options.codes.length > 0 ? options.codes : undefined
|
|
23
|
+
const { operator = 'eq' } = filter as FilterConfigObject
|
|
24
|
+
const hiddenText = value ? value : ''
|
|
25
|
+
|
|
26
|
+
var text = value ? value : ''
|
|
27
|
+
|
|
28
|
+
if (options.dispField && value && codes) {
|
|
29
|
+
let dispCode = codes.filter(x => x.value == value)
|
|
30
|
+
|
|
31
|
+
if (dispCode && dispCode.length > 0) {
|
|
32
|
+
text = dispCode[0].display
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return operator === 'eq'
|
|
37
|
+
? html`
|
|
38
|
+
<input name='${column.name}' .value=${hiddenText} type="text" hidden></input>
|
|
39
|
+
<input
|
|
40
|
+
type="text"
|
|
41
|
+
readonly
|
|
42
|
+
name='${column.name}_disp'
|
|
43
|
+
.value=${text}
|
|
44
|
+
@click=${e => {
|
|
45
|
+
e.stopPropagation()
|
|
46
|
+
|
|
47
|
+
const input = e.target
|
|
48
|
+
|
|
49
|
+
const confirmCallback = selected => {
|
|
50
|
+
let code = selected ? selected[options.codeField] : ''
|
|
51
|
+
let disp = code
|
|
52
|
+
|
|
53
|
+
if (selected && options.dispField) {
|
|
54
|
+
let fields = options.dispField.split(',')
|
|
55
|
+
disp = selected[fields[0]]
|
|
56
|
+
|
|
57
|
+
if (fields.length > 1) {
|
|
58
|
+
disp += `(${fields
|
|
59
|
+
.splice(1)
|
|
60
|
+
.map(field => {
|
|
61
|
+
return selected[field]
|
|
62
|
+
})
|
|
63
|
+
.join(',')})`
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
input.value = disp
|
|
68
|
+
|
|
69
|
+
let codeInput =
|
|
70
|
+
owner.tagName.toLowerCase() == 'ox-grid-header'
|
|
71
|
+
? //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
72
|
+
owner.renderRoot.querySelector(`[name="${filter.name}"]`)
|
|
73
|
+
: //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
74
|
+
owner.renderRoot.querySelector(`form [name="${filter.name}"]`)
|
|
75
|
+
codeInput.value = code
|
|
76
|
+
|
|
77
|
+
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
78
|
+
|
|
79
|
+
input.dispatchEvent(
|
|
80
|
+
new CustomEvent('filter-change', {
|
|
81
|
+
bubbles: true,
|
|
82
|
+
composed: true,
|
|
83
|
+
detail: {
|
|
84
|
+
name: column.name,
|
|
85
|
+
operator,
|
|
86
|
+
value: code
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
openMetaCodeSelector(column, value, confirmCallback)
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
`
|
|
96
|
+
: html``
|
|
97
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import '../popup/meta-object-selector-popup'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit-html'
|
|
4
|
+
|
|
5
|
+
import { openPopup } from '@operato/layout'
|
|
6
|
+
import { FilterConfigObject, FilterSelectRenderer } from '@operato/data-grist'
|
|
7
|
+
import { TermsUtil } from '../../utils/terms-util'
|
|
8
|
+
|
|
9
|
+
function openMetaObjectSelector(column, value, confirmCallback) {
|
|
10
|
+
var template = html` <meta-object-selector-popup .value=${value} .options=${column.record.options} .confirmCallback=${confirmCallback}></meta-object-selector-popup> `
|
|
11
|
+
|
|
12
|
+
openPopup(template, {
|
|
13
|
+
backdrop: true,
|
|
14
|
+
size: 'large',
|
|
15
|
+
title: column.record.options.selectorName ? String(TermsUtil.tMenu(column.record.options.selectorName)) : String(TermsUtil.tTitle('select_item'))
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const FilterGristMetaObjectSelect: FilterSelectRenderer = (column, value, owner) => {
|
|
20
|
+
const filter = column.filter
|
|
21
|
+
const { operator = 'eq' } = filter as FilterConfigObject
|
|
22
|
+
const options = column.record.options
|
|
23
|
+
const hiddenText = value ? value.id : ''
|
|
24
|
+
|
|
25
|
+
var text = ''
|
|
26
|
+
|
|
27
|
+
if (value) {
|
|
28
|
+
let fields = options.nameField.split(',')
|
|
29
|
+
text = value[fields[0]]
|
|
30
|
+
|
|
31
|
+
if (fields.length > 1) {
|
|
32
|
+
text += `(${fields
|
|
33
|
+
.splice(1)
|
|
34
|
+
.map(field => {
|
|
35
|
+
return value[field]
|
|
36
|
+
})
|
|
37
|
+
.join(',')})`
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return operator === 'eq'
|
|
42
|
+
? html`
|
|
43
|
+
<input name='${column.name}' .value=${hiddenText} type="text" hidden></input>
|
|
44
|
+
<input
|
|
45
|
+
type="text"
|
|
46
|
+
readonly
|
|
47
|
+
name='${column.name}_disp'
|
|
48
|
+
.value=${text}
|
|
49
|
+
@click=${e => {
|
|
50
|
+
e.stopPropagation()
|
|
51
|
+
|
|
52
|
+
const input = e.target
|
|
53
|
+
|
|
54
|
+
const confirmCallback = selected => {
|
|
55
|
+
let code = selected ? selected.id : ''
|
|
56
|
+
let disp = ''
|
|
57
|
+
|
|
58
|
+
if (selected) {
|
|
59
|
+
let fields = options.nameField.split(',')
|
|
60
|
+
disp = selected[fields[0]]
|
|
61
|
+
|
|
62
|
+
if (fields.length > 1) {
|
|
63
|
+
disp += `(${fields
|
|
64
|
+
.splice(1)
|
|
65
|
+
.map(field => {
|
|
66
|
+
return selected[field]
|
|
67
|
+
})
|
|
68
|
+
.join(',')})`
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input.value = disp
|
|
73
|
+
|
|
74
|
+
let codeInput =
|
|
75
|
+
owner.tagName.toLowerCase() == 'ox-grid-header'
|
|
76
|
+
? //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
77
|
+
owner.renderRoot.querySelector(`[name="${filter.name}"]`)
|
|
78
|
+
: //@ts-ignore owner element를 전제하지 않는 방법이 필요할 것이다.
|
|
79
|
+
owner.renderRoot.querySelector(`form [name="${filter.name}"]`)
|
|
80
|
+
codeInput.value = code
|
|
81
|
+
|
|
82
|
+
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
83
|
+
|
|
84
|
+
input.dispatchEvent(
|
|
85
|
+
new CustomEvent('filter-change', {
|
|
86
|
+
bubbles: true,
|
|
87
|
+
composed: true,
|
|
88
|
+
detail: {
|
|
89
|
+
name: column.name,
|
|
90
|
+
operator,
|
|
91
|
+
value: code
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
openMetaObjectSelector(column, value, confirmCallback)
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
`
|
|
101
|
+
: html``
|
|
102
|
+
}
|
|
@@ -52,7 +52,7 @@ export class CodeInputEditorPopup extends LitElement {
|
|
|
52
52
|
<ox-input-code mode="javascript" value=${this.codeVlaue} tab-size="2" tab-as-space="true"></ox-input-code>
|
|
53
53
|
|
|
54
54
|
<div id="button-container" class="button-container" style="margin-left:unset;">
|
|
55
|
-
<button @click=${this.clickEmpty.bind(this)}><md-icon>
|
|
55
|
+
<button @click=${this.clickEmpty.bind(this)}><md-icon>check_box_outline_blank</md-icon>${TermsUtil.tButton('empty')}</button>
|
|
56
56
|
<div filler></div>
|
|
57
57
|
<button @click=${this.clickCancel.bind(this)}><md-icon>cancel</md-icon>${TermsUtil.tButton('cancel')}</button>
|
|
58
58
|
<button @click=${this.clickConfirm.bind(this)}><md-icon>done</md-icon>${TermsUtil.tButton('confirm')}</button>
|
package/client/component/popup/{meta-object-selector-popup.js → meta-object-selector-popup.ts}
RENAMED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js'
|
|
2
2
|
|
|
3
|
-
import { css, html, LitElement } from 'lit'
|
|
3
|
+
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
4
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
5
|
+
import { closePopup } from '@operato/popup'
|
|
6
|
+
import { isMobileDevice, adjustFilters } from '@operato/utils'
|
|
4
7
|
import { CommonGristStyles, ButtonContainerStyles } from '@operato/styles'
|
|
8
|
+
import { ColumnConfig, DataGrist, FetchOption, FetchResult, GristRecord, QueryFilter } from '@operato/data-grist'
|
|
9
|
+
|
|
5
10
|
import { TermsUtil } from '../../utils/terms-util'
|
|
6
11
|
import { ValueUtil } from '../../utils/value-util'
|
|
7
12
|
import { ServiceUtil } from '../../utils/service-util'
|
|
8
13
|
import { MetaApi } from '../../utils/meta-api'
|
|
9
14
|
import { MetaUiUtil } from '../../utils/meta-ui-util'
|
|
10
|
-
import { isMobileDevice } from '@operato/utils'
|
|
11
|
-
import { closePopup } from '@operato/popup'
|
|
12
15
|
|
|
16
|
+
@customElement('meta-object-selector-popup')
|
|
13
17
|
export class MetaObjectSelectorPopup extends LitElement {
|
|
14
18
|
static styles = [
|
|
15
19
|
CommonGristStyles,
|
|
@@ -31,11 +35,37 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
31
35
|
`
|
|
32
36
|
]
|
|
33
37
|
|
|
38
|
+
@property({ type: String }) value?: string
|
|
39
|
+
@property({ type: Object }) gridConfig: any
|
|
40
|
+
@property({ type: Object }) basicArgs?: FetchOption
|
|
41
|
+
@property({ type: Object }) options!: FetchOption & {
|
|
42
|
+
menu_template?: any
|
|
43
|
+
filterFields?: any[]
|
|
44
|
+
codeField?: string
|
|
45
|
+
nameField?: string
|
|
46
|
+
dispField?: string
|
|
47
|
+
queryName: string
|
|
48
|
+
select?: (ColumnConfig & {
|
|
49
|
+
options: any
|
|
50
|
+
select_opt: any
|
|
51
|
+
object_opt: any
|
|
52
|
+
})[]
|
|
53
|
+
}
|
|
54
|
+
@property({ type: Object }) confirmCallback?: (record?: Partial<GristRecord>) => void
|
|
55
|
+
@property({ type: Array }) selectedRecords: GristRecord[] = []
|
|
56
|
+
|
|
57
|
+
@query('ox-grist') private grist!: DataGrist
|
|
58
|
+
|
|
59
|
+
private foundationFilters: QueryFilter[] = []
|
|
60
|
+
private record: any
|
|
61
|
+
|
|
34
62
|
async connectedCallback() {
|
|
63
|
+
const { select, sorters, filters, codeField, nameField, dispField, filterFields: optionFilterFields, menu_template } = this.options || {}
|
|
64
|
+
|
|
35
65
|
// 숨김 검색 조건
|
|
36
|
-
this.
|
|
66
|
+
this.foundationFilters = filters ? filters : this.basicArgs && this.basicArgs.filters ? this.basicArgs.filters : []
|
|
37
67
|
|
|
38
|
-
this.
|
|
68
|
+
this.foundationFilters = this.foundationFilters.map(x => {
|
|
39
69
|
let { name, operator, value } = x
|
|
40
70
|
|
|
41
71
|
if (value.startsWith('::')) {
|
|
@@ -50,24 +80,20 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
50
80
|
})
|
|
51
81
|
|
|
52
82
|
// 기본 정렬
|
|
53
|
-
let sortFields =
|
|
83
|
+
let sortFields = sorters ? sorters : this.basicArgs && this.basicArgs.sorters ? this.basicArgs.sorters : []
|
|
54
84
|
|
|
55
85
|
// 기본 검색 조건
|
|
56
|
-
let filterFields =
|
|
57
|
-
? this.options.filterFields
|
|
58
|
-
: this.options.menu_template?.search && this.options.menu_template?.search.length > 0
|
|
59
|
-
? this.options.menu_template.search
|
|
60
|
-
: []
|
|
86
|
+
let filterFields = optionFilterFields ? optionFilterFields : menu_template?.search && menu_template?.search.length > 0 ? menu_template.search : []
|
|
61
87
|
|
|
62
88
|
// 그리드 컬럼
|
|
63
|
-
let gridColumns =
|
|
89
|
+
let gridColumns = select
|
|
64
90
|
|
|
65
91
|
// 기본 검색 조건이 없으면 코드 (code-selector), 또는 이름 (object-selector)
|
|
66
92
|
if (!filterFields || filterFields.length == 0) {
|
|
67
|
-
let defaultFilter
|
|
93
|
+
let defaultFilter
|
|
68
94
|
|
|
69
|
-
if (
|
|
70
|
-
if (
|
|
95
|
+
if (codeField) defaultFilter = codeField
|
|
96
|
+
if (nameField) defaultFilter = nameField
|
|
71
97
|
|
|
72
98
|
if (defaultFilter) {
|
|
73
99
|
filterFields.push({
|
|
@@ -114,7 +140,15 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
114
140
|
type = 'boolean'
|
|
115
141
|
}
|
|
116
142
|
|
|
117
|
-
let columnConfig = MetaApi.getGristColumnConfig2(
|
|
143
|
+
let columnConfig = MetaApi.getGristColumnConfig2(
|
|
144
|
+
type,
|
|
145
|
+
name,
|
|
146
|
+
header ? (header as unknown as string) : name,
|
|
147
|
+
record.align ? record.align : 'left',
|
|
148
|
+
false,
|
|
149
|
+
sortable,
|
|
150
|
+
Number(width)
|
|
151
|
+
)
|
|
118
152
|
|
|
119
153
|
if (type.startsWith('meta-') && object_opt && object_opt.menu) {
|
|
120
154
|
options = await MetaUiUtil.getGristMetaObjectOptions(type, options)
|
|
@@ -152,10 +186,10 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
152
186
|
}
|
|
153
187
|
}
|
|
154
188
|
} else {
|
|
155
|
-
selectFields.push(MetaApi.getGristColumnConfig2('string',
|
|
189
|
+
selectFields.push(MetaApi.getGristColumnConfig2('string', codeField!, codeField!, 'left', false, true, 180))
|
|
156
190
|
|
|
157
|
-
if (
|
|
158
|
-
selectFields.push(MetaApi.getGristColumnConfig2('string',
|
|
191
|
+
if (dispField) {
|
|
192
|
+
selectFields.push(MetaApi.getGristColumnConfig2('string', dispField, dispField, 'left', false, true, 300))
|
|
159
193
|
}
|
|
160
194
|
}
|
|
161
195
|
|
|
@@ -188,8 +222,8 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
188
222
|
await super.connectedCallback()
|
|
189
223
|
}
|
|
190
224
|
|
|
191
|
-
async firstUpdated() {
|
|
192
|
-
await super.firstUpdated()
|
|
225
|
+
async firstUpdated(changes: PropertyValues<this>) {
|
|
226
|
+
await super.firstUpdated(changes)
|
|
193
227
|
}
|
|
194
228
|
|
|
195
229
|
render() {
|
|
@@ -203,7 +237,7 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
203
237
|
</ox-grist>
|
|
204
238
|
|
|
205
239
|
<div id="button-container" class="button-container" style="margin-left:unset;">
|
|
206
|
-
<button @click=${this.clickEmpty.bind(this)}><md-icon>
|
|
240
|
+
<button @click=${this.clickEmpty.bind(this)}><md-icon>check_box_outline_blank</md-icon>${TermsUtil.tButton('empty')}</button>
|
|
207
241
|
<div filler></div>
|
|
208
242
|
<button @click=${this.clickCancel.bind(this)}><md-icon>cancel</md-icon>${TermsUtil.tButton('cancel')}</button>
|
|
209
243
|
<button @click=${this.clickSelect.bind(this)}><md-icon>done</md-icon>${TermsUtil.tButton('select')}</button>
|
|
@@ -211,40 +245,35 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
211
245
|
`
|
|
212
246
|
}
|
|
213
247
|
|
|
214
|
-
/**
|
|
215
|
-
* @description 그리드 리턴
|
|
216
|
-
**************************
|
|
217
|
-
* @returns {Object} 그리드
|
|
218
|
-
*/
|
|
219
|
-
get grist() {
|
|
220
|
-
return this.shadowRoot.querySelector('#ox-grist')
|
|
221
|
-
}
|
|
222
|
-
|
|
223
248
|
/**
|
|
224
249
|
* @description 컬럼 조회
|
|
225
250
|
***************************
|
|
226
251
|
* @returns
|
|
227
252
|
*/
|
|
228
|
-
async fetchHandler({ page = 0, limit = 0, sorters = [], filters = [] }) {
|
|
229
|
-
|
|
253
|
+
async fetchHandler({ page = 0, limit = 0, sorters = [], filters = [] }: FetchOption): Promise<FetchResult> {
|
|
254
|
+
const { menu_template, queryName } = this.options || {}
|
|
230
255
|
|
|
231
|
-
|
|
232
|
-
let dupFilter = resFilter.filter(y => x.name == y.name)
|
|
233
|
-
if (dupFilter && dupFilter.length > 0) {
|
|
234
|
-
delete resFilter[x.name]
|
|
235
|
-
}
|
|
256
|
+
// let resFilter = [...this.foundationFilters]
|
|
236
257
|
|
|
237
|
-
|
|
238
|
-
|
|
258
|
+
// filters.forEach((x: any) => {
|
|
259
|
+
// let dupFilter = resFilter.filter(y => x.name == y.name)
|
|
260
|
+
// if (dupFilter && dupFilter.length > 0) {
|
|
261
|
+
// delete resFilter[x.name]
|
|
262
|
+
// }
|
|
263
|
+
|
|
264
|
+
// resFilter.push(x)
|
|
265
|
+
// })
|
|
239
266
|
|
|
240
|
-
let
|
|
267
|
+
let resFilter = adjustFilters([...this.foundationFilters], filters)
|
|
268
|
+
|
|
269
|
+
let queryAfterSetFields = ValueUtil.getParams(menu_template ? menu_template.gql || {} : {}, 'query', 'after_set_fields')
|
|
241
270
|
let selectSkipFields = Object.keys(queryAfterSetFields || {})
|
|
242
271
|
|
|
243
272
|
// 조회 컬럼 추출 후 조회
|
|
244
273
|
let selectFields = MetaApi.getSelectColumns(this.gridConfig.columns.filter(x => !selectSkipFields.includes(x.name)))
|
|
245
274
|
|
|
246
275
|
// 조회 실행
|
|
247
|
-
let result = await MetaApi.searchByPagination(
|
|
276
|
+
let result = await MetaApi.searchByPagination(queryName, resFilter, sorters, page, limit, selectFields)
|
|
248
277
|
|
|
249
278
|
return result
|
|
250
279
|
}
|
|
@@ -255,7 +284,7 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
255
284
|
* @returns
|
|
256
285
|
*/
|
|
257
286
|
async clickEmpty(e) {
|
|
258
|
-
this.confirmCallback && this.confirmCallback(
|
|
287
|
+
this.confirmCallback && this.confirmCallback()
|
|
259
288
|
closePopup(this)
|
|
260
289
|
}
|
|
261
290
|
/**
|
|
@@ -275,7 +304,7 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
275
304
|
let selected = this.grist.selected
|
|
276
305
|
|
|
277
306
|
if (!selected || selected.length == 0) {
|
|
278
|
-
MetaApi.showToast('info', TermsUtil.tText('NOTHING_SELECTED'))
|
|
307
|
+
MetaApi.showToast('info', String(TermsUtil.tText('NOTHING_SELECTED')))
|
|
279
308
|
return
|
|
280
309
|
}
|
|
281
310
|
|
|
@@ -292,5 +321,3 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
292
321
|
closePopup(this)
|
|
293
322
|
}
|
|
294
323
|
}
|
|
295
|
-
|
|
296
|
-
customElements.define('meta-object-selector-popup', MetaObjectSelectorPopup)
|