@gsc-basic/components 1.0.1 → 1.0.2

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.
Files changed (108) hide show
  1. package/README.md +59 -0
  2. package/dist/es/index.js +34 -30
  3. package/dist/es/node_modules/@codemirror/commands/dist/index.js +26 -20
  4. package/dist/es/node_modules/@codemirror/language/dist/index.js +77 -77
  5. package/dist/es/node_modules/@codemirror/search/dist/index.js +432 -465
  6. package/dist/es/node_modules/@codemirror/state/dist/index.js +272 -268
  7. package/dist/es/node_modules/@codemirror/view/dist/index.js +1732 -1647
  8. package/dist/es/node_modules/@lezer/common/dist/index.js +191 -190
  9. package/dist/es/node_modules/@lezer/lr/dist/index.js +3 -3
  10. package/dist/es/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js +178 -0
  11. package/dist/es/node_modules/@tanstack/form-core/dist/esm/EventClient.js +13 -0
  12. package/dist/es/node_modules/@tanstack/form-core/dist/esm/FieldApi.js +406 -0
  13. package/dist/es/node_modules/@tanstack/form-core/dist/esm/FormApi.js +768 -0
  14. package/dist/es/node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js +55 -0
  15. package/dist/es/node_modules/@tanstack/form-core/dist/esm/metaHelper.js +109 -0
  16. package/dist/es/node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js +45 -0
  17. package/dist/es/node_modules/@tanstack/form-core/dist/esm/utils.js +213 -0
  18. package/dist/es/node_modules/@tanstack/pacer-lite/dist/lite-throttler.js +29 -0
  19. package/dist/es/node_modules/@tanstack/store/dist/esm/derived.js +74 -0
  20. package/dist/es/node_modules/@tanstack/store/dist/esm/scheduler.js +79 -0
  21. package/dist/es/node_modules/@tanstack/store/dist/esm/store.js +21 -0
  22. package/dist/es/node_modules/@tanstack/store/dist/esm/types.js +6 -0
  23. package/dist/es/node_modules/@tanstack/table-core/build/lib/index.js +1885 -0
  24. package/dist/es/node_modules/@tanstack/vue-form/dist/esm/useField.js +38 -0
  25. package/dist/es/node_modules/@tanstack/vue-form/dist/esm/useForm.js +33 -0
  26. package/dist/es/node_modules/@tanstack/vue-store/dist/esm/index.js +48 -0
  27. package/dist/es/node_modules/@tanstack/vue-table/build/lib/index.js +159 -0
  28. package/dist/es/src/Grid/index.js +6 -0
  29. package/dist/es/src/Grid/src/Grid.css +1 -0
  30. package/dist/es/src/Grid/src/Grid.vue.js +186 -0
  31. package/dist/es/src/Grid/src/components/ActionBar.css +1 -0
  32. package/dist/es/src/Grid/src/components/ActionBar.vue.js +58 -0
  33. package/dist/es/src/Grid/src/components/CellEditor.css +1 -0
  34. package/dist/es/src/Grid/src/components/CellEditor.vue.js +121 -0
  35. package/dist/es/src/Grid/src/components/CellEditor2.css +1 -0
  36. package/dist/es/src/Grid/src/components/ColumnFilter.css +1 -0
  37. package/dist/es/src/Grid/src/components/ColumnFilter.vue.js +61 -0
  38. package/dist/es/src/Grid/src/components/ColumnSettings.css +1 -0
  39. package/dist/es/src/Grid/src/components/ColumnSettings.vue.js +86 -0
  40. package/dist/es/src/Grid/src/components/DataTable.css +1 -0
  41. package/dist/es/src/Grid/src/components/DataTable.vue.js +533 -0
  42. package/dist/es/src/Grid/src/components/Pager.css +1 -0
  43. package/dist/es/src/Grid/src/components/Pager.vue.js +55 -0
  44. package/dist/es/src/Grid/src/components/QueryBar.css +1 -0
  45. package/dist/es/src/Grid/src/components/QueryBar.vue.js +184 -0
  46. package/dist/es/src/Grid/src/composables/useCellEditor.js +20 -0
  47. package/dist/es/src/Grid/src/composables/useGridTable.js +212 -0
  48. package/dist/es/src/Grid/src/styles/antd.css +1 -0
  49. package/dist/es/src/Grid/src/utils/exportCsv.js +15 -0
  50. package/dist/es/src/index.js +23 -21
  51. package/dist/es/src/locale/lang/en-US.js +40 -0
  52. package/dist/es/src/locale/lang/ja-JP.js +42 -2
  53. package/dist/es/src/locale/lang/zh-CN.js +42 -2
  54. package/dist/es/src/styles/tokens.css +1 -1
  55. package/dist/lib/index.js +1 -1
  56. package/dist/lib/node_modules/@codemirror/commands/dist/index.js +1 -1
  57. package/dist/lib/node_modules/@codemirror/language/dist/index.js +1 -1
  58. package/dist/lib/node_modules/@codemirror/search/dist/index.js +2 -2
  59. package/dist/lib/node_modules/@codemirror/state/dist/index.js +4 -4
  60. package/dist/lib/node_modules/@codemirror/view/dist/index.js +5 -5
  61. package/dist/lib/node_modules/@lezer/common/dist/index.js +1 -1
  62. package/dist/lib/node_modules/@lezer/lr/dist/index.js +1 -1
  63. package/dist/lib/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js +1 -0
  64. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/EventClient.js +1 -0
  65. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/FieldApi.js +1 -0
  66. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/FormApi.js +1 -0
  67. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js +1 -0
  68. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/metaHelper.js +1 -0
  69. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js +1 -0
  70. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/utils.js +1 -0
  71. package/dist/lib/node_modules/@tanstack/pacer-lite/dist/lite-throttler.js +1 -0
  72. package/dist/lib/node_modules/@tanstack/store/dist/esm/derived.js +1 -0
  73. package/dist/lib/node_modules/@tanstack/store/dist/esm/scheduler.js +1 -0
  74. package/dist/lib/node_modules/@tanstack/store/dist/esm/store.js +1 -0
  75. package/dist/lib/node_modules/@tanstack/store/dist/esm/types.js +1 -0
  76. package/dist/lib/node_modules/@tanstack/table-core/build/lib/index.js +4 -0
  77. package/dist/lib/node_modules/@tanstack/vue-form/dist/esm/useField.js +1 -0
  78. package/dist/lib/node_modules/@tanstack/vue-form/dist/esm/useForm.js +1 -0
  79. package/dist/lib/node_modules/@tanstack/vue-store/dist/esm/index.js +1 -0
  80. package/dist/lib/node_modules/@tanstack/vue-table/build/lib/index.js +1 -0
  81. package/dist/lib/src/Grid/index.js +1 -0
  82. package/dist/lib/src/Grid/src/Grid.css +1 -0
  83. package/dist/lib/src/Grid/src/Grid.vue.js +1 -0
  84. package/dist/lib/src/Grid/src/components/ActionBar.css +1 -0
  85. package/dist/lib/src/Grid/src/components/ActionBar.vue.js +1 -0
  86. package/dist/lib/src/Grid/src/components/CellEditor.css +1 -0
  87. package/dist/lib/src/Grid/src/components/CellEditor.vue.js +1 -0
  88. package/dist/lib/src/Grid/src/components/CellEditor2.css +1 -0
  89. package/dist/lib/src/Grid/src/components/ColumnFilter.css +1 -0
  90. package/dist/lib/src/Grid/src/components/ColumnFilter.vue.js +1 -0
  91. package/dist/lib/src/Grid/src/components/ColumnSettings.css +1 -0
  92. package/dist/lib/src/Grid/src/components/ColumnSettings.vue.js +1 -0
  93. package/dist/lib/src/Grid/src/components/DataTable.css +1 -0
  94. package/dist/lib/src/Grid/src/components/DataTable.vue.js +1 -0
  95. package/dist/lib/src/Grid/src/components/Pager.css +1 -0
  96. package/dist/lib/src/Grid/src/components/Pager.vue.js +1 -0
  97. package/dist/lib/src/Grid/src/components/QueryBar.css +1 -0
  98. package/dist/lib/src/Grid/src/components/QueryBar.vue.js +1 -0
  99. package/dist/lib/src/Grid/src/composables/useCellEditor.js +1 -0
  100. package/dist/lib/src/Grid/src/composables/useGridTable.js +1 -0
  101. package/dist/lib/src/Grid/src/styles/antd.css +1 -0
  102. package/dist/lib/src/Grid/src/utils/exportCsv.js +3 -0
  103. package/dist/lib/src/index.js +1 -1
  104. package/dist/lib/src/locale/lang/en-US.js +1 -1
  105. package/dist/lib/src/locale/lang/ja-JP.js +1 -1
  106. package/dist/lib/src/locale/lang/zh-CN.js +1 -1
  107. package/dist/lib/src/styles/tokens.css +1 -1
  108. package/package.json +6 -3
@@ -0,0 +1,38 @@
1
+ import { FieldApi as a } from "../../../form-core/dist/esm/FieldApi.js";
2
+ import { useStore as d } from "../../../vue-store/dist/esm/index.js";
3
+ import { defineComponent as m, onMounted as f, onUnmounted as l, watch as u } from "vue";
4
+ function s(e) {
5
+ const t = (() => {
6
+ const r = new a({
7
+ ...e,
8
+ form: e.form,
9
+ name: e.name
10
+ });
11
+ return r.Field = p, r;
12
+ })(), n = d(t.store, (o) => o);
13
+ let i;
14
+ return f(() => {
15
+ i = t.mount();
16
+ }), l(() => {
17
+ i();
18
+ }), u(
19
+ () => e,
20
+ () => {
21
+ t.update({ ...e, form: e.form });
22
+ }
23
+ ), { api: t, state: n };
24
+ }
25
+ const p = m(
26
+ (e, t) => {
27
+ const n = s({ ...e, ...t.attrs });
28
+ return () => t.slots.default({
29
+ field: n.api,
30
+ state: n.state.value
31
+ });
32
+ },
33
+ { name: "Field", inheritAttrs: !1 }
34
+ );
35
+ export {
36
+ p as Field,
37
+ s as useField
38
+ };
@@ -0,0 +1,33 @@
1
+ import { FormApi as d } from "../../../form-core/dist/esm/FormApi.js";
2
+ import { useStore as i } from "../../../vue-store/dist/esm/index.js";
3
+ import { defineComponent as l, h as f, onMounted as p } from "vue";
4
+ import { Field as c, useField as F } from "./useField.js";
5
+ function v(n) {
6
+ const s = (() => {
7
+ const t = new d(n), o = t;
8
+ return o.Field = l(
9
+ (e, r) => () => f(
10
+ c,
11
+ { ...e, ...r.attrs, form: t },
12
+ r.slots
13
+ ),
14
+ {
15
+ name: "APIField",
16
+ inheritAttrs: !1
17
+ }
18
+ ), o.useField = (e) => F({ ...e, form: t }), o.useStore = (e) => i(t.store, e), o.Subscribe = l(
19
+ (e, r) => {
20
+ const u = { ...e, ...r.attrs }.selector ?? ((a) => a), m = i(t.store, u);
21
+ return () => r.slots.default(m.value);
22
+ },
23
+ {
24
+ name: "Subscribe",
25
+ inheritAttrs: !1
26
+ }
27
+ ), o;
28
+ })();
29
+ return p(s.mount), s.update(n), s;
30
+ }
31
+ export {
32
+ v as useForm
33
+ };
@@ -0,0 +1,48 @@
1
+ import { ref as u, watch as c, toRaw as l, readonly as p } from "vue";
2
+ function O(t, e = (n) => n) {
3
+ const n = u(e(t.state));
4
+ return c(
5
+ () => t,
6
+ (r, s, i) => {
7
+ const a = r.subscribe(() => {
8
+ const f = e(r.state);
9
+ h(l(n.value), f) || (n.value = f);
10
+ });
11
+ i(() => {
12
+ a();
13
+ });
14
+ },
15
+ { immediate: !0 }
16
+ ), p(n);
17
+ }
18
+ function h(t, e) {
19
+ if (Object.is(t, e))
20
+ return !0;
21
+ if (typeof t != "object" || t === null || typeof e != "object" || e === null)
22
+ return !1;
23
+ if (t instanceof Map && e instanceof Map) {
24
+ if (t.size !== e.size) return !1;
25
+ for (const [r, s] of t)
26
+ if (!e.has(r) || !Object.is(s, e.get(r))) return !1;
27
+ return !0;
28
+ }
29
+ if (t instanceof Set && e instanceof Set) {
30
+ if (t.size !== e.size) return !1;
31
+ for (const r of t)
32
+ if (!e.has(r)) return !1;
33
+ return !0;
34
+ }
35
+ if (t instanceof Date && e instanceof Date)
36
+ return t.getTime() === e.getTime();
37
+ const n = Object.keys(t);
38
+ if (n.length !== Object.keys(e).length)
39
+ return !1;
40
+ for (let r = 0; r < n.length; r++)
41
+ if (!Object.prototype.hasOwnProperty.call(e, n[r]) || !Object.is(t[n[r]], e[n[r]]))
42
+ return !1;
43
+ return !0;
44
+ }
45
+ export {
46
+ h as shallow,
47
+ O as useStore
48
+ };
@@ -0,0 +1,159 @@
1
+ import { createTable as m } from "../../../table-core/build/lib/index.js";
2
+ import { ColumnFaceting as G, ColumnFiltering as T, ColumnGrouping as k, ColumnOrdering as j, ColumnPinning as z, ColumnSizing as D, ColumnVisibility as H, GlobalFaceting as I, GlobalFiltering as N, Headers as U, RowExpanding as $, RowPagination as B, RowPinning as K, RowSelection as L, RowSorting as O, _getVisibleLeafColumns as W, aggregationFns as X, buildHeaderGroups as Y, createCell as q, createColumn as J, createRow as Q, defaultColumnSizing as Z, expandRows as _, filterFns as ee, flattenBy as te, functionalUpdate as ne, getCoreRowModel as re, getFilteredRowModel as oe, getMemoOptions as ae, getPaginationRowModel as le, getSortedRowModel as ue, isFunction as ie, isNumberArray as ge, isRowSelected as se, isSubRowSelected as fe, makeStateUpdater as ce, memo as de, orderColumns as me, passiveEventSupported as we, reSplitAlphaNumeric as Re, selectRowsFn as Se, shouldAutoRemoveFilter as he, sortingFns as Ce } from "../../../table-core/build/lib/index.js";
3
+ import { defineComponent as w, isRef as R, shallowRef as S, watch as h, ref as C, watchEffect as y, h as b, unref as p } from "vue";
4
+ function g() {
5
+ return !0;
6
+ }
7
+ const v = /* @__PURE__ */ Symbol("merge-proxy"), F = {
8
+ get(e, t, a) {
9
+ return t === v ? a : e.get(t);
10
+ },
11
+ has(e, t) {
12
+ return e.has(t);
13
+ },
14
+ set: g,
15
+ deleteProperty: g,
16
+ getOwnPropertyDescriptor(e, t) {
17
+ return {
18
+ configurable: !0,
19
+ enumerable: !0,
20
+ get() {
21
+ return e.get(t);
22
+ },
23
+ set: g,
24
+ deleteProperty: g
25
+ };
26
+ },
27
+ ownKeys(e) {
28
+ return e.keys();
29
+ }
30
+ };
31
+ function s(e) {
32
+ return "value" in e ? e.value : e;
33
+ }
34
+ function i() {
35
+ for (var e = arguments.length, t = new Array(e), a = 0; a < e; a++)
36
+ t[a] = arguments[a];
37
+ return new Proxy({
38
+ get(r) {
39
+ for (let n = t.length - 1; n >= 0; n--) {
40
+ const o = s(t[n])[r];
41
+ if (o !== void 0) return o;
42
+ }
43
+ },
44
+ has(r) {
45
+ for (let n = t.length - 1; n >= 0; n--)
46
+ if (r in s(t[n])) return !0;
47
+ return !1;
48
+ },
49
+ keys() {
50
+ const r = [];
51
+ for (let n = 0; n < t.length; n++) r.push(...Object.keys(s(t[n])));
52
+ return [...Array.from(new Set(r))];
53
+ }
54
+ }, F);
55
+ }
56
+ const A = w({
57
+ props: ["render", "props"],
58
+ setup: (e) => () => typeof e.render == "function" || typeof e.render == "object" ? b(e.render, e.props) : e.render
59
+ });
60
+ function f(e) {
61
+ return i(e, {
62
+ data: p(e.data)
63
+ });
64
+ }
65
+ function E(e) {
66
+ const t = R(e.data), a = i({
67
+ state: {},
68
+ // Dummy state
69
+ onStateChange: () => {
70
+ },
71
+ // noop
72
+ renderFallbackValue: null,
73
+ mergeOptions(o, l) {
74
+ return t ? {
75
+ ...o,
76
+ ...l
77
+ } : i(o, l);
78
+ }
79
+ }, t ? f(e) : e), r = m(a);
80
+ if (t) {
81
+ const o = S(e.data);
82
+ h(o, () => {
83
+ r.setState((l) => ({
84
+ ...l,
85
+ data: o.value
86
+ }));
87
+ }, {
88
+ immediate: !0
89
+ });
90
+ }
91
+ const n = C(r.initialState);
92
+ return y(() => {
93
+ r.setOptions((o) => {
94
+ var l;
95
+ const c = new Proxy({}, {
96
+ get: (u, d) => n.value[d]
97
+ });
98
+ return i(o, t ? f(e) : e, {
99
+ // merge the initialState and `options.state`
100
+ // create a new proxy on each `setOptions` call
101
+ // and get the value from state on each property access
102
+ state: i(c, (l = e.state) != null ? l : {}),
103
+ // Similarly, we'll maintain both our internal state and any user-provided
104
+ // state.
105
+ onStateChange: (u) => {
106
+ u instanceof Function ? n.value = u(n.value) : n.value = u, e.onStateChange == null || e.onStateChange(u);
107
+ }
108
+ });
109
+ });
110
+ }), r;
111
+ }
112
+ export {
113
+ G as ColumnFaceting,
114
+ T as ColumnFiltering,
115
+ k as ColumnGrouping,
116
+ j as ColumnOrdering,
117
+ z as ColumnPinning,
118
+ D as ColumnSizing,
119
+ H as ColumnVisibility,
120
+ A as FlexRender,
121
+ I as GlobalFaceting,
122
+ N as GlobalFiltering,
123
+ U as Headers,
124
+ $ as RowExpanding,
125
+ B as RowPagination,
126
+ K as RowPinning,
127
+ L as RowSelection,
128
+ O as RowSorting,
129
+ W as _getVisibleLeafColumns,
130
+ X as aggregationFns,
131
+ Y as buildHeaderGroups,
132
+ q as createCell,
133
+ J as createColumn,
134
+ Q as createRow,
135
+ m as createTable,
136
+ Z as defaultColumnSizing,
137
+ _ as expandRows,
138
+ ee as filterFns,
139
+ te as flattenBy,
140
+ ne as functionalUpdate,
141
+ re as getCoreRowModel,
142
+ oe as getFilteredRowModel,
143
+ ae as getMemoOptions,
144
+ le as getPaginationRowModel,
145
+ ue as getSortedRowModel,
146
+ ie as isFunction,
147
+ ge as isNumberArray,
148
+ se as isRowSelected,
149
+ fe as isSubRowSelected,
150
+ ce as makeStateUpdater,
151
+ de as memo,
152
+ me as orderColumns,
153
+ we as passiveEventSupported,
154
+ Re as reSplitAlphaNumeric,
155
+ Se as selectRowsFn,
156
+ he as shouldAutoRemoveFilter,
157
+ Ce as sortingFns,
158
+ E as useVueTable
159
+ };
@@ -0,0 +1,6 @@
1
+ import { withInstall as r } from "@gsc-basic/utils";
2
+ import o from "./src/Grid.vue.js";
3
+ const m = r(o);
4
+ export {
5
+ m as GscGrid
6
+ };
@@ -0,0 +1 @@
1
+ [data-v-3a0fc4a7],[data-v-3a0fc4a7]:before,[data-v-3a0fc4a7]:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }[data-v-3a0fc4a7]::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.space-y-3[data-v-3a0fc4a7]>:not([hidden])~:not([hidden]){--un-space-y-reverse:0;margin-top:.75rem;margin-top:calc(.75rem * calc(1 - var(--un-space-y-reverse)));margin-bottom:0rem;margin-bottom:calc(.75rem * var(--un-space-y-reverse))}.px-4[data-v-3a0fc4a7]{padding-left:1rem;padding-right:1rem}.py-3[data-v-3a0fc4a7]{padding-top:.75rem;padding-bottom:.75rem}
@@ -0,0 +1,186 @@
1
+ import { computed as l, watch as d, createElementBlock as C, openBlock as i, createBlock as b, createCommentVNode as s, createElementVNode as A, unref as u, createVNode as g, createSlots as q, withCtx as p, renderSlot as m, renderList as G } from "vue";
2
+ import O from "./components/QueryBar.vue.js";
3
+ import T from "./components/ActionBar.vue.js";
4
+ import U from "./components/Pager.vue.js";
5
+ import H from "./components/DataTable.vue.js";
6
+ import I from "./components/ColumnSettings.vue.js";
7
+ import { useGridTable as L } from "./composables/useGridTable.js";
8
+ import { exportToCsv as M } from "./utils/exportCsv.js";
9
+ import './Grid.css';import './styles/antd.css';/* empty css */
10
+ /* empty css */
11
+ import J from "../../../_virtual/_plugin-vue_export-helper.js";
12
+ const P = { class: "gsc-grid space-y-3" }, W = { class: "gsc-card gsc-card-pad" }, X = { class: "gsc-card" }, Y = {
13
+ key: 0,
14
+ class: "px-4 py-3 gsc-divider-top"
15
+ }, Z = {
16
+ __name: "Grid",
17
+ props: {
18
+ data: { type: Array, default: () => [] },
19
+ request: { type: Function },
20
+ mode: { type: String, default: "server" },
21
+ // 'server' | 'client'
22
+ columns: { type: Array, default: () => [] },
23
+ pagination: { type: [Boolean, Object], default: () => ({ page: 1, pageSize: 10 }) },
24
+ query: { type: Object, default: () => ({}) },
25
+ filterSchema: { type: Array, default: () => [] },
26
+ // ActionBar config (optional). Example: { left: [{ key:'export', text:'导出' }], right: [{ key:'refresh', text:'刷新' }], showColumnSettings: true }
27
+ actions: { type: Object, default: () => ({}) },
28
+ rowKey: { type: String, default: "id" },
29
+ rowSelection: { type: Boolean, default: !1 },
30
+ virtual: { type: Boolean, default: !1 },
31
+ rowHeight: { type: Number, default: 40 },
32
+ height: { type: Number, default: 400 }
33
+ },
34
+ emits: ["update:query", "selection-change", "load", "cell-change", "update:modelValue", "info"],
35
+ setup(k, { emit: B }) {
36
+ const o = k, r = B, f = o.filterSchema || [], $ = l(() => o.columns || []), y = l(() => !!o.rowSelection), z = l(() => o.pagination !== !1), Q = l(() => {
37
+ const e = o.actions || {}, t = e.left || e.leftActions || [];
38
+ return Array.isArray(t) ? t : [];
39
+ }), V = l(() => {
40
+ const e = o.actions || {}, t = e.right || e.rightActions || [];
41
+ return Array.isArray(t) ? t : [];
42
+ }), _ = l(() => (o.actions || {}).showColumnSettings !== !1), a = L({
43
+ data: o.data,
44
+ request: o.request,
45
+ mode: o.mode,
46
+ pageSize: o.pagination && o.pagination.pageSize || 10,
47
+ initialQuery: o.query,
48
+ columns: o.columns,
49
+ rowKey: o.rowKey,
50
+ enableRowSelection: y.value
51
+ }), c = l(() => !!a.loading.value), v = l({
52
+ get() {
53
+ return a.query.value || {};
54
+ },
55
+ set(e) {
56
+ a.setQuery(e || {});
57
+ }
58
+ }), x = l(() => a.rows.value || []), h = l({
59
+ get() {
60
+ return a.page.value;
61
+ },
62
+ set(e) {
63
+ a.page.value = e;
64
+ }
65
+ }), w = l({
66
+ get() {
67
+ return a.pageSize.value;
68
+ },
69
+ set(e) {
70
+ a.pageSize.value = e;
71
+ }
72
+ }), K = l(() => a.total.value || 0);
73
+ function N(e) {
74
+ const t = e || {};
75
+ a.setQuery(t), a.load();
76
+ }
77
+ function R(e) {
78
+ const t = e || {};
79
+ a.setQuery(t), a.load();
80
+ }
81
+ function j({ key: e, value: t }) {
82
+ const n = { ...a.query.value || {} };
83
+ t != null && t !== "" ? n[e] = t : delete n[e], a.setQuery(n), a.load();
84
+ }
85
+ function D(e) {
86
+ r("selection-change", e || []);
87
+ }
88
+ function E(e) {
89
+ o.mode === "client" ? a.setData((a.rows.value || []).slice()) : r("cell-change", {
90
+ rowKey: e?.row?.[o.rowKey],
91
+ column: e?.column,
92
+ value: e?.value,
93
+ row: e?.row
94
+ }), r("update:modelValue", (a.rows.value || []).slice());
95
+ }
96
+ function F() {
97
+ const e = o.columns || [], t = x.value || [];
98
+ M("grid-export.csv", e, t);
99
+ }
100
+ return d(() => o.data, (e) => {
101
+ a.setData(e || []);
102
+ }, { deep: !0 }), d(() => o.columns, (e) => {
103
+ a.setColumns(e || []);
104
+ }, { deep: !0 }), d(() => a.query.value, (e) => {
105
+ r("update:query", e);
106
+ }, { deep: !0 }), (e, t) => (i(), C("div", P, [
107
+ u(f).length ? (i(), b(O, {
108
+ key: 0,
109
+ modelValue: v.value,
110
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => v.value = n),
111
+ schema: u(f),
112
+ loading: c.value,
113
+ onSearch: N,
114
+ onReset: R
115
+ }, null, 8, ["modelValue", "schema", "loading"])) : s("", !0),
116
+ A("div", W, [
117
+ g(T, {
118
+ loading: c.value,
119
+ "left-actions": Q.value,
120
+ "right-actions": V.value,
121
+ onExport: F,
122
+ onInfo: t[1] || (t[1] = (n) => e.$emit("info"))
123
+ }, q({
124
+ right: p(() => [
125
+ m(e.$slots, "actions-right", {}, () => [
126
+ _.value ? (i(), b(I, {
127
+ key: 0,
128
+ table: u(a).table
129
+ }, null, 8, ["table"])) : s("", !0)
130
+ ], !0)
131
+ ]),
132
+ _: 2
133
+ }, [
134
+ e.$slots["actions-left"] ? {
135
+ name: "left",
136
+ fn: p(() => [
137
+ m(e.$slots, "actions-left", {}, void 0, !0)
138
+ ]),
139
+ key: "0"
140
+ } : void 0
141
+ ]), 1032, ["loading", "left-actions", "right-actions"])
142
+ ]),
143
+ A("div", X, [
144
+ g(H, {
145
+ table: u(a).table,
146
+ mode: o.mode,
147
+ loading: c.value,
148
+ virtual: o.virtual,
149
+ height: o.height,
150
+ "row-height": o.rowHeight,
151
+ "enable-row-selection": y.value,
152
+ onSelectionChange: D,
153
+ onCellChange: E,
154
+ onServerFilterChange: j
155
+ }, q({ _: 2 }, [
156
+ G($.value, (n) => ({
157
+ name: `cell-${n.key}`,
158
+ fn: p((S) => [
159
+ e.$slots[`cell-${n.key}`] ? m(e.$slots, `cell-${n.key}`, {
160
+ key: 0,
161
+ value: S.value,
162
+ row: S.row
163
+ }, void 0, !0) : s("", !0)
164
+ ])
165
+ }))
166
+ ]), 1032, ["table", "mode", "loading", "virtual", "height", "row-height", "enable-row-selection"]),
167
+ z.value ? (i(), C("div", Y, [
168
+ g(U, {
169
+ page: h.value,
170
+ "page-size": w.value,
171
+ total: K.value,
172
+ "onUpdate:page": t[2] || (t[2] = (n) => {
173
+ h.value = n;
174
+ }),
175
+ "onUpdate:pageSize": t[3] || (t[3] = (n) => {
176
+ w.value = n;
177
+ })
178
+ }, null, 8, ["page", "page-size", "total"])
179
+ ])) : s("", !0)
180
+ ])
181
+ ]));
182
+ }
183
+ }, de = /* @__PURE__ */ J(Z, [["__scopeId", "data-v-3a0fc4a7"]]);
184
+ export {
185
+ de as default
186
+ };
@@ -0,0 +1 @@
1
+ [data-v-e03d5343],[data-v-e03d5343]:before,[data-v-e03d5343]:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }[data-v-e03d5343]::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.flex[data-v-e03d5343]{display:flex}.items-center[data-v-e03d5343]{align-items:center}.justify-between[data-v-e03d5343]{justify-content:space-between}.gap-2[data-v-e03d5343]{gap:.5rem}
@@ -0,0 +1,58 @@
1
+ import { computed as f, createElementBlock as i, openBlock as n, createElementVNode as u, renderSlot as g, Fragment as p, renderList as m, normalizeClass as y, toDisplayString as A } from "vue";
2
+ import { useLocale as x } from "../../../hooks/useLocale.js";
3
+ import './ActionBar.css';/* empty css */
4
+ import B from "../../../../_virtual/_plugin-vue_export-helper.js";
5
+ const C = { class: "flex items-center justify-between" }, b = { class: "flex items-center gap-2" }, $ = ["disabled", "onClick"], L = { class: "flex items-center gap-2" }, E = ["disabled", "onClick"], S = {
6
+ __name: "ActionBar",
7
+ props: {
8
+ loading: { type: Boolean, default: !1 },
9
+ leftActions: { type: Array, default: () => [] },
10
+ rightActions: { type: Array, default: () => [] }
11
+ },
12
+ emits: ["export", "info", "action"],
13
+ setup(s, { emit: k }) {
14
+ const r = s, a = k, { t: c } = x(), v = f(() => {
15
+ const t = Array.isArray(r.leftActions) ? r.leftActions : [];
16
+ return t.length ? t : [
17
+ { key: "export", text: c("gsc.grid.actionBar.export"), variant: "primary" },
18
+ { key: "info", text: c("gsc.grid.actionBar.info"), variant: "default" }
19
+ ];
20
+ }), _ = f(() => Array.isArray(r.rightActions) ? r.rightActions : []);
21
+ function l(t) {
22
+ const o = t?.variant || "default";
23
+ return o === "primary" ? "gsc-btn-primary" : o === "danger" ? "gsc-btn-danger" : "gsc-btn-default";
24
+ }
25
+ function d(t) {
26
+ const o = t?.key;
27
+ a("action", { key: o, action: t }), o === "export" && a("export"), o === "info" && a("info");
28
+ try {
29
+ t?.onClick?.();
30
+ } catch {
31
+ }
32
+ }
33
+ return (t, o) => (n(), i("div", C, [
34
+ u("div", b, [
35
+ g(t.$slots, "left", {}, () => [
36
+ (n(!0), i(p, null, m(v.value, (e) => (n(), i("button", {
37
+ key: e.key,
38
+ class: y(["gsc-btn", l(e)]),
39
+ disabled: s.loading || !!e.disabled,
40
+ onClick: (h) => d(e)
41
+ }, A(e.text), 11, $))), 128))
42
+ ], !0)
43
+ ]),
44
+ u("div", L, [
45
+ (n(!0), i(p, null, m(_.value, (e) => (n(), i("button", {
46
+ key: e.key,
47
+ class: y(["gsc-btn", l(e)]),
48
+ disabled: s.loading || !!e.disabled,
49
+ onClick: (h) => d(e)
50
+ }, A(e.text), 11, E))), 128)),
51
+ g(t.$slots, "right", {}, void 0, !0)
52
+ ])
53
+ ]));
54
+ }
55
+ }, F = /* @__PURE__ */ B(S, [["__scopeId", "data-v-e03d5343"]]);
56
+ export {
57
+ F as default
58
+ };
@@ -0,0 +1 @@
1
+ .gsc-cell-editor[data-v-8c70dd7e]{display:flex;flex-direction:column}
@@ -0,0 +1,121 @@
1
+ import { ref as M, onMounted as E, createElementBlock as u, openBlock as r, renderSlot as b, withDirectives as p, createElementVNode as g, unref as t, withKeys as i, withModifiers as d, isRef as y, Fragment as V, renderList as S, toDisplayString as w, vModelSelect as U, vModelText as v } from "vue";
2
+ import { useCellEditor as L } from "../composables/useCellEditor.js";
3
+ import './CellEditor2.css';import './CellEditor.css';/* empty css */
4
+ /* empty css */
5
+ import R from "../../../../_virtual/_plugin-vue_export-helper.js";
6
+ const D = { class: "gsc-cell-editor" }, I = ["value"], T = { key: 0 }, $ = { class: "mt-2 flex gap-2 justify-end" }, B = {
7
+ __name: "CellEditor",
8
+ props: { modelValue: [String, Number, Date], type: { type: String, default: "text" }, options: Array },
9
+ emits: ["update:modelValue", "commit", "cancel"],
10
+ setup(m, { emit: K }) {
11
+ const k = m, x = K, { localValue: l, updateLocal: f, commit: o, cancel: s } = L(k, x), c = M(null);
12
+ E(() => {
13
+ k.type === "rich-text" && c.value && (c.value.innerHTML = l.value || "");
14
+ });
15
+ function C(a) {
16
+ const n = a.target.innerHTML;
17
+ f(n);
18
+ }
19
+ return (a, n) => (r(), u("div", D, [
20
+ m.type === "custom" ? b(a.$slots, "custom", {
21
+ key: 0,
22
+ modelValue: m.modelValue,
23
+ update: t(f),
24
+ commit: t(o),
25
+ cancel: t(s)
26
+ }, void 0, !0) : m.type === "select" ? p((r(), u("select", {
27
+ key: 1,
28
+ "onUpdate:modelValue": n[0] || (n[0] = (e) => y(l) ? l.value = e : null),
29
+ class: "gsc-control",
30
+ onKeydown: [
31
+ n[1] || (n[1] = i(d((...e) => t(o) && t(o)(...e), ["prevent"]), ["enter"])),
32
+ n[2] || (n[2] = i(d((...e) => t(s) && t(s)(...e), ["prevent"]), ["esc"]))
33
+ ]
34
+ }, [
35
+ (r(!0), u(V, null, S(m.options || [], (e) => (r(), u("option", {
36
+ key: e.value,
37
+ value: e.value
38
+ }, w(e.label), 9, I))), 128))
39
+ ], 544)), [
40
+ [U, t(l)]
41
+ ]) : m.type === "date" ? p((r(), u("input", {
42
+ key: 2,
43
+ "onUpdate:modelValue": n[3] || (n[3] = (e) => y(l) ? l.value = e : null),
44
+ type: "date",
45
+ class: "gsc-control",
46
+ onKeydown: [
47
+ n[4] || (n[4] = i(d((...e) => t(o) && t(o)(...e), ["prevent"]), ["enter"])),
48
+ n[5] || (n[5] = i(d((...e) => t(s) && t(s)(...e), ["prevent"]), ["esc"]))
49
+ ]
50
+ }, null, 544)), [
51
+ [v, t(l)]
52
+ ]) : m.type === "datetime-local" ? p((r(), u("input", {
53
+ key: 3,
54
+ "onUpdate:modelValue": n[6] || (n[6] = (e) => y(l) ? l.value = e : null),
55
+ type: "datetime-local",
56
+ class: "gsc-control",
57
+ onKeydown: [
58
+ n[7] || (n[7] = i(d((...e) => t(o) && t(o)(...e), ["prevent"]), ["enter"])),
59
+ n[8] || (n[8] = i(d((...e) => t(s) && t(s)(...e), ["prevent"]), ["esc"]))
60
+ ]
61
+ }, null, 544)), [
62
+ [v, t(l)]
63
+ ]) : m.type === "number" ? p((r(), u("input", {
64
+ key: 4,
65
+ "onUpdate:modelValue": n[9] || (n[9] = (e) => y(l) ? l.value = e : null),
66
+ type: "number",
67
+ class: "gsc-control",
68
+ onKeydown: [
69
+ n[10] || (n[10] = i(d((...e) => t(o) && t(o)(...e), ["prevent"]), ["enter"])),
70
+ n[11] || (n[11] = i(d((...e) => t(s) && t(s)(...e), ["prevent"]), ["esc"]))
71
+ ]
72
+ }, null, 544)), [
73
+ [
74
+ v,
75
+ t(l),
76
+ void 0,
77
+ { number: !0 }
78
+ ]
79
+ ]) : m.type === "rich-text" ? (r(), u(V, { key: 5 }, [
80
+ a.$slots.custom ? (r(), u("div", T, [
81
+ b(a.$slots, "custom", {
82
+ modelValue: t(l),
83
+ update: t(f),
84
+ commit: t(o),
85
+ cancel: t(s)
86
+ }, void 0, !0)
87
+ ])) : (r(), u("div", {
88
+ key: 1,
89
+ ref_key: "richRef",
90
+ ref: c,
91
+ contenteditable: "",
92
+ class: "gsc-textarea",
93
+ onInput: C
94
+ }, w(t(l)), 545))
95
+ ], 64)) : p((r(), u("input", {
96
+ key: 6,
97
+ "onUpdate:modelValue": n[12] || (n[12] = (e) => y(l) ? l.value = e : null),
98
+ class: "gsc-control",
99
+ onKeydown: [
100
+ n[13] || (n[13] = i(d((...e) => t(o) && t(o)(...e), ["prevent"]), ["enter"])),
101
+ n[14] || (n[14] = i(d((...e) => t(s) && t(s)(...e), ["prevent"]), ["esc"]))
102
+ ]
103
+ }, null, 544)), [
104
+ [v, t(l)]
105
+ ]),
106
+ g("div", $, [
107
+ g("button", {
108
+ class: "gsc-btn gsc-btn-primary",
109
+ onClick: n[15] || (n[15] = (...e) => t(o) && t(o)(...e))
110
+ }, " OK "),
111
+ g("button", {
112
+ class: "gsc-btn gsc-btn-default",
113
+ onClick: n[16] || (n[16] = (...e) => t(s) && t(s)(...e))
114
+ }, " Cancel ")
115
+ ])
116
+ ]));
117
+ }
118
+ }, O = /* @__PURE__ */ R(B, [["__scopeId", "data-v-8c70dd7e"]]);
119
+ export {
120
+ O as default
121
+ };
@@ -0,0 +1 @@
1
+ [data-v-8c70dd7e],[data-v-8c70dd7e]:before,[data-v-8c70dd7e]:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }[data-v-8c70dd7e]::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.mt-2[data-v-8c70dd7e]{margin-top:.5rem}.flex[data-v-8c70dd7e]{display:flex}.justify-end[data-v-8c70dd7e]{justify-content:flex-end}.gap-2[data-v-8c70dd7e]{gap:.5rem}