@at-pocket/js-sdk 0.0.1 → 0.0.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/package.json +10 -3
- package/src/interfaces.d.ts +9 -0
- package/src/lib/events.d.ts +36 -5
- package/src/lib/plugin.d.ts +18 -1
- package/src/lib/record.d.ts +100 -80
- /package/src/lib/{portal.ts → portal.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@at-pocket/js-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "TypeScript definitions for the atPocket JS SDK",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typescript",
|
|
7
|
+
"types",
|
|
8
|
+
"atPocket",
|
|
9
|
+
"js-sdk"
|
|
10
|
+
],
|
|
6
11
|
"author": "iii@oec",
|
|
7
12
|
"license": "MIT",
|
|
8
13
|
"types": "src/index.d.ts",
|
|
9
|
-
"files": [
|
|
14
|
+
"files": [
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
10
17
|
"publishConfig": {
|
|
11
18
|
"access": "public"
|
|
12
19
|
}
|
package/src/interfaces.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ApiInterface } from "./lib/api";
|
|
|
3
3
|
import { EventsInterface } from "./lib/events";
|
|
4
4
|
import { PortalInterface } from "./lib/portal";
|
|
5
5
|
import { ProxyInterface } from './lib/proxy';
|
|
6
|
+
import { PluginInterface } from './lib/plugin';
|
|
6
7
|
|
|
7
8
|
// atPocket インターフェースに `app` を追加
|
|
8
9
|
export interface atPocket {
|
|
@@ -13,4 +14,12 @@ export interface atPocket {
|
|
|
13
14
|
app: AppInterface;
|
|
14
15
|
portal: PortalInterface;
|
|
15
16
|
proxy: ProxyInterface;
|
|
17
|
+
plugin: PluginInterface;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* デバイスタイプを取得
|
|
21
|
+
*
|
|
22
|
+
* @returns desktop | mobile
|
|
23
|
+
*/
|
|
24
|
+
deviceType: 'desktop' | 'mobile';
|
|
16
25
|
}
|
package/src/lib/events.d.ts
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
|
+
type ListEvent = {
|
|
2
|
+
appId: number,
|
|
3
|
+
fields: any,
|
|
4
|
+
record: any,
|
|
5
|
+
sort: any,
|
|
6
|
+
order: any,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type DetailEvent = {
|
|
10
|
+
appId: number,
|
|
11
|
+
fields: any,
|
|
12
|
+
record: any[]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type Event = ListEvent & DetailEvent;
|
|
16
|
+
|
|
1
17
|
// イベントハンドラーの型
|
|
2
|
-
export type EventHandler = (event:
|
|
18
|
+
export type EventHandler = (event: Event) => any;
|
|
3
19
|
|
|
4
20
|
// トリガーイベントのオプションの型
|
|
5
21
|
export type IOptions = Record<string, any>;
|
|
6
22
|
|
|
7
23
|
// コールバック関数の型
|
|
8
|
-
export type ICallback = (event:
|
|
24
|
+
export type ICallback = (event: Event) => void;
|
|
25
|
+
|
|
26
|
+
// イベントタイプ
|
|
27
|
+
export type EventType = 'app.record.index.show'
|
|
28
|
+
| 'app.record.detail.show'
|
|
29
|
+
| 'app.record.detail.delete.submit'
|
|
30
|
+
| 'app.record.detail.delete.submit.success'
|
|
31
|
+
| 'app.record.create.show'
|
|
32
|
+
| 'app.record.create.change'
|
|
33
|
+
| 'app.record.create.submit'
|
|
34
|
+
| 'app.record.create.submit.success'
|
|
35
|
+
| 'app.record.edit.show'
|
|
36
|
+
| 'app.record.edit.change'
|
|
37
|
+
| 'app.record.edit.submit'
|
|
38
|
+
| 'app.record.edit.submit.success'
|
|
39
|
+
| 'portal.index.show';
|
|
9
40
|
|
|
10
41
|
// Events インターフェースの定義
|
|
11
42
|
export interface EventsInterface {
|
|
@@ -14,13 +45,13 @@ export interface EventsInterface {
|
|
|
14
45
|
* @param types - イベントの種類(文字列 or 文字列配列)
|
|
15
46
|
* @param handler - イベント発火時に実行する関数
|
|
16
47
|
*/
|
|
17
|
-
on(types:
|
|
48
|
+
on(types: EventType | EventType[], handler: EventHandler): void;
|
|
18
49
|
|
|
19
50
|
/**
|
|
20
51
|
* イベントハンドラーを削除
|
|
21
52
|
* @param types - 削除するイベントの種類(省略可)
|
|
22
53
|
*/
|
|
23
|
-
off(types?:
|
|
54
|
+
off(types?: EventType | EventType[]): void;
|
|
24
55
|
|
|
25
56
|
/**
|
|
26
57
|
* イベントを発火
|
|
@@ -28,7 +59,7 @@ export interface EventsInterface {
|
|
|
28
59
|
* @param options - イベントのオプション(デフォルト `{}`)
|
|
29
60
|
* @param callback - イベント完了後に実行する関数(オプション)
|
|
30
61
|
*/
|
|
31
|
-
trigger(type:
|
|
62
|
+
trigger(type: EventType, options?: IOptions, callback?: ICallback): Event | void;
|
|
32
63
|
|
|
33
64
|
/**
|
|
34
65
|
* すべてのイベントを削除
|
package/src/lib/plugin.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
export interface PluginInterface {
|
|
2
|
-
|
|
2
|
+
app: {
|
|
3
|
+
/**
|
|
4
|
+
* プラグイン設定取得
|
|
5
|
+
*
|
|
6
|
+
* @returns プラグイン設定
|
|
7
|
+
*/
|
|
8
|
+
getConfig(): Record<string, any>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* プラグイン設定をセット
|
|
12
|
+
*
|
|
13
|
+
* @param values プラグイン設定
|
|
14
|
+
* @returns {void}
|
|
15
|
+
*/
|
|
16
|
+
setConfig(values: Record<string, any>): void
|
|
17
|
+
};
|
|
18
|
+
getConfigFormData(): any;
|
|
19
|
+
setConfigFormData(): void;
|
|
3
20
|
}
|
package/src/lib/record.d.ts
CHANGED
|
@@ -5,83 +5,103 @@ export interface RecordInterface {
|
|
|
5
5
|
* @returns {HTMLElement | null}
|
|
6
6
|
*/
|
|
7
7
|
getAppBarSpaceElement(): HTMLElement | null;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* レコードIDを取得
|
|
11
|
+
* @returns {number | null} レコードID
|
|
12
|
+
*/
|
|
13
|
+
getId(): number | null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* レコードのデータを取得
|
|
17
|
+
* @returns {Record<string, any>}
|
|
18
|
+
*/
|
|
19
|
+
get(): Record<string, any>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* レコードに値をセット
|
|
23
|
+
* @param {object} record セットするレコードデータ
|
|
24
|
+
*/
|
|
25
|
+
set(record: { record: any }): void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 詳細画面でフィールド要素を取得
|
|
29
|
+
* @param fieldId フィールドのID
|
|
30
|
+
* @returns HTMLElement | null
|
|
31
|
+
*/
|
|
32
|
+
getFieldElement(fieldId: string): HTMLElement | null;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 新規作成、編集画面でフィールドの入力要素を取得
|
|
36
|
+
* @param fieldId フィールドのID
|
|
37
|
+
* @returns HTMLElement | null;
|
|
38
|
+
*/
|
|
39
|
+
getFieldInputElement(fieldId: string): HTMLElement | null;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* フィールドのラベル要素を取得
|
|
43
|
+
* @param fieldId フィールドのID
|
|
44
|
+
* @returns HTMLElement | null
|
|
45
|
+
*/
|
|
46
|
+
getFieldLabelElement(fieldId: string): HTMLElement | null;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* フィールドのデータ要素を取得
|
|
50
|
+
* @param fieldId フィールドのID
|
|
51
|
+
* @returns HTMLElement | null
|
|
52
|
+
*/
|
|
53
|
+
getFieldValueElement(fieldId: string): HTMLElement | null;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* フィールドのデータ要素を取得
|
|
57
|
+
* @deprecated getFieldValueElementを使用
|
|
58
|
+
* @param fieldId フィールドのID
|
|
59
|
+
* @returns HTMLElement | null
|
|
60
|
+
*/
|
|
61
|
+
getFieldDataElement(fieldId: string): HTMLElement | null;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* スペースフィールドの要素を取得
|
|
65
|
+
* @param fieldId フィールドのID
|
|
66
|
+
* @returns HTMLElement | null
|
|
67
|
+
*/
|
|
68
|
+
getSpaceElement(fieldId: string): HTMLElement | null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* フィールドの表示/非表示を切り替える
|
|
72
|
+
* @param fieldId フィールドのID
|
|
73
|
+
* @param isShown 表示するかどうか
|
|
74
|
+
*/
|
|
75
|
+
setFieldShown(fieldId: string, isShown?: boolean): void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* フィールドが表示中かどうか
|
|
79
|
+
* @param fieldId フィールドのID
|
|
80
|
+
*/
|
|
81
|
+
isFieldShown(fieldId: string): boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* フィールドの編集可/不可を切り替える
|
|
85
|
+
* @param fieldId フィールドのID
|
|
86
|
+
* @param isDisabled 編集不可にするかどうか
|
|
87
|
+
*/
|
|
88
|
+
setFieldDisabled(fieldId: string, isDisabled?: boolean): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* フィールドが編集不可かどうか
|
|
92
|
+
* @param fieldId フィールドのID
|
|
93
|
+
*/
|
|
94
|
+
isFieldDisabled(fieldId: string): boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* レコード一覧上部の要素を取得
|
|
98
|
+
* @returns HTMLElement | null
|
|
99
|
+
*/
|
|
100
|
+
getRecordHeaderSpaceElement(): HTMLElement | null;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* レコードの一覧下部の要素を取得
|
|
104
|
+
* @returns HTMLElement | null
|
|
105
|
+
*/
|
|
106
|
+
getRecordFooterSpaceElement(): HTMLElement | null;
|
|
107
|
+
}
|
|
File without changes
|