@operato/attachment 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.
@@ -1,111 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@material/web/icon/icon.js'
6
- import './ox-attachment-list.js'
7
-
8
- import { LitElement, css, html } from 'lit'
9
- import { PopupHandle, openPopup } from '@operato/layout'
10
- import { customElement, property } from 'lit/decorators.js'
11
-
12
- import { i18next } from '@operato/i18n'
13
-
14
- @customElement('ox-attachment-selector')
15
- export class OxAttachmentSelector extends LitElement {
16
- static styles = [
17
- css`
18
- :host {
19
- position: relative;
20
- display: inline-block;
21
- }
22
-
23
- input[type='text'] {
24
- box-sizing: border-box;
25
- width: 100%;
26
- height: 100%;
27
- border: 1px solid rgba(0, 0, 0, 0.2);
28
- }
29
-
30
- md-icon {
31
- position: absolute;
32
- top: 0;
33
- right: 3px;
34
- }
35
- `
36
- ]
37
-
38
- @property({ type: String }) value: string = ''
39
- @property({ type: Object }) properties: any
40
-
41
- private popup?: PopupHandle
42
-
43
- render() {
44
- return html`
45
- <input
46
- id="text"
47
- type="text"
48
- .value=${this.value || ''}
49
- @change=${(e: KeyboardEvent) => this._onInputChanged(e)}
50
- />
51
-
52
- <md-icon @click=${() => this.openSelector()}>${this.getIconByCategory()}</md-icon>
53
- `
54
- }
55
-
56
- getIconByCategory() {
57
- var { category } = this.properties || {}
58
- switch (category) {
59
- case 'audio':
60
- return 'library_music'
61
- case 'video':
62
- return 'video_library'
63
- case 'image':
64
- return 'image'
65
- case 'text':
66
- case 'application':
67
- default:
68
- return 'attachment'
69
- }
70
- }
71
-
72
- _onInputChanged(e: KeyboardEvent) {
73
- this.value = (e.target as HTMLInputElement).value
74
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
75
- }
76
-
77
- openSelector() {
78
- if (this.popup) {
79
- delete this.popup
80
- }
81
-
82
- /*
83
- * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
84
- * 주의. value는 object일 수도 있고, string일 수도 있다.
85
- * string인 경우에는 해당 보드의 id로 해석한다.
86
- */
87
- var value = this.value || {}
88
- var { category = 'application' } = this.properties || {}
89
-
90
- var template = html`
91
- <ox-attachment-list
92
- .creatable=${true}
93
- .category=${category}
94
- @attachment-selected=${async (e: CustomEvent) => {
95
- var attachment = e.detail.attachment
96
- this.value = `/attachment/${attachment.path}`
97
-
98
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
99
-
100
- this.popup && this.popup.close()
101
- }}
102
- ></ox-attachment-list>
103
- `
104
-
105
- this.popup = openPopup(template, {
106
- backdrop: true,
107
- size: 'large',
108
- title: i18next.t('title.select attachment')
109
- })
110
- }
111
- }
@@ -1,15 +0,0 @@
1
- import './ox-attachment-selector'
2
-
3
- import { html, TemplateResult } from 'lit'
4
- import { customElement } from 'lit/decorators.js'
5
-
6
- import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
7
-
8
- @customElement('ox-property-editor-attachment-selector')
9
- class OxPropertyEditorAttachmentSelector extends OxPropertyEditor {
10
- editorTemplate(value: any, spec: PropertySpec): TemplateResult {
11
- return html`
12
- <ox-attachment-selector id="editor" .value=${value} .properties=${spec.property}></ox-attachment-selector>
13
- `
14
- }
15
- }
@@ -1,22 +0,0 @@
1
- import './ox-attachment-selector'
2
-
3
- import { html, TemplateResult } from 'lit'
4
- import { customElement } from 'lit/decorators.js'
5
-
6
- import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
7
-
8
- @customElement('ox-property-editor-image-selector')
9
- class OxPropertyEditorImageSelector extends OxPropertyEditor {
10
- editorTemplate(value: any, spec: PropertySpec): TemplateResult {
11
- return html`
12
- <ox-attachment-selector
13
- id="editor"
14
- .value=${value}
15
- .properties=${{
16
- ...spec.property,
17
- category: 'image'
18
- }}
19
- ></ox-attachment-selector>
20
- `
21
- }
22
- }
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
- });