rj-grid 0.2.4 → 0.2.6
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/dist/rj-grid.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { reactive, ref, watch, computed, defineComponent, h, inject, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, normalizeClass, createElementVNode, withModifiers, createTextVNode, toDisplayString, unref, createCommentVNode, createBlock, onMounted, nextTick, resolveDynamicComponent, withDirectives, withKeys, vModelText, vShow, mergeProps, toHandlers,
|
|
7
|
+
import { reactive, ref, watch, computed, defineComponent, h, inject, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, normalizeClass, createElementVNode, withModifiers, createTextVNode, toDisplayString, unref, createCommentVNode, createBlock, onMounted, nextTick, resolveDynamicComponent, withDirectives, withKeys, vModelText, vShow, mergeProps, toHandlers, vModelCheckbox, vModelSelect, vModelDynamic, resolveComponent, createVNode, onBeforeUnmount, useSlots, renderSlot, provide, isRef, createSlots, withCtx } from "vue";
|
|
8
8
|
function getValueByPath(obj, path) {
|
|
9
9
|
if (!path)
|
|
10
10
|
return void 0;
|
|
@@ -6109,14 +6109,16 @@ const RjSlotRender = defineComponent({
|
|
|
6109
6109
|
};
|
|
6110
6110
|
}
|
|
6111
6111
|
});
|
|
6112
|
-
defineComponent({
|
|
6112
|
+
const RjFnRender = defineComponent({
|
|
6113
6113
|
name: "RjFnRender",
|
|
6114
6114
|
props: {
|
|
6115
|
-
render: { type: Function,
|
|
6115
|
+
render: { type: Function, default: void 0 },
|
|
6116
6116
|
params: { type: Object, required: true }
|
|
6117
6117
|
},
|
|
6118
6118
|
setup(props) {
|
|
6119
6119
|
return () => {
|
|
6120
|
+
if (!props.render)
|
|
6121
|
+
return null;
|
|
6120
6122
|
const out = props.render(props.params);
|
|
6121
6123
|
if (out == null)
|
|
6122
6124
|
return null;
|
|
@@ -7035,32 +7037,16 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7035
7037
|
return typeof t2 === "function" ? t2(cellParams.value) : t2;
|
|
7036
7038
|
});
|
|
7037
7039
|
const slotName = computed(() => "cell-" + props.leaf.colId);
|
|
7038
|
-
|
|
7040
|
+
const cellSlot = computed(() => {
|
|
7039
7041
|
var _a;
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
vnode = slotFn(cellParams.value);
|
|
7044
|
-
else if (props.leaf.col.cellRenderer) {
|
|
7045
|
-
const out = props.leaf.col.cellRenderer(cellParams.value);
|
|
7046
|
-
vnode = typeof out === "string" || typeof out === "number" ? String(out) : out;
|
|
7047
|
-
}
|
|
7048
|
-
if (vnode == null)
|
|
7049
|
-
return null;
|
|
7050
|
-
const host = document.createElement("div");
|
|
7051
|
-
render(h("div", null, Array.isArray(vnode) ? vnode : [vnode]), host);
|
|
7052
|
-
const html = host.innerHTML;
|
|
7053
|
-
render(null, host);
|
|
7054
|
-
return html;
|
|
7055
|
-
}
|
|
7042
|
+
return ((_a = props.gridSlots) == null ? void 0 : _a[slotName.value]) ? slotName.value : "";
|
|
7043
|
+
});
|
|
7044
|
+
const cellRendererFn = computed(() => cellSlot.value ? void 0 : props.leaf.col.cellRenderer);
|
|
7056
7045
|
function esc(s) {
|
|
7057
7046
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
7058
7047
|
}
|
|
7059
7048
|
const richContent = computed(() => {
|
|
7060
7049
|
var _a;
|
|
7061
|
-
const custom = vnodeToHtml();
|
|
7062
|
-
if (custom != null)
|
|
7063
|
-
return custom;
|
|
7064
7050
|
const text = props.display ?? "";
|
|
7065
7051
|
if (text === "")
|
|
7066
7052
|
return "";
|
|
@@ -7085,12 +7071,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7085
7071
|
return html;
|
|
7086
7072
|
});
|
|
7087
7073
|
const imgUrls = computed(() => {
|
|
7088
|
-
var _a;
|
|
7089
7074
|
const c = props.leaf.col;
|
|
7090
7075
|
if (c.type !== "image")
|
|
7091
7076
|
return [];
|
|
7092
7077
|
const cfg = c.image || {};
|
|
7093
|
-
if (
|
|
7078
|
+
if (cellSlot.value || c.cellRenderer)
|
|
7094
7079
|
return [];
|
|
7095
7080
|
const raw = cfg.src ? cfg.src(cellParams.value) : props.value;
|
|
7096
7081
|
if (raw == null || raw === "")
|
|
@@ -7121,7 +7106,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7121
7106
|
emit("img-preview", url);
|
|
7122
7107
|
}
|
|
7123
7108
|
return (_ctx, _cache) => {
|
|
7124
|
-
var _a, _b, _c;
|
|
7109
|
+
var _a, _b, _c, _d, _e;
|
|
7125
7110
|
return openBlock(), createElementBlock("div", {
|
|
7126
7111
|
class: normalizeClass(["rj-cell", cellClass.value]),
|
|
7127
7112
|
style: normalizeStyle([baseStyle.value, dynStyle.value]),
|
|
@@ -7193,18 +7178,46 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
7193
7178
|
class: "rj-expand-icon",
|
|
7194
7179
|
onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.$emit("toggle-detail", _ctx.drow.key), ["stop"]))
|
|
7195
7180
|
}, toDisplayString(_ctx.detailOpen ? unref(icons).collapse : unref(icons).expand), 1)) : (openBlock(), createElementBlock("span", _hoisted_5$c)),
|
|
7196
|
-
imgUrls.value.length ? (openBlock(), createBlock(_sfc_main$g, mergeProps({ key: 3 }, imgBind.value, { onPreview: onImgPreview }), null, 16)) : (openBlock(), createElementBlock("span", {
|
|
7181
|
+
imgUrls.value.length ? (openBlock(), createBlock(_sfc_main$g, mergeProps({ key: 3 }, imgBind.value, { onPreview: onImgPreview }), null, 16)) : cellSlot.value || cellRendererFn.value ? (openBlock(), createElementBlock("span", {
|
|
7197
7182
|
key: 4,
|
|
7183
|
+
class: normalizeClass(["rj-cell-inner", { wrap: _ctx.leaf.col.wrapText }])
|
|
7184
|
+
}, [
|
|
7185
|
+
((_b = _ctx.gridSlots) == null ? void 0 : _b[cellSlot.value]) ? (openBlock(), createBlock(unref(RjSlotRender), {
|
|
7186
|
+
key: 0,
|
|
7187
|
+
slots: _ctx.gridSlots,
|
|
7188
|
+
name: cellSlot.value,
|
|
7189
|
+
params: cellParams.value
|
|
7190
|
+
}, null, 8, ["slots", "name", "params"])) : (openBlock(), createBlock(unref(RjFnRender), {
|
|
7191
|
+
key: 1,
|
|
7192
|
+
render: cellRendererFn.value,
|
|
7193
|
+
params: cellParams.value
|
|
7194
|
+
}, null, 8, ["render", "params"]))
|
|
7195
|
+
], 2)) : (openBlock(), createElementBlock("span", {
|
|
7196
|
+
key: 5,
|
|
7198
7197
|
class: normalizeClass(["rj-cell-inner", { wrap: _ctx.leaf.col.wrapText }]),
|
|
7199
7198
|
innerHTML: richContent.value
|
|
7200
7199
|
}, null, 10, _hoisted_6$c))
|
|
7201
|
-
], 64)) : imgUrls.value.length ? (openBlock(), createBlock(_sfc_main$g, mergeProps({ key: 5 }, imgBind.value, { onPreview: onImgPreview }), null, 16)) :
|
|
7200
|
+
], 64)) : imgUrls.value.length ? (openBlock(), createBlock(_sfc_main$g, mergeProps({ key: 5 }, imgBind.value, { onPreview: onImgPreview }), null, 16)) : cellSlot.value || cellRendererFn.value ? (openBlock(), createElementBlock("span", {
|
|
7202
7201
|
key: 6,
|
|
7202
|
+
class: normalizeClass(["rj-cell-inner", { wrap: _ctx.leaf.col.wrapText }])
|
|
7203
|
+
}, [
|
|
7204
|
+
((_c = _ctx.gridSlots) == null ? void 0 : _c[cellSlot.value]) ? (openBlock(), createBlock(unref(RjSlotRender), {
|
|
7205
|
+
key: 0,
|
|
7206
|
+
slots: _ctx.gridSlots,
|
|
7207
|
+
name: cellSlot.value,
|
|
7208
|
+
params: cellParams.value
|
|
7209
|
+
}, null, 8, ["slots", "name", "params"])) : (openBlock(), createBlock(unref(RjFnRender), {
|
|
7210
|
+
key: 1,
|
|
7211
|
+
render: cellRendererFn.value,
|
|
7212
|
+
params: cellParams.value
|
|
7213
|
+
}, null, 8, ["render", "params"]))
|
|
7214
|
+
], 2)) : sparkData.value ? (openBlock(), createBlock(_sfc_main$f, {
|
|
7215
|
+
key: 7,
|
|
7203
7216
|
data: sparkData.value,
|
|
7204
|
-
style: normalizeStyle(((
|
|
7205
|
-
color: (
|
|
7217
|
+
style: normalizeStyle(((_d = _ctx.leaf.col.sparkline) == null ? void 0 : _d.style) || "bar"),
|
|
7218
|
+
color: (_e = _ctx.leaf.col.sparkline) == null ? void 0 : _e.color
|
|
7206
7219
|
}, null, 8, ["data", "style", "color"])) : (openBlock(), createElementBlock("span", {
|
|
7207
|
-
key:
|
|
7220
|
+
key: 8,
|
|
7208
7221
|
class: normalizeClass(["rj-cell-inner", { wrap: _ctx.leaf.col.wrapText }]),
|
|
7209
7222
|
innerHTML: richContent.value
|
|
7210
7223
|
}, null, 10, _hoisted_7$b))
|
|
@@ -9131,7 +9144,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9131
9144
|
actions: {},
|
|
9132
9145
|
selectedRows: {}
|
|
9133
9146
|
},
|
|
9134
|
-
emits: ["update:modelValue", "search", "action-click"],
|
|
9147
|
+
emits: ["update:modelValue", "search", "reset", "action-click"],
|
|
9135
9148
|
setup(__props, { emit: __emit }) {
|
|
9136
9149
|
const props = __props;
|
|
9137
9150
|
const emit = __emit;
|
|
@@ -9214,8 +9227,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9214
9227
|
emitList(next);
|
|
9215
9228
|
}
|
|
9216
9229
|
function clearAll() {
|
|
9217
|
-
|
|
9218
|
-
emit("search");
|
|
9230
|
+
emit("reset");
|
|
9219
9231
|
}
|
|
9220
9232
|
function readVal(ev, numeric) {
|
|
9221
9233
|
const raw = ev.target.value;
|
|
@@ -10512,6 +10524,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10512
10524
|
emit("filter-change");
|
|
10513
10525
|
dispatchEvent("filterChanged", {});
|
|
10514
10526
|
}
|
|
10527
|
+
function onQueryReset() {
|
|
10528
|
+
const cur = savedViews.views.value.find((v) => v.id === currentViewId.value);
|
|
10529
|
+
queryConditions.value = cur ? cloneConditions(cur.conditions || []) : [];
|
|
10530
|
+
onQuerySearch();
|
|
10531
|
+
}
|
|
10515
10532
|
function applyView(v, viewId) {
|
|
10516
10533
|
var _a2;
|
|
10517
10534
|
const view = "conditions" in v ? v : null;
|
|
@@ -13870,6 +13887,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13870
13887
|
actions: _ctx.queryActions,
|
|
13871
13888
|
"selected-rows": selectedRows(),
|
|
13872
13889
|
onSearch: onQuerySearch,
|
|
13890
|
+
onReset: onQueryReset,
|
|
13873
13891
|
onActionClick: runQueryAction
|
|
13874
13892
|
}, createSlots({ _: 2 }, [
|
|
13875
13893
|
_ctx.$slots["query-actions"] ? {
|
|
@@ -9,6 +9,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
9
9
|
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
10
|
"update:modelValue": (v: RjQueryCondition[]) => void;
|
|
11
11
|
search: () => void;
|
|
12
|
+
reset: () => void;
|
|
12
13
|
"action-click": (a: RjQueryAction) => void;
|
|
13
14
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
14
15
|
fields: RjQueryFieldDef[];
|
|
@@ -19,6 +20,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
|
|
|
19
20
|
selectedRows?: RjRowData[] | undefined;
|
|
20
21
|
}>>> & Readonly<{
|
|
21
22
|
onSearch?: (() => any) | undefined;
|
|
23
|
+
onReset?: (() => any) | undefined;
|
|
22
24
|
"onUpdate:modelValue"?: ((v: RjQueryCondition[]) => any) | undefined;
|
|
23
25
|
"onAction-click"?: ((a: RjQueryAction) => any) | undefined;
|
|
24
26
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<{
|
|
@@ -38,7 +38,7 @@ export default _default;
|
|
|
38
38
|
export declare const RjFnRender: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
39
39
|
render: {
|
|
40
40
|
type: PropType<(p: any) => any>;
|
|
41
|
-
|
|
41
|
+
default: undefined;
|
|
42
42
|
};
|
|
43
43
|
params: {
|
|
44
44
|
type: PropType<any>;
|
|
@@ -47,10 +47,12 @@ export declare const RjFnRender: import("vue").DefineComponent<import("vue").Ext
|
|
|
47
47
|
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
48
|
render: {
|
|
49
49
|
type: PropType<(p: any) => any>;
|
|
50
|
-
|
|
50
|
+
default: undefined;
|
|
51
51
|
};
|
|
52
52
|
params: {
|
|
53
53
|
type: PropType<any>;
|
|
54
54
|
required: true;
|
|
55
55
|
};
|
|
56
|
-
}>> & Readonly<{}>, {
|
|
56
|
+
}>> & Readonly<{}>, {
|
|
57
|
+
render: (p: any) => any;
|
|
58
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|