eco-vue-js 0.8.21 → 0.8.23
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 +5 -3
- package/dist/components/List/WList.vue.d.ts.map +1 -1
- package/dist/components/List/WList.vue.js +38 -44
- package/dist/components/List/WListCard.vue.d.ts.map +1 -1
- package/dist/components/List/WListCard.vue.js +19 -6
- package/dist/components/List/WListCardField.vue.d.ts +2 -1
- package/dist/components/List/WListCardField.vue.d.ts.map +1 -1
- package/dist/components/List/WListCardField.vue.js +10 -23
- 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 +9 -4
- package/dist/components/List/components/HeaderSettings.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderSettings.vue.js +23 -13
- package/dist/components/List/components/HeaderSettingsItem.vue.d.ts +3 -3
- package/dist/components/List/components/HeaderSettingsItem.vue.d.ts.map +1 -1
- package/dist/components/List/components/HeaderSettingsItem.vue.js +2 -2
- package/dist/components/List/types.d.ts +2 -2
- package/dist/components/List/types.d.ts.map +1 -1
- package/dist/components/List/use/useFieldConfigMap.d.ts +8 -0
- package/dist/components/List/use/useFieldConfigMap.d.ts.map +1 -0
- package/dist/components/List/use/useFieldConfigMap.js +63 -0
- package/dist/components/Tooltip/WTooltip.vue.d.ts +3 -1
- package/dist/components/Tooltip/WTooltip.vue.d.ts.map +1 -1
- package/dist/components/Tooltip/WTooltip.vue.js +9 -9
- 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 +7 -1
- package/package.json +1 -1
- package/tailwind-base/plugins/default.cjs +3 -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;YA6GQ,GAAG;;;WASnB,OAAO,IAA6B;EAEjD;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;WArJZ,YAAY;eACR,OAAO;;WADX,YAAY;eACR,OAAO;iGA0JlB,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
|
30
|
+
}, "outline-none flex items-center 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, ListField, MenuComponent } 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<{
|
1
|
+
import { BulkComponent, FieldComponent, FieldConfigMap, ListField, MenuComponent } from './types';
|
2
|
+
declare const _default: <Data extends DefaultData, QueryParams, Fields extends ListField<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,8 @@ 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>;
|
21
23
|
}> & import('vue').PublicProps;
|
22
24
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
23
25
|
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":"","sources":["../../../src/components/List/WList.vue"],"names":[],"mappings":"AA2RA,OAAO,KAAK,EAAC,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,SAAS,CAAA;yBASnF,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,eACvF,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;WAmkBxD,mBAAmB,CAAC;;;gBA3jBpB,MAAM;gBACN,MAAM;oBACF,cAAc,CAAC,IAAI,CAAC;oBACpB,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC;qBACnC,WAAW;6BACH,MAAM;wBACX,MAAM;eACf,aAAa,CAAC,WAAW,CAAC,EAAE;mBACxB,aAAa,CAAC,WAAW,CAAC,EAAE;cACjC,aAAa,CAAC,IAAI,CAAC,EAAE;yBACV,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO;oBAC5B,MAAM;6BACG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM;oBACvD,OAAO;qBACN,OAAO;mBACT,MAAM;0BACC,cAAc,CAAC,MAAM,CAAC;KA2iB6C,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;cAxiBP,uBAAuB,SAAS,MAAM,KAAG,IAAI;;;;YA6iBP,OAAO,CAAC,OAAO,WAAW,CAAC;;AA7kBvE,wBA6kB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
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, isRef, normalizeStyle } 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';
|
@@ -8,6 +8,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
10
|
import _sfc_main$4 from './components/HeaderSettings.vue.js';
|
11
|
+
import { useFieldConfigMap } from './use/useFieldConfigMap.js';
|
11
12
|
|
12
13
|
const PAGE_LENGTH = 24;
|
13
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
@@ -27,7 +28,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
27
28
|
cardClass: {},
|
28
29
|
selectAllTextGetter: { type: Function },
|
29
30
|
hasBorder: { type: Boolean },
|
30
|
-
moreBottom: { type: Boolean }
|
31
|
+
moreBottom: { type: Boolean },
|
32
|
+
configKey: {},
|
33
|
+
defaultConfigMap: {}
|
31
34
|
},
|
32
35
|
emits: ["update:header-padding"],
|
33
36
|
setup(__props) {
|
@@ -35,20 +38,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
35
38
|
const props = __props;
|
36
39
|
const listCount = ref(0);
|
37
40
|
const selectionCount = ref(0);
|
38
|
-
const fieldsConfig = ref(props.fields.reduce((result, field, index) => {
|
39
|
-
result[field.label] = {
|
40
|
-
width: 0,
|
41
|
-
visible: true,
|
42
|
-
order: index
|
43
|
-
};
|
44
|
-
return result;
|
45
|
-
}, {}));
|
46
41
|
const fieldsVisible = computed(() => props.fields.filter((field) => field.visibleGetter?.(props.queryParams) ?? true));
|
42
|
+
const { fieldConfigMap, hasSaved, reset } = useFieldConfigMap(toRef(props, "configKey"), fieldsVisible, toRef(props, "defaultConfigMap"));
|
47
43
|
const fieldsFiltered = computed(() => {
|
48
44
|
if (isMobile) return fieldsVisible.value;
|
49
|
-
return fieldsVisible.value.filter((field) =>
|
45
|
+
return fieldsVisible.value.filter((field) => fieldConfigMap.value[field.label]?.visible).sort((a, b) => fieldConfigMap.value[a.label].order - fieldConfigMap.value[b.label].order);
|
50
46
|
});
|
51
47
|
const allowSelect = computed(() => props.bulk !== void 0);
|
48
|
+
const allowOpen = computed(() => props.expansion !== void 0);
|
52
49
|
const {
|
53
50
|
selected,
|
54
51
|
reverse,
|
@@ -106,8 +103,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
106
103
|
onSelect: unref(setSelected),
|
107
104
|
onSelectReverse: unref(setSelectedReverse),
|
108
105
|
onSelectRange: unref(setSelectedRange),
|
109
|
-
"onUpdate:headerPadding": _cache[
|
110
|
-
"onUpdate:count": _cache[
|
106
|
+
"onUpdate:headerPadding": _cache[6] || (_cache[6] = ($event) => _ctx.$emit("update:header-padding", $event)),
|
107
|
+
"onUpdate:count": _cache[7] || (_cache[7] = ($event) => listCount.value = $event)
|
111
108
|
}, {
|
112
109
|
header: withCtx(({ selectAllValue }) => [
|
113
110
|
allowSelect.value ? (openBlock(), createBlock(_sfc_main$2, {
|
@@ -155,15 +152,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
155
152
|
"tooltip-text": _ctx.selectAllTextGetter(selectAllValue !== true, _ctx.count ?? listCount.value),
|
156
153
|
count: _ctx.count ?? listCount.value,
|
157
154
|
selection: selectAllValue,
|
158
|
-
"onToggle:selection": _cache[
|
155
|
+
"onToggle:selection": _cache[5] || (_cache[5] = ($event) => $event ? unref(setSelectedReverse)([]) : unref(setSelected)([]))
|
159
156
|
}, {
|
160
157
|
settings: withCtx(() => [
|
161
158
|
createVNode(_sfc_main$4, {
|
162
|
-
|
163
|
-
"
|
159
|
+
"field-config-map": unref(fieldConfigMap),
|
160
|
+
"onUpdate:fieldConfigMap": _cache[4] || (_cache[4] = ($event) => isRef(fieldConfigMap) ? fieldConfigMap.value = $event : null),
|
161
|
+
fields: fieldsVisible.value,
|
164
162
|
"query-params": _ctx.queryParams,
|
165
|
-
"
|
166
|
-
|
163
|
+
"has-saved": unref(hasSaved),
|
164
|
+
"onClick:reset": unref(reset)
|
165
|
+
}, null, 8, ["field-config-map", "fields", "query-params", "has-saved", "onClick:reset"])
|
167
166
|
]),
|
168
167
|
default: withCtx(() => [
|
169
168
|
(openBlock(true), createElementBlock(Fragment, null, renderList(fieldsFiltered.value, (field) => {
|
@@ -176,9 +175,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
176
175
|
disabled: !field.field,
|
177
176
|
"allow-resize": field.allowResize,
|
178
177
|
style: normalizeStyle({
|
179
|
-
minWidth: !unref(isMobile) &&
|
178
|
+
minWidth: !unref(isMobile) && unref(fieldConfigMap)[field.label]?.width ? unref(fieldConfigMap)[field.label].width + "px" : void 0
|
180
179
|
}),
|
181
|
-
"onUpdate:width": ($event) =>
|
180
|
+
"onUpdate:width": ($event) => unref(fieldConfigMap)[field.label].width = $event,
|
181
|
+
"onSave:width": _cache[3] || (_cache[3] = ($event) => fieldConfigMap.value = unref(fieldConfigMap))
|
182
182
|
}, null, 8, ["title", "field", "class", "ordering", "disabled", "allow-resize", "style", "onUpdate:width"]);
|
183
183
|
}), 128))
|
184
184
|
]),
|
@@ -192,46 +192,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
192
192
|
"card-class": _ctx.cardClass,
|
193
193
|
"has-border": _ctx.hasBorder,
|
194
194
|
"more-bottom": _ctx.moreBottom,
|
195
|
-
"allow-open":
|
195
|
+
"allow-open": allowOpen.value && !skeleton
|
196
196
|
}, createSlots({
|
197
|
-
|
198
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
199
|
-
return openBlock(), createBlock(resolveDynamicComponent(
|
200
|
-
key:
|
197
|
+
more: withCtx(() => [
|
198
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menu, (menuItem, menuIndex) => {
|
199
|
+
return openBlock(), createBlock(resolveDynamicComponent(menuItem), {
|
200
|
+
key: menuIndex,
|
201
201
|
item,
|
202
202
|
readonly: _ctx.readonlyGetter?.(item),
|
203
|
-
skeleton,
|
204
|
-
mobile: unref(isMobile),
|
205
|
-
class: normalizeClass({
|
206
|
-
[field.cssClass ?? ""]: true,
|
207
|
-
"cursor-pointer w-ripple w-ripple-hover w-ripple-has w-ripple-opacity-[0.04]": field.allowOpen && !skeleton,
|
208
|
-
"sm:border-y border-gray-300 dark:border-gray-700": _ctx.hasBorder,
|
209
|
-
"sm:border-b-[transparent] sm:dark:border-b-[transparent]": _ctx.hasBorder && isOpen
|
210
|
-
}),
|
211
|
-
style: normalizeStyle({
|
212
|
-
minWidth: !unref(isMobile) && fieldsConfig.value[field.label]?.width ? fieldsConfig.value[field.label].width + "px" : void 0
|
213
|
-
}),
|
214
203
|
"onUpdate:item": setter,
|
215
204
|
"onDelete:item": ($event) => {
|
216
205
|
setter();
|
217
206
|
refetch();
|
218
|
-
}
|
219
|
-
|
220
|
-
}, null, 40, ["item", "readonly", "skeleton", "mobile", "class", "style", "onUpdate:item", "onDelete:item", "onClick"]);
|
207
|
+
}
|
208
|
+
}, null, 40, ["item", "readonly", "onUpdate:item", "onDelete:item"]);
|
221
209
|
}), 128))
|
222
210
|
]),
|
223
|
-
|
224
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
225
|
-
return openBlock(), createBlock(resolveDynamicComponent(
|
226
|
-
key:
|
211
|
+
default: withCtx(() => [
|
212
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(fieldsFiltered.value, (field) => {
|
213
|
+
return openBlock(), createBlock(resolveDynamicComponent(field.component), {
|
214
|
+
key: field.label,
|
227
215
|
item,
|
228
216
|
readonly: _ctx.readonlyGetter?.(item),
|
217
|
+
skeleton,
|
218
|
+
mobile: unref(isMobile),
|
219
|
+
class: normalizeClass(field.cssClass),
|
220
|
+
style: normalizeStyle({
|
221
|
+
minWidth: !unref(isMobile) && unref(fieldConfigMap)[field.label]?.width ? unref(fieldConfigMap)[field.label].width + "px" : void 0
|
222
|
+
}),
|
229
223
|
"onUpdate:item": setter,
|
230
224
|
"onDelete:item": ($event) => {
|
231
225
|
setter();
|
232
226
|
refetch();
|
233
227
|
}
|
234
|
-
}, null, 40, ["item", "readonly", "onUpdate:item", "onDelete:item"]);
|
228
|
+
}, null, 40, ["item", "readonly", "skeleton", "mobile", "class", "style", "onUpdate:item", "onDelete:item"]);
|
235
229
|
}), 128))
|
236
230
|
]),
|
237
231
|
_: 2
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WListCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WListCard.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WListCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WListCard.vue"],"names":[],"mappings":"AAmRA,iBAAS,cAAc;;;;;YAqUO,GAAG;sBACN,GAAG;2BACE,GAAG;;;WASrB,OAAO,IAA6B;EAEjD;AA4BD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;eAhbR,OAAO;eACP,OAAO;aACT,OAAO;iBACH,OAAO;eACT,OAAO;gBACN,OAAO;gBACP,MAAM;gBACN,OAAO;;;;;;;eAPR,OAAO;eACP,OAAO;aACT,OAAO;iBACH,OAAO;eACT,OAAO;gBACN,OAAO;gBACP,MAAM;gBACN,OAAO;;;;kFAobnB,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"}
|
@@ -61,8 +61,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
61
61
|
return (_ctx, _cache) => {
|
62
62
|
return openBlock(), createElementBlock(Fragment, null, [
|
63
63
|
createElementVNode("div", {
|
64
|
-
class: normalizeClass(["relative
|
65
|
-
[_ctx.cardClass ?? ""]: true,
|
64
|
+
class: normalizeClass(["relative grid sm-not:grid-cols-1 sm:flex isolate sm:mt-4 first:mt-0 sm-not:group-even:bg-gray-50 sm-not:dark:group-even:bg-primary-darkest/25 sm-not:pt-2", {
|
66
65
|
"w-ripple-trigger-has": _ctx.allowOpen
|
67
66
|
}])
|
68
67
|
}, [
|
@@ -108,9 +107,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
108
107
|
}, null, 8, ["model-value", "disabled", "allow-shift", "align-top", "class"])) : createCommentVNode("", true)
|
109
108
|
], 2)
|
110
109
|
], 2)) : createCommentVNode("", true),
|
111
|
-
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ toggle, isOpen: isOpen.value }))),
|
112
110
|
createElementVNode("div", {
|
113
|
-
class: normalizeClass(["sm:
|
111
|
+
class: normalizeClass(["grid sm:flex sm:flex-1 sm-not:-px--inner-margin isolate", {
|
112
|
+
[_ctx.cardClass ?? ""]: true,
|
113
|
+
"sm:border-y border-gray-300 dark:border-gray-700": _ctx.hasBorder,
|
114
|
+
"sm:border-b-[transparent] sm:dark:border-b-[transparent]": _ctx.hasBorder && isOpen.value,
|
115
|
+
"isolate": _ctx.allowOpen
|
116
|
+
}])
|
117
|
+
}, [
|
118
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ toggle, isOpen: isOpen.value }))),
|
119
|
+
_ctx.allowOpen ? (openBlock(), createElementBlock("button", {
|
120
|
+
key: 0,
|
121
|
+
class: "cursor-pointer w-ripple w-ripple-hover w-ripple-has w-ripple-opacity-[0.04] absolute top-0 left-0 h-full w-full -z-[1]",
|
122
|
+
onClick: toggle
|
123
|
+
})) : createCommentVNode("", true)
|
124
|
+
], 2),
|
125
|
+
createElementVNode("div", {
|
126
|
+
class: normalizeClass(["sm:sticky sm:z-[1] sm:right-inner sm:bg-default sm:dark:bg-default-dark", {
|
114
127
|
"width-14": !_ctx.hideMore,
|
115
128
|
"width-4": _ctx.hideMore
|
116
129
|
}])
|
@@ -121,7 +134,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
121
134
|
"sm:border sm:border-l-0 border-gray-300 dark:border-gray-700 sm:rounded-tr-3xl": _ctx.hasBorder,
|
122
135
|
"sm:rounded-br-3xl": _ctx.hasBorder && !isOpen.value,
|
123
136
|
"sm:border-b-[transparent] sm:dark:border-b-[transparent]": _ctx.hasBorder && isOpen.value,
|
124
|
-
"w-ripple-has-only w-ripple-hover w-ripple-opacity-[0.04]": _ctx.allowOpen
|
137
|
+
"w-ripple-has-only w-ripple-hover w-ripple-opacity-[0.04]": !_ctx.mobile && _ctx.allowOpen
|
125
138
|
}])
|
126
139
|
}, [
|
127
140
|
!_ctx.hideMore ? (openBlock(), createBlock(_sfc_main$2, {
|
@@ -151,7 +164,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
151
164
|
_ctx.$slots.expansion ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
152
165
|
isOpen.value ? (openBlock(), createElementBlock("div", {
|
153
166
|
key: 0,
|
154
|
-
class: normalizeClass(["sm:sticky sm:w-inner sm:left-inner", {
|
167
|
+
class: normalizeClass(["sm:sticky sm:w-inner sm:left-inner sm:-mt-px", {
|
155
168
|
"sm:px-5 sm:border sm:border-t-0 border-gray-300 dark:border-gray-700 sm:rounded-b-3xl": _ctx.hasBorder
|
156
169
|
}])
|
157
170
|
}, [
|
@@ -2,7 +2,6 @@ declare function __VLS_template(): {
|
|
2
2
|
slots: {
|
3
3
|
default?(_: {}): any;
|
4
4
|
inner?(_: {}): any;
|
5
|
-
inner?(_: {}): any;
|
6
5
|
};
|
7
6
|
refs: {};
|
8
7
|
attrs: Partial<{}>;
|
@@ -11,9 +10,11 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
10
|
declare const __VLS_component: import('vue').DefineComponent<{
|
12
11
|
modelValue?: string | number;
|
13
12
|
skeleton?: boolean;
|
13
|
+
allowOpen?: boolean;
|
14
14
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
15
15
|
modelValue?: string | number;
|
16
16
|
skeleton?: boolean;
|
17
|
+
allowOpen?: boolean;
|
17
18
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
18
19
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
19
20
|
export default _default;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WListCardField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WListCardField.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WListCardField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/List/WListCardField.vue"],"names":[],"mappings":"AA+CA,iBAAS,cAAc;;yBA+CM,GAAG;uBACL,GAAG;;;WAShB,OAAO,IAA6B;EAEjD;AASD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;iBAhFN,MAAM,GAAG,MAAM;eACjB,OAAO;gBACN,OAAO;;iBAFN,MAAM,GAAG,MAAM;eACjB,OAAO;gBACN,OAAO;iGAoFnB,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"}
|
@@ -1,40 +1,27 @@
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createBlock, renderSlot, createElementVNode, createTextVNode, toDisplayString
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, createBlock, renderSlot, createElementVNode, createTextVNode, toDisplayString } from 'vue';
|
2
2
|
import WSkeleton from '../Skeleton/WSkeleton.vue.js';
|
3
|
-
import _sfc_main$1 from '../Tooltip/WTooltip.vue.js';
|
4
3
|
|
5
|
-
const _hoisted_1 = { class: "
|
6
|
-
const _hoisted_2 = { class: "truncate" };
|
7
|
-
const _hoisted_3 = { class: "min-w-[12rem] max-w-xl overflow-hidden" };
|
4
|
+
const _hoisted_1 = { class: "truncate" };
|
8
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
6
|
__name: "WListCardField",
|
10
7
|
props: {
|
11
8
|
modelValue: {},
|
12
|
-
skeleton: { type: Boolean }
|
9
|
+
skeleton: { type: Boolean },
|
10
|
+
allowOpen: { type: Boolean }
|
13
11
|
},
|
14
12
|
setup(__props) {
|
15
13
|
return (_ctx, _cache) => {
|
16
|
-
return openBlock(), createElementBlock("div",
|
14
|
+
return openBlock(), createElementBlock("div", {
|
15
|
+
class: normalizeClass(["grid grid-cols-1 items-center sm:h-16 sm:pr-6", { "pointer-events-none": _ctx.allowOpen }])
|
16
|
+
}, [
|
17
17
|
_ctx.skeleton ? (openBlock(), createBlock(WSkeleton, { key: 0 })) : renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
|
18
|
-
createElementVNode("div",
|
18
|
+
createElementVNode("div", _hoisted_1, [
|
19
19
|
renderSlot(_ctx.$slots, "inner", {}, () => [
|
20
20
|
createTextVNode(toDisplayString(_ctx.modelValue), 1)
|
21
|
-
])
|
22
|
-
createVNode(_sfc_main$1, {
|
23
|
-
"no-touch": "",
|
24
|
-
"overflow-only": ""
|
25
|
-
}, {
|
26
|
-
default: withCtx(() => [
|
27
|
-
createElementVNode("div", _hoisted_3, [
|
28
|
-
renderSlot(_ctx.$slots, "inner", {}, () => [
|
29
|
-
createTextVNode(toDisplayString(_ctx.modelValue), 1)
|
30
|
-
])
|
31
|
-
])
|
32
|
-
]),
|
33
|
-
_: 3
|
34
|
-
})
|
21
|
+
])
|
35
22
|
])
|
36
23
|
])
|
37
|
-
]);
|
24
|
+
], 2);
|
38
25
|
};
|
39
26
|
}
|
40
27
|
});
|
@@ -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
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:
|
5
|
-
|
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"> & {
|
6
7
|
fields: ListField<Data, QueryParams>[];
|
7
|
-
|
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":"AAoGA,OAAO,KAAK,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;yBAInC,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;WA8NxD,mBAAmB,CAAC;;;;gBA1NpB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE;wBACtB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;qBAC9B,WAAW;mBACb,OAAO;mBACP,OAAO;KAsNmE,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YAnNP,yBAAyB,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;YACpE,aAAa,GAAG,IAAI;;;;;YAuNkB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAxOvE,wBAwO4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,29 +1,31 @@
|
|
1
|
-
import { defineComponent, ref, openBlock, createBlock, markRaw, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, normalizeStyle } from 'vue';
|
1
|
+
import { defineComponent, ref, openBlock, createBlock, markRaw, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, normalizeStyle, 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
4
|
import _sfc_main$2 from './HeaderSettingsItem.vue.js';
|
5
5
|
|
6
6
|
const _hoisted_1 = { class: "p-4" };
|
7
7
|
const _hoisted_2 = { class: "flex flex-col" };
|
8
|
+
const _hoisted_3 = ["disabled"];
|
8
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
10
|
__name: "HeaderSettings",
|
10
11
|
props: {
|
11
12
|
fields: {},
|
12
|
-
|
13
|
+
fieldConfigMap: {},
|
13
14
|
queryParams: {},
|
15
|
+
hasSaved: { type: Boolean },
|
14
16
|
disabled: { type: Boolean }
|
15
17
|
},
|
16
|
-
emits: ["update:
|
18
|
+
emits: ["update:field-config-map", "click:reset"],
|
17
19
|
setup(__props, { emit: __emit }) {
|
18
20
|
const props = __props;
|
19
21
|
const emit = __emit;
|
20
22
|
const dragItem = ref(null);
|
21
23
|
const dragItemNewOrder = ref(null);
|
22
24
|
const getOrder = (field) => {
|
23
|
-
if (dragItem.value === null || dragItemNewOrder.value === null) return props.
|
25
|
+
if (dragItem.value === null || dragItemNewOrder.value === null) return props.fieldConfigMap[field.label].order;
|
24
26
|
if (field.label === dragItem.value) return dragItemNewOrder.value;
|
25
|
-
if (props.
|
26
|
-
return props.
|
27
|
+
if (props.fieldConfigMap[field.label].order <= dragItemNewOrder.value) return props.fieldConfigMap[field.label].order - 1;
|
28
|
+
return props.fieldConfigMap[field.label].order;
|
27
29
|
};
|
28
30
|
const dragEnter = (field) => {
|
29
31
|
dragItemNewOrder.value = getOrder(field);
|
@@ -34,16 +36,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
34
36
|
};
|
35
37
|
const drop = () => {
|
36
38
|
const newConfig = props.fields.reduce((result, field) => {
|
37
|
-
result[field.label] = { ...props.
|
39
|
+
result[field.label] = { ...props.fieldConfigMap[field.label], order: getOrder(field) };
|
38
40
|
return result;
|
39
41
|
}, {});
|
40
|
-
if (Object.keys(newConfig).some((key) => props.
|
42
|
+
if (Object.keys(newConfig).some((key) => props.fieldConfigMap[key].order !== newConfig[key].order)) emit("update:field-config-map", newConfig);
|
41
43
|
dragEnd();
|
42
44
|
};
|
43
45
|
return (_ctx, _cache) => {
|
44
46
|
return openBlock(), createBlock(_sfc_main$1, {
|
45
47
|
icon: markRaw(unref(IconTableSettings)),
|
46
|
-
disabled: _ctx.disabled
|
48
|
+
disabled: _ctx.disabled,
|
49
|
+
class: "h-full w-full"
|
47
50
|
}, {
|
48
51
|
default: withCtx(() => [
|
49
52
|
createElementVNode("div", _hoisted_1, [
|
@@ -52,7 +55,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
52
55
|
return openBlock(), createBlock(_sfc_main$2, {
|
53
56
|
key: field.label,
|
54
57
|
field,
|
55
|
-
"field-config": _ctx.
|
58
|
+
"field-config": _ctx.fieldConfigMap[field.label],
|
56
59
|
"query-params": _ctx.queryParams,
|
57
60
|
disabled: _ctx.disabled,
|
58
61
|
style: normalizeStyle({
|
@@ -61,12 +64,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
61
64
|
"onDrag:start": ($event) => dragItem.value = field.label,
|
62
65
|
"onDrag:enter": ($event) => dragEnter(field),
|
63
66
|
"onDrag:end": drop,
|
64
|
-
"onUpdate:
|
67
|
+
"onUpdate:fieldsConfigMap": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:field-config-map", { ..._ctx.fieldConfigMap, ...$event }))
|
65
68
|
}, null, 8, ["field", "field-config", "query-params", "disabled", "style", "onDrag:start", "onDrag:enter"]);
|
66
69
|
}), 128))
|
67
70
|
]),
|
68
|
-
_cache[
|
69
|
-
|
71
|
+
_cache[2] || (_cache[2] = createElementVNode("div", { class: "border-b border-solid border-gray-200 dark:border-gray-700 my-4" }, null, -1)),
|
72
|
+
createElementVNode("button", {
|
73
|
+
class: normalizeClass(["relative py-1 px-2 rounded-lg bg-gray-100 dark:bg-gray-800", {
|
74
|
+
"w-ripple w-ripple-hover": _ctx.hasSaved,
|
75
|
+
"cursor-not-allowed opacity-50": !_ctx.hasSaved
|
76
|
+
}]),
|
77
|
+
disabled: !_ctx.hasSaved,
|
78
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.hasSaved && _ctx.$emit("click:reset"))
|
79
|
+
}, " Reset ", 10, _hoisted_3)
|
70
80
|
])
|
71
81
|
]),
|
72
82
|
_: 1
|
@@ -1,11 +1,11 @@
|
|
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;
|
4
|
+
readonly "onUpdate:fields-config-map"?: ((value: Record<string, FieldConfig>) => any) | undefined;
|
5
5
|
readonly "onDrag:start"?: (() => any) | undefined;
|
6
6
|
readonly "onDrag:enter"?: (() => 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;
|
@@ -15,7 +15,7 @@ declare const _default: <Data extends DefaultData, QueryParams>(__VLS_props: Non
|
|
15
15
|
attrs: any;
|
16
16
|
slots: {};
|
17
17
|
emit: {
|
18
|
-
(e: "update:fields-config", value: Record<string, FieldConfig>): void;
|
18
|
+
(e: "update:fields-config-map", value: Record<string, FieldConfig>): void;
|
19
19
|
(e: "drag:start"): void;
|
20
20
|
(e: "drag:enter"): void;
|
21
21
|
(e: "drag:end"): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HeaderSettingsItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderSettingsItem.vue"],"names":[],"mappings":"AAiFA,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;WA0JxD,mBAAmB,CAAC;;;;;;eAtJrB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;qBACtB,WAAW;qBACX,WAAW;mBACb,OAAO;KAmJmE,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YAhJP,
|
1
|
+
{"version":3,"file":"HeaderSettingsItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/List/components/HeaderSettingsItem.vue"],"names":[],"mappings":"AAiFA,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;WA0JxD,mBAAmB,CAAC;;;;;;eAtJrB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;qBACtB,WAAW;qBACX,WAAW;mBACb,OAAO;KAmJmE,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YAhJP,0BAA0B,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAI;YACrE,YAAY,GAAG,IAAI;YACnB,YAAY,GAAG,IAAI;YACnB,UAAU,GAAG,IAAI;;;;;YAkJqB,OAAO,CAAC,OAAO,WAAW,CAAC;;AApKvE,wBAoK4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -13,7 +13,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
13
|
queryParams: {},
|
14
14
|
disabled: { type: Boolean }
|
15
15
|
},
|
16
|
-
emits: ["update:fields-config", "drag:start", "drag:enter", "drag:end"],
|
16
|
+
emits: ["update:fields-config-map", "drag:start", "drag:enter", "drag:end"],
|
17
17
|
setup(__props, { emit: __emit }) {
|
18
18
|
const emit = __emit;
|
19
19
|
const isDraggable = ref(false);
|
@@ -52,7 +52,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
52
52
|
createElementVNode("div", _hoisted_2, toDisplayString(typeof _ctx.field.title === "string" ? _ctx.field.title : _ctx.field.title(_ctx.queryParams)), 1),
|
53
53
|
createElementVNode("button", {
|
54
54
|
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 } }))
|
55
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fields-config-map", { [_ctx.field.label]: { ..._ctx.fieldConfig, visible: !_ctx.fieldConfig.visible } }))
|
56
56
|
}, [
|
57
57
|
(openBlock(), createBlock(resolveDynamicComponent(_ctx.fieldConfig.visible ? unref(IconEye) : unref(IconEyeSlash)), { class: "pointer-events-none" }))
|
58
58
|
])
|
@@ -12,7 +12,6 @@ export type ListField<Data, QueryParams = unknown> = {
|
|
12
12
|
cssClass?: string;
|
13
13
|
field?: Extract<keyof Data, string> | ((params: QueryParams) => Extract<keyof Data, string>);
|
14
14
|
visibleGetter?: (params: QueryParams) => boolean;
|
15
|
-
allowOpen?: boolean;
|
16
15
|
allowResize?: boolean;
|
17
16
|
};
|
18
17
|
export type MenuComponent<Data> = Component<{
|
@@ -25,8 +24,9 @@ export type BulkComponent<QueryParams> = Component<{
|
|
25
24
|
disableMessage?: string;
|
26
25
|
}>;
|
27
26
|
export type FieldConfig = {
|
28
|
-
width: number;
|
27
|
+
width: number | null;
|
29
28
|
visible: boolean;
|
30
29
|
order: number;
|
31
30
|
};
|
31
|
+
export type FieldConfigMap<Fields extends ListField<any, any>[]> = Record<Fields[number]['label'], FieldConfig>;
|
32
32
|
//# 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,CAAC,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC,CAAA;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5F,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAA;IAChD,
|
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,CAAC,MAAM,EAAE,WAAW,KAAK,MAAM,CAAC,CAAA;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5F,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAA;IAChD,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,IAAI,IAAI,SAAS,CAAC;IAC1C,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,MAAM,MAAM,aAAa,CAAC,WAAW,IAAI,SAAS,CAAC;IACjD,iBAAiB,EAAE,MAAM,WAAW,CAAA;IACpC,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAGD,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { MaybeRef } from 'vue';
|
2
|
+
import { FieldConfig, FieldConfigMap, ListField } from '../types';
|
3
|
+
export declare const useFieldConfigMap: <Fields extends ListField<any, any>[]>(key: MaybeRef<string>, fields: MaybeRef<Fields>, defaultConfigMap: MaybeRef<FieldConfigMap<Fields>>) => {
|
4
|
+
fieldConfigMap: import('vue').WritableComputedRef<Record<string, FieldConfig>, Record<string, FieldConfig>>;
|
5
|
+
hasSaved: import('vue').Ref<boolean, boolean>;
|
6
|
+
reset: () => void;
|
7
|
+
};
|
8
|
+
//# 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,EAAC,MAAM,UAAU,CAAA;AAoDpE,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,QAAQ,CAAC,MAAM,CAAC,oBAAoB,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;;;;CA6B1K,CAAA"}
|
@@ -0,0 +1,63 @@
|
|
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 = fields.reduce((result, field) => {
|
9
|
+
const config = value instanceof Object && field.label in value ? value[field.label] : void 0;
|
10
|
+
const defaultConfig = defaultConfigMap[field.label];
|
11
|
+
if (!isFieldConfig(config)) {
|
12
|
+
result[field.label] = { ...defaultConfig };
|
13
|
+
} else {
|
14
|
+
result[field.label] = {
|
15
|
+
width: config.width ?? null,
|
16
|
+
visible: config.visible ?? defaultConfig.visible,
|
17
|
+
order: config.order ?? defaultConfig.order
|
18
|
+
};
|
19
|
+
}
|
20
|
+
return result;
|
21
|
+
}, {});
|
22
|
+
Object.values(configMap).sort((a, b) => a.order - b.order).forEach((item, index) => {
|
23
|
+
item.order = index;
|
24
|
+
});
|
25
|
+
return configMap;
|
26
|
+
};
|
27
|
+
const getFieldConfigMap = (key) => {
|
28
|
+
const value = localStorage.getItem(key);
|
29
|
+
if (typeof value !== "string") return void 0;
|
30
|
+
try {
|
31
|
+
return JSON.parse(value);
|
32
|
+
} catch {
|
33
|
+
return void 0;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
const useFieldConfigMap = (key, fields, defaultConfigMap) => {
|
37
|
+
const value = ref(parseFieldConfigMap(getFieldConfigMap(unref(key)), unref(fields), unref(defaultConfigMap)));
|
38
|
+
const hasSaved = ref(localStorage.getItem(unref(key)) !== null);
|
39
|
+
const fieldConfigMap = computed({
|
40
|
+
get: () => value.value,
|
41
|
+
set: (newValue) => {
|
42
|
+
value.value = newValue;
|
43
|
+
localStorage.setItem(unref(key), JSON.stringify(newValue));
|
44
|
+
}
|
45
|
+
});
|
46
|
+
const reset = () => {
|
47
|
+
value.value = parseFieldConfigMap(void 0, unref(fields), unref(defaultConfigMap));
|
48
|
+
hasSaved.value = false;
|
49
|
+
localStorage.removeItem(unref(key));
|
50
|
+
};
|
51
|
+
if (isRef(key)) {
|
52
|
+
watch(key, (newKey) => {
|
53
|
+
value.value = parseFieldConfigMap(getFieldConfigMap(unref(newKey)), unref(fields), unref(defaultConfigMap));
|
54
|
+
});
|
55
|
+
}
|
56
|
+
return {
|
57
|
+
fieldConfigMap,
|
58
|
+
hasSaved,
|
59
|
+
reset
|
60
|
+
};
|
61
|
+
};
|
62
|
+
|
63
|
+
export { useFieldConfigMap };
|
@@ -12,6 +12,8 @@ declare const _default: import('vue').DefineComponent<{
|
|
12
12
|
light?: boolean;
|
13
13
|
trigger?: Element;
|
14
14
|
maxHeight?: number;
|
15
|
-
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
15
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
16
|
+
container: HTMLSpanElement;
|
17
|
+
}, any>;
|
16
18
|
export default _default;
|
17
19
|
//# sourceMappingURL=WTooltip.vue.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WTooltip.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/WTooltip.vue"],"names":[],"mappings":";WA2FS,MAAM;cACH,OAAO;mBACF,OAAO;YACd,OAAO;cACL,OAAO;gBACL,MAAM;;WALX,MAAM;cACH,OAAO;mBACF,OAAO;YACd,OAAO;cACL,OAAO;gBACL,MAAM
|
1
|
+
{"version":3,"file":"WTooltip.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/WTooltip.vue"],"names":[],"mappings":";WA2FS,MAAM;cACH,OAAO;mBACF,OAAO;YACd,OAAO;cACL,OAAO;gBACL,MAAM;;WALX,MAAM;cACH,OAAO;mBACF,OAAO;YACd,OAAO;cACL,OAAO;gBACL,MAAM;;;;AAoHpB,wBAOG"}
|
@@ -1,8 +1,13 @@
|
|
1
|
-
import { defineComponent, useSlots, ref, computed, watch, toRef, onBeforeUnmount, unref, openBlock, createElementBlock, createCommentVNode, markRaw } from 'vue';
|
1
|
+
import { defineComponent, useSlots, useTemplateRef, ref, computed, watch, toRef, onBeforeUnmount, unref, openBlock, createElementBlock, createCommentVNode, markRaw } from 'vue';
|
2
2
|
import { getIsTouchDevice } from '../../utils/mobile.js';
|
3
3
|
import { Tooltip } from '../../utils/Tooltip.js';
|
4
4
|
import { getIncrement } from './models/utils.js';
|
5
5
|
|
6
|
+
const _hoisted_1 = {
|
7
|
+
key: 0,
|
8
|
+
ref: "container",
|
9
|
+
class: "hidden"
|
10
|
+
};
|
6
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
7
12
|
__name: "WTooltip",
|
8
13
|
props: {
|
@@ -17,9 +22,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
22
|
const props = __props;
|
18
23
|
const slots = useSlots();
|
19
24
|
const isTouchDevice = getIsTouchDevice();
|
20
|
-
const
|
25
|
+
const containerRef = useTemplateRef("container");
|
21
26
|
const isOpen = ref(false);
|
22
|
-
const parent = computed(() =>
|
27
|
+
const parent = computed(() => containerRef.value?.parentElement ?? null);
|
23
28
|
const triggerElement = computed(() => props.trigger ?? parent.value);
|
24
29
|
const open = () => {
|
25
30
|
const slot = slots.default?.()?.[0];
|
@@ -58,12 +63,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
58
63
|
close();
|
59
64
|
});
|
60
65
|
return (_ctx, _cache) => {
|
61
|
-
return !(_ctx.noTouch && unref(isTouchDevice)) ? (openBlock(), createElementBlock("span",
|
62
|
-
key: 0,
|
63
|
-
ref_key: "container",
|
64
|
-
ref: container,
|
65
|
-
class: "hidden"
|
66
|
-
}, null, 512)) : createCommentVNode("", true);
|
66
|
+
return !(_ctx.noTouch && unref(isTouchDevice)) ? (openBlock(), createElementBlock("span", _hoisted_1, null, 512)) : createCommentVNode("", true);
|
67
67
|
};
|
68
68
|
}
|
69
69
|
});
|
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, ListField } 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 ListField<any, any>[]>(fields: Fields, visible: Fields[number]["label"][]) => 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,SAAS,EAAC,MAAM,yBAAyB,CAAA;AAYnF,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,OAAO,EAAE,KAAG,OAE7D,CAAA;AAED,eAAO,MAAM,UAAU,SAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,MAAM,EAAE,YAAY,MAAM,EAAE,KAAG,OAWjI,CAAA;AAED,eAAO,MAAM,uBAAuB,mBAAmE,CAAA;AACvG,eAAO,MAAM,sBAAsB,mBAAiD,CAAA;AACpF,eAAO,MAAM,eAAe,mBAA0B,CAAA;AAEtD,eAAO,MAAM,YAAY,EAAE,OAAuC,CAAA;AAIlE,eAAO,MAAM,KAAK,cAEjB,CAAA;AAED,eAAO,MAAM,IAAI,UAAW,OAAO,KAAG,KAAK,IAAI,MAE9C,CAAA;AAED,eAAO,MAAM,OAAO,UAAW,OAAO,KAAG,MAUxC,CAAA;AAED,eAAO,MAAM,MAAM,UAAW,OAAO,KAAG,KAAK,IAAI,MAAqB,CAAA;AAEtE,eAAO,MAAM,OAAO,UAAW,OAAO,KAAG,KAAK,IAAI,MAEjD,CAAA;AAED,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,MAU3C,CAAA;AAED,eAAO,MAAM,GAAG,GAAI,SAAS,EAAE,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,IAAI,QAAQ,MAAM,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,KAAG,SAAS,GAAG,SAA8H,CAAA;AAEtQ,eAAO,MAAM,GAAG,GAAI,SAAS,EAAE,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,IAAI,QAAQ,MAAM,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,SAAS,KAAG,IAe7I,CAAA;AAGD,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,UAAU,MAAM,WAAW,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAG,cAAc,CAAC,MAAM,CAKxJ,CAAA"}
|
package/dist/utils/utils.js
CHANGED
@@ -94,5 +94,11 @@ const set = (data, path, value) => {
|
|
94
94
|
}, data);
|
95
95
|
return data;
|
96
96
|
};
|
97
|
+
const getDefaultFieldConfigMap = (fields, visible) => {
|
98
|
+
return fields.reduce((result, field, order) => {
|
99
|
+
result[field.label] = { width: null, visible: visible.includes(field.label), order };
|
100
|
+
return result;
|
101
|
+
}, {});
|
102
|
+
};
|
97
103
|
|
98
|
-
export { debounce, genId, get, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, isId, isIndex, isPage, numberCompactFormatter, numberFormatter, parseId, parseIndex, percentCompactFormatter, set, throttle };
|
104
|
+
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