cosey 0.4.5 → 0.4.7
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/components/table/table-column/renderer.js +5 -5
- package/package.json +1 -1
- package/utils/date.d.ts +2 -2
- package/utils/date.js +3 -3
- package/utils/index.js +1 -1
- package/utils/message-box.js +7 -0
|
@@ -6,7 +6,7 @@ import { MediaCard as _MediaCard } from '../../media-card/index.js';
|
|
|
6
6
|
import { MediaCardGroup as _MediaCardGroup } from '../../media-card-group/index.js';
|
|
7
7
|
import { isEmpty, isString } from '../../../utils/is.js';
|
|
8
8
|
import { Scope } from '../../../utils/vue.js';
|
|
9
|
-
import {
|
|
9
|
+
import { formatToDate, formatToDateTime } from '../../../utils/date.js';
|
|
10
10
|
import { toArray } from '../../../utils/array.js';
|
|
11
11
|
|
|
12
12
|
function _isSlot(s) {
|
|
@@ -41,9 +41,9 @@ function renderer({
|
|
|
41
41
|
case "text":
|
|
42
42
|
return cellValue;
|
|
43
43
|
case "datetime":
|
|
44
|
-
return
|
|
44
|
+
return formatToDateTime(cellValue);
|
|
45
45
|
case "date":
|
|
46
|
-
return
|
|
46
|
+
return formatToDate(cellValue);
|
|
47
47
|
case "media":
|
|
48
48
|
return cellValue ? createVNode(_MediaCard, mergeProps({
|
|
49
49
|
"src": cellValue
|
|
@@ -135,9 +135,9 @@ function exportRenderer(row, column, cellValue, index) {
|
|
|
135
135
|
case "mediagroup":
|
|
136
136
|
return JSON.stringify(cellValue);
|
|
137
137
|
case "datetime":
|
|
138
|
-
return
|
|
138
|
+
return formatToDateTime(cellValue);
|
|
139
139
|
case "date":
|
|
140
|
-
return
|
|
140
|
+
return formatToDate(cellValue);
|
|
141
141
|
case "tag":
|
|
142
142
|
{
|
|
143
143
|
const value = isEmpty(cellValue) ? [] : toArray(cellValue);
|
package/package.json
CHANGED
package/utils/date.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export declare function getDayjs(date?: Parameters<typeof dayjs>[0]): dayjs.Dayj
|
|
|
11
11
|
/**
|
|
12
12
|
* 格式化为“年月日 时分秒”
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function formatToDateTime(date?: Parameters<typeof dayjs>[0]): string;
|
|
15
15
|
/**
|
|
16
16
|
* 格式化为“年月日”
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function formatToDate(date?: Parameters<typeof dayjs>[0]): string;
|
|
19
19
|
/**
|
|
20
20
|
* 格式化为基础格式的日期+时间,即未添加分隔符的格式
|
|
21
21
|
*/
|
package/utils/date.js
CHANGED
|
@@ -11,14 +11,14 @@ function getDayjs(date) {
|
|
|
11
11
|
}
|
|
12
12
|
return dayjs(date);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function formatToDateTime(date) {
|
|
15
15
|
return getDayjs(date).format(DATE_TIME_FORMAT);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function formatToDate(date) {
|
|
18
18
|
return getDayjs(date).format(DATE_FORMAT);
|
|
19
19
|
}
|
|
20
20
|
function formatAsBasicDateTime(date) {
|
|
21
21
|
return getDayjs(date).format("YYYYMMDDHHmmss");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export { DATE_FORMAT, DATE_TIME_FORMAT, MONTH_FORMAT, TIME_FORMAT, YEAR_FORMAT, formatAsBasicDateTime,
|
|
24
|
+
export { DATE_FORMAT, DATE_TIME_FORMAT, MONTH_FORMAT, TIME_FORMAT, YEAR_FORMAT, formatAsBasicDateTime, formatToDate, formatToDateTime, getDayjs };
|
package/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { getCssVarProp } from './bem.js';
|
|
|
3
3
|
export { getControlKey } from './browser.js';
|
|
4
4
|
export { getLabelByValue, getTreeLabelByValue } from './collection.js';
|
|
5
5
|
export { addPxUnit, cssObjectToString, getContextBoxWidth, getDir, getStyle, setStyle } from './css.js';
|
|
6
|
-
export { DATE_FORMAT, DATE_TIME_FORMAT, MONTH_FORMAT, TIME_FORMAT, YEAR_FORMAT, formatAsBasicDateTime,
|
|
6
|
+
export { DATE_FORMAT, DATE_TIME_FORMAT, MONTH_FORMAT, TIME_FORMAT, YEAR_FORMAT, formatAsBasicDateTime, formatToDate, formatToDateTime, getDayjs } from './date.js';
|
|
7
7
|
export { exportExcel, flatColumns } from './excel/index.js';
|
|
8
8
|
export { chooseFiles, downloadAttachment, getFileType, readAsArrayBuffer, readAsDataURL } from './file.js';
|
|
9
9
|
export { isBoolean, isEmpty, isFunction, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isString, isUndefined } from './is.js';
|
package/utils/message-box.js
CHANGED
|
@@ -11,6 +11,13 @@ function warningConfirm(message, options) {
|
|
|
11
11
|
type: "warning",
|
|
12
12
|
message,
|
|
13
13
|
showCancelButton: true,
|
|
14
|
+
customStyle: {
|
|
15
|
+
position: "absolute",
|
|
16
|
+
left: "50%",
|
|
17
|
+
top: "30vh",
|
|
18
|
+
transform: "translateX(-50%)",
|
|
19
|
+
...options?.customStyle
|
|
20
|
+
},
|
|
14
21
|
async beforeClose(action, instance, done) {
|
|
15
22
|
if (action === "confirm") {
|
|
16
23
|
instance.confirmButtonLoading = true;
|