portal-design-system 0.0.911 → 0.0.912
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/DataGrid-Bt8cH87w.cjs +1 -0
- package/dist/DataGrid-p_11DFdf.js +230 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +125 -1
- package/dist/index.js +378 -602
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("devextreme/dist/css/dx.light.css");const o=require("devextreme-vue/data-grid"),F=require("./index.cjs"),P={class:"w-full relative"},z=e.defineComponent({__name:"DataGrid",props:{dataSource:{},columns:{},keyExpr:{default:"id"},hasActions:{type:Boolean},remoteOperations:{type:Boolean},enablePagination:{type:Boolean},enableFiltering:{type:Boolean},enableSearch:{type:Boolean},enableColumnFixing:{type:Boolean},enableColumnChooser:{type:Boolean},enableRowSelection:{type:Boolean},enableExport:{type:Boolean},pageSize:{default:15},exportFileName:{},backRoute:{},showBackButton:{type:Boolean},wordWrapEnabled:{type:Boolean},useFixedHeight:{type:Boolean,default:!1},hasCreate:{type:Boolean}},emits:["refresh","on-exporting","create"],setup(r,{expose:x,emit:g}){const w=g,C=[5,10,15,20,50],u=r,{dataSource:d,columns:c,keyExpr:B,remoteOperations:k=!1,enablePagination:i=!0,enableFiltering:f=!0,enableSearch:y=!0,enableColumnChooser:p=!0,enableExport:m=!0,pageSize:v=10,exportFileName:D="GridData"}=e.toRefs(u),N={caption:"Actions",dataType:"string",alignment:"center",sortable:!1,disableFilters:!0,fixed:!0,width:120,fixedPosition:"right",template:"actionsTemplate"},h=e.computed(()=>u.hasActions?[...c.value,N]:c.value),s=e.ref(null),b=()=>{var a,n;return(n=(a=s.value)==null?void 0:a.instance)==null?void 0:n.refresh()},S=()=>{var a,n,t;try{(t=(n=(a=s.value)==null?void 0:a.instance)==null?void 0:n.showColumnChooser)==null||t.call(n)}catch(l){console.warn("Column chooser API not available on the DataGrid instance",l)}},V=a=>{a.fileName=D,w("on-exporting",a)};return x({refresh:b}),(a,n)=>(e.openBlock(),e.createElementBlock("div",P,[e.unref(d)?(e.openBlock(),e.createBlock(e.unref(o.DxDataGrid),{key:0,class:e.normalizeClass(["datagrid-table",{"fixed-height":r.useFixedHeight}]),ref_key:"dataGrid",ref:s,"data-source":e.unref(d),"word-wrap-enabled":r.wordWrapEnabled,"hover-state-enabled":!0,"show-borders":!0,"allow-column-reordering":!0,"allow-column-resizing":!0,"column-hiding-enabled":!1,"show-column-lines":!0,"row-alternation-enabled":!0,"column-auto-width":!0,"remote-operations":e.unref(k),onExporting:V,"key-expr":e.unref(B)},e.createSlots({customRefreshButton:e.withCtx(()=>[e.renderSlot(a.$slots,"customRefreshButton",{refresh:b})]),exportButton:e.withCtx(()=>[e.renderSlot(a.$slots,"exportButton")]),createButton:e.withCtx(()=>[e.renderSlot(a.$slots,"createButton")]),toolbarLeft:e.withCtx(()=>[e.renderSlot(a.$slots,"toolbarLeft")]),customColumnChooser:e.withCtx(()=>[e.createVNode(F.Button,{variant:"outline",onClick:S,text:"Column Chooser",size:"40",class:"datagrid-column-chooser-button gap-2","icon-config":{size:20},icon:"Convertshape"})]),toolbarRight:e.withCtx(()=>[e.renderSlot(a.$slots,"toolbarRight")]),default:e.withCtx(()=>[e.createVNode(e.unref(o.DxPaging),{enabled:e.unref(i),"page-size":e.unref(v)},null,8,["enabled","page-size"]),e.createVNode(e.unref(o.DxPager),{visible:e.unref(i),"allowed-page-sizes":C,"display-mode":"compact","show-page-size-selector":!0,"show-info":"","show-navigation-buttons":""},null,8,["visible"]),e.createVNode(e.unref(o.DxSearchPanel),{class:"search",width:350,visible:e.unref(y),"highlight-case-sensitive":""},null,8,["visible"]),e.createVNode(e.unref(o.DxFilterRow),{visible:e.unref(f)},null,8,["visible"]),e.createVNode(e.unref(o.DxHeaderFilter),{visible:e.unref(f)},null,8,["visible"]),e.unref(i)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(o.DxScrolling),{key:0,mode:"virtual","use-native":!1})),e.createVNode(e.unref(o.DxColumnChooser),{enabled:e.unref(p),mode:"select"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.DxPosition),{my:"right top",at:"right bottom",of:".datagrid-column-chooser-button"})]),_:1},8,["enabled"]),e.createVNode(e.unref(o.DxExport),{enabled:e.unref(m),"allow-export-selected-data":!0},null,8,["enabled"]),e.createVNode(e.unref(o.DxColumnFixing),{enabled:!r.enableRowSelection&&r.enableColumnFixing},null,8,["enabled"]),e.createVNode(e.unref(o.DxSelection),{mode:"multiple"}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(t,l)=>(e.openBlock(),e.createBlock(e.unref(o.DxColumn),{key:l,"data-field":t.dataField,caption:t.caption,"data-type":t.dataType,alignment:t.alignment??"left","allow-sorting":t.sortable??!0,"allow-filtering":!t.disableFilters,"allow-header-filtering":!t.disableFilters,width:t.width,"cell-template":t.template,lookup:t.lookup,visible:t.visible??!0,"allow-hiding":t.allowHiding??!0,fixed:t.fixed,"fixed-position":t.fixedPosition},null,8,["data-field","caption","data-type","alignment","allow-sorting","allow-filtering","allow-header-filtering","width","cell-template","lookup","visible","allow-hiding","fixed","fixed-position"]))),128)),e.createVNode(e.unref(o.DxToolbar),null,{default:e.withCtx(()=>[e.createVNode(e.unref(o.DxItem),{location:"before",name:"searchPanel","locate-in-menu":"auto"}),e.createVNode(e.unref(o.DxItem),{location:"before",template:"toolbarLeft"}),e.createVNode(e.unref(o.DxItem),{location:"after",template:"toolbarRight","locate-in-menu":"auto"}),e.createVNode(e.unref(o.DxItem),{location:"after",template:"customRefreshButton"}),e.unref(m)?(e.openBlock(),e.createBlock(e.unref(o.DxItem),{key:0,name:"exportButton","locate-in-menu":"auto",template:"exportButton"})):e.createCommentVNode("",!0),r.hasCreate?(e.openBlock(),e.createBlock(e.unref(o.DxItem),{key:1,location:"before",template:"createButton"})):e.createCommentVNode("",!0),e.unref(p)?(e.openBlock(),e.createBlock(e.unref(o.DxItem),{key:2,location:"after",template:"customColumnChooser","locate-in-menu":"auto"})):e.createCommentVNode("",!0)]),_:1})]),_:2},[e.renderList(h.value.filter(t=>t.template),t=>({name:t.template,fn:e.withCtx(l=>[e.renderSlot(a.$slots,t.template,e.normalizeProps(e.guardReactiveProps(l)))])}))]),1032,["class","data-source","word-wrap-enabled","remote-operations","key-expr"])):e.createCommentVNode("",!0)]))}});exports.default=z;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { defineComponent as L, toRefs as T, computed as I, ref as O, createElementBlock as v, openBlock as i, createBlock as u, createCommentVNode as p, unref as e, normalizeClass as V, createSlots as W, withCtx as l, createVNode as o, Fragment as j, renderList as k, renderSlot as d, normalizeProps as q, guardReactiveProps as J } from "vue";
|
|
2
|
+
import "devextreme/dist/css/dx.light.css";
|
|
3
|
+
import { DxDataGrid as K, DxPaging as M, DxPager as Q, DxSearchPanel as U, DxFilterRow as X, DxHeaderFilter as Y, DxScrolling as Z, DxColumnChooser as _, DxPosition as ee, DxExport as te, DxColumnFixing as oe, DxSelection as ae, DxColumn as le, DxToolbar as ne, DxItem as r } from "devextreme-vue/data-grid";
|
|
4
|
+
import { Button as ie } from "./index.js";
|
|
5
|
+
const re = { class: "w-full relative" }, pe = /* @__PURE__ */ L({
|
|
6
|
+
__name: "DataGrid",
|
|
7
|
+
props: {
|
|
8
|
+
dataSource: {},
|
|
9
|
+
columns: {},
|
|
10
|
+
keyExpr: { default: "id" },
|
|
11
|
+
hasActions: { type: Boolean },
|
|
12
|
+
remoteOperations: { type: Boolean },
|
|
13
|
+
enablePagination: { type: Boolean },
|
|
14
|
+
enableFiltering: { type: Boolean },
|
|
15
|
+
enableSearch: { type: Boolean },
|
|
16
|
+
enableColumnFixing: { type: Boolean },
|
|
17
|
+
enableColumnChooser: { type: Boolean },
|
|
18
|
+
enableRowSelection: { type: Boolean },
|
|
19
|
+
enableExport: { type: Boolean },
|
|
20
|
+
pageSize: { default: 15 },
|
|
21
|
+
exportFileName: {},
|
|
22
|
+
backRoute: {},
|
|
23
|
+
showBackButton: { type: Boolean },
|
|
24
|
+
wordWrapEnabled: { type: Boolean },
|
|
25
|
+
useFixedHeight: { type: Boolean, default: !1 },
|
|
26
|
+
hasCreate: { type: Boolean }
|
|
27
|
+
},
|
|
28
|
+
emits: ["refresh", "on-exporting", "create"],
|
|
29
|
+
setup(s, { expose: D, emit: F }) {
|
|
30
|
+
const S = F, P = [5, 10, 15, 20, 50], h = s, {
|
|
31
|
+
dataSource: f,
|
|
32
|
+
columns: g,
|
|
33
|
+
keyExpr: z,
|
|
34
|
+
remoteOperations: R = !1,
|
|
35
|
+
enablePagination: m = !0,
|
|
36
|
+
enableFiltering: x = !0,
|
|
37
|
+
enableSearch: E = !0,
|
|
38
|
+
enableColumnChooser: w = !0,
|
|
39
|
+
enableExport: y = !0,
|
|
40
|
+
pageSize: $ = 10,
|
|
41
|
+
exportFileName: G = "GridData"
|
|
42
|
+
} = T(h), N = {
|
|
43
|
+
caption: "Actions",
|
|
44
|
+
dataType: "string",
|
|
45
|
+
alignment: "center",
|
|
46
|
+
sortable: !1,
|
|
47
|
+
disableFilters: !0,
|
|
48
|
+
fixed: !0,
|
|
49
|
+
width: 120,
|
|
50
|
+
fixedPosition: "right",
|
|
51
|
+
template: "actionsTemplate"
|
|
52
|
+
}, C = I(() => h.hasActions ? [...g.value, N] : g.value), b = O(null), B = () => {
|
|
53
|
+
var a, n;
|
|
54
|
+
return (n = (a = b.value) == null ? void 0 : a.instance) == null ? void 0 : n.refresh();
|
|
55
|
+
}, A = () => {
|
|
56
|
+
var a, n, t;
|
|
57
|
+
try {
|
|
58
|
+
(t = (n = (a = b.value) == null ? void 0 : a.instance) == null ? void 0 : n.showColumnChooser) == null || t.call(n);
|
|
59
|
+
} catch (c) {
|
|
60
|
+
console.warn("Column chooser API not available on the DataGrid instance", c);
|
|
61
|
+
}
|
|
62
|
+
}, H = (a) => {
|
|
63
|
+
a.fileName = G, S("on-exporting", a);
|
|
64
|
+
};
|
|
65
|
+
return D({ refresh: B }), (a, n) => (i(), v("div", re, [
|
|
66
|
+
e(f) ? (i(), u(e(K), {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: V(["datagrid-table", { "fixed-height": s.useFixedHeight }]),
|
|
69
|
+
ref_key: "dataGrid",
|
|
70
|
+
ref: b,
|
|
71
|
+
"data-source": e(f),
|
|
72
|
+
"word-wrap-enabled": s.wordWrapEnabled,
|
|
73
|
+
"hover-state-enabled": !0,
|
|
74
|
+
"show-borders": !0,
|
|
75
|
+
"allow-column-reordering": !0,
|
|
76
|
+
"allow-column-resizing": !0,
|
|
77
|
+
"column-hiding-enabled": !1,
|
|
78
|
+
"show-column-lines": !0,
|
|
79
|
+
"row-alternation-enabled": !0,
|
|
80
|
+
"column-auto-width": !0,
|
|
81
|
+
"remote-operations": e(R),
|
|
82
|
+
onExporting: H,
|
|
83
|
+
"key-expr": e(z)
|
|
84
|
+
}, W({
|
|
85
|
+
customRefreshButton: l(() => [
|
|
86
|
+
d(a.$slots, "customRefreshButton", { refresh: B })
|
|
87
|
+
]),
|
|
88
|
+
exportButton: l(() => [
|
|
89
|
+
d(a.$slots, "exportButton")
|
|
90
|
+
]),
|
|
91
|
+
createButton: l(() => [
|
|
92
|
+
d(a.$slots, "createButton")
|
|
93
|
+
]),
|
|
94
|
+
toolbarLeft: l(() => [
|
|
95
|
+
d(a.$slots, "toolbarLeft")
|
|
96
|
+
]),
|
|
97
|
+
customColumnChooser: l(() => [
|
|
98
|
+
o(ie, {
|
|
99
|
+
variant: "outline",
|
|
100
|
+
onClick: A,
|
|
101
|
+
text: "Column Chooser",
|
|
102
|
+
size: "40",
|
|
103
|
+
class: "datagrid-column-chooser-button gap-2",
|
|
104
|
+
"icon-config": { size: 20 },
|
|
105
|
+
icon: "Convertshape"
|
|
106
|
+
})
|
|
107
|
+
]),
|
|
108
|
+
toolbarRight: l(() => [
|
|
109
|
+
d(a.$slots, "toolbarRight")
|
|
110
|
+
]),
|
|
111
|
+
default: l(() => [
|
|
112
|
+
o(e(M), {
|
|
113
|
+
enabled: e(m),
|
|
114
|
+
"page-size": e($)
|
|
115
|
+
}, null, 8, ["enabled", "page-size"]),
|
|
116
|
+
o(e(Q), {
|
|
117
|
+
visible: e(m),
|
|
118
|
+
"allowed-page-sizes": P,
|
|
119
|
+
"display-mode": "compact",
|
|
120
|
+
"show-page-size-selector": !0,
|
|
121
|
+
"show-info": "",
|
|
122
|
+
"show-navigation-buttons": ""
|
|
123
|
+
}, null, 8, ["visible"]),
|
|
124
|
+
o(e(U), {
|
|
125
|
+
class: "search",
|
|
126
|
+
width: 350,
|
|
127
|
+
visible: e(E),
|
|
128
|
+
"highlight-case-sensitive": ""
|
|
129
|
+
}, null, 8, ["visible"]),
|
|
130
|
+
o(e(X), { visible: e(x) }, null, 8, ["visible"]),
|
|
131
|
+
o(e(Y), { visible: e(x) }, null, 8, ["visible"]),
|
|
132
|
+
e(m) ? p("", !0) : (i(), u(e(Z), {
|
|
133
|
+
key: 0,
|
|
134
|
+
mode: "virtual",
|
|
135
|
+
"use-native": !1
|
|
136
|
+
})),
|
|
137
|
+
o(e(_), {
|
|
138
|
+
enabled: e(w),
|
|
139
|
+
mode: "select"
|
|
140
|
+
}, {
|
|
141
|
+
default: l(() => [
|
|
142
|
+
o(e(ee), {
|
|
143
|
+
my: "right top",
|
|
144
|
+
at: "right bottom",
|
|
145
|
+
of: ".datagrid-column-chooser-button"
|
|
146
|
+
})
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
}, 8, ["enabled"]),
|
|
150
|
+
o(e(te), {
|
|
151
|
+
enabled: e(y),
|
|
152
|
+
"allow-export-selected-data": !0
|
|
153
|
+
}, null, 8, ["enabled"]),
|
|
154
|
+
o(e(oe), {
|
|
155
|
+
enabled: !s.enableRowSelection && s.enableColumnFixing
|
|
156
|
+
}, null, 8, ["enabled"]),
|
|
157
|
+
o(e(ae), { mode: "multiple" }),
|
|
158
|
+
(i(!0), v(j, null, k(C.value, (t, c) => (i(), u(e(le), {
|
|
159
|
+
key: c,
|
|
160
|
+
"data-field": t.dataField,
|
|
161
|
+
caption: t.caption,
|
|
162
|
+
"data-type": t.dataType,
|
|
163
|
+
alignment: t.alignment ?? "left",
|
|
164
|
+
"allow-sorting": t.sortable ?? !0,
|
|
165
|
+
"allow-filtering": !t.disableFilters,
|
|
166
|
+
"allow-header-filtering": !t.disableFilters,
|
|
167
|
+
width: t.width,
|
|
168
|
+
"cell-template": t.template,
|
|
169
|
+
lookup: t.lookup,
|
|
170
|
+
visible: t.visible ?? !0,
|
|
171
|
+
"allow-hiding": t.allowHiding ?? !0,
|
|
172
|
+
fixed: t.fixed,
|
|
173
|
+
"fixed-position": t.fixedPosition
|
|
174
|
+
}, null, 8, ["data-field", "caption", "data-type", "alignment", "allow-sorting", "allow-filtering", "allow-header-filtering", "width", "cell-template", "lookup", "visible", "allow-hiding", "fixed", "fixed-position"]))), 128)),
|
|
175
|
+
o(e(ne), null, {
|
|
176
|
+
default: l(() => [
|
|
177
|
+
o(e(r), {
|
|
178
|
+
location: "before",
|
|
179
|
+
name: "searchPanel",
|
|
180
|
+
"locate-in-menu": "auto"
|
|
181
|
+
}),
|
|
182
|
+
o(e(r), {
|
|
183
|
+
location: "before",
|
|
184
|
+
template: "toolbarLeft"
|
|
185
|
+
}),
|
|
186
|
+
o(e(r), {
|
|
187
|
+
location: "after",
|
|
188
|
+
template: "toolbarRight",
|
|
189
|
+
"locate-in-menu": "auto"
|
|
190
|
+
}),
|
|
191
|
+
o(e(r), {
|
|
192
|
+
location: "after",
|
|
193
|
+
template: "customRefreshButton"
|
|
194
|
+
}),
|
|
195
|
+
e(y) ? (i(), u(e(r), {
|
|
196
|
+
key: 0,
|
|
197
|
+
name: "exportButton",
|
|
198
|
+
"locate-in-menu": "auto",
|
|
199
|
+
template: "exportButton"
|
|
200
|
+
})) : p("", !0),
|
|
201
|
+
s.hasCreate ? (i(), u(e(r), {
|
|
202
|
+
key: 1,
|
|
203
|
+
location: "before",
|
|
204
|
+
template: "createButton"
|
|
205
|
+
})) : p("", !0),
|
|
206
|
+
e(w) ? (i(), u(e(r), {
|
|
207
|
+
key: 2,
|
|
208
|
+
location: "after",
|
|
209
|
+
template: "customColumnChooser",
|
|
210
|
+
"locate-in-menu": "auto"
|
|
211
|
+
})) : p("", !0)
|
|
212
|
+
]),
|
|
213
|
+
_: 1
|
|
214
|
+
})
|
|
215
|
+
]),
|
|
216
|
+
_: 2
|
|
217
|
+
}, [
|
|
218
|
+
k(C.value.filter((t) => t.template), (t) => ({
|
|
219
|
+
name: t.template,
|
|
220
|
+
fn: l((c) => [
|
|
221
|
+
d(a.$slots, t.template, q(J(c)))
|
|
222
|
+
])
|
|
223
|
+
}))
|
|
224
|
+
]), 1032, ["class", "data-source", "word-wrap-enabled", "remote-operations", "key-expr"])) : p("", !0)
|
|
225
|
+
]));
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
export {
|
|
229
|
+
pe as default
|
|
230
|
+
};
|