@digitalwalletcorp/vue-core 1.3.1 → 1.4.1
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/README.md +36 -0
- package/lib/accordion-section.d.cts +1 -1
- package/lib/accordion-section.d.ts +1 -1
- package/lib/components-BCJWnExf.cjs +1 -0
- package/lib/{components-BuTJ1wX8.js → components-CDIhw5uP.js} +5 -5
- package/lib/data-table.d.cts +101 -8
- package/lib/data-table.d.ts +101 -8
- package/lib/{types → helpers}/data-table.d.cts +47 -93
- package/lib/{types → helpers}/data-table.d.ts +47 -93
- package/lib/helpers/{show-floating-component.d.cts → floating-component.d.cts} +1 -1
- package/lib/helpers/{show-floating-component.d.ts → floating-component.d.ts} +1 -1
- package/lib/helpers/{show-modal-dialog.d.cts → modal-dialog.d.cts} +13 -1
- package/lib/helpers/{show-modal-dialog.d.ts → modal-dialog.d.ts} +13 -1
- package/lib/helpers/{show-overlay-box.d.ts → overlay-box.d.cts} +3 -1
- package/lib/helpers/{show-overlay-box.d.cts → overlay-box.d.ts} +3 -1
- package/lib/helpers/{show-snackbar.d.cts → snackbar.d.cts} +16 -1
- package/lib/helpers/{show-snackbar.d.ts → snackbar.d.ts} +16 -1
- package/lib/helpers/vue-core-options.d.cts +17 -0
- package/lib/helpers/vue-core-options.d.ts +17 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +18 -18
- package/lib/index.d.ts +18 -18
- package/lib/index.js +187 -270
- package/lib/internal/data-table-controls.d.cts +3 -3
- package/lib/internal/data-table-controls.d.ts +3 -3
- package/lib/internal/floating-component.d.cts +1 -1
- package/lib/internal/floating-component.d.ts +1 -1
- package/lib/internal/movable-window.d.cts +1 -1
- package/lib/internal/movable-window.d.ts +1 -1
- package/lib/internal/pagination.d.cts +1 -1
- package/lib/internal/pagination.d.ts +1 -1
- package/lib/internal/snackbar-container.d.cts +1 -1
- package/lib/internal/snackbar-container.d.ts +1 -1
- package/lib/internal/use-movable-window.d.cts +1 -1
- package/lib/internal/use-movable-window.d.ts +1 -1
- package/lib/internal/{mount-window.d.cts → window-control.d.cts} +22 -1
- package/lib/internal/{mount-window.d.ts → window-control.d.ts} +22 -1
- package/lib/label-button.d.cts +1 -1
- package/lib/label-button.d.ts +1 -1
- package/lib/label-icon.d.cts +12 -2
- package/lib/label-icon.d.ts +12 -2
- package/lib/modal-dialog.d.cts +1 -1
- package/lib/modal-dialog.d.ts +1 -1
- package/lib/nuxt.cjs +1 -1
- package/lib/nuxt.js +1 -1
- package/lib/overlay-box.d.cts +1 -1
- package/lib/overlay-box.d.ts +1 -1
- package/lib/register.cjs +1 -1
- package/lib/register.js +1 -1
- package/lib/tab-content.d.cts +1 -1
- package/lib/tab-content.d.ts +1 -1
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-BJxLA6aU.js +1954 -0
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-TYmLM_h9.cjs +1 -0
- package/package.json +1 -1
- package/src/accordion-section.vue +1 -1
- package/src/data-table.vue +189 -49
- package/src/helpers/data-table.ts +250 -0
- package/src/helpers/{show-floating-component.ts → floating-component.ts} +2 -2
- package/src/helpers/{show-modal-dialog.ts → modal-dialog.ts} +17 -1
- package/src/helpers/{show-overlay-box.ts → overlay-box.ts} +5 -2
- package/src/helpers/{show-snackbar.ts → snackbar.ts} +19 -1
- package/src/helpers/vue-core-options.ts +20 -0
- package/src/index.ts +18 -18
- package/src/internal/data-table-controls.vue +1 -1
- package/src/internal/floating-component.vue +2 -2
- package/src/internal/movable-window.vue +1 -1
- package/src/internal/pagination.vue +1 -1
- package/src/internal/snackbar-container.vue +1 -1
- package/src/internal/use-movable-window.ts +1 -1
- package/src/internal/{mount-window.ts → window-control.ts} +31 -1
- package/src/label-button.vue +1 -1
- package/src/label-icon.vue +13 -2
- package/src/modal-dialog.vue +1 -1
- package/src/overlay-box.vue +3 -3
- package/src/tab-content.vue +2 -2
- package/src/tab-group.vue +2 -2
- package/lib/components-CKql5lWg.cjs +0 -1
- package/lib/helpers/data-table-csv.d.cts +0 -17
- package/lib/helpers/data-table-csv.d.ts +0 -17
- package/lib/internal/data-table-value.d.cts +0 -32
- package/lib/internal/data-table-value.d.ts +0 -32
- package/lib/internal/opened-overlay-boxes.d.cts +0 -2
- package/lib/internal/opened-overlay-boxes.d.ts +0 -2
- package/lib/internal/snackbar-item.d.cts +0 -17
- package/lib/internal/snackbar-item.d.ts +0 -17
- package/lib/internal/window-order.d.cts +0 -6
- package/lib/internal/window-order.d.ts +0 -6
- package/lib/types/label-preset.d.cts +0 -12
- package/lib/types/label-preset.d.ts +0 -12
- package/lib/types/modal-dialog.d.cts +0 -13
- package/lib/types/modal-dialog.d.ts +0 -13
- package/lib/types/movable-window.d.cts +0 -16
- package/lib/types/movable-window.d.ts +0 -16
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-BKV_FX6k.js +0 -1837
- package/lib/warning-popper.vue_vue_type_style_index_0_lang-CHmkjVCO.cjs +0 -1
- package/src/helpers/data-table-csv.ts +0 -55
- package/src/internal/data-table-value.ts +0 -99
- package/src/internal/opened-overlay-boxes.ts +0 -2
- package/src/internal/snackbar-item.ts +0 -20
- package/src/internal/window-order.ts +0 -11
- package/src/types/data-table.ts +0 -196
- package/src/types/label-preset.ts +0 -13
- package/src/types/modal-dialog.ts +0 -16
- package/src/types/movable-window.ts +0 -18
- /package/lib/helpers/{show-screen-loading.d.cts → screen-loading.d.cts} +0 -0
- /package/lib/helpers/{show-screen-loading.d.ts → screen-loading.d.ts} +0 -0
- /package/lib/internal/{tab-group-context.d.cts → tab-group.d.cts} +0 -0
- /package/lib/internal/{tab-group-context.d.ts → tab-group.d.ts} +0 -0
- /package/src/helpers/{show-screen-loading.ts → screen-loading.ts} +0 -0
- /package/src/internal/{tab-group-context.ts → tab-group.ts} +0 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/** 列の値の型。ソートの比較方法を決める */
|
|
2
|
+
export type DataTableValueType = 'boolean' | 'string' | 'number' | 'object';
|
|
3
|
+
|
|
4
|
+
/** ソートの方式。page は表示中の行を並べ替えて表示し、remote はソート条件を通知するだけで利用側が再取得する */
|
|
5
|
+
export type DataTableSortMode = 'page' | 'remote';
|
|
6
|
+
|
|
7
|
+
/** コントロール(ページネーション・総件数・表示件数・ダウンロードボタン)を出す位置 */
|
|
8
|
+
export type DataTableControlsPlacement = 'both' | 'top' | 'bottom' | 'none';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* CSV に出力する列の定義
|
|
12
|
+
*/
|
|
13
|
+
export interface DataTableCsvColumn<T = unknown> {
|
|
14
|
+
/** true なら出力しない */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** 値を取り出すキー。ドット区切りで入れ子を辿る。未指定なら DataTableHeader.id。'$index' は行番号 */
|
|
17
|
+
key?: string;
|
|
18
|
+
/** 列名。未指定なら DataTableHeader.label。言語切替に追従させる場合は関数で渡す */
|
|
19
|
+
label?: string | (() => string);
|
|
20
|
+
/** 値の整形。指定したときは key を使わない */
|
|
21
|
+
format?: (row: T) => unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* ヘッダの定義
|
|
26
|
+
*/
|
|
27
|
+
export interface DataTableHeader<T = unknown> {
|
|
28
|
+
/** 列を識別するキー。ソートで値を取り出すキーにもなる */
|
|
29
|
+
id: string;
|
|
30
|
+
/** 見出し。言語切替に追従させる場合は関数で渡す */
|
|
31
|
+
label: string | (() => string);
|
|
32
|
+
/** true なら label を HTML として描画する */
|
|
33
|
+
html?: boolean;
|
|
34
|
+
/** ソートで値を取り出すキー。id と違うキーで並べるときに指定する。ドット区切りで入れ子を辿る */
|
|
35
|
+
sortKey?: string;
|
|
36
|
+
/** 値の型。ソートの比較方法を決める。未指定なら string */
|
|
37
|
+
type?: DataTableValueType;
|
|
38
|
+
/** 行同士を比較する関数。指定したときは sortKey と type を使わない。昇順の並びで a が前なら負の数を返す */
|
|
39
|
+
compare?: (a: T, b: T) => number;
|
|
40
|
+
/** 列の幅。数値は px */
|
|
41
|
+
width?: string | number;
|
|
42
|
+
/** 列の最小幅。数値は px */
|
|
43
|
+
minWidth?: string | number;
|
|
44
|
+
/** 列の最大幅。数値は px */
|
|
45
|
+
maxWidth?: string | number;
|
|
46
|
+
/** th の rowspan */
|
|
47
|
+
rowspan?: string | number;
|
|
48
|
+
/** th の colspan */
|
|
49
|
+
colspan?: string | number;
|
|
50
|
+
/** th の title 属性 */
|
|
51
|
+
title?: string;
|
|
52
|
+
/** CSV の出力定義。true なら id の値を label の列名で出力する。未指定なら出力しない */
|
|
53
|
+
csv?: boolean | DataTableCsvColumn<T>[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 表示する文言。言語切替に追従させる場合は関数で渡す
|
|
58
|
+
*/
|
|
59
|
+
export interface DataTableLabels {
|
|
60
|
+
/** 総件数の見出し */
|
|
61
|
+
totalCount?: string | (() => string);
|
|
62
|
+
/** 総件数の後ろに付ける単位 */
|
|
63
|
+
totalUnit?: string | (() => string);
|
|
64
|
+
/** 1ページあたりの表示件数の見出し */
|
|
65
|
+
limit?: string | (() => string);
|
|
66
|
+
/** データが無いときの表示 */
|
|
67
|
+
noData?: string | (() => string);
|
|
68
|
+
/** ページ番号の選択の見出し。showPageSelect のときに表示する */
|
|
69
|
+
pageNumber?: string | (() => string);
|
|
70
|
+
/** ページダウンロードボタンの title */
|
|
71
|
+
downloadPage?: string | (() => string);
|
|
72
|
+
/** 全件ダウンロードボタンの title */
|
|
73
|
+
downloadAll?: string | (() => string);
|
|
74
|
+
/** 先頭ページへ移動するボタンの読み上げ名 */
|
|
75
|
+
firstPage?: string | (() => string);
|
|
76
|
+
/** 前のページへ移動するボタンの読み上げ名 */
|
|
77
|
+
previousPage?: string | (() => string);
|
|
78
|
+
/** 前のページ番号の組へ移動するボタンの読み上げ名 */
|
|
79
|
+
previousPages?: string | (() => string);
|
|
80
|
+
/** 次のページ番号の組へ移動するボタンの読み上げ名 */
|
|
81
|
+
nextPages?: string | (() => string);
|
|
82
|
+
/** 次のページへ移動するボタンの読み上げ名 */
|
|
83
|
+
nextPage?: string | (() => string);
|
|
84
|
+
/** 末尾ページへ移動するボタンの読み上げ名 */
|
|
85
|
+
lastPage?: string | (() => string);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 関数を評価した後の文言 */
|
|
89
|
+
export type DataTableResolvedLabels = Record<keyof DataTableLabels, string>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* ソートの状態
|
|
93
|
+
*/
|
|
94
|
+
export interface DataTableSortContext {
|
|
95
|
+
/** ソートしているヘッダの id。ソートしていなければ空文字 */
|
|
96
|
+
sortKey: string;
|
|
97
|
+
/** 降順なら true */
|
|
98
|
+
descending: boolean;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* ドット区切りのパスで入れ子の値を取り出す。途中が null なら undefined
|
|
103
|
+
*
|
|
104
|
+
* @param {unknown} obj
|
|
105
|
+
* @param {string} path 'a.b.c' の形。'a[0].b' は 'a.0.b' と同じ
|
|
106
|
+
* @returns {unknown}
|
|
107
|
+
*/
|
|
108
|
+
export const getValueByPath = (obj: unknown, path: string): unknown => {
|
|
109
|
+
let value: unknown = obj;
|
|
110
|
+
for (const key of path.replace(/\[(\w+)\]/g, '.$1').split('.')) {
|
|
111
|
+
if (value == null) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
value = (value as Record<string, unknown>)[key];
|
|
115
|
+
}
|
|
116
|
+
return value;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 文字列または文字列を返す関数から文字列を得る
|
|
121
|
+
*
|
|
122
|
+
* @param {string | (() => string)} label
|
|
123
|
+
* @returns {string}
|
|
124
|
+
*/
|
|
125
|
+
export const resolveLabel = (label: string | (() => string) | undefined): string => {
|
|
126
|
+
if (typeof label === 'function') {
|
|
127
|
+
return label();
|
|
128
|
+
}
|
|
129
|
+
return label ?? '';
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const toBoolean = (value: unknown): boolean => {
|
|
133
|
+
return value === true || value === 'true' || value === '1' || value === 'on' || value === 1;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* カンマ付きの文字列も数値として扱うため、符号・数字・小数点だけを残して数値化する
|
|
138
|
+
*/
|
|
139
|
+
const toNumber = (value: unknown): number => {
|
|
140
|
+
if (typeof value === 'number') {
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
return Number(String(value).replace(/[^+\-\d.]/g, ''));
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 型に応じて2つの値を比較する。null / undefined は最小として扱う
|
|
148
|
+
*
|
|
149
|
+
* @param {unknown} a
|
|
150
|
+
* @param {unknown} b
|
|
151
|
+
* @param {DataTableValueType} type
|
|
152
|
+
* @returns {number} a が前なら負の数、後ろなら正の数、等しければ 0
|
|
153
|
+
*/
|
|
154
|
+
export const compareValues = (a: unknown, b: unknown, type: DataTableValueType): number => {
|
|
155
|
+
if (a == null && b == null) {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
if (a == null) {
|
|
159
|
+
return -1;
|
|
160
|
+
}
|
|
161
|
+
if (b == null) {
|
|
162
|
+
return 1;
|
|
163
|
+
}
|
|
164
|
+
if (a === b) {
|
|
165
|
+
return 0;
|
|
166
|
+
}
|
|
167
|
+
switch (type) {
|
|
168
|
+
case 'boolean':
|
|
169
|
+
return (toBoolean(a) ? 1 : 0) - (toBoolean(b) ? 1 : 0);
|
|
170
|
+
case 'number': {
|
|
171
|
+
const numA = toNumber(a);
|
|
172
|
+
const numB = toNumber(b);
|
|
173
|
+
if (Number.isNaN(numA) || Number.isNaN(numB)) {
|
|
174
|
+
return (Number.isNaN(numA) ? 0 : 1) - (Number.isNaN(numB) ? 0 : 1);
|
|
175
|
+
}
|
|
176
|
+
return numA - numB;
|
|
177
|
+
}
|
|
178
|
+
case 'object':
|
|
179
|
+
return stringifyValue(a).localeCompare(stringifyValue(b));
|
|
180
|
+
default:
|
|
181
|
+
return String(a).localeCompare(String(b));
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 行の同一性の判定に使う文字列にする。bigint は文字列にし、循環参照は空文字にする
|
|
187
|
+
*
|
|
188
|
+
* @param {unknown} value
|
|
189
|
+
* @returns {string}
|
|
190
|
+
*/
|
|
191
|
+
export const stringifyValue = (value: unknown): string => {
|
|
192
|
+
try {
|
|
193
|
+
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v) ?? '';
|
|
194
|
+
} catch {
|
|
195
|
+
return '';
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/** 行番号を出力するキー */
|
|
200
|
+
const INDEX_KEY = '$index';
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* ヘッダから CSV に出力する列の定義を取り出す。csv を持たないヘッダと disabled の列は含めない
|
|
204
|
+
*/
|
|
205
|
+
const toCsvColumns = <T>(headers: DataTableHeader<T>[]): { header: DataTableHeader<T>; column: DataTableCsvColumn<T> }[] => {
|
|
206
|
+
const columns: { header: DataTableHeader<T>; column: DataTableCsvColumn<T> }[] = [];
|
|
207
|
+
for (const header of headers) {
|
|
208
|
+
if (header.csv === true) {
|
|
209
|
+
columns.push({ header, column: {} });
|
|
210
|
+
} else if (Array.isArray(header.csv)) {
|
|
211
|
+
for (const column of header.csv) {
|
|
212
|
+
if (!column.disabled) {
|
|
213
|
+
columns.push({ header, column });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return columns;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* ヘッダの csv の定義から CSV の列名を作る
|
|
223
|
+
*
|
|
224
|
+
* @param {DataTableHeader<T>[]} headers
|
|
225
|
+
* @returns {string[]} 列名
|
|
226
|
+
*/
|
|
227
|
+
export const headersToCsvColumns = <T>(headers: DataTableHeader<T>[]): string[] => {
|
|
228
|
+
return toCsvColumns(headers).map(({ header, column }) => resolveLabel(column.label ?? header.label));
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* ヘッダの csv の定義に従って行から CSV の列の値を取り出す
|
|
233
|
+
*
|
|
234
|
+
* @param {DataTableHeader<T>[]} headers
|
|
235
|
+
* @param {T} row
|
|
236
|
+
* @param {number} [rowNumber] key が '$index' の列に出力する行番号
|
|
237
|
+
* @returns {unknown[]} 列の値。文字列化はしない
|
|
238
|
+
*/
|
|
239
|
+
export const rowToCsvColumns = <T>(headers: DataTableHeader<T>[], row: T, rowNumber?: number): unknown[] => {
|
|
240
|
+
return toCsvColumns(headers).map(({ header, column }) => {
|
|
241
|
+
if (column.format) {
|
|
242
|
+
return column.format(row);
|
|
243
|
+
}
|
|
244
|
+
const key = column.key ?? header.id;
|
|
245
|
+
if (key === INDEX_KEY) {
|
|
246
|
+
return rowNumber;
|
|
247
|
+
}
|
|
248
|
+
return getValueByPath(row, key);
|
|
249
|
+
});
|
|
250
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h } from 'vue';
|
|
2
2
|
import type { AppContext, ClassValue, Component, StyleValue, VNode } from 'vue';
|
|
3
3
|
import FloatingComponent from '@/internal/floating-component.vue';
|
|
4
|
-
import { mountWindow, useWindowOwner } from '@/internal/
|
|
5
|
-
import type { MovableWindowContentProps, MovableWindowDragMode, MovableWindowHandle } from '@/
|
|
4
|
+
import { mountWindow, useWindowOwner } from '@/internal/window-control';
|
|
5
|
+
import type { MovableWindowContentProps, MovableWindowDragMode, MovableWindowHandle } from '@/internal/window-control';
|
|
6
6
|
|
|
7
7
|
/** showFloatingComponent が中身のコンポーネントに props として渡す関数 */
|
|
8
8
|
export type FloatingComponentContentProps = MovableWindowContentProps;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { h, render } from 'vue';
|
|
2
2
|
import type { AppContext, ClassValue, Component, StyleValue } from 'vue';
|
|
3
3
|
import ModalDialog from '@/modal-dialog.vue';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/** モーダルダイアログの種類 */
|
|
6
|
+
export type ModalDialogType = 'info' | 'confirm' | 'warn' | 'error';
|
|
7
|
+
|
|
8
|
+
/** モーダルダイアログに並べるボタンの種類 */
|
|
9
|
+
export type ModalDialogButton = 'ok' | 'yes' | 'no' | 'cancel';
|
|
10
|
+
|
|
11
|
+
/** モーダルダイアログを閉じたボタン。Esc で閉じたときは cancel */
|
|
12
|
+
export type ModalDialogResult = ModalDialogButton;
|
|
13
|
+
|
|
14
|
+
/** モーダルダイアログに表示する画像。文字列は画像の URL */
|
|
15
|
+
export type ModalDialogImage = string | {
|
|
16
|
+
/** 画像の URL */
|
|
17
|
+
src: string;
|
|
18
|
+
/** 代替テキスト */
|
|
19
|
+
alt: string;
|
|
20
|
+
};
|
|
5
21
|
|
|
6
22
|
export interface ShowModalDialogOptions {
|
|
7
23
|
/** ダイアログの種類 */
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { h } from 'vue';
|
|
2
2
|
import type { AppContext, ClassValue, Component, StyleValue } from 'vue';
|
|
3
3
|
import OverlayBox from '@/overlay-box.vue';
|
|
4
|
-
import { mountWindow, useWindowOwner } from '@/internal/
|
|
5
|
-
import type { MovableWindowContentProps, MovableWindowDragMode, MovableWindowHandle } from '@/
|
|
4
|
+
import { mountWindow, useWindowOwner } from '@/internal/window-control';
|
|
5
|
+
import type { MovableWindowContentProps, MovableWindowDragMode, MovableWindowHandle } from '@/internal/window-control';
|
|
6
|
+
|
|
7
|
+
/** 開いている OverlayBox を開いた順に持つ。Esc では最後に開いたものだけを閉じる */
|
|
8
|
+
export const openedOverlayBoxes: symbol[] = [];
|
|
6
9
|
|
|
7
10
|
/** showOverlayBox が中身のコンポーネントに props として渡す関数 */
|
|
8
11
|
export type OverlayBoxContentProps = MovableWindowContentProps;
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import { h, render, shallowReactive } from 'vue';
|
|
2
2
|
import type { ClassValue, StyleValue } from 'vue';
|
|
3
3
|
import SnackbarContainer from '@/internal/snackbar-container.vue';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/** snackbar を表示する画面上の位置 */
|
|
6
|
+
export type SnackbarPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
7
|
+
|
|
8
|
+
/** 同じ表示領域に並べる向き。overlap は同じ位置に重ねて新しいものを前面に出し、column は縦に積み、row は横に並べて端で折り返す */
|
|
9
|
+
export type SnackbarDirection = 'overlap' | 'column' | 'row';
|
|
10
|
+
|
|
11
|
+
/** 表示領域に並べる snackbar 1件分の内容 */
|
|
12
|
+
export interface SnackbarItem {
|
|
13
|
+
id: number;
|
|
14
|
+
message: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
timestamp?: string;
|
|
18
|
+
clearable: boolean;
|
|
19
|
+
clearLabel: string;
|
|
20
|
+
class?: ClassValue;
|
|
21
|
+
style?: StyleValue;
|
|
22
|
+
}
|
|
5
23
|
|
|
6
24
|
/** snackbar が閉じた理由。click はクリック、duration は表示時間の経過、clear は一括消去ボタンと closeAllSnackbars()、handle は SnackbarHandle の close() */
|
|
7
25
|
export type SnackbarCloseReason = 'click' | 'duration' | 'clear' | 'handle';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
import type { Props } from '@/data-table.vue';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* DataTable のアプリ既定の設定。vueCoreOptionsKey の dataTable で渡す。
|
|
6
|
+
* props のうちデータと表示の状態を除いた項目を持ち、DataTable の props に同じ名前の指定があればそちらが優先される
|
|
7
|
+
*/
|
|
8
|
+
export type DataTableOptions = Partial<Omit<Props, 'dataList' | 'headers' | 'loading' | 'totalCount' | 'current' | 'limit'>>;
|
|
9
|
+
|
|
10
|
+
/** アプリ全体の設定 */
|
|
11
|
+
export type VueCoreOptions = {
|
|
12
|
+
/** DataTable のアプリ既定の設定 */
|
|
13
|
+
dataTable?: DataTableOptions;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* アプリ全体の設定を provide/inject するためのキー
|
|
18
|
+
* provide は任意。画面の上位または app.provide で使う
|
|
19
|
+
*/
|
|
20
|
+
export const vueCoreOptionsKey: InjectionKey<VueCoreOptions> = Symbol('dwui-vue-core-options');
|
package/src/index.ts
CHANGED
|
@@ -2,13 +2,14 @@ export * from '@/components';
|
|
|
2
2
|
export type { Props as AccordionFieldsetProps, Slots as AccordionFieldsetSlots } from '@/accordion-fieldset.vue';
|
|
3
3
|
export type { Props as AccordionSectionProps, Slots as AccordionSectionSlots } from '@/accordion-section.vue';
|
|
4
4
|
export type { Props as CopyButtonProps, Emits as CopyButtonEmits, Slots as CopyButtonSlots } from '@/copy-button.vue';
|
|
5
|
+
export type { Props as DataTableProps, Emits as DataTableEmits, Slots as DataTableSlots } from '@/data-table.vue';
|
|
5
6
|
export type { Props as DarkModeSelectorProps, Emits as DarkModeSelectorEmits, Slots as DarkModeSelectorSlots } from '@/dark-mode-selector.vue';
|
|
6
7
|
export type { Props as HelpButtonProps, Emits as HelpButtonEmits, Slots as HelpButtonSlots } from '@/help-button.vue';
|
|
7
8
|
export type { Props as HelpPopperProps, Emits as HelpPopperEmits, Slots as HelpPopperSlots } from '@/help-popper.vue';
|
|
8
9
|
export type { Props as HourglassLoadingProps } from '@/hourglass-loading.vue';
|
|
9
10
|
export type { Props as IntersectionLazyComponentProps, Emits as IntersectionLazyComponentEmits, Slots as IntersectionLazyComponentSlots } from '@/intersection-lazy-component.vue';
|
|
10
11
|
export type { Props as LabelButtonProps, Slots as LabelButtonSlots } from '@/label-button.vue';
|
|
11
|
-
export type { Props as LabelIconProps, Slots as LabelIconSlots } from '@/label-icon.vue';
|
|
12
|
+
export type { Props as LabelIconProps, Slots as LabelIconSlots, LabelPreset } from '@/label-icon.vue';
|
|
12
13
|
export type { Props as ModalDialogProps, Emits as ModalDialogEmits, Slots as ModalDialogSlots } from '@/modal-dialog.vue';
|
|
13
14
|
export type { Props as OverlayBoxProps, Emits as OverlayBoxEmits, Slots as OverlayBoxSlots } from '@/overlay-box.vue';
|
|
14
15
|
export type { Props as PageSectionProps, Slots as PageSectionSlots } from '@/page-section.vue';
|
|
@@ -17,21 +18,20 @@ export type { Props as ScreenLoadingProps } from '@/screen-loading.vue';
|
|
|
17
18
|
export type { Props as TabContentProps, Slots as TabContentSlots } from '@/tab-content.vue';
|
|
18
19
|
export type { Props as TabGroupProps, Slots as TabGroupSlots } from '@/tab-group.vue';
|
|
19
20
|
export type { Props as WarningPopperProps, Emits as WarningPopperEmits, Slots as WarningPopperSlots } from '@/warning-popper.vue';
|
|
20
|
-
export { headersToCsvColumns, rowToCsvColumns } from '@/helpers/data-table
|
|
21
|
-
export type { DataTableControlsPlacement, DataTableCsvColumn,
|
|
22
|
-
export { closeAllFloatingComponents, showFloatingComponent, showFloatingMessage, useFloatingComponent } from '@/helpers/
|
|
23
|
-
export type { FloatingComponentContentProps, FloatingComponentHandle, ShowFloatingComponentOptions, ShowFloatingMessageOptions } from '@/helpers/
|
|
24
|
-
export { showConfirmationDialog, showErrorDialog, showInformationDialog, showModalDialog, showWarningDialog } from '@/helpers/
|
|
25
|
-
export type { ShowModalDialogOptions } from '@/helpers/
|
|
26
|
-
export
|
|
27
|
-
export {
|
|
28
|
-
export
|
|
29
|
-
export {
|
|
30
|
-
export
|
|
31
|
-
export {
|
|
32
|
-
export type {
|
|
33
|
-
export type {
|
|
34
|
-
export
|
|
35
|
-
export type {
|
|
36
|
-
export type { TabContentStatus } from '@/internal/tab-group-context';
|
|
21
|
+
export { headersToCsvColumns, rowToCsvColumns } from '@/helpers/data-table';
|
|
22
|
+
export type { DataTableControlsPlacement, DataTableCsvColumn, DataTableHeader, DataTableLabels, DataTableResolvedLabels, DataTableSortContext, DataTableSortMode, DataTableValueType } from '@/helpers/data-table';
|
|
23
|
+
export { closeAllFloatingComponents, showFloatingComponent, showFloatingMessage, useFloatingComponent } from '@/helpers/floating-component';
|
|
24
|
+
export type { FloatingComponentContentProps, FloatingComponentHandle, ShowFloatingComponentOptions, ShowFloatingMessageOptions } from '@/helpers/floating-component';
|
|
25
|
+
export { showConfirmationDialog, showErrorDialog, showInformationDialog, showModalDialog, showWarningDialog } from '@/helpers/modal-dialog';
|
|
26
|
+
export type { ModalDialogButton, ModalDialogImage, ModalDialogResult, ModalDialogType, ShowModalDialogOptions } from '@/helpers/modal-dialog';
|
|
27
|
+
export { closeAllOverlayBoxes, showOverlayBox, useOverlayBox } from '@/helpers/overlay-box';
|
|
28
|
+
export type { OverlayBoxContentProps, OverlayBoxHandle, ShowOverlayBoxOptions } from '@/helpers/overlay-box';
|
|
29
|
+
export { showScreenLoading } from '@/helpers/screen-loading';
|
|
30
|
+
export type { ScreenLoadingHandle, ShowScreenLoadingOptions } from '@/helpers/screen-loading';
|
|
31
|
+
export { closeAllSnackbars, showSnackbar } from '@/helpers/snackbar';
|
|
32
|
+
export type { ShowSnackbarOptions, SnackbarCloseReason, SnackbarDirection, SnackbarHandle, SnackbarPlacement } from '@/helpers/snackbar';
|
|
33
|
+
export type { MovableWindowContentProps, MovableWindowDragMode, MovableWindowHandle } from '@/internal/window-control';
|
|
34
|
+
export type { TabContentStatus } from '@/internal/tab-group';
|
|
35
|
+
export { vueCoreOptionsKey } from '@/helpers/vue-core-options';
|
|
36
|
+
export type { DataTableOptions, VueCoreOptions } from '@/helpers/vue-core-options';
|
|
37
37
|
export type { PopoverPlacement } from '@/internal/anchored-position';
|
|
@@ -67,7 +67,7 @@ DataTable の上下に置くコントロール
|
|
|
67
67
|
import { computed } from 'vue';
|
|
68
68
|
import { SvgCloudDownload, SvgFolderDownload } from '@digitalwalletcorp/vue-svg-icons';
|
|
69
69
|
import Pagination from '@/internal/pagination.vue';
|
|
70
|
-
import type { DataTableResolvedLabels } from '@/
|
|
70
|
+
import type { DataTableResolvedLabels } from '@/helpers/data-table';
|
|
71
71
|
|
|
72
72
|
interface Props {
|
|
73
73
|
/** ページネーションを表示するか */
|
|
@@ -50,8 +50,8 @@ import type { ClassValue, StyleValue } from 'vue';
|
|
|
50
50
|
import CopyButton from '@/copy-button.vue';
|
|
51
51
|
import { computeAnchoredPosition } from '@/internal/anchored-position';
|
|
52
52
|
import MovableWindow from '@/internal/movable-window.vue';
|
|
53
|
-
import { nextWindowOrder } from '@/internal/window-
|
|
54
|
-
import type { MovableWindowDragMode } from '@/
|
|
53
|
+
import { nextWindowOrder } from '@/internal/window-control';
|
|
54
|
+
import type { MovableWindowDragMode } from '@/internal/window-control';
|
|
55
55
|
|
|
56
56
|
interface Props {
|
|
57
57
|
/** 表示するか */
|
|
@@ -80,7 +80,7 @@ import type { ClassValue, StyleValue } from 'vue';
|
|
|
80
80
|
import { SvgCornerDiagonal, SvgNegativeSquaredCrossMark } from '@digitalwalletcorp/vue-svg-icons';
|
|
81
81
|
import { useMovableWindow } from '@/internal/use-movable-window';
|
|
82
82
|
import type { MovableWindowCorner } from '@/internal/use-movable-window';
|
|
83
|
-
import type { MovableWindowDragMode } from '@/
|
|
83
|
+
import type { MovableWindowDragMode } from '@/internal/window-control';
|
|
84
84
|
|
|
85
85
|
interface Props {
|
|
86
86
|
/** 各部位のクラスの接頭辞。利用側のコンポーネントのクラス名(dwui-overlay-box など) */
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<script setup lang="ts">
|
|
146
146
|
import { computed, ref } from 'vue';
|
|
147
|
-
import type { DataTableResolvedLabels } from '@/
|
|
147
|
+
import type { DataTableResolvedLabels } from '@/helpers/data-table';
|
|
148
148
|
import { SvgBlackArrow, SvgChevron, SvgChevronDouble } from '@digitalwalletcorp/vue-svg-icons';
|
|
149
149
|
|
|
150
150
|
interface Props {
|
|
@@ -68,7 +68,7 @@ showSnackbar から body 直下に描画して使う。
|
|
|
68
68
|
<script setup lang="ts">
|
|
69
69
|
import { computed } from 'vue';
|
|
70
70
|
import { SvgWastebasket } from '@digitalwalletcorp/vue-svg-icons';
|
|
71
|
-
import type { SnackbarDirection, SnackbarItem, SnackbarPlacement } from '@/
|
|
71
|
+
import type { SnackbarDirection, SnackbarItem, SnackbarPlacement } from '@/helpers/snackbar';
|
|
72
72
|
|
|
73
73
|
interface Props {
|
|
74
74
|
/** 表示する位置 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onBeforeUnmount, reactive, ref } from 'vue';
|
|
2
2
|
import type { Ref } from 'vue';
|
|
3
|
-
import type { MovableWindowDragMode } from '@/
|
|
3
|
+
import type { MovableWindowDragMode } from '@/internal/window-control';
|
|
4
4
|
|
|
5
5
|
/** リサイズで掴んでいる角 */
|
|
6
6
|
export type MovableWindowCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import { defineComponent, getCurrentInstance, h, onBeforeUnmount, ref, render } from 'vue';
|
|
2
2
|
import type { AppContext, VNode } from 'vue';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/** ドラッグで移動するときに掴む範囲。body はウィンドウ全体、header は見出しだけ */
|
|
5
|
+
export type MovableWindowDragMode = 'body' | 'header';
|
|
6
|
+
|
|
7
|
+
/** showOverlayBox / showFloatingComponent が中身のコンポーネントに props として渡す関数 */
|
|
8
|
+
export interface MovableWindowContentProps {
|
|
9
|
+
/** ウィンドウを閉じる */
|
|
10
|
+
close: () => void;
|
|
11
|
+
/** ウィンドウのローディング表示を切り替える */
|
|
12
|
+
setLoading: (loading: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** showOverlayBox / showFloatingComponent が返す、表示中のウィンドウを操作するためのハンドル */
|
|
16
|
+
export interface MovableWindowHandle {
|
|
17
|
+
/** ウィンドウを閉じ、閉じ終わったら取り外す */
|
|
18
|
+
close: () => void;
|
|
19
|
+
/** ウィンドウのローディング表示を切り替える */
|
|
20
|
+
setLoading: (loading: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let lastOrder = 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ウィンドウ(OverlayBox / FloatingComponent)の重なり順を返す。後から呼んだものほど大きく、前面に出る
|
|
27
|
+
*
|
|
28
|
+
* @returns {number}
|
|
29
|
+
*/
|
|
30
|
+
export const nextWindowOrder = (): number => {
|
|
31
|
+
lastOrder += 1;
|
|
32
|
+
return lastOrder;
|
|
33
|
+
};
|
|
4
34
|
|
|
5
35
|
/** ウィンドウのコンポーネントに渡す、開閉とローディングの props とリスナー */
|
|
6
36
|
export interface WindowProps {
|
package/src/label-button.vue
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<script setup lang="ts">
|
|
35
35
|
import type { ClassValue, StyleValue } from 'vue';
|
|
36
36
|
import LabelIcon from '@/label-icon.vue';
|
|
37
|
-
import type { LabelPreset } from '@/
|
|
37
|
+
import type { LabelPreset } from '@/label-icon.vue';
|
|
38
38
|
|
|
39
39
|
export interface Props {
|
|
40
40
|
/** アイコンとラベルの組み合わせ */
|
package/src/label-icon.vue
CHANGED
|
@@ -28,8 +28,19 @@
|
|
|
28
28
|
</template>
|
|
29
29
|
|
|
30
30
|
<script setup lang="ts">
|
|
31
|
-
import type { ClassValue, StyleValue } from 'vue';
|
|
32
|
-
|
|
31
|
+
import type { ClassValue, Component, StyleValue } from 'vue';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* アイコンとラベルの組み合わせ
|
|
35
|
+
*/
|
|
36
|
+
export interface LabelPreset {
|
|
37
|
+
/** アイコンのコンポーネント */
|
|
38
|
+
icon: Component;
|
|
39
|
+
/** アイコンに渡すProps */
|
|
40
|
+
iconProps?: Record<string, unknown>;
|
|
41
|
+
/** ラベル。言語切替に追従させる場合は、描画のたびに呼ばれる関数で渡す */
|
|
42
|
+
label: string | (() => string);
|
|
43
|
+
}
|
|
33
44
|
|
|
34
45
|
export interface Props {
|
|
35
46
|
/** アイコンとラベルの組み合わせ */
|
package/src/modal-dialog.vue
CHANGED
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<script setup lang="ts">
|
|
85
85
|
import { computed, onMounted, ref, useId, watch } from 'vue';
|
|
86
86
|
import { SvgCritical, SvgInfo, SvgQuestion, SvgWarningSign } from '@digitalwalletcorp/vue-svg-icons';
|
|
87
|
-
import type { ModalDialogButton, ModalDialogImage, ModalDialogResult, ModalDialogType } from '@/
|
|
87
|
+
import type { ModalDialogButton, ModalDialogImage, ModalDialogResult, ModalDialogType } from '@/helpers/modal-dialog';
|
|
88
88
|
|
|
89
89
|
export interface Props {
|
|
90
90
|
/** ダイアログの種類 */
|
package/src/overlay-box.vue
CHANGED
|
@@ -45,9 +45,9 @@ FloatingComponent とは開いた順に重なり、後から開いたものが
|
|
|
45
45
|
<script setup lang="ts">
|
|
46
46
|
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
47
47
|
import MovableWindow from '@/internal/movable-window.vue';
|
|
48
|
-
import { openedOverlayBoxes } from '@/
|
|
49
|
-
import { nextWindowOrder } from '@/internal/window-
|
|
50
|
-
import type { MovableWindowDragMode } from '@/
|
|
48
|
+
import { openedOverlayBoxes } from '@/helpers/overlay-box';
|
|
49
|
+
import { nextWindowOrder } from '@/internal/window-control';
|
|
50
|
+
import type { MovableWindowDragMode } from '@/internal/window-control';
|
|
51
51
|
|
|
52
52
|
export interface Props {
|
|
53
53
|
/** 見出し。title スロットで差し替えられる */
|
package/src/tab-content.vue
CHANGED
|
@@ -36,8 +36,8 @@ TabGroupの中に置くタブ1つ分の中身
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
37
|
import { computed, inject, ref } from 'vue';
|
|
38
38
|
import type { ClassValue, Slot, StyleValue } from 'vue';
|
|
39
|
-
import { tabGroupContextKey } from '@/internal/tab-group
|
|
40
|
-
import type { TabContentStatus } from '@/internal/tab-group
|
|
39
|
+
import { tabGroupContextKey } from '@/internal/tab-group';
|
|
40
|
+
import type { TabContentStatus } from '@/internal/tab-group';
|
|
41
41
|
|
|
42
42
|
// tabId・label・header*・status・#iconは、TabGroupが見出しを描画するために読む
|
|
43
43
|
export interface Props {
|
package/src/tab-group.vue
CHANGED
|
@@ -61,8 +61,8 @@ import { computed, onMounted, provide, ref, useId } from 'vue';
|
|
|
61
61
|
import type { ClassValue, Slot, StyleValue, VNode } from 'vue';
|
|
62
62
|
import LabelIcon from '@/label-icon.vue';
|
|
63
63
|
import TabContent from '@/tab-content.vue';
|
|
64
|
-
import { tabGroupContextKey } from '@/internal/tab-group
|
|
65
|
-
import type { TabContentStatus } from '@/internal/tab-group
|
|
64
|
+
import { tabGroupContextKey } from '@/internal/tab-group';
|
|
65
|
+
import type { TabContentStatus } from '@/internal/tab-group';
|
|
66
66
|
|
|
67
67
|
export interface Props {
|
|
68
68
|
/** ラジオボタンのname。未指定なら自動で採番する */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./warning-popper.vue_vue_type_style_index_0_lang-CHmkjVCO.cjs"),_=Object.freeze(Object.defineProperty({__proto__:null,AccordionFieldset:n._sfc_main$5,AccordionSection:n._sfc_main$6,CopyButton:n._sfc_main$1,DarkModeSelector:n._sfc_main$7,DataTable:n._sfc_main$8,HelpButton:n._sfc_main$9,HelpPopper:n._sfc_main$10,HourglassLoading:n._sfc_main$11,IntersectionLazyComponent:n._sfc_main$12,LabelButton:n._sfc_main$13,LabelIcon:n._sfc_main$14,ModalDialog:n._sfc_main$2,OverlayBox:n._sfc_main$3,PageSection:n._sfc_main$15,PageTitle:n._sfc_main$16,ScreenLoading:n._sfc_main$4,TabContent:n._sfc_main$17,TabGroup:n._sfc_main$18,WarningPopper:n._sfc_main$19},Symbol.toStringTag,{value:"Module"}));exports.components=_;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DataTableHeader } from '../types/data-table.cjs';
|
|
2
|
-
/**
|
|
3
|
-
* ヘッダの csv の定義から CSV の列名を作る
|
|
4
|
-
*
|
|
5
|
-
* @param {DataTableHeader<T>[]} headers
|
|
6
|
-
* @returns {string[]} 列名
|
|
7
|
-
*/
|
|
8
|
-
export declare const headersToCsvColumns: <T>(headers: DataTableHeader<T>[]) => string[];
|
|
9
|
-
/**
|
|
10
|
-
* ヘッダの csv の定義に従って行から CSV の列の値を取り出す
|
|
11
|
-
*
|
|
12
|
-
* @param {DataTableHeader<T>[]} headers
|
|
13
|
-
* @param {T} row
|
|
14
|
-
* @param {number} [rowNumber] key が '$index' の列に出力する行番号
|
|
15
|
-
* @returns {unknown[]} 列の値。文字列化はしない
|
|
16
|
-
*/
|
|
17
|
-
export declare const rowToCsvColumns: <T>(headers: DataTableHeader<T>[], row: T, rowNumber?: number) => unknown[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DataTableHeader } from '../types/data-table';
|
|
2
|
-
/**
|
|
3
|
-
* ヘッダの csv の定義から CSV の列名を作る
|
|
4
|
-
*
|
|
5
|
-
* @param {DataTableHeader<T>[]} headers
|
|
6
|
-
* @returns {string[]} 列名
|
|
7
|
-
*/
|
|
8
|
-
export declare const headersToCsvColumns: <T>(headers: DataTableHeader<T>[]) => string[];
|
|
9
|
-
/**
|
|
10
|
-
* ヘッダの csv の定義に従って行から CSV の列の値を取り出す
|
|
11
|
-
*
|
|
12
|
-
* @param {DataTableHeader<T>[]} headers
|
|
13
|
-
* @param {T} row
|
|
14
|
-
* @param {number} [rowNumber] key が '$index' の列に出力する行番号
|
|
15
|
-
* @returns {unknown[]} 列の値。文字列化はしない
|
|
16
|
-
*/
|
|
17
|
-
export declare const rowToCsvColumns: <T>(headers: DataTableHeader<T>[], row: T, rowNumber?: number) => unknown[];
|