@dao-style/core 0.0.1-beta.15 → 0.0.1-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/plugin.d.ts +1 -2
- package/dist/components/table/table-props.d.ts +4 -2
- package/dist/components/table/table.vue.d.ts +4 -3
- package/dist/dao-style.es.js +43 -19
- package/dist/dao-style.umd.js +1 -1
- package/dist/font/DaoCloudIconFont/DaoCloudIconFont.woff2 +0 -0
- package/dist/font/nunito/XRXV3I6Li01BKofINeaB.woff2 +0 -0
- package/dist/font/nunito/XRXV3I6Li01BKofIO-aBXso.woff2 +0 -0
- package/dist/font/nunito/XRXX3I6Li01BKofIMNaDRs4.woff2 +0 -0
- package/dist/font/nunito/XRXX3I6Li01BKofIMNaNRs71cA.woff2 +0 -0
- package/dist/font/roboto/KFOjCnqEu92Fr1Mu51S7ACc0CsTKlA.woff2 +0 -0
- package/dist/font/roboto/KFOjCnqEu92Fr1Mu51S7ACc6CsQ.woff2 +0 -0
- package/dist/font/roboto/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2 +0 -0
- package/dist/font/roboto/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2 +0 -0
- package/dist/font/roboto/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 +0 -0
- package/dist/font/roboto/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 +0 -0
- package/dist/font/roboto/KFOlCnqEu92Fr1MmWUlfBBc4.woff2 +0 -0
- package/dist/font/roboto/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2 +0 -0
- package/dist/style.css +1 -1
- package/dist/styles/color/alias.json +17 -2
- package/dist/styles/color/alias.scss +9 -0
- package/dist/styles/color/var.json +4 -0
- package/dist/styles/color/var.scss +2 -0
- package/package.json +2 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
2
|
import type { DaoTableColumn, DaoTableSort } from './type';
|
|
3
|
+
declare type DataPropType = Record<string, unknown>[];
|
|
4
|
+
declare type SelectablePropType = ((row: DataPropType[number], index: number) => boolean) | boolean;
|
|
3
5
|
declare const tableProps: {
|
|
4
6
|
id: {
|
|
5
7
|
type: PropType<string>;
|
|
@@ -10,7 +12,7 @@ declare const tableProps: {
|
|
|
10
12
|
default: () => DaoTableColumn[];
|
|
11
13
|
};
|
|
12
14
|
data: {
|
|
13
|
-
type: PropType<
|
|
15
|
+
type: PropType<DataPropType>;
|
|
14
16
|
default: () => Record<string, unknown>[];
|
|
15
17
|
};
|
|
16
18
|
showHeader: {
|
|
@@ -18,7 +20,7 @@ declare const tableProps: {
|
|
|
18
20
|
default: boolean;
|
|
19
21
|
};
|
|
20
22
|
selectable: {
|
|
21
|
-
type: PropType<
|
|
23
|
+
type: PropType<SelectablePropType>;
|
|
22
24
|
default: boolean;
|
|
23
25
|
};
|
|
24
26
|
expandable: {
|
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
20
|
selectable: {
|
|
21
|
-
type: import("vue").PropType<boolean>;
|
|
21
|
+
type: import("vue").PropType<boolean | ((row: Record<string, unknown>, index: number) => boolean)>;
|
|
22
22
|
default: boolean;
|
|
23
23
|
};
|
|
24
24
|
expandable: {
|
|
@@ -136,6 +136,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
136
136
|
expandedRows: WeakSet<object>;
|
|
137
137
|
onRowClick: (row: Record<string, unknown>, rowIndex: number) => void;
|
|
138
138
|
isEmpty: import("vue").ComputedRef<boolean>;
|
|
139
|
+
selectableRows: import("vue").ComputedRef<Set<Record<string, unknown>>>;
|
|
139
140
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "next" | "prev" | "update:page-size" | "update:current-page" | "sortChange" | "hideColumn" | "afterResize" | "expandToggle" | "pageChange" | "sizeChange" | "row-click")[], "select" | "next" | "prev" | "update:page-size" | "update:current-page" | "sortChange" | "hideColumn" | "afterResize" | "expandToggle" | "pageChange" | "sizeChange" | "row-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
140
141
|
id?: unknown;
|
|
141
142
|
columns?: unknown;
|
|
@@ -168,7 +169,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
168
169
|
totalFormat: (val: number) => string;
|
|
169
170
|
currentPage: number;
|
|
170
171
|
pageSizerWidth: number;
|
|
171
|
-
selectable: boolean;
|
|
172
|
+
selectable: boolean | ((row: Record<string, unknown>, index: number) => boolean);
|
|
172
173
|
expandable: boolean;
|
|
173
174
|
emptyText: string;
|
|
174
175
|
noShadow: boolean;
|
|
@@ -201,7 +202,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
201
202
|
totalFormat: (val: number) => string;
|
|
202
203
|
currentPage: number;
|
|
203
204
|
pageSizerWidth: number;
|
|
204
|
-
selectable: boolean;
|
|
205
|
+
selectable: boolean | ((row: Record<string, unknown>, index: number) => boolean);
|
|
205
206
|
expandable: boolean;
|
|
206
207
|
emptyText: string;
|
|
207
208
|
noShadow: boolean;
|
package/dist/dao-style.es.js
CHANGED
|
@@ -17,8 +17,9 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, unref, resolveComponent, Fragment, createBlock, createTextVNode, toDisplayString, ref, inject, watchEffect, mergeProps, provide, readonly, toRefs, createVNode, withCtx, watch, Transition, withModifiers, normalizeStyle, withDirectives, vShow, withKeys, getCurrentInstance, onMounted,
|
|
20
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, unref, resolveComponent, Fragment, createBlock, createTextVNode, toDisplayString, ref, inject, watchEffect, mergeProps, provide, readonly, toRefs, createVNode, withCtx, watch, onBeforeUnmount, Transition, withModifiers, normalizeStyle, withDirectives, vShow, withKeys, getCurrentInstance, onMounted, Teleport, nextTick, reactive, renderList, getCurrentScope, onScopeDispose, vModelText, onUnmounted, h } from "vue";
|
|
21
21
|
import { isArray, isSet, looseIndexOf, looseEqual, isFunction, NOOP } from "@vue/shared";
|
|
22
|
+
var common = "";
|
|
22
23
|
var actionIcon_vue_vue_type_style_index_0_lang = "";
|
|
23
24
|
var _export_sfc = (sfc, props) => {
|
|
24
25
|
for (const [key, val] of props) {
|
|
@@ -864,8 +865,8 @@ const _sfc_main$y = defineComponent({
|
|
|
864
865
|
if (!lockScroll.value) {
|
|
865
866
|
return;
|
|
866
867
|
}
|
|
867
|
-
const
|
|
868
|
-
document.body.setAttribute(DIALOG_NUM_ATTR, String(
|
|
868
|
+
const bodyDialogNum = Number(document.body.getAttribute(DIALOG_NUM_ATTR) || 0);
|
|
869
|
+
document.body.setAttribute(DIALOG_NUM_ATTR, String(bodyDialogNum + 1));
|
|
869
870
|
document.body.style.overflow = "hidden";
|
|
870
871
|
};
|
|
871
872
|
const onClose = () => {
|
|
@@ -885,16 +886,18 @@ const _sfc_main$y = defineComponent({
|
|
|
885
886
|
return;
|
|
886
887
|
}
|
|
887
888
|
const specDialogNum = Number(document.body.getAttribute(DIALOG_NUM_ATTR)) - 1;
|
|
888
|
-
if (specDialogNum
|
|
889
|
+
if (specDialogNum < 1) {
|
|
889
890
|
document.body.removeAttribute(DIALOG_NUM_ATTR);
|
|
890
891
|
document.body.style.overflow = "";
|
|
891
892
|
} else {
|
|
892
893
|
document.body.setAttribute(DIALOG_NUM_ATTR, String(specDialogNum));
|
|
893
894
|
}
|
|
894
895
|
};
|
|
896
|
+
let currentDialogOpened = false;
|
|
895
897
|
const onBeforeEnter = () => {
|
|
896
|
-
lockWindowScroll();
|
|
897
898
|
document.addEventListener("keydown", onKeyDown);
|
|
899
|
+
lockWindowScroll();
|
|
900
|
+
currentDialogOpened = true;
|
|
898
901
|
emit("before-open");
|
|
899
902
|
};
|
|
900
903
|
const onAfterEnter = () => {
|
|
@@ -915,8 +918,14 @@ const _sfc_main$y = defineComponent({
|
|
|
915
918
|
const onAfterLeave = () => {
|
|
916
919
|
document.removeEventListener("keydown", onKeyDown);
|
|
917
920
|
unLockWindowScroll();
|
|
921
|
+
currentDialogOpened = false;
|
|
918
922
|
emit("closed");
|
|
919
923
|
};
|
|
924
|
+
onBeforeUnmount(() => {
|
|
925
|
+
if (currentDialogOpened) {
|
|
926
|
+
onAfterLeave();
|
|
927
|
+
}
|
|
928
|
+
});
|
|
920
929
|
return {
|
|
921
930
|
computedPaddingTop,
|
|
922
931
|
computedPaddingBottom,
|
|
@@ -3670,7 +3679,7 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3670
3679
|
return openBlock(), createElementBlock("div", {
|
|
3671
3680
|
ref: "header",
|
|
3672
3681
|
"aria-label": "Header",
|
|
3673
|
-
class: normalizeClass(_ctx.ns)
|
|
3682
|
+
class: normalizeClass([_ctx.ns, `${_ctx.ns}--${_ctx.type}`])
|
|
3674
3683
|
}, [
|
|
3675
3684
|
createElementVNode("div", {
|
|
3676
3685
|
class: normalizeClass(_ctx.ns + "__left-container")
|
|
@@ -5159,8 +5168,10 @@ const _sfc_main$c = defineComponent({
|
|
|
5159
5168
|
const bindTriggerEleOutsideClick = {
|
|
5160
5169
|
cleanup: void 0,
|
|
5161
5170
|
visible() {
|
|
5162
|
-
|
|
5163
|
-
|
|
5171
|
+
var _a2;
|
|
5172
|
+
const el = (_a2 = popper2.value) == null ? void 0 : _a2.popper.$el;
|
|
5173
|
+
if (!this.cleanup && el) {
|
|
5174
|
+
this.cleanup = onClickOutside(el, () => {
|
|
5164
5175
|
state.visible = false;
|
|
5165
5176
|
}, {
|
|
5166
5177
|
ignore: [triggerRef]
|
|
@@ -6072,7 +6083,7 @@ const tableProps = {
|
|
|
6072
6083
|
default: true
|
|
6073
6084
|
},
|
|
6074
6085
|
selectable: {
|
|
6075
|
-
type: Boolean,
|
|
6086
|
+
type: [Function, Boolean],
|
|
6076
6087
|
default: false
|
|
6077
6088
|
},
|
|
6078
6089
|
expandable: {
|
|
@@ -6164,6 +6175,17 @@ const _sfc_main$3 = defineComponent({
|
|
|
6164
6175
|
const sort = reactive(props.sort);
|
|
6165
6176
|
const expandRows = reactive([]);
|
|
6166
6177
|
const selectedRows = reactive(new Set());
|
|
6178
|
+
const selectableFn = computed(() => typeof props.selectable === "function" ? props.selectable : () => true);
|
|
6179
|
+
const selectableRows = computed(() => {
|
|
6180
|
+
var _a2;
|
|
6181
|
+
const selectableRowsSet = new Set();
|
|
6182
|
+
(_a2 = props.data) == null ? void 0 : _a2.forEach((item, index2) => {
|
|
6183
|
+
if (selectableFn.value && selectableFn.value(item, index2)) {
|
|
6184
|
+
selectableRowsSet.add(item);
|
|
6185
|
+
}
|
|
6186
|
+
});
|
|
6187
|
+
return selectableRowsSet;
|
|
6188
|
+
});
|
|
6167
6189
|
const expandedRows = reactive(new WeakSet());
|
|
6168
6190
|
const columnRefs = reactive({});
|
|
6169
6191
|
const columns = reactive([]);
|
|
@@ -6313,14 +6335,16 @@ const _sfc_main$3 = defineComponent({
|
|
|
6313
6335
|
}
|
|
6314
6336
|
};
|
|
6315
6337
|
const toggleSelectedAll = () => {
|
|
6316
|
-
if (global2.checked) {
|
|
6317
|
-
selectedRows.clear();
|
|
6318
|
-
emit("select", []);
|
|
6319
|
-
} else {
|
|
6338
|
+
if (!global2.checked || global2.indeterminate) {
|
|
6320
6339
|
props.data.forEach((item) => {
|
|
6321
|
-
|
|
6340
|
+
if (selectableRows.value.has(item)) {
|
|
6341
|
+
selectedRows.add(item);
|
|
6342
|
+
}
|
|
6322
6343
|
});
|
|
6323
6344
|
emit("select", Array.from(selectedRows));
|
|
6345
|
+
} else {
|
|
6346
|
+
selectedRows.clear();
|
|
6347
|
+
emit("select", []);
|
|
6324
6348
|
}
|
|
6325
6349
|
};
|
|
6326
6350
|
const fixedColumnWidth = () => {
|
|
@@ -6351,7 +6375,7 @@ const _sfc_main$3 = defineComponent({
|
|
|
6351
6375
|
const item = props.data[i];
|
|
6352
6376
|
if (selectedRows.has(item)) {
|
|
6353
6377
|
have += 1;
|
|
6354
|
-
} else {
|
|
6378
|
+
} else if (selectableRows.value.has(item)) {
|
|
6355
6379
|
notHave += 1;
|
|
6356
6380
|
}
|
|
6357
6381
|
if (have && notHave) {
|
|
@@ -6419,7 +6443,8 @@ const _sfc_main$3 = defineComponent({
|
|
|
6419
6443
|
tableScroll,
|
|
6420
6444
|
expandedRows,
|
|
6421
6445
|
onRowClick,
|
|
6422
|
-
isEmpty
|
|
6446
|
+
isEmpty,
|
|
6447
|
+
selectableRows
|
|
6423
6448
|
};
|
|
6424
6449
|
}
|
|
6425
6450
|
});
|
|
@@ -6521,9 +6546,10 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6521
6546
|
}, [
|
|
6522
6547
|
_ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_10, [
|
|
6523
6548
|
createVNode(_component_dao_checkbox, {
|
|
6549
|
+
disabled: !_ctx.selectableRows.has(row),
|
|
6524
6550
|
checked: _ctx.isRowSelected(row),
|
|
6525
6551
|
onChange: ($event) => _ctx.toggleSelected(row)
|
|
6526
|
-
}, null, 8, ["checked", "onChange"])
|
|
6552
|
+
}, null, 8, ["disabled", "checked", "onChange"])
|
|
6527
6553
|
])) : createCommentVNode("", true),
|
|
6528
6554
|
_ctx.expandable ? (openBlock(), createElementBlock("td", _hoisted_11, [
|
|
6529
6555
|
createElementVNode("i", {
|
|
@@ -6913,8 +6939,6 @@ var components = /* @__PURE__ */ Object.freeze({
|
|
|
6913
6939
|
TabItem: tabItem,
|
|
6914
6940
|
Tooltip: _sfc_main$o
|
|
6915
6941
|
});
|
|
6916
|
-
var common = "";
|
|
6917
|
-
var alias = "";
|
|
6918
6942
|
const plugin = (app) => {
|
|
6919
6943
|
Object.values(components).forEach((c) => {
|
|
6920
6944
|
app.component(c.name, c);
|