cosey 0.4.18 → 0.4.20
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/field/components/tree-select/tree-select.d.ts +1 -1
- package/components/table/table-column/renderer.d.ts +1 -1
- package/components/table/table-column/renderer.js +3 -3
- package/components/table/table.vue.js +2 -2
- package/hooks/useUpsert.d.ts +1 -1
- package/hooks/useUpsert.js +10 -8
- package/locale/lang/ar.d.ts +1 -0
- package/locale/lang/ar.js +3 -2
- package/locale/lang/en.d.ts +1 -0
- package/locale/lang/en.js +3 -2
- package/locale/lang/zh-cn.d.ts +1 -0
- package/locale/lang/zh-cn.js +3 -2
- package/package.json +1 -1
- package/utils/date.js +3 -0
- package/utils/vue.js +8 -2
|
@@ -34,7 +34,7 @@ export declare const elTreeProps: {
|
|
|
34
34
|
};
|
|
35
35
|
defaultCheckedKeys: ArrayConstructor;
|
|
36
36
|
defaultExpandedKeys: ArrayConstructor;
|
|
37
|
-
currentNodeKey: (
|
|
37
|
+
currentNodeKey: (NumberConstructor | StringConstructor)[];
|
|
38
38
|
renderContent: FunctionConstructor;
|
|
39
39
|
showCheckbox: {
|
|
40
40
|
type: BooleanConstructor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LinkProps, SwitchProps, type TableColumnCtx } from 'element-plus';
|
|
1
|
+
import { type LinkProps, type SwitchProps, type TableColumnCtx } from 'element-plus';
|
|
2
2
|
import { type TableColumnProps } from './table-column';
|
|
3
3
|
import { type LongTextProps } from '../../long-text';
|
|
4
4
|
import { type MediaCardProps } from '../../media-card';
|
|
@@ -5,7 +5,7 @@ import { LongText as _LongText } from '../../long-text/index.js';
|
|
|
5
5
|
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
|
-
import { Scope } from '../../../utils/vue.js';
|
|
8
|
+
import { Scope, getVNodeText } from '../../../utils/vue.js';
|
|
9
9
|
import { formatToDate, formatToDateTime } from '../../../utils/date.js';
|
|
10
10
|
import { toArray } from '../../../utils/array.js';
|
|
11
11
|
|
|
@@ -113,10 +113,10 @@ function renderer({
|
|
|
113
113
|
}
|
|
114
114
|
function exportRenderer(row, column, cellValue, index) {
|
|
115
115
|
if (column.formatter) {
|
|
116
|
-
return column.formatter(row, column, cellValue, index);
|
|
116
|
+
return getVNodeText(column.formatter(row, column, cellValue, index));
|
|
117
117
|
}
|
|
118
118
|
if (column.format) {
|
|
119
|
-
return column.format(cellValue, row, column, index);
|
|
119
|
+
return getVNodeText(column.format(cellValue, row, column, index));
|
|
120
120
|
}
|
|
121
121
|
if (isEmpty(cellValue)) {
|
|
122
122
|
return "";
|
|
@@ -17,12 +17,12 @@ import stdin_default$3 from './table-stats/table-stats.vue.js';
|
|
|
17
17
|
import { uniqid } from '../../utils/string.js';
|
|
18
18
|
import { useComponentConfig, useConfig } from '../config-provider/config-provider.js';
|
|
19
19
|
import { flatColumns } from '../../utils/excel/index.js';
|
|
20
|
-
import { getVNodeText, createMergedExpose } from '../../utils/vue.js';
|
|
21
20
|
import { useFetch } from '../../hooks/useFetch.js';
|
|
22
21
|
import { useFullPage } from '../../hooks/useFullPage.js';
|
|
23
22
|
import { useLocale } from '../../hooks/useLocale.js';
|
|
24
23
|
import { addPxUnit } from '../../utils/css.js';
|
|
25
24
|
import { isNullish, isObject, isFunction } from '../../utils/is.js';
|
|
25
|
+
import { getVNodeText, createMergedExpose } from '../../utils/vue.js';
|
|
26
26
|
import { useResizeObserver } from '../../hooks/useResizeObserver.js';
|
|
27
27
|
import { walkTree } from '../../utils/tree.js';
|
|
28
28
|
|
|
@@ -419,7 +419,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
419
419
|
_: 1
|
|
420
420
|
/* STABLE */
|
|
421
421
|
}, 8, ["content"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.export ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(_component_el_tooltip, {
|
|
422
|
-
content: unref(t)("co.table.
|
|
422
|
+
content: unref(t)("co.table.exportThisPage"),
|
|
423
423
|
placement: "top",
|
|
424
424
|
"show-after": 200,
|
|
425
425
|
"hide-after": 0
|
package/hooks/useUpsert.d.ts
CHANGED
|
@@ -52,6 +52,6 @@ export interface UseExternalUpsertReturn<Row extends Record<string, any>, Data>
|
|
|
52
52
|
edit: (...args: any[]) => void;
|
|
53
53
|
setData: (data: Data) => void;
|
|
54
54
|
expose: Readonly<ShallowRef<UseUpsertExpose<Row, Data> | null>>;
|
|
55
|
-
ref:
|
|
55
|
+
ref: (_expose: any) => void;
|
|
56
56
|
}
|
|
57
57
|
export declare function useOuterUpsert<Row extends Record<string, any>, Data>(options: UseExternalUpsertOptions): UseExternalUpsertReturn<Row, Data>;
|
package/hooks/useUpsert.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ElMessage } from 'element-plus';
|
|
2
2
|
import { cloneDeep, pick } from 'lodash-es';
|
|
3
|
-
import {
|
|
3
|
+
import { ref, computed, unref, reactive, useTemplateRef, shallowRef, readonly } from 'vue';
|
|
4
4
|
import { toRefs } from '@vueuse/core';
|
|
5
|
-
import { uuid } from '../utils/string.js';
|
|
6
5
|
import { useLocale } from './useLocale.js';
|
|
6
|
+
import { uuid } from '../utils/string.js';
|
|
7
7
|
import { deepAssign } from '../utils/object.js';
|
|
8
8
|
|
|
9
9
|
const mapTypeTitle = {
|
|
@@ -112,8 +112,13 @@ function useUpsert(options) {
|
|
|
112
112
|
return result;
|
|
113
113
|
}
|
|
114
114
|
function useOuterUpsert(options) {
|
|
115
|
-
const
|
|
116
|
-
const
|
|
115
|
+
const expose = ref(null);
|
|
116
|
+
const vnodeRef = (_expose) => {
|
|
117
|
+
expose.value = _expose;
|
|
118
|
+
if (_expose) {
|
|
119
|
+
_expose.setOptions(options);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
117
122
|
const add = (...args) => {
|
|
118
123
|
expose.value?.add(...args);
|
|
119
124
|
};
|
|
@@ -123,15 +128,12 @@ function useOuterUpsert(options) {
|
|
|
123
128
|
const setData = (data) => {
|
|
124
129
|
expose.value?.setData(data);
|
|
125
130
|
};
|
|
126
|
-
onMounted(() => {
|
|
127
|
-
expose.value?.setOptions(options);
|
|
128
|
-
});
|
|
129
131
|
const result = {
|
|
130
132
|
add,
|
|
131
133
|
edit,
|
|
132
134
|
setData,
|
|
133
135
|
expose,
|
|
134
|
-
ref:
|
|
136
|
+
ref: vnodeRef
|
|
135
137
|
};
|
|
136
138
|
return result;
|
|
137
139
|
}
|
package/locale/lang/ar.d.ts
CHANGED
package/locale/lang/ar.js
CHANGED
|
@@ -56,8 +56,9 @@ var stdin_default = {
|
|
|
56
56
|
video: "\u0641\u064A\u062F\u064A\u0648"
|
|
57
57
|
},
|
|
58
58
|
table: {
|
|
59
|
-
export: "\u0635\u062F\
|
|
60
|
-
|
|
59
|
+
export: "\u062A\u0635\u062F\u064A\u0631",
|
|
60
|
+
exportThisPage: "\u062A\u0635\u062F\u064A\u0631 \u0627\u0644\u0635\u0641\u062D\u0629 \u0627\u0644\u062D\u0627\u0644\u064A\u0629",
|
|
61
|
+
exportData: "\u062A\u0635\u062F\u064A\u0631 \u0627\u0644\u0628\u064A\u0627\u0646\u0627\u062A",
|
|
61
62
|
exitFullScreen: "\u0627\u0644\u062E\u0631\u0648\u062C \u0645\u0646 \u0648\u0636\u0639 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",
|
|
62
63
|
fullScreen: "\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",
|
|
63
64
|
columnSettings: "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0623\u0639\u0645\u062F\u0629",
|
package/locale/lang/en.d.ts
CHANGED
package/locale/lang/en.js
CHANGED
|
@@ -56,8 +56,9 @@ var stdin_default = {
|
|
|
56
56
|
video: "Video"
|
|
57
57
|
},
|
|
58
58
|
table: {
|
|
59
|
-
export: "Export
|
|
60
|
-
|
|
59
|
+
export: "Export",
|
|
60
|
+
exportThisPage: "Export current page",
|
|
61
|
+
exportData: "Export data",
|
|
61
62
|
exitFullScreen: "Exit full screen",
|
|
62
63
|
fullScreen: "Full screen",
|
|
63
64
|
columnSettings: "Column Settings",
|
package/locale/lang/zh-cn.d.ts
CHANGED
package/locale/lang/zh-cn.js
CHANGED
|
@@ -56,8 +56,9 @@ var stdin_default = {
|
|
|
56
56
|
video: "\u89C6\u9891"
|
|
57
57
|
},
|
|
58
58
|
table: {
|
|
59
|
-
export: "\u5BFC\u51FA
|
|
60
|
-
|
|
59
|
+
export: "\u5BFC\u51FA",
|
|
60
|
+
exportThisPage: "\u5BFC\u51FA\u5F53\u524D\u9875",
|
|
61
|
+
exportData: "\u5BFC\u51FA\u6570\u636E",
|
|
61
62
|
exitFullScreen: "\u9000\u51FA\u5168\u5C4F",
|
|
62
63
|
fullScreen: "\u5168\u5C4F",
|
|
63
64
|
columnSettings: "\u5217\u8BBE\u7F6E",
|
package/package.json
CHANGED
package/utils/date.js
CHANGED
|
@@ -6,6 +6,9 @@ const DATE_FORMAT = MONTH_FORMAT + "-DD";
|
|
|
6
6
|
const TIME_FORMAT = "HH:mm:ss";
|
|
7
7
|
const DATE_TIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT;
|
|
8
8
|
function getDayjs(date) {
|
|
9
|
+
if (typeof date === "string" && Number.isFinite(+date)) {
|
|
10
|
+
date = +date;
|
|
11
|
+
}
|
|
9
12
|
if (typeof date === "number" && String(date).length === 10) {
|
|
10
13
|
date = date * 1e3;
|
|
11
14
|
}
|
package/utils/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createVNode } from 'vue';
|
|
2
|
-
import { isObject } from './is.js';
|
|
2
|
+
import { isObject, isPlainObject, isFunction } from './is.js';
|
|
3
3
|
|
|
4
4
|
function defineTemplate(callback) {
|
|
5
5
|
return {
|
|
@@ -45,9 +45,15 @@ function getVNodeText(vnode) {
|
|
|
45
45
|
if (Array.isArray(vnode)) {
|
|
46
46
|
return vnode.map(getVNodeText).join("");
|
|
47
47
|
}
|
|
48
|
-
if (isObject(vnode)
|
|
48
|
+
if (isObject(vnode)) {
|
|
49
|
+
if (isPlainObject(vnode.children)) {
|
|
50
|
+
return Object.values(vnode.children).map((slot) => getVNodeText(slot)).join("");
|
|
51
|
+
}
|
|
49
52
|
return getVNodeText(vnode.children);
|
|
50
53
|
}
|
|
54
|
+
if (isFunction(vnode)) {
|
|
55
|
+
return getVNodeText(vnode());
|
|
56
|
+
}
|
|
51
57
|
return "";
|
|
52
58
|
}
|
|
53
59
|
|