@konomi-app/kintone-utilities 1.9.1 → 1.10.0

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,165 +1,165 @@
1
- import type { App as DefaultApp, Layout as DefaultLayout, Record as DefaultRecord, ViewForParameter, ViewForResponse } from '@kintone/rest-api-client/lib/client/types';
2
- import type { Calc as CalcField, Category as CategoryField, CheckBox as CheckBoxField, CreatedTime as CreatedTimeField, Creator as CreatorField, Date as DateField, DateTime as DateTimeField, Dropdown as DropdownField, File as FileField, GroupSelect as GroupSelectField, ID as IDField, InSubtable as InSubtableField, Link as LinkField, Modifier as ModifierField, MultiLineText as MultiLineTextField, MultiSelect as MultiSelectField, Number as NumberField, OneOf as OneOfField, OrganizationSelect as OrganizationSelectField, RadioButton as RadioButtonField, RecordNumber as RecordNumberField, Revision as RevisionField, RichText as RichTextField, SingleLineText as SingleLineTextField, Status as StatusField, StatusAssignee as StatusAssigneeField, Subtable as SubtableField, Time as TimeField, UpdatedTime as UpdatedTimeField, UserSelect as UserSelectField } from '@kintone/rest-api-client/lib/KintoneFields/types/field';
3
- import type { CheckBox as DefaultLayoutCheckBox, CreatedTime as DefaultLayoutCreatedTime, Creator as DefaultLayoutCreator, Date as DefaultLayoutDate, DateTime as DefaultLayoutDateTime, Dropdown as DefaultLayoutDropdown, File as DefaultLayoutFile, GroupSelect as DefaultLayoutGroupSelect, HR as DefaultLayoutHR, InSubtable as DefaultLayoutInSubtable, Label as DefaultLayoutLabel, Link as DefaultLayoutLink, Modifier as DefaultLayoutModifier, MultiLineText as DefaultLayoutMultiLineText, MultiSelect as DefaultLayoutMultiSelect, Number as DefaultLayoutNumber, OneOf as DefaultLayoutField, OrganizationSelect as DefaultLayoutOrganizationSelect, RadioButton as DefaultLayoutRadioButton, RecordNumber as DefaultLayoutRecordNumber, ReferenceTable as DefaultLayoutReferenceTable, RichText as DefaultLayoutRichText, SingleLineText as DefaultLayoutSingleLineText, Spacer as DefaultLayoutSpacer, Time as DefaultLayoutTime, UpdatedTime as DefaultLayoutUpdatedTime, UserSelect as DefaultLayoutUserSelect } from '@kintone/rest-api-client/lib/KintoneFields/types/fieldLayout';
4
- import type { Group as DefaultGroup, Row as DefaultRow } from '@kintone/rest-api-client/lib/KintoneFields/types/layout';
5
- import type { Calc as CalcProperty, Category as CategoryProperty, CheckBox as CheckBoxProperty, CreatedTime as CreatedTimeProperty, Creator as CreatorProperty, Date as DateProperty, DateTime as DateTimeProperty, Dropdown as DropdownProperty, File as FileProperty, GroupSelect as GroupSelectProperty, InSubtable as InSubtableProperty, Link as LinkProperty, Modifier as ModifierProperty, MultiLineText as MultiLineTextProperty, MultiSelect as MultiSelectProperty, Number as NumberProperty, OneOf as OneOfProperty, OrganizationSelect as OrganizationSelectProperty, RadioButton as RadioButtonProperty, RecordNumber as RecordNumberProperty, RichText as RichTextProperty, SingleLineText as SingleLineTextProperty, Status as StatusProperty, StatusAssignee as StatusAssigneeProperty, Subtable as SubtableProperty, Time as TimeProperty, UpdatedTime as UpdatedTimeProperty, UserSelect as UserSelectProperty } from '@kintone/rest-api-client/lib/KintoneFields/types/property';
6
- export declare namespace kintoneAPI {
7
- type App = DefaultApp;
8
- type RecordData = DefaultRecord;
9
- namespace view {
10
- type Response = ViewForResponse;
11
- type Parameter = ViewForParameter;
12
- }
13
- type Field = OneOfField;
14
- /** JavaScript APIやREST APIから取得できるレコードの各フィールド情報 */
15
- namespace field {
16
- type Calc = CalcField;
17
- type Category = CategoryField;
18
- type CheckBox = CheckBoxField;
19
- type CreatedTime = CreatedTimeField;
20
- type Creator = CreatorField;
21
- type Date = DateField;
22
- type DateTime = DateTimeField;
23
- type Dropdown = DropdownField;
24
- type File = FileField;
25
- type GroupSelect = GroupSelectField;
26
- type GroupEntity = GroupSelect['value'][number];
27
- type ID = IDField;
28
- type InSubtable = InSubtableField;
29
- type Link = LinkField;
30
- type Modifier = ModifierField;
31
- type MultiLineText = MultiLineTextField;
32
- type MultiSelect = MultiSelectField;
33
- type Number = NumberField;
34
- type OneOf = OneOfField;
35
- type OrganizationSelect = OrganizationSelectField;
36
- type OrganizationEntity = OrganizationSelect['value'][number];
37
- type RadioButton = RadioButtonField;
38
- type RecordNumber = RecordNumberField;
39
- type Revision = RevisionField;
40
- type RichText = RichTextField;
41
- type SingleLineText = SingleLineTextField;
42
- type Status = StatusField;
43
- type StatusAssignee = StatusAssigneeField;
44
- type Subtable<T extends Record<string, InSubtable> = Record<string, InSubtable>> = SubtableField<T>;
45
- type Time = TimeField;
46
- type UpdatedTime = UpdatedTimeField;
47
- type UserSelect = UserSelectField;
48
- type UserEntity = UserSelect['value'][number];
49
- }
50
- type FieldProperty = OneOfProperty;
51
- type FieldPropertyType = FieldProperty['type'];
52
- type FieldProperties = Record<string, OneOfProperty>;
53
- type FieldEntry = [string, OneOfProperty];
54
- /** REST APIから取得できるアプリの各フィールド情報 */
55
- namespace property {
56
- type Calc = CalcProperty;
57
- type Category = CategoryProperty;
58
- type CheckBox = CheckBoxProperty;
59
- type CreatedTime = CreatedTimeProperty;
60
- type Creator = CreatorProperty;
61
- type Date = DateProperty;
62
- type DateTime = DateTimeProperty;
63
- type Dropdown = DropdownProperty;
64
- type File = FileProperty;
65
- type GroupSelect = GroupSelectProperty;
66
- type InSubtable = InSubtableProperty;
67
- type Link = LinkProperty;
68
- type Modifier = ModifierProperty;
69
- type MultiLineText = MultiLineTextProperty;
70
- type MultiSelect = MultiSelectProperty;
71
- type Number = NumberProperty;
72
- type OneOf = OneOfProperty;
73
- type OrganizationSelect = OrganizationSelectProperty;
74
- type RadioButton = RadioButtonProperty;
75
- type RecordNumber = RecordNumberProperty;
76
- type RichText = RichTextProperty;
77
- type SingleLineText = SingleLineTextProperty;
78
- type Status = StatusProperty;
79
- type StatusAssignee = StatusAssigneeProperty;
80
- type Subtable<T extends Record<string, InSubtable> = Record<string, InSubtable>> = SubtableProperty<T>;
81
- type Time = TimeProperty;
82
- type UpdatedTime = UpdatedTimeProperty;
83
- type UserSelect = UserSelectProperty;
84
- }
85
- type Layout = DefaultLayout;
86
- type LayoutField = DefaultLayoutField;
87
- namespace layout {
88
- type Label = DefaultLayoutLabel;
89
- type Row = DefaultRow<LayoutField[]>;
90
- type Group = DefaultGroup<Row[]>;
91
- type Spacer = DefaultLayoutSpacer;
92
- type HR = DefaultLayoutHR;
93
- type CheckBox = DefaultLayoutCheckBox;
94
- type CreatedTime = DefaultLayoutCreatedTime;
95
- type Creator = DefaultLayoutCreator;
96
- type Date = DefaultLayoutDate;
97
- type DateTime = DefaultLayoutDateTime;
98
- type Dropdown = DefaultLayoutDropdown;
99
- type File = DefaultLayoutFile;
100
- type GroupSelect = DefaultLayoutGroupSelect;
101
- type InSubtable = DefaultLayoutInSubtable;
102
- type Link = DefaultLayoutLink;
103
- type Modifier = DefaultLayoutModifier;
104
- type MultiLineText = DefaultLayoutMultiLineText;
105
- type MultiSelect = DefaultLayoutMultiSelect;
106
- type Number = DefaultLayoutNumber;
107
- type OrganizationSelect = DefaultLayoutOrganizationSelect;
108
- type RadioButton = DefaultLayoutRadioButton;
109
- type RecordNumber = DefaultLayoutRecordNumber;
110
- type ReferenceTable = DefaultLayoutReferenceTable;
111
- type RichText = DefaultLayoutRichText;
112
- type SingleLineText = DefaultLayoutSingleLineText;
113
- type Time = DefaultLayoutTime;
114
- type UpdatedTime = DefaultLayoutUpdatedTime;
115
- type UserSelect = DefaultLayoutUserSelect;
116
- }
117
- namespace response {
118
- type App = {
119
- readonly app?: DefaultApp;
120
- readonly fields?: FieldProperties;
121
- };
122
- }
123
- type EventType = 'portal.show' | 'app.record.index.show' | 'app.record.index.edit.show' | 'app.record.index.edit.submit' | 'app.record.index.edit.submit.success' | 'app.record.index.delete.submit' | 'app.record.detail.show' | 'app.record.detail.delete.submit' | 'app.record.detail.process.proceed' | 'app.record.create.show' | 'app.record.create.change' | 'app.record.create.submit' | 'app.record.create.submit.success' | 'app.record.edit.show' | 'app.record.edit.change' | 'app.record.edit.submit' | 'app.record.edit.submit.success' | 'app.record.print.show' | 'mobile.app.record.index.show' | 'mobile.app.record.detail.show' | 'mobile.app.record.detail.delete.submit' | 'mobile.app.record.detail.process.proceed' | 'mobile.app.record.create.show' | 'mobile.app.record.create.change' | 'mobile.app.record.create.submit' | 'mobile.app.record.create.submit.success' | 'mobile.app.record.edit.show' | 'mobile.app.record.edit.change' | 'mobile.app.record.edit.submit' | 'mobile.app.record.edit.submit.success';
124
- type Event<T = RecordData> = {
125
- appId: number;
126
- viewId: number;
127
- recordId: number;
128
- record: T;
129
- error: string;
130
- url: string;
131
- type: EventType;
132
- changes?: {
133
- field: {
134
- type: string;
135
- value: string;
136
- };
137
- row: any;
138
- };
139
- records?: T[];
140
- viewType?: string;
141
- viewName?: string;
142
- offset?: number;
143
- /**
144
- * プロセス - 実行されたアクション
145
- * app.record.detail.process.proceed イベントで取得できます
146
- */
147
- action?: {
148
- value: string;
149
- };
150
- /**
151
- * プロセス - 現在のステータス
152
- * app.record.detail.process.proceed イベントで取得できます
153
- */
154
- status?: {
155
- value: string;
156
- };
157
- /**
158
- * プロセス - 次のステータス
159
- * app.record.detail.process.proceed イベントで取得できます
160
- */
161
- nextStatus?: {
162
- value: string;
163
- };
164
- };
165
- }
1
+ import type { App as DefaultApp, Layout as DefaultLayout, Record as DefaultRecord, ViewForParameter, ViewForResponse } from '@kintone/rest-api-client/lib/client/types';
2
+ import type { Calc as CalcField, Category as CategoryField, CheckBox as CheckBoxField, CreatedTime as CreatedTimeField, Creator as CreatorField, Date as DateField, DateTime as DateTimeField, Dropdown as DropdownField, File as FileField, GroupSelect as GroupSelectField, ID as IDField, InSubtable as InSubtableField, Link as LinkField, Modifier as ModifierField, MultiLineText as MultiLineTextField, MultiSelect as MultiSelectField, Number as NumberField, OneOf as OneOfField, OrganizationSelect as OrganizationSelectField, RadioButton as RadioButtonField, RecordNumber as RecordNumberField, Revision as RevisionField, RichText as RichTextField, SingleLineText as SingleLineTextField, Status as StatusField, StatusAssignee as StatusAssigneeField, Subtable as SubtableField, Time as TimeField, UpdatedTime as UpdatedTimeField, UserSelect as UserSelectField } from '@kintone/rest-api-client/lib/KintoneFields/types/field';
3
+ import type { CheckBox as DefaultLayoutCheckBox, CreatedTime as DefaultLayoutCreatedTime, Creator as DefaultLayoutCreator, Date as DefaultLayoutDate, DateTime as DefaultLayoutDateTime, Dropdown as DefaultLayoutDropdown, File as DefaultLayoutFile, GroupSelect as DefaultLayoutGroupSelect, HR as DefaultLayoutHR, InSubtable as DefaultLayoutInSubtable, Label as DefaultLayoutLabel, Link as DefaultLayoutLink, Modifier as DefaultLayoutModifier, MultiLineText as DefaultLayoutMultiLineText, MultiSelect as DefaultLayoutMultiSelect, Number as DefaultLayoutNumber, OneOf as DefaultLayoutField, OrganizationSelect as DefaultLayoutOrganizationSelect, RadioButton as DefaultLayoutRadioButton, RecordNumber as DefaultLayoutRecordNumber, ReferenceTable as DefaultLayoutReferenceTable, RichText as DefaultLayoutRichText, SingleLineText as DefaultLayoutSingleLineText, Spacer as DefaultLayoutSpacer, Time as DefaultLayoutTime, UpdatedTime as DefaultLayoutUpdatedTime, UserSelect as DefaultLayoutUserSelect } from '@kintone/rest-api-client/lib/KintoneFields/types/fieldLayout';
4
+ import type { Group as DefaultGroup, Row as DefaultRow } from '@kintone/rest-api-client/lib/KintoneFields/types/layout';
5
+ import type { Calc as CalcProperty, Category as CategoryProperty, CheckBox as CheckBoxProperty, CreatedTime as CreatedTimeProperty, Creator as CreatorProperty, Date as DateProperty, DateTime as DateTimeProperty, Dropdown as DropdownProperty, File as FileProperty, GroupSelect as GroupSelectProperty, InSubtable as InSubtableProperty, Link as LinkProperty, Modifier as ModifierProperty, MultiLineText as MultiLineTextProperty, MultiSelect as MultiSelectProperty, Number as NumberProperty, OneOf as OneOfProperty, OrganizationSelect as OrganizationSelectProperty, RadioButton as RadioButtonProperty, RecordNumber as RecordNumberProperty, RichText as RichTextProperty, SingleLineText as SingleLineTextProperty, Status as StatusProperty, StatusAssignee as StatusAssigneeProperty, Subtable as SubtableProperty, Time as TimeProperty, UpdatedTime as UpdatedTimeProperty, UserSelect as UserSelectProperty } from '@kintone/rest-api-client/lib/KintoneFields/types/property';
6
+ export declare namespace kintoneAPI {
7
+ type App = DefaultApp;
8
+ type RecordData = DefaultRecord;
9
+ namespace view {
10
+ type Response = ViewForResponse;
11
+ type Parameter = ViewForParameter;
12
+ }
13
+ type Field = OneOfField;
14
+ /** JavaScript APIやREST APIから取得できるレコードの各フィールド情報 */
15
+ namespace field {
16
+ type Calc = CalcField;
17
+ type Category = CategoryField;
18
+ type CheckBox = CheckBoxField;
19
+ type CreatedTime = CreatedTimeField;
20
+ type Creator = CreatorField;
21
+ type Date = DateField;
22
+ type DateTime = DateTimeField;
23
+ type Dropdown = DropdownField;
24
+ type File = FileField;
25
+ type GroupSelect = GroupSelectField;
26
+ type GroupEntity = GroupSelect['value'][number];
27
+ type ID = IDField;
28
+ type InSubtable = InSubtableField;
29
+ type Link = LinkField;
30
+ type Modifier = ModifierField;
31
+ type MultiLineText = MultiLineTextField;
32
+ type MultiSelect = MultiSelectField;
33
+ type Number = NumberField;
34
+ type OneOf = OneOfField;
35
+ type OrganizationSelect = OrganizationSelectField;
36
+ type OrganizationEntity = OrganizationSelect['value'][number];
37
+ type RadioButton = RadioButtonField;
38
+ type RecordNumber = RecordNumberField;
39
+ type Revision = RevisionField;
40
+ type RichText = RichTextField;
41
+ type SingleLineText = SingleLineTextField;
42
+ type Status = StatusField;
43
+ type StatusAssignee = StatusAssigneeField;
44
+ type Subtable<T extends Record<string, InSubtable> = Record<string, InSubtable>> = SubtableField<T>;
45
+ type Time = TimeField;
46
+ type UpdatedTime = UpdatedTimeField;
47
+ type UserSelect = UserSelectField;
48
+ type UserEntity = UserSelect['value'][number];
49
+ }
50
+ type FieldProperty = OneOfProperty;
51
+ type FieldPropertyType = FieldProperty['type'];
52
+ type FieldProperties = Record<string, OneOfProperty>;
53
+ type FieldEntry = [string, OneOfProperty];
54
+ /** REST APIから取得できるアプリの各フィールド情報 */
55
+ namespace property {
56
+ type Calc = CalcProperty;
57
+ type Category = CategoryProperty;
58
+ type CheckBox = CheckBoxProperty;
59
+ type CreatedTime = CreatedTimeProperty;
60
+ type Creator = CreatorProperty;
61
+ type Date = DateProperty;
62
+ type DateTime = DateTimeProperty;
63
+ type Dropdown = DropdownProperty;
64
+ type File = FileProperty;
65
+ type GroupSelect = GroupSelectProperty;
66
+ type InSubtable = InSubtableProperty;
67
+ type Link = LinkProperty;
68
+ type Modifier = ModifierProperty;
69
+ type MultiLineText = MultiLineTextProperty;
70
+ type MultiSelect = MultiSelectProperty;
71
+ type Number = NumberProperty;
72
+ type OneOf = OneOfProperty;
73
+ type OrganizationSelect = OrganizationSelectProperty;
74
+ type RadioButton = RadioButtonProperty;
75
+ type RecordNumber = RecordNumberProperty;
76
+ type RichText = RichTextProperty;
77
+ type SingleLineText = SingleLineTextProperty;
78
+ type Status = StatusProperty;
79
+ type StatusAssignee = StatusAssigneeProperty;
80
+ type Subtable<T extends Record<string, InSubtable> = Record<string, InSubtable>> = SubtableProperty<T>;
81
+ type Time = TimeProperty;
82
+ type UpdatedTime = UpdatedTimeProperty;
83
+ type UserSelect = UserSelectProperty;
84
+ }
85
+ type Layout = DefaultLayout;
86
+ type LayoutField = DefaultLayoutField;
87
+ namespace layout {
88
+ type Label = DefaultLayoutLabel;
89
+ type Row = DefaultRow<LayoutField[]>;
90
+ type Group = DefaultGroup<Row[]>;
91
+ type Spacer = DefaultLayoutSpacer;
92
+ type HR = DefaultLayoutHR;
93
+ type CheckBox = DefaultLayoutCheckBox;
94
+ type CreatedTime = DefaultLayoutCreatedTime;
95
+ type Creator = DefaultLayoutCreator;
96
+ type Date = DefaultLayoutDate;
97
+ type DateTime = DefaultLayoutDateTime;
98
+ type Dropdown = DefaultLayoutDropdown;
99
+ type File = DefaultLayoutFile;
100
+ type GroupSelect = DefaultLayoutGroupSelect;
101
+ type InSubtable = DefaultLayoutInSubtable;
102
+ type Link = DefaultLayoutLink;
103
+ type Modifier = DefaultLayoutModifier;
104
+ type MultiLineText = DefaultLayoutMultiLineText;
105
+ type MultiSelect = DefaultLayoutMultiSelect;
106
+ type Number = DefaultLayoutNumber;
107
+ type OrganizationSelect = DefaultLayoutOrganizationSelect;
108
+ type RadioButton = DefaultLayoutRadioButton;
109
+ type RecordNumber = DefaultLayoutRecordNumber;
110
+ type ReferenceTable = DefaultLayoutReferenceTable;
111
+ type RichText = DefaultLayoutRichText;
112
+ type SingleLineText = DefaultLayoutSingleLineText;
113
+ type Time = DefaultLayoutTime;
114
+ type UpdatedTime = DefaultLayoutUpdatedTime;
115
+ type UserSelect = DefaultLayoutUserSelect;
116
+ }
117
+ namespace response {
118
+ type App = {
119
+ readonly app?: DefaultApp;
120
+ readonly fields?: FieldProperties;
121
+ };
122
+ }
123
+ type EventType = 'portal.show' | 'app.record.index.show' | 'app.record.index.edit.show' | 'app.record.index.edit.submit' | 'app.record.index.edit.submit.success' | 'app.record.index.delete.submit' | 'app.record.detail.show' | 'app.record.detail.delete.submit' | 'app.record.detail.process.proceed' | 'app.record.create.show' | 'app.record.create.change' | 'app.record.create.submit' | 'app.record.create.submit.success' | 'app.record.edit.show' | 'app.record.edit.change' | 'app.record.edit.submit' | 'app.record.edit.submit.success' | 'app.record.print.show' | 'mobile.app.record.index.show' | 'mobile.app.record.detail.show' | 'mobile.app.record.detail.delete.submit' | 'mobile.app.record.detail.process.proceed' | 'mobile.app.record.create.show' | 'mobile.app.record.create.change' | 'mobile.app.record.create.submit' | 'mobile.app.record.create.submit.success' | 'mobile.app.record.edit.show' | 'mobile.app.record.edit.change' | 'mobile.app.record.edit.submit' | 'mobile.app.record.edit.submit.success';
124
+ type Event<T = RecordData> = {
125
+ appId: number;
126
+ viewId: number;
127
+ recordId: number;
128
+ record: T;
129
+ error: string;
130
+ url: string;
131
+ type: EventType;
132
+ changes?: {
133
+ field: {
134
+ type: string;
135
+ value: string;
136
+ };
137
+ row: any;
138
+ };
139
+ records?: T[];
140
+ viewType?: string;
141
+ viewName?: string;
142
+ offset?: number;
143
+ /**
144
+ * プロセス - 実行されたアクション
145
+ * app.record.detail.process.proceed イベントで取得できます
146
+ */
147
+ action?: {
148
+ value: string;
149
+ };
150
+ /**
151
+ * プロセス - 現在のステータス
152
+ * app.record.detail.process.proceed イベントで取得できます
153
+ */
154
+ status?: {
155
+ value: string;
156
+ };
157
+ /**
158
+ * プロセス - 次のステータス
159
+ * app.record.detail.process.proceed イベントで取得できます
160
+ */
161
+ nextStatus?: {
162
+ value: string;
163
+ };
164
+ };
165
+ }
package/dist/api-types.js CHANGED
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=api-types.js.map
@@ -1,11 +1,11 @@
1
- export declare const convertKatakanaToHiragana: (target: string) => string;
2
- export declare const convertFullwidthAlphanumericToHalfwidth: (target: string) => string;
3
- export declare const convertHalfwidthKatakanaToFullwidth: (target: string) => string;
4
- /**
5
- * 指定された文字列に以下の変換をかけて返却します
6
- *
7
- * - 全角英数字を半角英数字へ
8
- * - アルファベットを大文字から小文字へ
9
- * - 全角カナと半角カナをひらがなへ
10
- */
11
- export declare const getYuruChara: (target: string) => string;
1
+ export declare const convertKatakanaToHiragana: (target: string) => string;
2
+ export declare const convertFullwidthAlphanumericToHalfwidth: (target: string) => string;
3
+ export declare const convertHalfwidthKatakanaToFullwidth: (target: string) => string;
4
+ /**
5
+ * 指定された文字列に以下の変換をかけて返却します
6
+ *
7
+ * - 全角英数字を半角英数字へ
8
+ * - アルファベットを大文字から小文字へ
9
+ * - 全角カナと半角カナをひらがなへ
10
+ */
11
+ export declare const getYuruChara: (target: string) => string;
@@ -1,118 +1,118 @@
1
- export const convertKatakanaToHiragana = (target) => {
2
- return target.replace(/[\u30a1-\u30f6]/g, (match) => String.fromCharCode(match.charCodeAt(0) - 0x60));
3
- };
4
- export const convertFullwidthAlphanumericToHalfwidth = (target) => {
5
- return target.replace(/[A-Za-z0-9]/g, (s) => String.fromCharCode(s.charCodeAt(0) - 0xfee0));
6
- };
7
- export const convertHalfwidthKatakanaToFullwidth = (target) => {
8
- const KANA_CONVERTION_MAP = {
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
- ォ: 'ォ',
88
- ッ: 'ッ',
89
- ャ: 'ャ',
90
- ュ: 'ュ',
91
- ョ: 'ョ',
92
- '。': '。',
93
- '、': '、',
94
- ー: 'ー',
95
- '「': '「',
96
- '」': '」',
97
- '・': '・',
98
- };
99
- const regexp = new RegExp(`(${Object.keys(KANA_CONVERTION_MAP).join('|')})`, 'g');
100
- return target
101
- .replace(regexp, (s) => KANA_CONVERTION_MAP[s])
102
- .replace(/゙/g, '゛')
103
- .replace(/゚/g, '゜');
104
- };
105
- /**
106
- * 指定された文字列に以下の変換をかけて返却します
107
- *
108
- * - 全角英数字を半角英数字へ
109
- * - アルファベットを大文字から小文字へ
110
- * - 全角カナと半角カナをひらがなへ
111
- */
112
- export const getYuruChara = (target) => {
113
- let converted = convertFullwidthAlphanumericToHalfwidth(target);
114
- converted = converted.toLowerCase();
115
- converted = convertHalfwidthKatakanaToFullwidth(converted);
116
- return convertKatakanaToHiragana(converted);
117
- };
1
+ export const convertKatakanaToHiragana = (target) => {
2
+ return target.replace(/[\u30a1-\u30f6]/g, (match) => String.fromCharCode(match.charCodeAt(0) - 0x60));
3
+ };
4
+ export const convertFullwidthAlphanumericToHalfwidth = (target) => {
5
+ return target.replace(/[A-Za-z0-9]/g, (s) => String.fromCharCode(s.charCodeAt(0) - 0xfee0));
6
+ };
7
+ export const convertHalfwidthKatakanaToFullwidth = (target) => {
8
+ const KANA_CONVERTION_MAP = {
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
+ ォ: 'ォ',
88
+ ッ: 'ッ',
89
+ ャ: 'ャ',
90
+ ュ: 'ュ',
91
+ ョ: 'ョ',
92
+ '。': '。',
93
+ '、': '、',
94
+ ー: 'ー',
95
+ '「': '「',
96
+ '」': '」',
97
+ '・': '・',
98
+ };
99
+ const regexp = new RegExp(`(${Object.keys(KANA_CONVERTION_MAP).join('|')})`, 'g');
100
+ return target
101
+ .replace(regexp, (s) => KANA_CONVERTION_MAP[s])
102
+ .replace(/゙/g, '゛')
103
+ .replace(/゚/g, '゜');
104
+ };
105
+ /**
106
+ * 指定された文字列に以下の変換をかけて返却します
107
+ *
108
+ * - 全角英数字を半角英数字へ
109
+ * - アルファベットを大文字から小文字へ
110
+ * - 全角カナと半角カナをひらがなへ
111
+ */
112
+ export const getYuruChara = (target) => {
113
+ let converted = convertFullwidthAlphanumericToHalfwidth(target);
114
+ converted = converted.toLowerCase();
115
+ converted = convertHalfwidthKatakanaToFullwidth(converted);
116
+ return convertKatakanaToHiragana(converted);
117
+ };
118
118
  //# sourceMappingURL=character-width-conversion.js.map
@@ -1,29 +1,29 @@
1
- import type { kintoneAPI } from './api-types';
2
- type ErrorHandler = (error: any, props: {
3
- event: kintoneAPI.Event;
4
- }) => void;
5
- type ConstructorProps = Partial<{
6
- errorHandler: ErrorHandler;
7
- pluginId: string;
8
- }>;
9
- export declare class KintoneEventListener {
10
- #private;
11
- /**
12
- * 複数の処理を、各イベントに登録することができます
13
- */
14
- constructor(props?: ConstructorProps);
15
- /**
16
- * **この関数は`kintone.events.on`の代替関数です. 引数に互換性があります.**
17
- *
18
- * デスクトップ版のイベントを指定することで自動的に対応するモバイル版のイベントが登録されます.
19
- * また、インスタンス作成時に指定したエラーハンドラが、コールバック関数のエラー発生時に実行されます
20
- * @param events
21
- * @param callback
22
- */
23
- add: <T = import("@kintone/rest-api-client/lib/client/types").Record>(events: kintoneAPI.EventType[], callback: (event: kintoneAPI.Event<T>, options?: {
24
- pluginId?: string;
25
- }) => kintoneAPI.Event<T> | Promise<kintoneAPI.Event<T>>) => void;
26
- /** JavaScript中にページを離れようとした場合にアラートを表示します */
27
- private beforeunload;
28
- }
29
- export {};
1
+ import type { kintoneAPI } from './api-types';
2
+ type ErrorHandler = (error: any, props: {
3
+ event: kintoneAPI.Event;
4
+ }) => void;
5
+ type ConstructorProps = Partial<{
6
+ errorHandler: ErrorHandler;
7
+ pluginId: string;
8
+ }>;
9
+ export declare class KintoneEventListener {
10
+ #private;
11
+ /**
12
+ * 複数の処理を、各イベントに登録することができます
13
+ */
14
+ constructor(props?: ConstructorProps);
15
+ /**
16
+ * **この関数は`kintone.events.on`の代替関数です. 引数に互換性があります.**
17
+ *
18
+ * デスクトップ版のイベントを指定することで自動的に対応するモバイル版のイベントが登録されます.
19
+ * また、インスタンス作成時に指定したエラーハンドラが、コールバック関数のエラー発生時に実行されます
20
+ * @param events
21
+ * @param callback
22
+ */
23
+ add: <T = import("@kintone/rest-api-client/lib/client/types").Record>(events: kintoneAPI.EventType[], callback: (event: kintoneAPI.Event<T>, options?: {
24
+ pluginId?: string;
25
+ }) => kintoneAPI.Event<T> | Promise<kintoneAPI.Event<T>>) => void;
26
+ /** JavaScript中にページを離れようとした場合にアラートを表示します */
27
+ private beforeunload;
28
+ }
29
+ export {};
@@ -1,42 +1,42 @@
1
- import { withMobileEvents } from './utilities';
2
- export class KintoneEventListener {
3
- #pluginId;
4
- #commonErrorHandler;
5
- /**
6
- * 複数の処理を、各イベントに登録することができます
7
- */
8
- constructor(props) {
9
- const { errorHandler = () => null, pluginId } = props ?? {};
10
- this.#commonErrorHandler = errorHandler;
11
- this.#pluginId = pluginId;
12
- }
13
- /**
14
- * **この関数は`kintone.events.on`の代替関数です. 引数に互換性があります.**
15
- *
16
- * デスクトップ版のイベントを指定することで自動的に対応するモバイル版のイベントが登録されます.
17
- * また、インスタンス作成時に指定したエラーハンドラが、コールバック関数のエラー発生時に実行されます
18
- * @param events
19
- * @param callback
20
- */
21
- add = (events, callback) => {
22
- kintone.events.on(withMobileEvents(events), async (event) => {
23
- try {
24
- window.addEventListener('beforeunload', this.beforeunload);
25
- return await callback(event, { pluginId: this.#pluginId });
26
- }
27
- catch (error) {
28
- await this.#commonErrorHandler(error, { event });
29
- throw error;
30
- }
31
- finally {
32
- window.removeEventListener('beforeunload', this.beforeunload);
33
- }
34
- });
35
- };
36
- /** JavaScript中にページを離れようとした場合にアラートを表示します */
37
- beforeunload(event) {
38
- event.preventDefault();
39
- event.returnValue = '';
40
- }
41
- }
1
+ import { withMobileEvents } from './utilities';
2
+ export class KintoneEventListener {
3
+ #pluginId;
4
+ #commonErrorHandler;
5
+ /**
6
+ * 複数の処理を、各イベントに登録することができます
7
+ */
8
+ constructor(props) {
9
+ const { errorHandler = () => null, pluginId } = props ?? {};
10
+ this.#commonErrorHandler = errorHandler;
11
+ this.#pluginId = pluginId;
12
+ }
13
+ /**
14
+ * **この関数は`kintone.events.on`の代替関数です. 引数に互換性があります.**
15
+ *
16
+ * デスクトップ版のイベントを指定することで自動的に対応するモバイル版のイベントが登録されます.
17
+ * また、インスタンス作成時に指定したエラーハンドラが、コールバック関数のエラー発生時に実行されます
18
+ * @param events
19
+ * @param callback
20
+ */
21
+ add = (events, callback) => {
22
+ kintone.events.on(withMobileEvents(events), async (event) => {
23
+ try {
24
+ window.addEventListener('beforeunload', this.beforeunload);
25
+ return await callback(event, { pluginId: this.#pluginId });
26
+ }
27
+ catch (error) {
28
+ await this.#commonErrorHandler(error, { event });
29
+ throw error;
30
+ }
31
+ finally {
32
+ window.removeEventListener('beforeunload', this.beforeunload);
33
+ }
34
+ });
35
+ };
36
+ /** JavaScript中にページを離れようとした場合にアラートを表示します */
37
+ beforeunload(event) {
38
+ event.preventDefault();
39
+ event.returnValue = '';
40
+ }
41
+ }
42
42
  //# sourceMappingURL=event-listener.js.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export type { kintoneAPI } from './api-types';
2
- export * from './character-width-conversion';
3
- export * from './event-listener';
4
- export * from './plugin';
5
- export * from './utilities';
6
- export * from './utility-types';
7
- export * from './types/kintone.config';
1
+ export type { kintoneAPI } from './api-types';
2
+ export * from './character-width-conversion';
3
+ export * from './event-listener';
4
+ export * from './plugin';
5
+ export * from './utilities';
6
+ export * from './utility-types';
7
+ export * from './types/kintone.config';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export * from './character-width-conversion';
2
- export * from './event-listener';
3
- export * from './plugin';
4
- export * from './utilities';
5
- export * from './utility-types';
6
- export * from './types/kintone.config';
1
+ export * from './character-width-conversion';
2
+ export * from './event-listener';
3
+ export * from './plugin';
4
+ export * from './utilities';
5
+ export * from './utility-types';
6
+ export * from './types/kintone.config';
7
7
  //# sourceMappingURL=index.js.map
package/dist/plugin.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- /**
2
- * プラグインがアプリ単位で保存している設定情報を返却します
3
- */
4
- export declare const restoreStorage: <T = any>(id: string) => T | null;
5
- /**
6
- * アプリにプラグインの設定情報を保存します
7
- * @param target プラグインの設定情報
8
- * @param callback 保存成功後に実行する処理. 省略すると、アプリ設定のプラグインの一覧画面に遷移し、設定完了メッセージを表示します。指定すると、アプリ設定のプラグインの一覧画面には遷移しません。
9
- */
10
- export declare const storeStorage: (target: Record<string, any>, callback?: () => void) => void;
1
+ /**
2
+ * プラグインがアプリ単位で保存している設定情報を返却します
3
+ */
4
+ export declare const restoreStorage: <T = any>(id: string) => T | null;
5
+ /**
6
+ * アプリにプラグインの設定情報を保存します
7
+ * @param target プラグインの設定情報
8
+ * @param callback 保存成功後に実行する処理. 省略すると、アプリ設定のプラグインの一覧画面に遷移し、設定完了メッセージを表示します。指定すると、アプリ設定のプラグインの一覧画面には遷移しません。
9
+ */
10
+ export declare const storeStorage: (target: Record<string, any>, callback?: () => void) => void;
package/dist/plugin.js CHANGED
@@ -1,20 +1,20 @@
1
- /**
2
- * プラグインがアプリ単位で保存している設定情報を返却します
3
- */
4
- export const restoreStorage = (id) => {
5
- const config = kintone.plugin.app.getConfig(id);
6
- if (!Object.keys(config).length) {
7
- return null;
8
- }
9
- return Object.entries(config).reduce((acc, [key, value]) => ({ ...acc, [key]: JSON.parse(value) }), {});
10
- };
11
- /**
12
- * アプリにプラグインの設定情報を保存します
13
- * @param target プラグインの設定情報
14
- * @param callback 保存成功後に実行する処理. 省略すると、アプリ設定のプラグインの一覧画面に遷移し、設定完了メッセージを表示します。指定すると、アプリ設定のプラグインの一覧画面には遷移しません。
15
- */
16
- export const storeStorage = (target, callback) => {
17
- const converted = Object.entries(target).reduce((acc, [key, value]) => ({ ...acc, [key]: JSON.stringify(value) }), {});
18
- kintone.plugin.app.setConfig(converted, callback);
19
- };
1
+ /**
2
+ * プラグインがアプリ単位で保存している設定情報を返却します
3
+ */
4
+ export const restoreStorage = (id) => {
5
+ const config = kintone.plugin.app.getConfig(id);
6
+ if (!Object.keys(config).length) {
7
+ return null;
8
+ }
9
+ return Object.entries(config).reduce((acc, [key, value]) => ({ ...acc, [key]: JSON.parse(value) }), {});
10
+ };
11
+ /**
12
+ * アプリにプラグインの設定情報を保存します
13
+ * @param target プラグインの設定情報
14
+ * @param callback 保存成功後に実行する処理. 省略すると、アプリ設定のプラグインの一覧画面に遷移し、設定完了メッセージを表示します。指定すると、アプリ設定のプラグインの一覧画面には遷移しません。
15
+ */
16
+ export const storeStorage = (target, callback) => {
17
+ const converted = Object.entries(target).reduce((acc, [key, value]) => ({ ...acc, [key]: JSON.stringify(value) }), {});
18
+ kintone.plugin.app.setConfig(converted, callback);
19
+ };
20
20
  //# sourceMappingURL=plugin.js.map
@@ -1,7 +1,8 @@
1
- export type KintoneConfig = {
2
- apps: {
3
- dev: number;
4
- prod: number;
5
- name: string;
6
- }[];
7
- };
1
+ export type KintoneConfig = {
2
+ apps: {
3
+ dev: number;
4
+ prod: number;
5
+ name: string;
6
+ }[];
7
+ kv?: Record<string, Record<string, string>>;
8
+ };
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=kintone.config.js.map
@@ -1,23 +1,23 @@
1
- import type { kintoneAPI } from './api-types';
2
- import type { SavedFields } from './utility-types';
3
- /**
4
- * 各フィールドタイプの値を文字列として返却します
5
- *
6
- * 配列で取得されるような値は区切り文字で連結されます
7
- * @param field
8
- * @param options
9
- * @returns
10
- */
11
- export declare const getFieldValueAsString: (field: kintoneAPI.Field | SavedFields, options?: {
12
- separator?: string;
13
- ignoresCalculationError?: boolean;
14
- }) => string;
15
- export declare const compareField: (field1: kintoneAPI.Field, field2: kintoneAPI.Field, options?: {
16
- ignoresType?: boolean;
17
- }) => boolean;
18
- /**
19
- * デスクトップ版のイベントタイプを基に、モバイル版を追加し返却します
20
- * @param events デスクトップのイベントタイプ
21
- * @returns モバイルを含むイベントタイプ
22
- */
23
- export declare const withMobileEvents: (events: string[]) => string[];
1
+ import type { kintoneAPI } from './api-types';
2
+ import type { SavedFields } from './utility-types';
3
+ /**
4
+ * 各フィールドタイプの値を文字列として返却します
5
+ *
6
+ * 配列で取得されるような値は区切り文字で連結されます
7
+ * @param field
8
+ * @param options
9
+ * @returns
10
+ */
11
+ export declare const getFieldValueAsString: (field: kintoneAPI.Field | SavedFields, options?: {
12
+ separator?: string;
13
+ ignoresCalculationError?: boolean;
14
+ }) => string;
15
+ export declare const compareField: (field1: kintoneAPI.Field, field2: kintoneAPI.Field, options?: {
16
+ ignoresType?: boolean;
17
+ }) => boolean;
18
+ /**
19
+ * デスクトップ版のイベントタイプを基に、モバイル版を追加し返却します
20
+ * @param events デスクトップのイベントタイプ
21
+ * @returns モバイルを含むイベントタイプ
22
+ */
23
+ export declare const withMobileEvents: (events: string[]) => string[];
package/dist/utilities.js CHANGED
@@ -1,79 +1,79 @@
1
- /**
2
- * 各フィールドタイプの値を文字列として返却します
3
- *
4
- * 配列で取得されるような値は区切り文字で連結されます
5
- * @param field
6
- * @param options
7
- * @returns
8
- */
9
- export const getFieldValueAsString = (field, options) => {
10
- const { separator = ', ', ignoresCalculationError = false } = options ?? {};
11
- if (field.type === 'MULTI_LINE_TEXT' ||
12
- field.type === 'RICH_TEXT' ||
13
- field.type === 'CREATED_TIME' ||
14
- field.type === 'DATE' ||
15
- field.type === 'DATETIME' ||
16
- field.type === 'DROP_DOWN' ||
17
- field.type === 'LINK' ||
18
- field.type === 'RECORD_NUMBER' ||
19
- field.type === 'STATUS' ||
20
- field.type === 'RADIO_BUTTON' ||
21
- field.type === 'TIME' ||
22
- field.type === 'UPDATED_TIME' ||
23
- field.type === '__ID__' ||
24
- field.type === '__REVISION__') {
25
- return field.value ?? '';
26
- }
27
- else if (field.type === 'SINGLE_LINE_TEXT' ||
28
- field.type === 'NUMBER' ||
29
- field.type === 'CALC') {
30
- const value = field.value ?? '';
31
- if (ignoresCalculationError) {
32
- return /^#.*!$/.test(value) ? '' : value;
33
- }
34
- return value;
35
- }
36
- else if (field.type === 'CATEGORY' ||
37
- field.type === 'CHECK_BOX' ||
38
- field.type === 'MULTI_SELECT') {
39
- return field.value.join(separator);
40
- }
41
- else if (field.type === 'CREATOR' || field.type === 'MODIFIER') {
42
- return field.value.name;
43
- }
44
- else if (field.type === 'GROUP_SELECT' ||
45
- field.type === 'ORGANIZATION_SELECT' ||
46
- field.type === 'USER_SELECT' ||
47
- field.type === 'STATUS_ASSIGNEE') {
48
- return field.value.map((value) => value.name).join(separator);
49
- }
50
- else if (field.type === 'FILE') {
51
- return field.value.map((value) => value.name).join(separator);
52
- }
53
- else if (field.type === 'SUBTABLE') {
54
- return field.value
55
- .map((row) => Object.values(row.value)
56
- .map((cell) => getFieldValueAsString(cell, { separator }))
57
- .join(separator))
58
- .join(separator);
59
- }
60
- return '';
61
- };
62
- export const compareField = (field1, field2, options) => {
63
- const { ignoresType = false } = options ?? {};
64
- if (!ignoresType && field1.type !== field2.type) {
65
- return false;
66
- }
67
- const separator = '$';
68
- return (getFieldValueAsString(field1, { separator }) === getFieldValueAsString(field2, { separator }));
69
- };
70
- /**
71
- * デスクトップ版のイベントタイプを基に、モバイル版を追加し返却します
72
- * @param events デスクトップのイベントタイプ
73
- * @returns モバイルを含むイベントタイプ
74
- */
75
- export const withMobileEvents = (events) => {
76
- const mobileEvents = events.filter((e) => !/^mobile/.test(e)).map((type) => 'mobile.' + type);
77
- return [...events, ...mobileEvents];
78
- };
1
+ /**
2
+ * 各フィールドタイプの値を文字列として返却します
3
+ *
4
+ * 配列で取得されるような値は区切り文字で連結されます
5
+ * @param field
6
+ * @param options
7
+ * @returns
8
+ */
9
+ export const getFieldValueAsString = (field, options) => {
10
+ const { separator = ', ', ignoresCalculationError = false } = options ?? {};
11
+ if (field.type === 'MULTI_LINE_TEXT' ||
12
+ field.type === 'RICH_TEXT' ||
13
+ field.type === 'CREATED_TIME' ||
14
+ field.type === 'DATE' ||
15
+ field.type === 'DATETIME' ||
16
+ field.type === 'DROP_DOWN' ||
17
+ field.type === 'LINK' ||
18
+ field.type === 'RECORD_NUMBER' ||
19
+ field.type === 'STATUS' ||
20
+ field.type === 'RADIO_BUTTON' ||
21
+ field.type === 'TIME' ||
22
+ field.type === 'UPDATED_TIME' ||
23
+ field.type === '__ID__' ||
24
+ field.type === '__REVISION__') {
25
+ return field.value ?? '';
26
+ }
27
+ else if (field.type === 'SINGLE_LINE_TEXT' ||
28
+ field.type === 'NUMBER' ||
29
+ field.type === 'CALC') {
30
+ const value = field.value ?? '';
31
+ if (ignoresCalculationError) {
32
+ return /^#.*!$/.test(value) ? '' : value;
33
+ }
34
+ return value;
35
+ }
36
+ else if (field.type === 'CATEGORY' ||
37
+ field.type === 'CHECK_BOX' ||
38
+ field.type === 'MULTI_SELECT') {
39
+ return field.value.join(separator);
40
+ }
41
+ else if (field.type === 'CREATOR' || field.type === 'MODIFIER') {
42
+ return field.value.name;
43
+ }
44
+ else if (field.type === 'GROUP_SELECT' ||
45
+ field.type === 'ORGANIZATION_SELECT' ||
46
+ field.type === 'USER_SELECT' ||
47
+ field.type === 'STATUS_ASSIGNEE') {
48
+ return field.value.map((value) => value.name).join(separator);
49
+ }
50
+ else if (field.type === 'FILE') {
51
+ return field.value.map((value) => value.name).join(separator);
52
+ }
53
+ else if (field.type === 'SUBTABLE') {
54
+ return field.value
55
+ .map((row) => Object.values(row.value)
56
+ .map((cell) => getFieldValueAsString(cell, { separator }))
57
+ .join(separator))
58
+ .join(separator);
59
+ }
60
+ return '';
61
+ };
62
+ export const compareField = (field1, field2, options) => {
63
+ const { ignoresType = false } = options ?? {};
64
+ if (!ignoresType && field1.type !== field2.type) {
65
+ return false;
66
+ }
67
+ const separator = '$';
68
+ return (getFieldValueAsString(field1, { separator }) === getFieldValueAsString(field2, { separator }));
69
+ };
70
+ /**
71
+ * デスクトップ版のイベントタイプを基に、モバイル版を追加し返却します
72
+ * @param events デスクトップのイベントタイプ
73
+ * @returns モバイルを含むイベントタイプ
74
+ */
75
+ export const withMobileEvents = (events) => {
76
+ const mobileEvents = events.filter((e) => !/^mobile/.test(e)).map((type) => 'mobile.' + type);
77
+ return [...events, ...mobileEvents];
78
+ };
79
79
  //# sourceMappingURL=utilities.js.map
@@ -1,2 +1,2 @@
1
- /** kintone.fieldTypes以下のプロパティをすべて参照する */
2
- export type SavedFields = kintone.fieldTypes.Calc | kintone.fieldTypes.CheckBox | kintone.fieldTypes.CreatedTime | kintone.fieldTypes.Creator | kintone.fieldTypes.Date | kintone.fieldTypes.DateTime | kintone.fieldTypes.DropDown | kintone.fieldTypes.File | kintone.fieldTypes.GroupSelect | kintone.fieldTypes.Id | kintone.fieldTypes.Link | kintone.fieldTypes.Modifier | kintone.fieldTypes.MultiLineText | kintone.fieldTypes.MultiSelect | kintone.fieldTypes.Number | kintone.fieldTypes.OrganizationSelect | kintone.fieldTypes.RadioButton | kintone.fieldTypes.RecordNumber | kintone.fieldTypes.Revision | kintone.fieldTypes.RichText | kintone.fieldTypes.SingleLineText | kintone.fieldTypes.Time | kintone.fieldTypes.UpdatedTime | kintone.fieldTypes.UserSelect;
1
+ /** kintone.fieldTypes以下のプロパティをすべて参照する */
2
+ export type SavedFields = kintone.fieldTypes.Calc | kintone.fieldTypes.CheckBox | kintone.fieldTypes.CreatedTime | kintone.fieldTypes.Creator | kintone.fieldTypes.Date | kintone.fieldTypes.DateTime | kintone.fieldTypes.DropDown | kintone.fieldTypes.File | kintone.fieldTypes.GroupSelect | kintone.fieldTypes.Id | kintone.fieldTypes.Link | kintone.fieldTypes.Modifier | kintone.fieldTypes.MultiLineText | kintone.fieldTypes.MultiSelect | kintone.fieldTypes.Number | kintone.fieldTypes.OrganizationSelect | kintone.fieldTypes.RadioButton | kintone.fieldTypes.RecordNumber | kintone.fieldTypes.Revision | kintone.fieldTypes.RichText | kintone.fieldTypes.SingleLineText | kintone.fieldTypes.Time | kintone.fieldTypes.UpdatedTime | kintone.fieldTypes.UserSelect;
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=utility-types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konomi-app/kintone-utilities",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://github.com/local-bias/kintone-utilities.git",
@@ -11,16 +11,13 @@
11
11
  "prepare": "yarn run build",
12
12
  "play": "cd playground && yarn run dev"
13
13
  },
14
- "engines": {
15
- "node": ">=18.0.0"
16
- },
17
14
  "dependencies": {
18
15
  "@emotion/css": "^11.10.6",
19
- "@kintone/rest-api-client": "^3.3.4"
16
+ "@kintone/rest-api-client": "^3.3.5"
20
17
  },
21
18
  "devDependencies": {
22
- "@kintone/dts-gen": "^6.1.21",
23
- "typescript": "^4.9.5"
19
+ "@kintone/dts-gen": "^6.1.22",
20
+ "typescript": "^5.0.2"
24
21
  },
25
22
  "prettier": {
26
23
  "printWidth": 100,
@@ -1,30 +0,0 @@
1
- // //@ts-check
2
- // import { writeFileSync } from 'fs';
3
- // import { join } from 'path';
4
- // import { cwd } from 'process';
5
- // import config from '../kintone.config.mjs';
6
-
7
- // const fileContent = `
8
- // /** このファイルは設定情報を基に自動生成されました */
9
-
10
- // type KintoneAppName = ${config.apps.map((app) => `'${app.name}'`).join(' | ')};
11
-
12
- // const apps = ${JSON.stringify(config.apps, null, 2)};
13
-
14
- // export const getKintoneAppId = (appName: KintoneAppName) => {
15
- // const env = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
16
- // const app = apps.find((app) => app.name === appName);
17
- // if (!app) {
18
- // throw new Error(\`アプリ名が不正です: \${appName}\`);
19
- // }
20
- // return app[env];
21
- // };
22
- // `;
23
-
24
- // const folder = join(cwd(), 'src', 'lib');
25
-
26
- // const filePath = join(folder, 'kintone-app-id.ts');
27
-
28
- // writeFileSync(filePath, fileContent);
29
-
30
- // console.log(`🐸 kintoneのアプリID取得関数を生成しました`, filePath);