eco-vue-js 0.8.22 → 0.8.24
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Button/WButtonMore.vue.d.ts.map +1 -1
- package/dist/components/Button/WButtonMore.vue.js +1 -1
- package/dist/components/HeaderBar/WHeaderBar.vue.d.ts +1 -1
- package/dist/components/HeaderBar/WHeaderBar.vue.d.ts.map +1 -1
- package/dist/components/List/WList.vue.d.ts +6 -3
- package/dist/components/List/WList.vue.d.ts.map +1 -1
- package/dist/components/List/WList.vue.js +76 -62
- package/dist/components/List/WListCardField.vue.js +1 -1
- package/dist/components/List/components/HeaderFieldNested.vue.d.ts +37 -0
- package/dist/components/List/components/HeaderFieldNested.vue.d.ts.map +1 -0
- package/dist/components/List/components/HeaderFieldNested.vue.js +46 -0
- package/dist/components/List/components/HeaderFieldNested.vue2.js +5 -0
- package/dist/components/List/components/HeaderItemResizer.vue.d.ts +6 -2
- package/dist/components/List/components/HeaderItemResizer.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderItemResizer.vue.js +2 -1
- package/dist/components/List/components/HeaderSettings.vue.d.ts +11 -6
- package/dist/components/List/components/HeaderSettings.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderSettings.vue.js +64 -33
- package/dist/components/List/components/HeaderSettingsItem.vue.d.ts +9 -7
- package/dist/components/List/components/HeaderSettingsItem.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderSettingsItem.vue.js +20 -15
- package/dist/components/List/components/ListCardFieldNested.vue.d.ts +30 -0
- package/dist/components/List/components/ListCardFieldNested.vue.d.ts.map +1 -0
- package/dist/components/List/components/ListCardFieldNested.vue.js +63 -0
- package/dist/components/List/components/ListCardFieldNested.vue2.js +5 -0
- package/dist/components/List/types.d.ts +29 -1
- package/dist/components/List/types.d.ts.map +1 -1
- package/dist/components/List/use/useFieldConfigMap.d.ts +10 -0
- package/dist/components/List/use/useFieldConfigMap.d.ts.map +1 -0
- package/dist/components/List/use/useFieldConfigMap.js +83 -0
- package/dist/main.js +1 -1
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +14 -1
- package/package.json +1 -1
- package/tailwind-base/plugins/default.cjs +2 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WButtonMore.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonMore.vue"],"names":[],"mappings":"AAqGA,iBAAS,cAAc;;;yBATL,IAAI;
|
1
|
+
{"version":3,"file":"WButtonMore.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonMore.vue"],"names":[],"mappings":"AAqGA,iBAAS,cAAc;;;yBATL,IAAI;YA4GQ,GAAG;;;WASnB,OAAO,IAA6B;EAEjD;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;WApJZ,YAAY;eACR,OAAO;;WADX,YAAY;eACR,OAAO;iGAyJlB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -27,7 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
27
27
|
class: normalizeClass([{
|
28
28
|
"w-hover-circle-trigger cursor-pointer": !_ctx.disabled,
|
29
29
|
"cursor-not-allowed opacity-50": _ctx.disabled
|
30
|
-
}, "outline-none flex
|
30
|
+
}, "outline-none flex justify-center"]),
|
31
31
|
onClick: toggle
|
32
32
|
}, [
|
33
33
|
createVNode(_sfc_main$1, {
|
@@ -28,8 +28,8 @@ declare const __VLS_component: import('vue').DefineComponent<{
|
|
28
28
|
}> & Readonly<{
|
29
29
|
"onUpdate:search"?: ((value: string | undefined) => any) | undefined;
|
30
30
|
}>, {
|
31
|
-
search: string;
|
32
31
|
title: string;
|
32
|
+
search: string;
|
33
33
|
headerPadding: number;
|
34
34
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
35
35
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WHeaderBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/HeaderBar/WHeaderBar.vue"],"names":[],"mappings":"AAsOA,iBAAS,cAAc;;uBA6OI,GAAG;wBACD,GAAG;wBACH,GAAG;;;;;;;;WAUlB,OAAO,IAA6B;EAEjD;AAsBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;YAxVT,MAAM;aACL,MAAM;oBACC,OAAO;oBACP,MAAM;;;;YAHd,MAAM;aACL,MAAM;oBACC,OAAO;oBACP,MAAM;;;;
|
1
|
+
{"version":3,"file":"WHeaderBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/HeaderBar/WHeaderBar.vue"],"names":[],"mappings":"AAsOA,iBAAS,cAAc;;uBA6OI,GAAG;wBACD,GAAG;wBACH,GAAG;;;;;;;;WAUlB,OAAO,IAA6B;EAEjD;AAsBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;YAxVT,MAAM;aACL,MAAM;oBACC,OAAO;oBACP,MAAM;;;;YAHd,MAAM;aACL,MAAM;oBACC,OAAO;oBACP,MAAM;;;;WAHd,MAAM;YACL,MAAM;mBAEC,MAAM;6EA+VxB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAgBpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { BulkComponent, FieldComponent,
|
2
|
-
declare const _default: <Data extends DefaultData, QueryParams
|
1
|
+
import { BulkComponent, FieldComponent, FieldConfigMap, ListFields, MenuComponent } from './types';
|
2
|
+
declare const _default: <Data extends DefaultData, QueryParams, Fields extends ListFields<Data, QueryParams>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
4
|
readonly "onUpdate:header-padding"?: ((value: number) => any) | undefined;
|
5
5
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:header-padding"> & {
|
6
6
|
count?: number;
|
7
|
-
fields:
|
7
|
+
fields: Fields;
|
8
8
|
expansion?: FieldComponent<Data>;
|
9
9
|
useQueryFn: UseQueryPaginated<Data, QueryParams>;
|
10
10
|
queryParams: QueryParams;
|
@@ -18,6 +18,9 @@ declare const _default: <Data extends DefaultData, QueryParams>(__VLS_props: Non
|
|
18
18
|
selectAllTextGetter: (isUnselect: boolean, count: number) => string;
|
19
19
|
hasBorder?: boolean;
|
20
20
|
moreBottom?: boolean;
|
21
|
+
configKey: string;
|
22
|
+
defaultConfigMap: FieldConfigMap<Fields>;
|
23
|
+
alignTop?: boolean;
|
21
24
|
}> & import('vue').PublicProps;
|
22
25
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
23
26
|
attrs: any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WList.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WList.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WList.vue.d.ts","sourceRoot":"","s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KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,13 +1,16 @@
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createSlots, createElementBlock, Fragment, renderList, resolveDynamicComponent, normalizeClass, createCommentVNode, createVNode, normalizeStyle } from 'vue';
|
1
|
+
import { defineComponent, ref, computed, toRef, openBlock, createBlock, unref, withCtx, createSlots, createElementBlock, Fragment, renderList, resolveDynamicComponent, normalizeClass, createCommentVNode, createVNode, normalizeStyle, isRef } from 'vue';
|
2
2
|
import _sfc_main$1 from '../InfiniteList/WInfiniteList.vue.js';
|
3
3
|
import { getIsMobile } from '../../utils/mobile.js';
|
4
4
|
import { useSelected, getPosition } from '../../utils/useSelected.js';
|
5
|
-
import _sfc_main$
|
5
|
+
import _sfc_main$7 from './WListCard.vue.js';
|
6
6
|
import _sfc_main$3 from './WListHeader.vue.js';
|
7
7
|
import _sfc_main$5 from './WListHeaderItem.vue.js';
|
8
8
|
import { parseOrdering } from '../../utils/order.js';
|
9
9
|
import _sfc_main$2 from '../Button/WButtonSelection.vue.js';
|
10
|
-
import _sfc_main$
|
10
|
+
import _sfc_main$6 from './components/HeaderSettings.vue.js';
|
11
|
+
import { filterFields, useFieldConfigMap, getFirstFieldLabel } from './use/useFieldConfigMap.js';
|
12
|
+
import _sfc_main$8 from './components/ListCardFieldNested.vue.js';
|
13
|
+
import _sfc_main$4 from './components/HeaderFieldNested.vue.js';
|
11
14
|
|
12
15
|
const PAGE_LENGTH = 24;
|
13
16
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
@@ -27,7 +30,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
27
30
|
cardClass: {},
|
28
31
|
selectAllTextGetter: { type: Function },
|
29
32
|
hasBorder: { type: Boolean },
|
30
|
-
moreBottom: { type: Boolean }
|
33
|
+
moreBottom: { type: Boolean },
|
34
|
+
configKey: {},
|
35
|
+
defaultConfigMap: {},
|
36
|
+
alignTop: { type: Boolean }
|
31
37
|
},
|
32
38
|
emits: ["update:header-padding"],
|
33
39
|
setup(__props) {
|
@@ -35,18 +41,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
35
41
|
const props = __props;
|
36
42
|
const listCount = ref(0);
|
37
43
|
const selectionCount = ref(0);
|
38
|
-
const
|
39
|
-
|
40
|
-
width: 0,
|
41
|
-
visible: true,
|
42
|
-
order: index
|
43
|
-
};
|
44
|
-
return result;
|
45
|
-
}, {}));
|
46
|
-
const fieldsVisible = computed(() => props.fields.filter((field) => field.visibleGetter?.(props.queryParams) ?? true));
|
44
|
+
const fieldsVisible = computed(() => filterFields(props.fields, (field) => field.visibleGetter?.(props.queryParams) ?? true));
|
45
|
+
const { fieldConfigMap, hasSaved, reset } = useFieldConfigMap(toRef(props, "configKey"), fieldsVisible, toRef(props, "defaultConfigMap"));
|
47
46
|
const fieldsFiltered = computed(() => {
|
48
47
|
if (isMobile) return fieldsVisible.value;
|
49
|
-
return fieldsVisible.value
|
48
|
+
return filterFields(fieldsVisible.value, (field) => fieldConfigMap.value[field.label]?.visible).sort((a, b) => fieldConfigMap.value[getFirstFieldLabel(a)].order - fieldConfigMap.value[getFirstFieldLabel(b)].order);
|
50
49
|
});
|
51
50
|
const allowSelect = computed(() => props.bulk !== void 0);
|
52
51
|
const allowOpen = computed(() => props.expansion !== void 0);
|
@@ -107,8 +106,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
107
106
|
onSelect: unref(setSelected),
|
108
107
|
onSelectReverse: unref(setSelectedReverse),
|
109
108
|
onSelectRange: unref(setSelectedRange),
|
110
|
-
"onUpdate:headerPadding": _cache[
|
111
|
-
"onUpdate:count": _cache[
|
109
|
+
"onUpdate:headerPadding": _cache[6] || (_cache[6] = ($event) => _ctx.$emit("update:header-padding", $event)),
|
110
|
+
"onUpdate:count": _cache[7] || (_cache[7] = ($event) => listCount.value = $event)
|
112
111
|
}, {
|
113
112
|
header: withCtx(({ selectAllValue }) => [
|
114
113
|
allowSelect.value ? (openBlock(), createBlock(_sfc_main$2, {
|
@@ -156,45 +155,80 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
156
155
|
"tooltip-text": _ctx.selectAllTextGetter(selectAllValue !== true, _ctx.count ?? listCount.value),
|
157
156
|
count: _ctx.count ?? listCount.value,
|
158
157
|
selection: selectAllValue,
|
159
|
-
"onToggle:selection": _cache[
|
158
|
+
"onToggle:selection": _cache[5] || (_cache[5] = ($event) => $event ? unref(setSelectedReverse)([]) : unref(setSelected)([]))
|
160
159
|
}, {
|
160
|
+
default: withCtx(() => [
|
161
|
+
createVNode(_sfc_main$4, { fields: fieldsFiltered.value }, {
|
162
|
+
default: withCtx(({ field }) => [
|
163
|
+
createVNode(_sfc_main$5, {
|
164
|
+
title: typeof field.title === "string" ? field.title : field.title(_ctx.queryParams),
|
165
|
+
field: typeof field.field === "string" ? field.field : field.field?.(_ctx.queryParams),
|
166
|
+
class: normalizeClass(field.cssClass),
|
167
|
+
ordering: ordering.value,
|
168
|
+
disabled: !field.field,
|
169
|
+
"allow-resize": field.allowResize,
|
170
|
+
style: normalizeStyle({
|
171
|
+
minWidth: !unref(isMobile) && unref(fieldConfigMap)[field.label]?.width ? unref(fieldConfigMap)[field.label].width + "px" : void 0
|
172
|
+
}),
|
173
|
+
"onUpdate:width": ($event) => unref(fieldConfigMap)[field.label].width = $event,
|
174
|
+
"onSave:width": _cache[3] || (_cache[3] = ($event) => fieldConfigMap.value = unref(fieldConfigMap))
|
175
|
+
}, null, 8, ["title", "field", "class", "ordering", "disabled", "allow-resize", "style", "onUpdate:width"])
|
176
|
+
]),
|
177
|
+
_: 1
|
178
|
+
}, 8, ["fields"])
|
179
|
+
]),
|
161
180
|
settings: withCtx(() => [
|
162
|
-
createVNode(_sfc_main$
|
163
|
-
|
164
|
-
"
|
181
|
+
createVNode(_sfc_main$6, {
|
182
|
+
"field-config-map": unref(fieldConfigMap),
|
183
|
+
"onUpdate:fieldConfigMap": _cache[4] || (_cache[4] = ($event) => isRef(fieldConfigMap) ? fieldConfigMap.value = $event : null),
|
184
|
+
fields: fieldsVisible.value,
|
165
185
|
"query-params": _ctx.queryParams,
|
166
|
-
"
|
167
|
-
|
168
|
-
|
169
|
-
default: withCtx(() => [
|
170
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(fieldsFiltered.value, (field) => {
|
171
|
-
return openBlock(), createBlock(_sfc_main$5, {
|
172
|
-
key: field.label,
|
173
|
-
title: typeof field.title === "string" ? field.title : field.title(_ctx.queryParams),
|
174
|
-
field: typeof field.field === "string" ? field.field : field.field?.(_ctx.queryParams),
|
175
|
-
class: normalizeClass(field.cssClass),
|
176
|
-
ordering: ordering.value,
|
177
|
-
disabled: !field.field,
|
178
|
-
"allow-resize": field.allowResize,
|
179
|
-
style: normalizeStyle({
|
180
|
-
minWidth: !unref(isMobile) && fieldsConfig.value[field.label]?.width ? fieldsConfig.value[field.label].width + "px" : void 0
|
181
|
-
}),
|
182
|
-
"onUpdate:width": ($event) => fieldsConfig.value[field.label].width = $event
|
183
|
-
}, null, 8, ["title", "field", "class", "ordering", "disabled", "allow-resize", "style", "onUpdate:width"]);
|
184
|
-
}), 128))
|
186
|
+
"has-saved": unref(hasSaved),
|
187
|
+
"onClick:reset": unref(reset)
|
188
|
+
}, null, 8, ["field-config-map", "fields", "query-params", "has-saved", "onClick:reset"])
|
185
189
|
]),
|
186
190
|
_: 2
|
187
191
|
}, 1032, ["query-params", "allow-select", "tooltip-text", "count", "selection"])) : createCommentVNode("", true)
|
188
192
|
]),
|
189
193
|
default: withCtx(({ item, skeleton, setter, refetch }) => [
|
190
|
-
createVNode(_sfc_main$
|
194
|
+
createVNode(_sfc_main$7, {
|
191
195
|
disabled: skeleton,
|
192
196
|
mobile: unref(isMobile),
|
193
197
|
"card-class": _ctx.cardClass,
|
194
198
|
"has-border": _ctx.hasBorder,
|
195
199
|
"more-bottom": _ctx.moreBottom,
|
196
|
-
"allow-open": allowOpen.value && !skeleton
|
200
|
+
"allow-open": allowOpen.value && !skeleton,
|
201
|
+
"align-top": _ctx.alignTop
|
197
202
|
}, createSlots({
|
203
|
+
default: withCtx(() => [
|
204
|
+
createVNode(_sfc_main$8, {
|
205
|
+
fields: fieldsFiltered.value,
|
206
|
+
item
|
207
|
+
}, {
|
208
|
+
default: withCtx((defaultScope) => [
|
209
|
+
(openBlock(), createBlock(resolveDynamicComponent(defaultScope.field.component), {
|
210
|
+
item: defaultScope.item,
|
211
|
+
readonly: _ctx.readonlyGetter?.(defaultScope.item),
|
212
|
+
skeleton,
|
213
|
+
mobile: unref(isMobile),
|
214
|
+
class: normalizeClass({
|
215
|
+
[defaultScope.field.cssClass ?? ""]: true,
|
216
|
+
"items-center": !_ctx.alignTop,
|
217
|
+
"items-start": _ctx.alignTop
|
218
|
+
}),
|
219
|
+
style: normalizeStyle({
|
220
|
+
minWidth: !unref(isMobile) && unref(fieldConfigMap)[defaultScope.field.label]?.width ? unref(fieldConfigMap)[defaultScope.field.label].width + "px" : void 0
|
221
|
+
}),
|
222
|
+
"onUpdate:item": setter,
|
223
|
+
"onDelete:item": ($event) => {
|
224
|
+
setter();
|
225
|
+
refetch();
|
226
|
+
}
|
227
|
+
}, null, 40, ["item", "readonly", "skeleton", "mobile", "class", "style", "onUpdate:item", "onDelete:item"]))
|
228
|
+
]),
|
229
|
+
_: 2
|
230
|
+
}, 1032, ["fields", "item"])
|
231
|
+
]),
|
198
232
|
more: withCtx(() => [
|
199
233
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menu, (menuItem, menuIndex) => {
|
200
234
|
return openBlock(), createBlock(resolveDynamicComponent(menuItem), {
|
@@ -209,26 +243,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
209
243
|
}, null, 40, ["item", "readonly", "onUpdate:item", "onDelete:item"]);
|
210
244
|
}), 128))
|
211
245
|
]),
|
212
|
-
default: withCtx(() => [
|
213
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(fieldsFiltered.value, (field) => {
|
214
|
-
return openBlock(), createBlock(resolveDynamicComponent(field.component), {
|
215
|
-
key: field.label,
|
216
|
-
item,
|
217
|
-
readonly: _ctx.readonlyGetter?.(item),
|
218
|
-
skeleton,
|
219
|
-
mobile: unref(isMobile),
|
220
|
-
class: normalizeClass(field.cssClass),
|
221
|
-
style: normalizeStyle({
|
222
|
-
minWidth: !unref(isMobile) && fieldsConfig.value[field.label]?.width ? fieldsConfig.value[field.label].width + "px" : void 0
|
223
|
-
}),
|
224
|
-
"onUpdate:item": setter,
|
225
|
-
"onDelete:item": ($event) => {
|
226
|
-
setter();
|
227
|
-
refetch();
|
228
|
-
}
|
229
|
-
}, null, 40, ["item", "readonly", "skeleton", "mobile", "class", "style", "onUpdate:item", "onDelete:item"]);
|
230
|
-
}), 128))
|
231
|
-
]),
|
232
246
|
_: 2
|
233
247
|
}, [
|
234
248
|
_ctx.expansion ? {
|
@@ -248,7 +262,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
248
262
|
]),
|
249
263
|
key: "0"
|
250
264
|
} : void 0
|
251
|
-
]), 1032, ["disabled", "mobile", "card-class", "has-border", "more-bottom", "allow-open"])
|
265
|
+
]), 1032, ["disabled", "mobile", "card-class", "has-border", "more-bottom", "allow-open", "align-top"])
|
252
266
|
]),
|
253
267
|
_: 1
|
254
268
|
}, 8, ["use-query-fn", "query-params", "skeleton-length", "header-margin", "allow-select", "selected", "reverse", "selected-range", "count", "onSelect", "onSelectReverse", "onSelectRange"]);
|
@@ -12,7 +12,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
12
|
setup(__props) {
|
13
13
|
return (_ctx, _cache) => {
|
14
14
|
return openBlock(), createElementBlock("div", {
|
15
|
-
class: normalizeClass(["grid grid-cols-1
|
15
|
+
class: normalizeClass(["grid grid-cols-1 sm:min-h-16 sm:pr-6 sm:last:-mr-6", { "pointer-events-none": _ctx.allowOpen }])
|
16
16
|
}, [
|
17
17
|
_ctx.skeleton ? (openBlock(), createBlock(WSkeleton, { key: 0 })) : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
|
18
18
|
createElementVNode("div", _hoisted_1, [
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { ListField, ListFields } from '../types';
|
2
|
+
declare const _default: <Data, QueryParams>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
4
|
+
fields: ListFields<Data, QueryParams>;
|
5
|
+
}> & import('vue').PublicProps;
|
6
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
7
|
+
attrs: any;
|
8
|
+
slots: Readonly<{
|
9
|
+
default: (props: {
|
10
|
+
field: ListField<Data, QueryParams>;
|
11
|
+
nested: boolean;
|
12
|
+
index: number;
|
13
|
+
length: number;
|
14
|
+
first: boolean;
|
15
|
+
last: boolean;
|
16
|
+
}) => void;
|
17
|
+
}> & {
|
18
|
+
default: (props: {
|
19
|
+
field: ListField<Data, QueryParams>;
|
20
|
+
nested: boolean;
|
21
|
+
index: number;
|
22
|
+
length: number;
|
23
|
+
first: boolean;
|
24
|
+
last: boolean;
|
25
|
+
}) => void;
|
26
|
+
};
|
27
|
+
emit: {};
|
28
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
29
|
+
[key: string]: any;
|
30
|
+
}> & {
|
31
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
32
|
+
};
|
33
|
+
export default _default;
|
34
|
+
type __VLS_PrettifyLocal<T> = {
|
35
|
+
[K in keyof T]: T[K];
|
36
|
+
} & {};
|
37
|
+
//# sourceMappingURL=HeaderFieldNested.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HeaderFieldNested.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderFieldNested.vue"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,UAAU,CAAA;yBAIlC,IAAI,EAAE,WAAW,eACpB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAyFxD,mBAAmB,CAAC;gBArFpB,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;KAqFgD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;iBAlFF,CAAC,KAAK,EAAE;YACf,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;YACnC,MAAM,EAAE,OAAO,CAAA;YACf,KAAK,EAAE,MAAM,CAAA;YACb,MAAM,EAAE,MAAM,CAAA;YACd,KAAK,EAAE,OAAO,CAAA;YACd,IAAI,EAAE,OAAO,CAAA;SACd,KAAK,IAAI;;iBAPD,CAAC,KAAK,EAAE;YACf,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;YACnC,MAAM,EAAE,OAAO,CAAA;YACf,KAAK,EAAE,MAAM,CAAA;YACb,MAAM,EAAE,MAAM,CAAA;YACd,KAAK,EAAE,OAAO,CAAA;YACd,IAAI,EAAE,OAAO,CAAA;SACd,KAAK,IAAI;;UA6EH,EAAE;;;;YAGiC,OAAO,CAAC,OAAO,WAAW,CAAC;;AAnGvE,wBAmG4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createBlock, withCtx, renderSlot } from 'vue';
|
2
|
+
import { getFirstFieldLabel } from '../use/useFieldConfigMap.js';
|
3
|
+
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
5
|
+
__name: "HeaderFieldNested",
|
6
|
+
props: {
|
7
|
+
fields: {}
|
8
|
+
},
|
9
|
+
setup(__props) {
|
10
|
+
return (_ctx, _cache) => {
|
11
|
+
const _component_HeaderFieldNested = resolveComponent("HeaderFieldNested", true);
|
12
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fields, (field, index) => {
|
13
|
+
return openBlock(), createElementBlock(Fragment, {
|
14
|
+
key: unref(getFirstFieldLabel)(field)
|
15
|
+
}, [
|
16
|
+
"fields" in field ? (openBlock(), createBlock(_component_HeaderFieldNested, {
|
17
|
+
key: 0,
|
18
|
+
fields: field.fields
|
19
|
+
}, {
|
20
|
+
default: withCtx((defaultScope) => [
|
21
|
+
renderSlot(_ctx.$slots, "default", {
|
22
|
+
field: defaultScope.field,
|
23
|
+
nested: true,
|
24
|
+
index: defaultScope.index,
|
25
|
+
length: defaultScope.length,
|
26
|
+
first: defaultScope.first,
|
27
|
+
last: defaultScope.last
|
28
|
+
})
|
29
|
+
]),
|
30
|
+
_: 2
|
31
|
+
}, 1032, ["fields"])) : renderSlot(_ctx.$slots, "default", {
|
32
|
+
key: 1,
|
33
|
+
field,
|
34
|
+
nested: false,
|
35
|
+
index,
|
36
|
+
length: _ctx.fields.length,
|
37
|
+
first: index === 0,
|
38
|
+
last: index === _ctx.fields.length - 1
|
39
|
+
})
|
40
|
+
], 64);
|
41
|
+
}), 128);
|
42
|
+
};
|
43
|
+
}
|
44
|
+
});
|
45
|
+
|
46
|
+
export { _sfc_main as default };
|
@@ -1,13 +1,17 @@
|
|
1
1
|
declare const _default: <Field>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
2
2
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
3
3
|
readonly "onUpdate:width"?: ((value: number) => any) | undefined;
|
4
|
-
|
4
|
+
readonly "onSave:width"?: (() => any) | undefined;
|
5
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:width" | "onSave:width"> & {}> & import('vue').PublicProps;
|
5
6
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
6
7
|
attrs: any;
|
7
8
|
slots: {
|
8
9
|
default?(_: {}): any;
|
9
10
|
};
|
10
|
-
emit:
|
11
|
+
emit: {
|
12
|
+
(e: "update:width", value: number): void;
|
13
|
+
(e: "save:width"): void;
|
14
|
+
};
|
11
15
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
12
16
|
[key: string]: any;
|
13
17
|
}> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HeaderItemResizer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderItemResizer.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"HeaderItemResizer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderItemResizer.vue"],"names":[],"mappings":"yBAsFiB,KAAK,eACR,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA6IxD,mBAAmB,CAAC;;;4JAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;yBA9BgB,GAAG;;;YA7G1B,cAAc,SAAS,MAAM,GAAG,IAAI;YACpC,YAAY,GAAG,IAAI;;;;;YA+ImB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAvJvE,wBAuJ4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -8,7 +8,7 @@ const _hoisted_1 = {
|
|
8
8
|
};
|
9
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
10
10
|
__name: "HeaderItemResizer",
|
11
|
-
emits: ["update:width"],
|
11
|
+
emits: ["update:width", "save:width"],
|
12
12
|
setup(__props, { emit: __emit }) {
|
13
13
|
const emit = __emit;
|
14
14
|
const listenerContainer = new DOMListenerContainer();
|
@@ -36,6 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
36
36
|
listenerContainer.destroy();
|
37
37
|
started = null;
|
38
38
|
widthSaved = null;
|
39
|
+
emit("save:width");
|
39
40
|
};
|
40
41
|
onMounted(() => {
|
41
42
|
setTimeout(() => {
|
@@ -1,17 +1,22 @@
|
|
1
|
-
import { FieldConfig,
|
1
|
+
import { FieldConfig, ListFields } from '../types';
|
2
2
|
declare const _default: <Data extends DefaultData, QueryParams>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
|
-
readonly "onUpdate:
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
readonly "onUpdate:field-config-map"?: ((value: Record<string, FieldConfig>) => any) | undefined;
|
5
|
+
readonly "onClick:reset"?: (() => any) | undefined;
|
6
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:field-config-map" | "onClick:reset"> & {
|
7
|
+
fields: ListFields<Data, QueryParams>;
|
8
|
+
fieldConfigMap: Record<string, FieldConfig>;
|
8
9
|
queryParams: QueryParams;
|
10
|
+
hasSaved?: boolean;
|
9
11
|
disabled?: boolean;
|
10
12
|
}> & import('vue').PublicProps;
|
11
13
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
12
14
|
attrs: any;
|
13
15
|
slots: {};
|
14
|
-
emit:
|
16
|
+
emit: {
|
17
|
+
(e: "update:field-config-map", value: Record<string, FieldConfig>): void;
|
18
|
+
(e: "click:reset"): void;
|
19
|
+
};
|
15
20
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
16
21
|
[key: string]: any;
|
17
22
|
}> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HeaderSettings.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderSettings.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"HeaderSettings.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderSettings.vue"],"names":[],"mappings":"AAqIA,OAAO,KAAK,EAAC,WAAW,EAAa,UAAU,EAAC,MAAM,UAAU,CAAA;yBAK/C,IAAI,SAAS,WAAW,EAAE,WAAW,eACxC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAqQxD,mBAAmB,CAAC;;;;gBAjQpB,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;wBACrB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;qBAC9B,WAAW;mBACb,OAAO;mBACP,OAAO;KA6PmE,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YA1PP,yBAAyB,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;YACpE,aAAa,GAAG,IAAI;;;;;YA8PkB,OAAO,CAAC,OAAO,WAAW,CAAC;;AA/QvE,wBA+Q4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,73 +1,104 @@
|
|
1
|
-
import { defineComponent, ref, openBlock, createBlock, markRaw, unref, withCtx, createElementVNode,
|
1
|
+
import { defineComponent, ref, openBlock, createBlock, markRaw, unref, withCtx, createElementVNode, createVNode, normalizeClass } from 'vue';
|
2
2
|
import _sfc_main$1 from '../../Button/WButtonMore.vue.js';
|
3
3
|
import IconTableSettings from '../../../assets/icons/sax/IconTableSettings.svg.js';
|
4
|
-
import _sfc_main$
|
4
|
+
import _sfc_main$3 from './HeaderSettingsItem.vue.js';
|
5
|
+
import _sfc_main$2 from './HeaderFieldNested.vue.js';
|
5
6
|
|
6
7
|
const _hoisted_1 = { class: "p-4" };
|
7
8
|
const _hoisted_2 = { class: "flex flex-col" };
|
9
|
+
const _hoisted_3 = ["disabled"];
|
8
10
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
11
|
__name: "HeaderSettings",
|
10
12
|
props: {
|
11
13
|
fields: {},
|
12
|
-
|
14
|
+
fieldConfigMap: {},
|
13
15
|
queryParams: {},
|
16
|
+
hasSaved: { type: Boolean },
|
14
17
|
disabled: { type: Boolean }
|
15
18
|
},
|
16
|
-
emits: ["update:
|
19
|
+
emits: ["update:field-config-map", "click:reset"],
|
17
20
|
setup(__props, { emit: __emit }) {
|
18
21
|
const props = __props;
|
19
22
|
const emit = __emit;
|
20
23
|
const dragItem = ref(null);
|
21
24
|
const dragItemNewOrder = ref(null);
|
22
25
|
const getOrder = (field) => {
|
23
|
-
if (dragItem.value === null || dragItemNewOrder.value === null) return props.
|
26
|
+
if (dragItem.value === null || dragItemNewOrder.value === null) return props.fieldConfigMap[field.label].order;
|
24
27
|
if (field.label === dragItem.value) return dragItemNewOrder.value;
|
25
|
-
if (props.
|
26
|
-
return props.
|
28
|
+
if (props.fieldConfigMap[field.label].order <= dragItemNewOrder.value) return props.fieldConfigMap[field.label].order - 1;
|
29
|
+
return props.fieldConfigMap[field.label].order;
|
27
30
|
};
|
28
|
-
const
|
29
|
-
|
31
|
+
const dragStart = (label, order) => {
|
32
|
+
dragItem.value = label;
|
33
|
+
dragItemNewOrder.value = order;
|
34
|
+
};
|
35
|
+
const dragEnter = (order, nested, first, last) => {
|
36
|
+
if (nested) {
|
37
|
+
if (dragItemNewOrder.value === null) return;
|
38
|
+
if (first) {
|
39
|
+
if (order < dragItemNewOrder.value) dragItemNewOrder.value = order;
|
40
|
+
} else if (last) {
|
41
|
+
if (order > dragItemNewOrder.value) dragItemNewOrder.value = order;
|
42
|
+
}
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
dragItemNewOrder.value = order;
|
30
46
|
};
|
31
47
|
const dragEnd = () => {
|
32
48
|
dragItem.value = null;
|
33
49
|
dragItemNewOrder.value = null;
|
34
50
|
};
|
35
51
|
const drop = () => {
|
36
|
-
const newConfig =
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
52
|
+
const newConfig = {};
|
53
|
+
const processConfig = (fields) => {
|
54
|
+
fields.forEach((field) => {
|
55
|
+
if ("label" in field) newConfig[field.label] = { ...props.fieldConfigMap[field.label], order: getOrder(field) };
|
56
|
+
if ("fields" in field) processConfig(field.fields);
|
57
|
+
}, {});
|
58
|
+
};
|
59
|
+
processConfig(props.fields);
|
60
|
+
Object.values(newConfig).sort((a, b) => a.order - b.order).forEach((item, index) => {
|
61
|
+
item.order = index;
|
62
|
+
});
|
63
|
+
if (Object.keys(newConfig).some((key) => props.fieldConfigMap[key].order !== newConfig[key].order)) emit("update:field-config-map", newConfig);
|
41
64
|
dragEnd();
|
42
65
|
};
|
43
66
|
return (_ctx, _cache) => {
|
44
67
|
return openBlock(), createBlock(_sfc_main$1, {
|
45
68
|
icon: markRaw(unref(IconTableSettings)),
|
46
69
|
disabled: _ctx.disabled,
|
47
|
-
class: "h-full w-full"
|
70
|
+
class: "h-full w-full items-center"
|
48
71
|
}, {
|
49
72
|
default: withCtx(() => [
|
50
73
|
createElementVNode("div", _hoisted_1, [
|
51
74
|
createElementVNode("div", _hoisted_2, [
|
52
|
-
(
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
order: getOrder(field)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
75
|
+
createVNode(_sfc_main$2, { fields: _ctx.fields }, {
|
76
|
+
default: withCtx(({ field, nested, first, last }) => [
|
77
|
+
createVNode(_sfc_main$3, {
|
78
|
+
field,
|
79
|
+
"field-config": _ctx.fieldConfigMap[field.label],
|
80
|
+
"query-params": _ctx.queryParams,
|
81
|
+
disabled: _ctx.disabled,
|
82
|
+
"disabled-drag": nested,
|
83
|
+
order: getOrder(field),
|
84
|
+
"onDrag:start": ($event) => dragStart(field.label, $event),
|
85
|
+
"onDrag:enter": ($event) => dragEnter($event, nested, first, last),
|
86
|
+
"onDrag:end": drop,
|
87
|
+
"onUpdate:fieldsConfigMap": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:field-config-map", { ..._ctx.fieldConfigMap, ...$event }))
|
88
|
+
}, null, 8, ["field", "field-config", "query-params", "disabled", "disabled-drag", "order", "onDrag:start", "onDrag:enter"])
|
89
|
+
]),
|
90
|
+
_: 1
|
91
|
+
}, 8, ["fields"])
|
68
92
|
]),
|
69
|
-
_cache[
|
70
|
-
|
93
|
+
_cache[2] || (_cache[2] = createElementVNode("div", { class: "border-b border-solid border-gray-200 dark:border-gray-700 my-4" }, null, -1)),
|
94
|
+
createElementVNode("button", {
|
95
|
+
class: normalizeClass(["relative py-1 px-2 rounded-lg bg-gray-100 dark:bg-gray-800", {
|
96
|
+
"w-ripple w-ripple-hover": _ctx.hasSaved,
|
97
|
+
"cursor-not-allowed opacity-50": !_ctx.hasSaved
|
98
|
+
}]),
|
99
|
+
disabled: !_ctx.hasSaved,
|
100
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.hasSaved && _ctx.$emit("click:reset"))
|
101
|
+
}, " Reset ", 10, _hoisted_3)
|
71
102
|
])
|
72
103
|
]),
|
73
104
|
_: 1
|
@@ -1,23 +1,25 @@
|
|
1
1
|
import { FieldConfig, ListField } from '../types';
|
2
2
|
declare const _default: <Data extends DefaultData, QueryParams>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
|
-
readonly "onUpdate:fields-config"?: ((value: Record<string, FieldConfig>) => any) | undefined;
|
5
|
-
readonly "onDrag:start"?: (() => any) | undefined;
|
6
|
-
readonly "onDrag:enter"?: (() => any) | undefined;
|
4
|
+
readonly "onUpdate:fields-config-map"?: ((value: Record<string, FieldConfig>) => any) | undefined;
|
5
|
+
readonly "onDrag:start"?: ((order: number) => any) | undefined;
|
6
|
+
readonly "onDrag:enter"?: ((order: number) => any) | undefined;
|
7
7
|
readonly "onDrag:end"?: (() => any) | undefined;
|
8
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:fields-config" | "onDrag:start" | "onDrag:enter" | "onDrag:end"> & {
|
8
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:fields-config-map" | "onDrag:start" | "onDrag:enter" | "onDrag:end"> & {
|
9
9
|
field: ListField<Data, QueryParams>;
|
10
10
|
fieldConfig: FieldConfig;
|
11
11
|
queryParams: QueryParams;
|
12
12
|
disabled?: boolean;
|
13
|
+
disabledDrag?: boolean;
|
14
|
+
order: number;
|
13
15
|
}> & import('vue').PublicProps;
|
14
16
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
15
17
|
attrs: any;
|
16
18
|
slots: {};
|
17
19
|
emit: {
|
18
|
-
(e: "update:fields-config", value: Record<string, FieldConfig>): void;
|
19
|
-
(e: "drag:start"): void;
|
20
|
-
(e: "drag:enter"): void;
|
20
|
+
(e: "update:fields-config-map", value: Record<string, FieldConfig>): void;
|
21
|
+
(e: "drag:start", order: number): void;
|
22
|
+
(e: "drag:enter", order: number): void;
|
21
23
|
(e: "drag:end"): void;
|
22
24
|
};
|
23
25
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HeaderSettingsItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderSettingsItem.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"HeaderSettingsItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderSettingsItem.vue"],"names":[],"mappings":"AAqFA,OAAO,KAAK,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;yBAKnC,IAAI,SAAS,WAAW,EAAE,WAAW,eACxC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAmKxD,mBAAmB,CAAC;;;;;;eA/JrB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;qBACtB,WAAW;qBACX,WAAW;mBACb,OAAO;uBACH,OAAO;eACf,MAAM;KA0JwE,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YAvJP,0BAA0B,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;YACrE,YAAY,SAAS,MAAM,GAAG,IAAI;YAClC,YAAY,SAAS,MAAM,GAAG,IAAI;YAClC,UAAU,GAAG,IAAI;;;;;YAyJqB,OAAO,CAAC,OAAO,WAAW,CAAC;;AA7KvE,wBA6K4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,20 +1,23 @@
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, normalizeClass,
|
1
|
+
import { defineComponent, ref, openBlock, createElementBlock, normalizeClass, normalizeStyle, withModifiers, createVNode, unref, createCommentVNode, createElementVNode, toDisplayString, createBlock, resolveDynamicComponent } from 'vue';
|
2
2
|
import IconDrag from '../../../assets/icons/sax/IconDrag.svg.js';
|
3
3
|
import IconEye from '../../../assets/icons/sax/IconEye.svg.js';
|
4
4
|
import IconEyeSlash from '../../../assets/icons/sax/IconEyeSlash.svg.js';
|
5
5
|
|
6
6
|
const _hoisted_1 = ["draggable"];
|
7
|
-
const _hoisted_2 = { class: "px-2 py-1 self-center font-semibold" };
|
7
|
+
const _hoisted_2 = { class: "px-2 py-1 self-center font-semibold col-start-2" };
|
8
8
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
9
|
__name: "HeaderSettingsItem",
|
10
10
|
props: {
|
11
11
|
field: {},
|
12
12
|
fieldConfig: {},
|
13
13
|
queryParams: {},
|
14
|
-
disabled: { type: Boolean }
|
14
|
+
disabled: { type: Boolean },
|
15
|
+
disabledDrag: { type: Boolean },
|
16
|
+
order: {}
|
15
17
|
},
|
16
|
-
emits: ["update:fields-config", "drag:start", "drag:enter", "drag:end"],
|
18
|
+
emits: ["update:fields-config-map", "drag:start", "drag:enter", "drag:end"],
|
17
19
|
setup(__props, { emit: __emit }) {
|
20
|
+
const props = __props;
|
18
21
|
const emit = __emit;
|
19
22
|
const isDraggable = ref(false);
|
20
23
|
const isDragging = ref(false);
|
@@ -23,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
23
26
|
};
|
24
27
|
const startDrag = () => {
|
25
28
|
isDragging.value = true;
|
26
|
-
emit("drag:start");
|
29
|
+
emit("drag:start", props.order);
|
27
30
|
};
|
28
31
|
const endDrag = () => {
|
29
32
|
isDraggable.value = false;
|
@@ -33,30 +36,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
33
36
|
return (_ctx, _cache) => {
|
34
37
|
return openBlock(), createElementBlock("div", {
|
35
38
|
draggable: isDraggable.value,
|
36
|
-
class: normalizeClass(["grid grid-cols-[
|
39
|
+
class: normalizeClass(["grid grid-cols-[1.75rem,1fr,auto] text-description select-none bg-default dark:bg-default-dark", {
|
37
40
|
"opacity-[0.001]": isDragging.value,
|
38
41
|
"opacity-50": !_ctx.fieldConfig.visible && !isDragging.value
|
39
42
|
}]),
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
style: normalizeStyle({ order: _ctx.order }),
|
44
|
+
onDragstart: _cache[1] || (_cache[1] = ($event) => !_ctx.disabledDrag && startDrag()),
|
45
|
+
onDragend: _cache[2] || (_cache[2] = ($event) => !_ctx.disabledDrag && endDrag()),
|
46
|
+
onDragenter: _cache[3] || (_cache[3] = ($event) => !isDraggable.value && _ctx.$emit("drag:enter", _ctx.order)),
|
47
|
+
onDragover: _cache[4] || (_cache[4] = withModifiers(() => {
|
44
48
|
}, ["stop", "prevent"]))
|
45
49
|
}, [
|
46
|
-
|
47
|
-
|
50
|
+
!_ctx.disabledDrag ? (openBlock(), createElementBlock("button", {
|
51
|
+
key: 0,
|
52
|
+
class: "relative w-ripple w-ripple-hover flex items-center justify-center",
|
48
53
|
onMousedown: initDrag
|
49
54
|
}, [
|
50
55
|
createVNode(unref(IconDrag), { class: "rotate-90" })
|
51
|
-
], 32),
|
56
|
+
], 32)) : createCommentVNode("", true),
|
52
57
|
createElementVNode("div", _hoisted_2, toDisplayString(typeof _ctx.field.title === "string" ? _ctx.field.title : _ctx.field.title(_ctx.queryParams)), 1),
|
53
58
|
createElementVNode("button", {
|
54
59
|
class: "relative w-ripple w-ripple-hover px-2 flex items-center",
|
55
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fields-config", { [_ctx.field.label]: { ..._ctx.fieldConfig, visible: !_ctx.fieldConfig.visible } }))
|
60
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fields-config-map", { [_ctx.field.label]: { ..._ctx.fieldConfig, visible: !_ctx.fieldConfig.visible } }))
|
56
61
|
}, [
|
57
62
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.fieldConfig.visible ? unref(IconEye) : unref(IconEyeSlash)), { class: "pointer-events-none" }))
|
58
63
|
])
|
59
|
-
],
|
64
|
+
], 46, _hoisted_1);
|
60
65
|
};
|
61
66
|
}
|
62
67
|
});
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { ListField, ListFields } from '../types';
|
2
|
+
declare const _default: <Data extends DefaultData, QueryParams>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
4
|
+
fields: ListFields<Data, QueryParams>;
|
5
|
+
item: Data;
|
6
|
+
}> & import('vue').PublicProps;
|
7
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
8
|
+
attrs: any;
|
9
|
+
slots: Readonly<{
|
10
|
+
default: (props: {
|
11
|
+
field: ListField<Data, QueryParams>;
|
12
|
+
item: Data;
|
13
|
+
}) => void;
|
14
|
+
}> & {
|
15
|
+
default: (props: {
|
16
|
+
field: ListField<Data, QueryParams>;
|
17
|
+
item: Data;
|
18
|
+
}) => void;
|
19
|
+
};
|
20
|
+
emit: {};
|
21
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
22
|
+
[key: string]: any;
|
23
|
+
}> & {
|
24
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
25
|
+
};
|
26
|
+
export default _default;
|
27
|
+
type __VLS_PrettifyLocal<T> = {
|
28
|
+
[K in keyof T]: T[K];
|
29
|
+
} & {};
|
30
|
+
//# sourceMappingURL=ListCardFieldNested.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ListCardFieldNested.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/ListCardFieldNested.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,UAAU,CAAA;yBAIlC,IAAI,SAAS,WAAW,EAAE,WAAW,eACxC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA6GxD,mBAAmB,CAAC;gBAzGpB,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;cAC/B,IAAI;KAwG2E,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;iBArGF,CAAC,KAAK,EAAE;YAAC,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAAC,IAAI,EAAE,IAAI,CAAA;SAAC,KAAK,IAAI;;iBAAlE,CAAC,KAAK,EAAE;YAAC,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YAAC,IAAI,EAAE,IAAI,CAAA;SAAC,KAAK,IAAI;;UAuGpE,EAAE;;;;YAGiC,OAAO,CAAC,OAAO,WAAW,CAAC;;AAvHvE,wBAuH4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, normalizeClass, createVNode, withCtx, renderSlot, mergeProps } from 'vue';
|
2
|
+
import { getFirstFieldLabel } from '../use/useFieldConfigMap.js';
|
3
|
+
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
5
|
+
__name: "ListCardFieldNested",
|
6
|
+
props: {
|
7
|
+
fields: {},
|
8
|
+
item: {}
|
9
|
+
},
|
10
|
+
setup(__props) {
|
11
|
+
return (_ctx, _cache) => {
|
12
|
+
const _component_ListCardFieldNested = resolveComponent("ListCardFieldNested", true);
|
13
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fields, (field) => {
|
14
|
+
return openBlock(), createElementBlock(Fragment, {
|
15
|
+
key: unref(getFirstFieldLabel)(field)
|
16
|
+
}, [
|
17
|
+
"fields" in field ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
18
|
+
"keyArray" in field ? (openBlock(), createElementBlock("div", {
|
19
|
+
key: 0,
|
20
|
+
class: normalizeClass([field.cssClassArray, "sm:mr-6"])
|
21
|
+
}, [
|
22
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.item[field.keyArray], (inner) => {
|
23
|
+
return openBlock(), createElementBlock("div", {
|
24
|
+
key: inner.id,
|
25
|
+
class: normalizeClass([field.cssClass, "flex"])
|
26
|
+
}, [
|
27
|
+
createVNode(_component_ListCardFieldNested, {
|
28
|
+
fields: field.fields,
|
29
|
+
item: inner
|
30
|
+
}, {
|
31
|
+
default: withCtx((defaultScope) => [
|
32
|
+
renderSlot(_ctx.$slots, "default", mergeProps({ ref_for: true }, defaultScope))
|
33
|
+
]),
|
34
|
+
_: 2
|
35
|
+
}, 1032, ["fields", "item"])
|
36
|
+
], 2);
|
37
|
+
}), 128))
|
38
|
+
], 2)) : (openBlock(), createElementBlock("div", {
|
39
|
+
key: 1,
|
40
|
+
class: normalizeClass([field.cssClass, "flex sm:mr-6"])
|
41
|
+
}, [
|
42
|
+
createVNode(_component_ListCardFieldNested, {
|
43
|
+
fields: field.fields,
|
44
|
+
item: "keyEntity" in field ? _ctx.item[field.keyEntity] : _ctx.item
|
45
|
+
}, {
|
46
|
+
default: withCtx((defaultScope) => [
|
47
|
+
renderSlot(_ctx.$slots, "default", mergeProps({ ref_for: true }, defaultScope))
|
48
|
+
]),
|
49
|
+
_: 2
|
50
|
+
}, 1032, ["fields", "item"])
|
51
|
+
], 2))
|
52
|
+
], 64)) : renderSlot(_ctx.$slots, "default", {
|
53
|
+
key: 1,
|
54
|
+
field,
|
55
|
+
item: _ctx.item
|
56
|
+
})
|
57
|
+
], 64);
|
58
|
+
}), 128);
|
59
|
+
};
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
export { _sfc_main as default };
|
@@ -14,6 +14,26 @@ export type ListField<Data, QueryParams = unknown> = {
|
|
14
14
|
visibleGetter?: (params: QueryParams) => boolean;
|
15
15
|
allowResize?: boolean;
|
16
16
|
};
|
17
|
+
export type ListFieldNested<Data, QueryParams = unknown> = {
|
18
|
+
cssClass?: string;
|
19
|
+
fields: ListFields<Data, QueryParams>;
|
20
|
+
};
|
21
|
+
type FieldNestedEntity<Data, QueryParams = unknown, Key extends keyof PickByType<Data, NonNullable<unknown>> = keyof PickByType<Data, NonNullable<unknown>>> = {
|
22
|
+
keyEntity: Key;
|
23
|
+
fields: ListFields<Data[Key], QueryParams>;
|
24
|
+
};
|
25
|
+
export interface ListFieldNestedEntity<Data, QueryParams = unknown> extends FieldNestedEntity<Data, QueryParams> {
|
26
|
+
cssClass?: string;
|
27
|
+
}
|
28
|
+
type FieldNestedArray<Data, QueryParams = unknown, Key extends keyof PickByType<Data, Array<unknown>> = keyof PickByType<Data, Array<unknown>>> = {
|
29
|
+
keyArray: Key;
|
30
|
+
fields: Data[Key] extends Array<infer Inner> ? ListFields<Inner, QueryParams> : [];
|
31
|
+
};
|
32
|
+
export interface ListFieldNestedArray<Data, QueryParams = unknown> extends FieldNestedArray<Data, QueryParams> {
|
33
|
+
cssClass?: string;
|
34
|
+
cssClassArray?: string;
|
35
|
+
}
|
36
|
+
export type ListFields<Data, QueryParams = unknown> = (ListField<Data, QueryParams> | ListFieldNested<Data, QueryParams> | ListFieldNestedEntity<Data, QueryParams> | ListFieldNestedArray<Data, QueryParams>)[];
|
17
37
|
export type MenuComponent<Data> = Component<{
|
18
38
|
item: Data;
|
19
39
|
readonly?: boolean;
|
@@ -24,8 +44,16 @@ export type BulkComponent<QueryParams> = Component<{
|
|
24
44
|
disableMessage?: string;
|
25
45
|
}>;
|
26
46
|
export type FieldConfig = {
|
27
|
-
width: number;
|
47
|
+
width: number | null;
|
28
48
|
visible: boolean;
|
29
49
|
order: number;
|
30
50
|
};
|
51
|
+
type GetFieldLabelsTuple<Fields> = Fields extends [infer Head, ...infer Tail] ? Head extends {
|
52
|
+
label: infer Label;
|
53
|
+
} ? [Label, ...GetFieldLabelsTuple<Tail>] : Head extends {
|
54
|
+
fields: infer InnerFields;
|
55
|
+
} ? [...GetFieldLabelsTuple<InnerFields>, ...GetFieldLabelsTuple<Tail>] : GetFieldLabelsTuple<Tail> : [];
|
56
|
+
export type GetFieldLabels<Fields extends ListFields<unknown>> = GetFieldLabelsTuple<Fields>[number];
|
57
|
+
export type FieldConfigMap<Fields extends ListFields<any, any>> = Record<GetFieldLabels<Fields>, FieldConfig>;
|
58
|
+
export {};
|
31
59
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/List/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,KAAK,CAAA;AAEvC,MAAM,MAAM,cAAc,CAAC,IAAI,IAAI,SAAS,CAAC;IAC3C,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAEF,MAAM,MAAM,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,IAAI;IACnD,SAAS,EAAE,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAA;IACpC,KAAK,EAAE,MAAM,GAAG,CAAC,C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C,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GACzE,IAAI,SAAS;IAAC,KAAK,EAAE,MAAM,KAAK,CAAA;CAAC,GACjC,CAAC,KAAK,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,GACrC,IAAI,SAAS;IAAC,MAAM,EAAE,MAAM,WAAW,CAAA;CAAC,GACxC,CAAC,GAAG,mBAAmB,CAAC,WAAW,CAAC,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,GACnE,mBAAmB,CAAC,IAAI,CAAC,GACzB,EAAE,CAAA;AAEN,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,UAAU,CAAC,OAAO,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAGpG,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { MaybeRef } from 'vue';
|
2
|
+
import { FieldConfig, FieldConfigMap, ListField, ListFields } from '../types';
|
3
|
+
export declare const filterFields: <F extends ListFields<any, any>>(fields: F, method: (field: ListField<unknown>) => boolean) => F;
|
4
|
+
export declare const getFirstFieldLabel: <F extends ListFields<any, any>[number]>(field: F) => string;
|
5
|
+
export declare const useFieldConfigMap: <Fields extends ListFields<any, any>>(key: MaybeRef<string>, fields: MaybeRef<Fields>, defaultConfigMap: MaybeRef<FieldConfigMap<Fields>>) => {
|
6
|
+
fieldConfigMap: import('vue').WritableComputedRef<Record<string, FieldConfig>, Record<string, FieldConfig>>;
|
7
|
+
hasSaved: import('vue').Ref<boolean, boolean>;
|
8
|
+
reset: () => void;
|
9
|
+
};
|
10
|
+
//# sourceMappingURL=useFieldConfigMap.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useFieldConfigMap.d.ts","sourceRoot":"","sources":["../../../../src/components/List/use/useFieldConfigMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,QAAQ,EAAC,MAAM,KAAK,CAAA;AACrE,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,UAAU,CAAA;AA6DhF,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,OAAO,KAAG,CAUxH,CAAA;AAGD,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAG,MAErF,CAAA;AAGD,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,QAAQ,CAAC,MAAM,CAAC,oBAAoB,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;;;;CA8BzK,CAAA"}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { ref, unref, computed, isRef, watch } from 'vue';
|
2
|
+
|
3
|
+
const fieldConfigKeyLength = 3;
|
4
|
+
const isFieldConfig = (value) => {
|
5
|
+
return value instanceof Object && Object.keys(value).length <= fieldConfigKeyLength && (!("width" in value) || value.width === null || typeof value.width === "number") && (!("visible" in value) || typeof value.visible === "boolean") && (!("order" in value) || typeof value.order === "number");
|
6
|
+
};
|
7
|
+
const parseFieldConfigMap = (value, fields, defaultConfigMap) => {
|
8
|
+
const configMap = {};
|
9
|
+
const processFields = (fieldList) => {
|
10
|
+
fieldList.forEach((field) => {
|
11
|
+
if ("fields" in field) {
|
12
|
+
processFields(field.fields);
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
const config = value instanceof Object && field.label in value ? value[field.label] : void 0;
|
16
|
+
const defaultConfig = defaultConfigMap[field.label];
|
17
|
+
if (!isFieldConfig(config)) {
|
18
|
+
configMap[field.label] = { ...defaultConfig };
|
19
|
+
} else {
|
20
|
+
configMap[field.label] = {
|
21
|
+
width: config.width ?? null,
|
22
|
+
visible: config.visible ?? defaultConfig.visible,
|
23
|
+
order: config.order ?? defaultConfig.order
|
24
|
+
};
|
25
|
+
}
|
26
|
+
});
|
27
|
+
};
|
28
|
+
processFields(fields);
|
29
|
+
Object.values(configMap).sort((a, b) => a.order - b.order).forEach((item, index) => {
|
30
|
+
item.order = index;
|
31
|
+
});
|
32
|
+
return configMap;
|
33
|
+
};
|
34
|
+
const getFieldConfigMap = (key) => {
|
35
|
+
const value = localStorage.getItem(key);
|
36
|
+
if (typeof value !== "string") return void 0;
|
37
|
+
try {
|
38
|
+
return JSON.parse(value);
|
39
|
+
} catch {
|
40
|
+
return void 0;
|
41
|
+
}
|
42
|
+
};
|
43
|
+
const filterFields = (fields, method) => {
|
44
|
+
return fields.reduce((result, field) => {
|
45
|
+
if ("fields" in field) {
|
46
|
+
const fields2 = filterFields(field.fields, method);
|
47
|
+
if (fields2.length) result.push({ ...field, fields: fields2 });
|
48
|
+
} else if (method(field)) result.push(field);
|
49
|
+
return result;
|
50
|
+
}, []);
|
51
|
+
};
|
52
|
+
const getFirstFieldLabel = (field) => {
|
53
|
+
return "label" in field ? field.label : getFirstFieldLabel(field.fields[0]);
|
54
|
+
};
|
55
|
+
const useFieldConfigMap = (key, fields, defaultConfigMap) => {
|
56
|
+
const value = ref(parseFieldConfigMap(getFieldConfigMap(unref(key)), unref(fields), unref(defaultConfigMap)));
|
57
|
+
const hasSaved = ref(localStorage.getItem(unref(key)) !== null);
|
58
|
+
const fieldConfigMap = computed({
|
59
|
+
get: () => value.value,
|
60
|
+
set: (newValue) => {
|
61
|
+
value.value = newValue;
|
62
|
+
hasSaved.value = true;
|
63
|
+
localStorage.setItem(unref(key), JSON.stringify(newValue));
|
64
|
+
}
|
65
|
+
});
|
66
|
+
const reset = () => {
|
67
|
+
value.value = parseFieldConfigMap(void 0, unref(fields), unref(defaultConfigMap));
|
68
|
+
hasSaved.value = false;
|
69
|
+
localStorage.removeItem(unref(key));
|
70
|
+
};
|
71
|
+
if (isRef(key)) {
|
72
|
+
watch(key, (newKey) => {
|
73
|
+
value.value = parseFieldConfigMap(getFieldConfigMap(unref(newKey)), unref(fields), unref(defaultConfigMap));
|
74
|
+
});
|
75
|
+
}
|
76
|
+
return {
|
77
|
+
fieldConfigMap,
|
78
|
+
hasSaved,
|
79
|
+
reset
|
80
|
+
};
|
81
|
+
};
|
82
|
+
|
83
|
+
export { filterFields, getFirstFieldLabel, useFieldConfigMap };
|
package/dist/main.js
CHANGED
@@ -86,5 +86,5 @@ export { getIsMobile, getIsTouchDevice } from './utils/mobile.js';
|
|
86
86
|
export { useDefaultQuery } from './utils/useDefaultQuery.js';
|
87
87
|
export { paginatedResponseUpdater, useQueryUpdater } from './utils/useQueryUpdater.js';
|
88
88
|
export { useCopy } from './utils/useCopy.js';
|
89
|
-
export { debounce, genId, get, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, isId, isIndex, isPage, numberCompactFormatter, numberFormatter, parseId, parseIndex, percentCompactFormatter, set, throttle } from './utils/utils.js';
|
89
|
+
export { debounce, genId, get, getAllScrollParents, getDefaultFieldConfigMap, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, isId, isIndex, isPage, numberCompactFormatter, numberFormatter, parseId, parseIndex, percentCompactFormatter, set, throttle } from './utils/utils.js';
|
90
90
|
export { validateRequired } from './utils/validate.js';
|
package/dist/utils/utils.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { FieldConfigMap, GetFieldLabels, ListFields } from '../components/List/types';
|
1
2
|
export declare const getScrollParent: (node: Element) => Element | null;
|
2
3
|
export declare const getAllScrollParents: (node?: Element, max?: number) => Array<Element>;
|
3
4
|
export declare const hasParent: (parent: Element, current: Element) => boolean;
|
@@ -18,5 +19,6 @@ export declare const isIndex: (value: unknown) => value is number;
|
|
18
19
|
export declare const parseIndex: (value: unknown) => number;
|
19
20
|
export declare const get: <FieldType, Data extends Record<string, unknown>>(data: Data, path: keyof ObjectPaths<Data, FieldType>) => FieldType | undefined;
|
20
21
|
export declare const set: <FieldType, Data extends Record<string, unknown>>(data: Data, path: keyof ObjectPaths<Data, FieldType>, value: FieldType) => Data;
|
22
|
+
export declare const getDefaultFieldConfigMap: <Fields extends ListFields<any, any>>(fields: Fields, visible: GetFieldLabels<Fields>[]) => FieldConfigMap<Fields>;
|
21
23
|
export {};
|
22
24
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,cAAc,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAYpG,eAAO,MAAM,eAAe,SAAU,OAAO,KAAG,OAAO,GAAG,IAKhD,CAAA;AAEV,eAAO,MAAM,mBAAmB,UAAW,OAAO,mBAAa,KAAK,CAAC,OAAO,CAa3E,CAAA;AAED,eAAO,MAAM,SAAS,WAAY,OAAO,WAAW,OAAO,KAAG,OAI7D,CAAA;AAGD,KAAK,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;AAE1C,wBAAgB,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAM,GAAG,CAAC,CAWpE;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAM,GAAG,CAAC,CAYpE;AAED,eAAO,MAAM,UAAU,SAAU,OAAO,EAAE,QAAQ,OA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J,CAAA"}
|
package/dist/utils/utils.js
CHANGED
@@ -94,5 +94,18 @@ const set = (data, path, value) => {
|
|
94
94
|
}, data);
|
95
95
|
return data;
|
96
96
|
};
|
97
|
+
const getDefaultFieldConfigMap = (fields, visible) => {
|
98
|
+
const result = {};
|
99
|
+
let order = 0;
|
100
|
+
const processFields = (fieldList) => {
|
101
|
+
fieldList.forEach((field) => {
|
102
|
+
if ("fields" in field) processFields(field.fields);
|
103
|
+
else result[field.label] = { width: null, visible: visible.includes(field.label), order };
|
104
|
+
order++;
|
105
|
+
});
|
106
|
+
};
|
107
|
+
processFields(fields);
|
108
|
+
return result;
|
109
|
+
};
|
97
110
|
|
98
|
-
export { debounce, genId, get, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, isId, isIndex, isPage, numberCompactFormatter, numberFormatter, parseId, parseIndex, percentCompactFormatter, set, throttle };
|
111
|
+
export { debounce, genId, get, getAllScrollParents, getDefaultFieldConfigMap, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, isId, isIndex, isPage, numberCompactFormatter, numberFormatter, parseId, parseIndex, percentCompactFormatter, set, throttle };
|
package/package.json
CHANGED
@@ -119,6 +119,8 @@ module.exports = plugin(function ({matchUtilities, addVariant, addUtilities, add
|
|
119
119
|
addVariant('touch-not', '.touch-not &')
|
120
120
|
addVariant('focus-within-not', '&:not(:focus-within)')
|
121
121
|
addVariant('resizer', '&::-webkit-resizer')
|
122
|
+
addVariant('last-not', '&:not(:last-child)')
|
123
|
+
addVariant('first-not', '&:not(:first-child)')
|
122
124
|
|
123
125
|
addBase({
|
124
126
|
'.w-input': {
|