vue-devui 1.0.0-rc.5 → 1.0.0-rc.6

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/table/index.es.js CHANGED
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
21
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
22
  return value;
23
23
  };
24
- import { computed, ref, watch, unref, defineComponent, inject, createVNode, toRefs, onMounted, onUnmounted, Teleport, Transition, renderSlot, isVNode, nextTick, mergeProps, Fragment, withDirectives, vShow, toRef, provide, getCurrentInstance, shallowRef, h, render, createTextVNode, resolveDirective, reactive, onBeforeMount, onBeforeUnmount } from "vue";
24
+ import { computed, ref, watch, unref, defineComponent, inject, createVNode, toRefs, onMounted, onUnmounted, Teleport, Transition, renderSlot, isVNode, nextTick, mergeProps, Fragment, withDirectives, vShow, h, render, resolveDirective, toRef, provide, createTextVNode, getCurrentInstance, reactive, onBeforeMount, onBeforeUnmount } from "vue";
25
25
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
26
26
  import { onClickOutside } from "@vueuse/core";
27
27
  const TableProps = {
@@ -217,15 +217,15 @@ const createSelection = (dataSource, _data) => {
217
217
  watch(dataSource, (value) => {
218
218
  _checkList.value = new Array(value.length).fill(false);
219
219
  }, { deep: true, immediate: true });
220
- watch(_checkList, (list) => {
221
- if (list.length === 0) {
220
+ watch(_checkList, (list2) => {
221
+ if (list2.length === 0) {
222
222
  return;
223
223
  }
224
224
  let allTrue = true;
225
225
  let allFalse = true;
226
- for (let i = 0; i < list.length; i++) {
227
- allTrue && (allTrue = list[i]);
228
- allFalse && (allFalse = !list[i]);
226
+ for (let i = 0; i < list2.length; i++) {
227
+ allTrue && (allTrue = list2[i]);
228
+ allFalse && (allFalse = !list2[i]);
229
229
  }
230
230
  _checkAllRecord.value = allTrue;
231
231
  _halfChecked.value = !(allFalse || allTrue);
@@ -253,23 +253,6 @@ const createSorter = (dataSource, _data) => {
253
253
  const thList = [];
254
254
  return { sortData, thList };
255
255
  };
256
- const createFilter = (dataSource, _data) => {
257
- const fieldSet = /* @__PURE__ */ new Set();
258
- const filterData = (field, results) => {
259
- fieldSet.add(field);
260
- const fields = [...fieldSet];
261
- _data.value = dataSource.value.filter((item) => {
262
- return fields.reduce((prev, fieldKey) => {
263
- return prev && results.indexOf(item[fieldKey]) !== -1;
264
- }, true);
265
- });
266
- };
267
- const resetFilterData = () => {
268
- fieldSet.clear();
269
- _data.value = [...dataSource.value];
270
- };
271
- return { filterData, resetFilterData };
272
- };
273
256
  const createFixedLogic = (columns) => {
274
257
  const isFixedLeft = computed(() => {
275
258
  return columns.value.reduce((prev, current) => prev || !!current.fixedLeft, false);
@@ -284,7 +267,6 @@ function createStore(dataSource) {
284
267
  const { _columns, flatColumns, insertColumn, removeColumn, sortColumn, updateColumns } = createColumnGenerator();
285
268
  const { _checkAll, _checkList, _halfChecked, getCheckedRows } = createSelection(dataSource, _data);
286
269
  const { sortData, thList } = createSorter(dataSource, _data);
287
- const { filterData, resetFilterData } = createFilter(dataSource, _data);
288
270
  const { isFixedLeft } = createFixedLogic(_columns);
289
271
  return {
290
272
  states: {
@@ -302,9 +284,7 @@ function createStore(dataSource) {
302
284
  removeColumn,
303
285
  updateColumns,
304
286
  getCheckedRows,
305
- sortData,
306
- filterData,
307
- resetFilterData
287
+ sortData
308
288
  };
309
289
  }
310
290
  var ColGroup = defineComponent({
@@ -394,6 +374,16 @@ var Sort = defineComponent({
394
374
  }, null)])])])]);
395
375
  }
396
376
  });
377
+ const filterProps = {
378
+ filterList: {
379
+ type: Array,
380
+ default: () => []
381
+ },
382
+ multiple: {
383
+ type: Boolean,
384
+ default: true
385
+ }
386
+ };
397
387
  const dropdownProps = {
398
388
  visible: {
399
389
  type: Boolean,
@@ -484,7 +474,7 @@ const useDropdownEvent = ({ id, isOpen, origin, dropdownRef, props, emit }) => {
484
474
  setTimeout(() => {
485
475
  subscriptions.push(subscribeEvent(document, "click", (e) => {
486
476
  const dropdownValues = [...dropdownMap.values()];
487
- if (!isOpen.value || closeScope.value === "none" || dropdownEl.contains(e.target) && closeScope.value === "blank" || dropdownValues.some((item) => {
477
+ if (!isOpen.value || closeScope.value === "none" || (dropdownEl == null ? void 0 : dropdownEl.contains(e.target)) && closeScope.value === "blank" || dropdownValues.some((item) => {
488
478
  var _a;
489
479
  return (_a = item.toggleEl) == null ? void 0 : _a.contains(e.target);
490
480
  }) && dropdownValues.some((item) => {
@@ -600,7 +590,7 @@ function useOverlayProps(props, currentPosition, isOpen) {
600
590
  return { overlayModelValue, overlayShowValue, styles, classes, handlePositionChange };
601
591
  }
602
592
  var baseOverlay = "";
603
- function _isSlot(s) {
593
+ function _isSlot$1(s) {
604
594
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
605
595
  }
606
596
  const CommonOverlay = defineComponent({
@@ -612,7 +602,7 @@ const CommonOverlay = defineComponent({
612
602
  }, {
613
603
  default: () => [createVNode(Transition, {
614
604
  "name": "devui-overlay-fade"
615
- }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
605
+ }, _isSlot$1(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
616
606
  default: () => [_slot]
617
607
  })]
618
608
  });
@@ -911,6 +901,7 @@ var Dropdown = defineComponent({
911
901
  align,
912
902
  offset: offset2,
913
903
  destroyOnHide,
904
+ shiftOffset,
914
905
  showAnimation
915
906
  } = toRefs(props);
916
907
  const origin = ref();
@@ -964,6 +955,7 @@ var Dropdown = defineComponent({
964
955
  "position": position.value,
965
956
  "align": align.value,
966
957
  "offset": offset2.value,
958
+ "shiftOffset": shiftOffset == null ? void 0 : shiftOffset.value,
967
959
  "onPositionChange": handlePositionChange,
968
960
  "class": classes.value,
969
961
  "style": styles.value
@@ -1078,207 +1070,553 @@ defineComponent({
1078
1070
  });
1079
1071
  }
1080
1072
  });
1081
- var checkbox = "";
1082
- const commonProps = {
1073
+ const iconProps = {
1083
1074
  name: {
1084
1075
  type: String,
1085
- default: void 0
1086
- },
1087
- halfchecked: {
1088
- type: Boolean,
1089
- default: false
1090
- },
1091
- isShowTitle: {
1092
- type: Boolean,
1093
- default: true
1076
+ default: "",
1077
+ required: true
1094
1078
  },
1095
- title: {
1096
- type: String
1079
+ size: {
1080
+ type: String,
1081
+ default: "inherit"
1097
1082
  },
1098
1083
  color: {
1099
1084
  type: String,
1100
- default: void 0
1101
- },
1102
- showAnimation: {
1103
- type: Boolean,
1104
- default: true
1105
- },
1106
- disabled: {
1107
- type: Boolean,
1108
- default: false
1085
+ default: "inherit"
1109
1086
  },
1110
- beforeChange: {
1111
- type: Function,
1112
- default: void 0
1087
+ classPrefix: {
1088
+ type: String,
1089
+ default: "icon"
1113
1090
  }
1114
1091
  };
1115
- const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
1116
- halfchecked: {
1117
- type: Boolean,
1118
- default: false
1092
+ var Icon = defineComponent({
1093
+ name: "DIcon",
1094
+ props: iconProps,
1095
+ setup(props) {
1096
+ const {
1097
+ name,
1098
+ size,
1099
+ color,
1100
+ classPrefix
1101
+ } = toRefs(props);
1102
+ return () => {
1103
+ return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
1104
+ "src": name.value,
1105
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
1106
+ "style": {
1107
+ width: size.value,
1108
+ verticalAlign: "text-bottom"
1109
+ }
1110
+ }, null) : createVNode("i", {
1111
+ "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
1112
+ "style": {
1113
+ fontSize: size.value,
1114
+ color: color.value
1115
+ }
1116
+ }, null);
1117
+ };
1118
+ }
1119
+ });
1120
+ class View {
1121
+ constructor() {
1122
+ __publicField(this, "top", "50%");
1123
+ __publicField(this, "left", "50%");
1124
+ }
1125
+ }
1126
+ const loadingProps = {
1127
+ message: String,
1128
+ backdrop: Boolean,
1129
+ view: {
1130
+ type: Object,
1131
+ default: () => new View()
1119
1132
  },
1120
- checked: {
1133
+ zIndex: Number,
1134
+ isFull: {
1121
1135
  type: Boolean,
1122
1136
  default: false
1123
- },
1124
- value: {
1125
- type: String
1126
- },
1127
- label: {
1128
- type: String,
1129
- default: void 0
1130
- },
1131
- title: {
1132
- type: String,
1133
- default: void 0
1134
- },
1135
- "onUpdate:checked": {
1136
- type: Function,
1137
- default: void 0
1138
- },
1139
- onChange: {
1140
- type: Function,
1141
- default: void 0
1142
- },
1143
- modelValue: {
1144
- type: Boolean
1145
- },
1146
- "onUpdate:modelValue": {
1147
- type: Function
1148
1137
  }
1149
- });
1150
- const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
1151
- modelValue: {
1152
- type: Array,
1153
- required: true
1154
- },
1155
- direction: {
1156
- type: String,
1157
- default: "column"
1158
- },
1159
- itemWidth: {
1160
- type: Number,
1161
- default: void 0
1162
- },
1163
- options: {
1164
- type: Array,
1165
- default: () => []
1166
- },
1167
- onChange: {
1168
- type: Function,
1169
- default: void 0
1170
- },
1171
- "onUpdate:modelValue": {
1172
- type: Function,
1173
- default: void 0
1138
+ };
1139
+ class LoadingOptions {
1140
+ constructor() {
1141
+ __publicField(this, "target");
1142
+ __publicField(this, "message");
1143
+ __publicField(this, "loadingTemplateRef");
1144
+ __publicField(this, "backdrop", true);
1145
+ __publicField(this, "positionType", "relative");
1146
+ __publicField(this, "view", new View());
1147
+ __publicField(this, "zIndex");
1174
1148
  }
1175
- });
1176
- const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
1177
- var Checkbox = defineComponent({
1178
- name: "DCheckbox",
1179
- props: checkboxProps,
1180
- emits: ["change", "update:checked", "update:modelValue"],
1181
- setup(props, ctx) {
1182
- const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
1183
- const isChecked = computed(() => props.checked || props.modelValue);
1184
- const mergedDisabled = computed(() => {
1185
- return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
1186
- });
1187
- const mergedChecked = computed(() => {
1188
- var _a, _b;
1189
- return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
1190
- });
1191
- const mergedIsShowTitle = computed(() => {
1192
- var _a;
1193
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
1194
- });
1195
- const mergedShowAnimation = computed(() => {
1196
- var _a;
1197
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
1198
- });
1199
- const mergedColor = computed(() => {
1200
- var _a;
1201
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
1202
- });
1203
- const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
1204
- const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
1205
- const canChange = (checked, val) => {
1206
- var _a;
1207
- if (mergedDisabled.value) {
1208
- return Promise.resolve(false);
1209
- }
1210
- const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
1211
- if (beforeChange) {
1212
- const res = beforeChange(checked, val);
1213
- if (typeof res === "boolean") {
1214
- return Promise.resolve(res);
1215
- }
1216
- return res;
1217
- }
1218
- return Promise.resolve(true);
1149
+ }
1150
+ var loading = "";
1151
+ var Loading = defineComponent({
1152
+ name: "DLoading",
1153
+ inheritAttrs: false,
1154
+ props: loadingProps,
1155
+ setup(props) {
1156
+ const style = {
1157
+ top: props.view.top,
1158
+ left: props.view.left,
1159
+ zIndex: props.zIndex
1219
1160
  };
1220
- const toggle = () => {
1221
- const current = !isChecked.value;
1222
- checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
1223
- ctx.emit("update:checked", current);
1224
- ctx.emit("update:modelValue", current);
1225
- ctx.emit("change", current);
1161
+ if (!props.message) {
1162
+ style.background = "none";
1163
+ }
1164
+ const isShow = ref(false);
1165
+ const open = () => {
1166
+ isShow.value = true;
1226
1167
  };
1227
- const handleClick = () => {
1228
- canChange(!isChecked.value, props.label).then((res) => res && toggle());
1168
+ const close = () => {
1169
+ isShow.value = false;
1229
1170
  };
1230
1171
  return {
1231
- itemWidth,
1232
- direction,
1233
- mergedColor,
1234
- mergedDisabled,
1235
- mergedIsShowTitle,
1236
- mergedChecked,
1237
- mergedShowAnimation,
1238
- handleClick
1172
+ style,
1173
+ isShow,
1174
+ open,
1175
+ close
1239
1176
  };
1240
1177
  },
1241
1178
  render() {
1242
1179
  var _a;
1243
1180
  const {
1244
- itemWidth,
1245
- direction,
1246
- mergedChecked,
1247
- mergedDisabled,
1248
- mergedIsShowTitle,
1249
- mergedShowAnimation,
1250
- halfchecked,
1251
- title,
1252
- label,
1253
- handleClick,
1254
- name,
1255
- value,
1256
- mergedColor,
1181
+ isShow,
1182
+ isFull,
1183
+ backdrop,
1184
+ style,
1185
+ message,
1257
1186
  $slots
1258
1187
  } = this;
1259
- const wrapperCls = {
1260
- "devui-checkbox-column-margin": direction === "column",
1261
- "devui-checkbox-wrap": typeof itemWidth !== "undefined"
1262
- };
1263
- const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
1264
- const checkboxCls = {
1265
- "devui-checkbox": true,
1266
- active: mergedChecked,
1267
- halfchecked,
1268
- disabled: mergedDisabled,
1269
- unchecked: !mergedChecked
1270
- };
1271
- const labelTitle = mergedIsShowTitle ? title || label : "";
1272
- const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
1273
- const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
1274
- const spanCls = {
1275
- "devui-checkbox-material": true,
1276
- "custom-color": mergedColor,
1277
- "devui-checkbox-no-label": !label && !$slots.default,
1278
- "devui-no-animation": !mergedShowAnimation,
1279
- "devui-checkbox-default-background": !halfchecked
1280
- };
1281
- const polygonCls = {
1188
+ return isShow && createVNode("div", {
1189
+ "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
1190
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
1191
+ "class": "devui-loading-wrapper"
1192
+ }, [backdrop ? createVNode("div", {
1193
+ "class": "devui-loading-mask"
1194
+ }, null) : null, createVNode("div", {
1195
+ "style": style,
1196
+ "class": "devui-loading-area"
1197
+ }, [createVNode("div", {
1198
+ "class": "devui-busy-default-spinner"
1199
+ }, [createVNode("div", {
1200
+ "class": "devui-loading-bar1"
1201
+ }, null), createVNode("div", {
1202
+ "class": "devui-loading-bar2"
1203
+ }, null), createVNode("div", {
1204
+ "class": "devui-loading-bar3"
1205
+ }, null), createVNode("div", {
1206
+ "class": "devui-loading-bar4"
1207
+ }, null)]), message ? createVNode("span", {
1208
+ "class": "devui-loading-text"
1209
+ }, [message]) : null])])]);
1210
+ }
1211
+ });
1212
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1213
+ function createComponent(component, props, children = null) {
1214
+ const vnode = h(component, __spreadValues({}, props), children);
1215
+ const container = document.createElement("div");
1216
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1217
+ render(vnode, container);
1218
+ return vnode.component;
1219
+ }
1220
+ function unmountComponent(ComponnetInstance) {
1221
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1222
+ }
1223
+ const loadingConstructor = defineComponent(Loading);
1224
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
1225
+ const isEmpty = (val) => {
1226
+ if (!val) {
1227
+ return true;
1228
+ }
1229
+ if (Array.isArray(val)) {
1230
+ return val.length === 0;
1231
+ }
1232
+ if (val instanceof Set || val instanceof Map) {
1233
+ return val.size === 0;
1234
+ }
1235
+ if (val instanceof Promise) {
1236
+ return false;
1237
+ }
1238
+ if (typeof val === "object") {
1239
+ try {
1240
+ return Object.keys(val).length === 0;
1241
+ } catch (e) {
1242
+ return false;
1243
+ }
1244
+ }
1245
+ return false;
1246
+ };
1247
+ const getType = (vari) => {
1248
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1249
+ };
1250
+ const isPromise = (value) => {
1251
+ const type = getType(value);
1252
+ switch (type) {
1253
+ case "promise":
1254
+ return [value];
1255
+ case "array":
1256
+ if (value.some((val) => getType(val) !== "promise")) {
1257
+ console.error(new TypeError("Binding values should all be of type Promise"));
1258
+ return "error";
1259
+ }
1260
+ return value;
1261
+ default:
1262
+ return false;
1263
+ }
1264
+ };
1265
+ const unmount = (el) => {
1266
+ cacheInstance.delete(el);
1267
+ el.instance.proxy.close();
1268
+ unmountComponent(el.instance);
1269
+ };
1270
+ const toggleLoading = (el, binding) => {
1271
+ var _a, _b, _c;
1272
+ if (binding.value) {
1273
+ const vals = isPromise(binding.value);
1274
+ if (vals === "error") {
1275
+ return;
1276
+ }
1277
+ (_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
1278
+ el.appendChild(el.mask);
1279
+ cacheInstance.add(el);
1280
+ if (vals) {
1281
+ Promise.all(vals).catch((err) => {
1282
+ console.error(new Error("Promise handling errors"), err);
1283
+ }).finally(() => {
1284
+ unmount(el);
1285
+ });
1286
+ }
1287
+ } else {
1288
+ unmount(el);
1289
+ }
1290
+ };
1291
+ const removeAttribute = (el) => {
1292
+ el.removeAttribute("zindex");
1293
+ el.removeAttribute("positiontype");
1294
+ el.removeAttribute("backdrop");
1295
+ el.removeAttribute("message");
1296
+ el.removeAttribute("view");
1297
+ el.removeAttribute("loadingtemplateref");
1298
+ };
1299
+ const handleProps = (el, vprops) => {
1300
+ var _a;
1301
+ const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
1302
+ const loadingTemplateRef = props.loadingTemplateRef;
1303
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1304
+ el.style.position = props.positionType;
1305
+ el.options = props;
1306
+ el.instance = loadingInstance;
1307
+ el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
1308
+ };
1309
+ const loadingDirective = {
1310
+ mounted: function(el, binding, vnode) {
1311
+ handleProps(el, vnode.props);
1312
+ removeAttribute(el);
1313
+ !isEmpty(binding.value) && toggleLoading(el, binding);
1314
+ },
1315
+ updated: function(el, binding, vnode) {
1316
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
1317
+ return;
1318
+ }
1319
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
1320
+ removeAttribute(el);
1321
+ toggleLoading(el, binding);
1322
+ }
1323
+ };
1324
+ const buttonProps = {
1325
+ variant: {
1326
+ type: String,
1327
+ default: "outline"
1328
+ },
1329
+ size: {
1330
+ type: String,
1331
+ default: "md"
1332
+ },
1333
+ color: {
1334
+ type: String
1335
+ },
1336
+ icon: {
1337
+ type: String,
1338
+ default: ""
1339
+ },
1340
+ loading: {
1341
+ type: Boolean,
1342
+ default: false
1343
+ },
1344
+ disabled: {
1345
+ type: Boolean,
1346
+ default: false
1347
+ }
1348
+ };
1349
+ function useButton(props, ctx) {
1350
+ const hasContent = computed(() => ctx.slots.default);
1351
+ const colorMap = {
1352
+ solid: "primary",
1353
+ outline: "secondary",
1354
+ text: "secondary"
1355
+ };
1356
+ const defaultColor = colorMap[props.variant];
1357
+ const classes = computed(() => ({
1358
+ "devui-btn": true,
1359
+ [`devui-btn-${props.variant}`]: true,
1360
+ [`devui-btn-${props.variant}-${props.color || defaultColor}`]: true,
1361
+ [`devui-btn-${props.size}`]: true,
1362
+ "devui-btn-icon-wrap": props.icon,
1363
+ "devui-btn-icon": props.icon && !hasContent.value && props.variant !== "solid"
1364
+ }));
1365
+ const iconClass = computed(() => {
1366
+ if (!props.icon) {
1367
+ return;
1368
+ }
1369
+ const origin = "devui-icon-fix icon";
1370
+ if (hasContent.value) {
1371
+ return `${origin} clear-right-5`;
1372
+ } else {
1373
+ return origin;
1374
+ }
1375
+ });
1376
+ return { classes, iconClass };
1377
+ }
1378
+ var button = "";
1379
+ var Button = defineComponent({
1380
+ name: "DButton",
1381
+ directives: {
1382
+ dLoading: loadingDirective
1383
+ },
1384
+ props: buttonProps,
1385
+ emits: ["click"],
1386
+ setup(props, ctx) {
1387
+ const {
1388
+ icon,
1389
+ disabled,
1390
+ loading: loading2
1391
+ } = toRefs(props);
1392
+ const {
1393
+ classes,
1394
+ iconClass
1395
+ } = useButton(props, ctx);
1396
+ const onClick = (e) => {
1397
+ if (loading2.value) {
1398
+ return;
1399
+ }
1400
+ ctx.emit("click", e);
1401
+ };
1402
+ return () => {
1403
+ var _a, _b;
1404
+ return withDirectives(createVNode("button", {
1405
+ "class": classes.value,
1406
+ "disabled": disabled.value,
1407
+ "onClick": onClick
1408
+ }, [icon.value && createVNode(Icon, {
1409
+ "name": icon.value,
1410
+ "size": "var(--devui-font-size, 12px)",
1411
+ "color": "",
1412
+ "class": iconClass.value
1413
+ }, null), createVNode("span", {
1414
+ "class": "button-content"
1415
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
1416
+ };
1417
+ }
1418
+ });
1419
+ var checkbox = "";
1420
+ const commonProps = {
1421
+ name: {
1422
+ type: String,
1423
+ default: void 0
1424
+ },
1425
+ halfchecked: {
1426
+ type: Boolean,
1427
+ default: false
1428
+ },
1429
+ isShowTitle: {
1430
+ type: Boolean,
1431
+ default: true
1432
+ },
1433
+ title: {
1434
+ type: String
1435
+ },
1436
+ color: {
1437
+ type: String,
1438
+ default: void 0
1439
+ },
1440
+ showAnimation: {
1441
+ type: Boolean,
1442
+ default: true
1443
+ },
1444
+ disabled: {
1445
+ type: Boolean,
1446
+ default: false
1447
+ },
1448
+ beforeChange: {
1449
+ type: Function,
1450
+ default: void 0
1451
+ }
1452
+ };
1453
+ const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
1454
+ halfchecked: {
1455
+ type: Boolean,
1456
+ default: false
1457
+ },
1458
+ checked: {
1459
+ type: Boolean,
1460
+ default: false
1461
+ },
1462
+ value: {
1463
+ type: String
1464
+ },
1465
+ label: {
1466
+ type: String,
1467
+ default: void 0
1468
+ },
1469
+ title: {
1470
+ type: String,
1471
+ default: void 0
1472
+ },
1473
+ "onUpdate:checked": {
1474
+ type: Function,
1475
+ default: void 0
1476
+ },
1477
+ onChange: {
1478
+ type: Function,
1479
+ default: void 0
1480
+ },
1481
+ modelValue: {
1482
+ type: Boolean
1483
+ },
1484
+ "onUpdate:modelValue": {
1485
+ type: Function
1486
+ }
1487
+ });
1488
+ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
1489
+ modelValue: {
1490
+ type: Array,
1491
+ required: true
1492
+ },
1493
+ direction: {
1494
+ type: String,
1495
+ default: "column"
1496
+ },
1497
+ itemWidth: {
1498
+ type: Number,
1499
+ default: void 0
1500
+ },
1501
+ options: {
1502
+ type: Array,
1503
+ default: () => []
1504
+ },
1505
+ onChange: {
1506
+ type: Function,
1507
+ default: void 0
1508
+ },
1509
+ "onUpdate:modelValue": {
1510
+ type: Function,
1511
+ default: void 0
1512
+ }
1513
+ });
1514
+ const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
1515
+ var Checkbox = defineComponent({
1516
+ name: "DCheckbox",
1517
+ props: checkboxProps,
1518
+ emits: ["change", "update:checked", "update:modelValue"],
1519
+ setup(props, ctx) {
1520
+ const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
1521
+ const isChecked = computed(() => props.checked || props.modelValue);
1522
+ const mergedDisabled = computed(() => {
1523
+ return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
1524
+ });
1525
+ const mergedChecked = computed(() => {
1526
+ var _a, _b;
1527
+ return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
1528
+ });
1529
+ const mergedIsShowTitle = computed(() => {
1530
+ var _a;
1531
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
1532
+ });
1533
+ const mergedShowAnimation = computed(() => {
1534
+ var _a;
1535
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
1536
+ });
1537
+ const mergedColor = computed(() => {
1538
+ var _a;
1539
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
1540
+ });
1541
+ const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
1542
+ const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
1543
+ const canChange = (checked, val) => {
1544
+ var _a;
1545
+ if (mergedDisabled.value) {
1546
+ return Promise.resolve(false);
1547
+ }
1548
+ const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
1549
+ if (beforeChange) {
1550
+ const res = beforeChange(checked, val);
1551
+ if (typeof res === "boolean") {
1552
+ return Promise.resolve(res);
1553
+ }
1554
+ return res;
1555
+ }
1556
+ return Promise.resolve(true);
1557
+ };
1558
+ const toggle = () => {
1559
+ const current = !isChecked.value;
1560
+ checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
1561
+ ctx.emit("update:checked", current);
1562
+ ctx.emit("update:modelValue", current);
1563
+ ctx.emit("change", current);
1564
+ };
1565
+ const handleClick = () => {
1566
+ canChange(!isChecked.value, props.label).then((res) => res && toggle());
1567
+ };
1568
+ return {
1569
+ itemWidth,
1570
+ direction,
1571
+ mergedColor,
1572
+ mergedDisabled,
1573
+ mergedIsShowTitle,
1574
+ mergedChecked,
1575
+ mergedShowAnimation,
1576
+ handleClick
1577
+ };
1578
+ },
1579
+ render() {
1580
+ var _a;
1581
+ const {
1582
+ itemWidth,
1583
+ direction,
1584
+ mergedChecked,
1585
+ mergedDisabled,
1586
+ mergedIsShowTitle,
1587
+ mergedShowAnimation,
1588
+ halfchecked,
1589
+ title,
1590
+ label,
1591
+ handleClick,
1592
+ name,
1593
+ value,
1594
+ mergedColor,
1595
+ $slots
1596
+ } = this;
1597
+ const wrapperCls = {
1598
+ "devui-checkbox-column-margin": direction === "column",
1599
+ "devui-checkbox-wrap": typeof itemWidth !== "undefined"
1600
+ };
1601
+ const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
1602
+ const checkboxCls = {
1603
+ "devui-checkbox": true,
1604
+ active: mergedChecked,
1605
+ halfchecked,
1606
+ disabled: mergedDisabled,
1607
+ unchecked: !mergedChecked
1608
+ };
1609
+ const labelTitle = mergedIsShowTitle ? title || label : "";
1610
+ const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
1611
+ const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
1612
+ const spanCls = {
1613
+ "devui-checkbox-material": true,
1614
+ "custom-color": mergedColor,
1615
+ "devui-checkbox-no-label": !label && !$slots.default,
1616
+ "devui-no-animation": !mergedShowAnimation,
1617
+ "devui-checkbox-default-background": !halfchecked
1618
+ };
1619
+ const polygonCls = {
1282
1620
  "devui-tick": true,
1283
1621
  "devui-no-animation": !mergedShowAnimation
1284
1622
  };
@@ -1419,99 +1757,242 @@ defineComponent({
1419
1757
  }, [children])]);
1420
1758
  }
1421
1759
  });
1422
- var filter = "";
1423
- const Filter = defineComponent({
1760
+ function useFilterRender(ctx) {
1761
+ const showMenu = ref(false);
1762
+ const filterMenuRef = ref(null);
1763
+ const filterIconRef = ref(null);
1764
+ const singleVal = ref(null);
1765
+ const multipleVal = ref(null);
1766
+ const handleIconClick = () => {
1767
+ showMenu.value = !showMenu.value;
1768
+ };
1769
+ const handleConfirm = (val) => {
1770
+ showMenu.value = false;
1771
+ multipleVal.value = val;
1772
+ ctx.emit("filter", val);
1773
+ };
1774
+ const handleSelect = (val) => {
1775
+ showMenu.value = false;
1776
+ singleVal.value = val;
1777
+ ctx.emit("filter", val);
1778
+ };
1779
+ const iconClasses = computed(() => {
1780
+ var _a;
1781
+ return {
1782
+ "filter-icon": true,
1783
+ "filter-icon-active": Boolean(singleVal.value || ((_a = multipleVal.value) == null ? void 0 : _a.length))
1784
+ };
1785
+ });
1786
+ onClickOutside(filterMenuRef, () => {
1787
+ showMenu.value = false;
1788
+ }, {
1789
+ ignore: [filterIconRef]
1790
+ });
1791
+ return { showMenu, filterMenuRef, filterIconRef, iconClasses, handleIconClick, handleConfirm, handleSelect };
1792
+ }
1793
+ function useFilterMultiple(filterList, ctx) {
1794
+ const _checkList = ref([]);
1795
+ const _checkAllRecord = ref(false);
1796
+ const _checkAll = computed({
1797
+ get: () => _checkAllRecord.value,
1798
+ set: (val) => {
1799
+ _checkAllRecord.value = val;
1800
+ for (let i = 0; i < _checkList.value.length; i++) {
1801
+ _checkList.value[i].checked = val;
1802
+ }
1803
+ }
1804
+ });
1805
+ const _halfChecked = ref(false);
1806
+ filterList == null ? void 0 : filterList.forEach((item) => {
1807
+ _checkList.value.push(__spreadValues({ checked: false }, item));
1808
+ });
1809
+ watch(_checkList, (list2) => {
1810
+ if (!list2.length) {
1811
+ return;
1812
+ }
1813
+ let allTrue = true;
1814
+ let allFalse = true;
1815
+ for (let i = 0; i < list2.length; i++) {
1816
+ allTrue && (allTrue = Boolean(list2[i].checked));
1817
+ allFalse && (allFalse = Boolean(!list2[i].checked));
1818
+ }
1819
+ _checkAllRecord.value = allTrue;
1820
+ _halfChecked.value = !(allFalse || allTrue);
1821
+ }, { immediate: true, deep: true });
1822
+ const getCheckedItems = () => {
1823
+ return _checkList.value.filter((item) => item.checked);
1824
+ };
1825
+ const handleConfirm = () => {
1826
+ ctx.emit("confirm", getCheckedItems());
1827
+ };
1828
+ return { _checkList, _checkAll, _halfChecked, handleConfirm };
1829
+ }
1830
+ function useFilterSingle(ctx) {
1831
+ const selectedItem = ref(null);
1832
+ const handleSelect = (val) => {
1833
+ selectedItem.value = val;
1834
+ ctx.emit("select", val);
1835
+ };
1836
+ return { selectedItem, handleSelect };
1837
+ }
1838
+ var MultipleFilter = defineComponent({
1839
+ props: {
1840
+ filterList: {
1841
+ type: Array,
1842
+ default: () => []
1843
+ }
1844
+ },
1845
+ emits: ["confirm"],
1846
+ setup(props, ctx) {
1847
+ const {
1848
+ _checkList,
1849
+ _checkAll,
1850
+ _halfChecked,
1851
+ handleConfirm
1852
+ } = useFilterMultiple(props.filterList, ctx);
1853
+ return () => createVNode(Fragment, null, [createVNode("div", {
1854
+ "class": "filter-all-check"
1855
+ }, [createVNode("div", {
1856
+ "class": "filter-item"
1857
+ }, [createVNode(Checkbox, {
1858
+ "modelValue": _checkAll.value,
1859
+ "onUpdate:modelValue": ($event) => _checkAll.value = $event,
1860
+ "halfchecked": _halfChecked.value,
1861
+ "label": "\u5168\u9009"
1862
+ }, null)])]), createVNode("div", {
1863
+ "class": "filter-multiple-menu"
1864
+ }, [_checkList.value.map((item) => createVNode("div", {
1865
+ "class": "filter-item"
1866
+ }, [createVNode(Checkbox, {
1867
+ "modelValue": item.checked,
1868
+ "onUpdate:modelValue": ($event) => item.checked = $event,
1869
+ "label": item.name
1870
+ }, null)]))]), createVNode("div", {
1871
+ "class": "filter-operation"
1872
+ }, [createVNode(Button, {
1873
+ "variant": "text",
1874
+ "onClick": handleConfirm
1875
+ }, {
1876
+ default: () => [createTextVNode("\u786E\u5B9A")]
1877
+ })])]);
1878
+ }
1879
+ });
1880
+ var list = "";
1881
+ var List = defineComponent({
1882
+ name: "DList",
1883
+ setup(props, {
1884
+ slots
1885
+ }) {
1886
+ return () => {
1887
+ var _a;
1888
+ return createVNode("div", {
1889
+ "class": "devui-list"
1890
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
1891
+ };
1892
+ }
1893
+ });
1894
+ var listItem = "";
1895
+ var ListItem = defineComponent({
1896
+ name: "DListItem",
1897
+ setup(props, {
1898
+ slots
1899
+ }) {
1900
+ return () => {
1901
+ var _a;
1902
+ return createVNode("div", {
1903
+ "class": "devui-list-item"
1904
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
1905
+ };
1906
+ }
1907
+ });
1908
+ function _isSlot(s) {
1909
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1910
+ }
1911
+ var SingleFilter = defineComponent({
1424
1912
  props: {
1425
- modelValue: {
1426
- type: Array,
1427
- default: []
1428
- },
1429
- "onUpdate:modelValue": {
1430
- type: Function
1431
- },
1432
- customTemplate: {
1433
- type: Function
1434
- },
1435
1913
  filterList: {
1436
1914
  type: Array,
1437
- required: true
1438
- },
1439
- filterMultiple: {
1440
- type: Boolean,
1441
- default: true
1915
+ default: () => []
1442
1916
  }
1443
1917
  },
1444
- emits: ["update:modelValue"],
1445
- setup(props) {
1446
- const filterOrigin = ref(null);
1447
- const onUpdateChecked = (config, value) => {
1448
- const checkedList = props.modelValue;
1449
- const update = props["onUpdate:modelValue"];
1450
- const contained = !!checkedList.find((item) => item === config.value);
1451
- if (value && !contained) {
1452
- update == null ? void 0 : update([...checkedList, config.value]);
1453
- } else if (!value && contained) {
1454
- update == null ? void 0 : update(checkedList.filter((item) => config.value !== item));
1455
- }
1456
- };
1457
- const updateSingleChecked = (config) => {
1458
- var _a;
1459
- (_a = props["onUpdate:modelValue"]) == null ? void 0 : _a.call(props, [config.value]);
1460
- };
1461
- const dropdownContent = computed(() => {
1462
- const checkedList = props.modelValue;
1463
- const isContained = (config) => !!checkedList.find((item) => item === config.value);
1464
- return () => createVNode("ul", {
1465
- "class": "devui-dropdown-menu data-table-column-filter-content",
1466
- "style": "padding:10px"
1467
- }, [props.filterList.map((item, index2) => {
1468
- return createVNode("li", {
1469
- "style": index2 > 0 ? "margin-top:10px" : ""
1470
- }, [props.filterMultiple ? createVNode(Checkbox, {
1471
- "modelValue": isContained(item),
1472
- "onUpdate:modelValue": (value) => onUpdateChecked(item, value)
1473
- }, {
1474
- default: () => [item.name]
1475
- }) : createVNode("span", {
1476
- "onClick": () => updateSingleChecked(item)
1477
- }, [item.name])]);
1918
+ emits: ["select"],
1919
+ setup(props, ctx) {
1920
+ const {
1921
+ selectedItem,
1922
+ handleSelect
1923
+ } = useFilterSingle(ctx);
1924
+ return () => {
1925
+ let _slot;
1926
+ return createVNode(Fragment, null, [createVNode(List, {
1927
+ "class": "filter-single-menu"
1928
+ }, _isSlot(_slot = props.filterList.map((item) => createVNode(ListItem, {
1929
+ "class": ["filter-item", {
1930
+ "filter-item-active": selectedItem.value === item
1931
+ }],
1932
+ "onClick": () => {
1933
+ handleSelect(item);
1934
+ }
1935
+ }, {
1936
+ default: () => [item.name]
1937
+ }))) ? _slot : {
1938
+ default: () => [_slot]
1478
1939
  })]);
1479
- });
1480
- return () => createVNode(Fragment, null, [createVNode("span", {
1481
- "ref": filterOrigin
1482
- }, [createVNode("i", {
1483
- "class": ["filter-icon", {
1484
- "filter-icon-active": true
1485
- }]
1486
- }, [createVNode("svg", {
1487
- "width": "16px",
1488
- "height": "16px",
1489
- "viewBox": "0 0 16 16",
1490
- "version": "1.1",
1491
- "xmlns": "http://www.w3.org/2000/svg",
1492
- "xmlns:xlink": "http://www.w3.org/1999/xlink"
1493
- }, [createVNode("g", {
1494
- "stroke": "none",
1495
- "stroke-width": "1",
1496
- "fill": "none",
1497
- "fill-rule": "evenodd"
1498
- }, [createVNode("g", null, [createVNode("polygon", {
1499
- "points": "10.0085775 7 10.0085775 15 6 13 6 7 2 3 2 1 14 1 14 3"
1500
- }, null)])])])])]), createVNode(Dropdown, {
1501
- "origin": filterOrigin.value,
1502
- "closeScope": "blank"
1940
+ };
1941
+ }
1942
+ });
1943
+ var filter = "";
1944
+ var Filter = defineComponent({
1945
+ props: filterProps,
1946
+ emits: ["filter"],
1947
+ setup(props, ctx) {
1948
+ const {
1949
+ showMenu,
1950
+ filterMenuRef,
1951
+ filterIconRef,
1952
+ iconClasses,
1953
+ handleIconClick,
1954
+ handleConfirm,
1955
+ handleSelect
1956
+ } = useFilterRender(ctx);
1957
+ return () => createVNode(Dropdown, {
1958
+ "visible": showMenu.value,
1959
+ "trigger": "manually",
1960
+ "close-scope": "none",
1961
+ "destroy-on-hide": false,
1962
+ "style": "padding-bottom: 4px;"
1503
1963
  }, {
1504
- default: () => {
1505
- var _a, _b;
1506
- return [(_b = (_a = props.customTemplate) == null ? void 0 : _a.call(props, {
1507
- value: props.modelValue,
1508
- onChange: props["onUpdate:modelValue"]
1509
- })) != null ? _b : dropdownContent.value()];
1510
- }
1511
- })]);
1964
+ default: () => createVNode("i", {
1965
+ "ref": filterIconRef,
1966
+ "class": iconClasses.value,
1967
+ "onClick": handleIconClick
1968
+ }, [createVNode("svg", {
1969
+ "width": "16px",
1970
+ "height": "16px",
1971
+ "viewBox": "0 0 16 16",
1972
+ "version": "1.1",
1973
+ "xmlns": "http://www.w3.org/2000/svg"
1974
+ }, [createVNode("g", {
1975
+ "stroke": "none",
1976
+ "stroke-width": "1",
1977
+ "fill": "none",
1978
+ "fill-rule": "evenodd"
1979
+ }, [createVNode("g", null, [createVNode("polygon", {
1980
+ "points": "10.0085775 7 10.0085775 15 6 13 6 7 2 3 2 1 14 1 14 3"
1981
+ }, null)])])])]),
1982
+ menu: () => createVNode("div", {
1983
+ "ref": filterMenuRef,
1984
+ "class": "filter-wrapper"
1985
+ }, [props.multiple ? createVNode(MultipleFilter, {
1986
+ "filterList": props.filterList,
1987
+ "onConfirm": handleConfirm
1988
+ }, null) : createVNode(SingleFilter, {
1989
+ "filterList": props.filterList,
1990
+ "onSelect": handleSelect
1991
+ }, null)])
1992
+ });
1512
1993
  }
1513
1994
  });
1514
- const useSort = (column) => {
1995
+ function useSort(column) {
1515
1996
  const table2 = inject(TABLE_TOKEN);
1516
1997
  const store = table2.store;
1517
1998
  const direction = ref(column.value.sortDirection);
@@ -1543,14 +2024,18 @@ const useSort = (column) => {
1543
2024
  direction.value = "";
1544
2025
  };
1545
2026
  return { direction, sortClass, handleSort, clearSortOrder };
1546
- };
1547
- const useFilter = (store, column) => {
1548
- const filteredRef = shallowRef();
1549
- watch(filteredRef, (results) => {
1550
- store.filterData(column.value.field, results);
1551
- });
1552
- return filteredRef;
1553
- };
2027
+ }
2028
+ function useFilter(column) {
2029
+ const filter2 = ref(null);
2030
+ const filterClass = computed(() => ({
2031
+ "filter-active": Boolean(filter2.value || Array.isArray(filter2.value) && filter2.value.length)
2032
+ }));
2033
+ const handleFilter = (val) => {
2034
+ filter2.value = val;
2035
+ column.value.ctx.emit("filter-change", val);
2036
+ };
2037
+ return { filterClass, handleFilter };
2038
+ }
1554
2039
  var TH = defineComponent({
1555
2040
  name: "DTableHeaderTh",
1556
2041
  props: {
@@ -1573,7 +2058,10 @@ var TH = defineComponent({
1573
2058
  handleSort,
1574
2059
  clearSortOrder
1575
2060
  } = useSort(column);
1576
- const filteredRef = useFilter(store, column);
2061
+ const {
2062
+ filterClass,
2063
+ handleFilter
2064
+ } = useFilter(column);
1577
2065
  const {
1578
2066
  stickyClass,
1579
2067
  stickyStyle
@@ -1584,15 +2072,14 @@ var TH = defineComponent({
1584
2072
  return () => {
1585
2073
  var _a, _b;
1586
2074
  return createVNode("th", {
1587
- "class": [stickyClass.value, sortClass.value],
2075
+ "class": [stickyClass.value, sortClass.value, filterClass.value],
1588
2076
  "style": stickyStyle.value
1589
2077
  }, [createVNode("div", {
1590
2078
  "class": "header-container"
1591
2079
  }, [(_b = (_a = column.value).renderHeader) == null ? void 0 : _b.call(_a, column.value, store), column.value.filterable && createVNode(Filter, {
1592
- "modelValue": filteredRef.value,
1593
- "onUpdate:modelValue": ($event) => filteredRef.value = $event,
1594
- "filterList": props.column.filterList,
1595
- "customTemplate": props.column.customFilterTemplate
2080
+ "filterList": column.value.filterList,
2081
+ "multiple": column.value.filterMultiple,
2082
+ "onFilter": handleFilter
1596
2083
  }, null), column.value.sortable && createVNode(Sort, {
1597
2084
  "sort-direction": direction.value,
1598
2085
  "onSort": handleSort
@@ -1855,210 +2342,6 @@ var NormalHeader = defineComponent({
1855
2342
  };
1856
2343
  }
1857
2344
  });
1858
- class View {
1859
- constructor() {
1860
- __publicField(this, "top", "50%");
1861
- __publicField(this, "left", "50%");
1862
- }
1863
- }
1864
- const loadingProps = {
1865
- message: String,
1866
- backdrop: Boolean,
1867
- view: {
1868
- type: Object,
1869
- default: () => new View()
1870
- },
1871
- zIndex: Number,
1872
- isFull: {
1873
- type: Boolean,
1874
- default: false
1875
- }
1876
- };
1877
- class LoadingOptions {
1878
- constructor() {
1879
- __publicField(this, "target");
1880
- __publicField(this, "message");
1881
- __publicField(this, "loadingTemplateRef");
1882
- __publicField(this, "backdrop", true);
1883
- __publicField(this, "positionType", "relative");
1884
- __publicField(this, "view", new View());
1885
- __publicField(this, "zIndex");
1886
- }
1887
- }
1888
- var loading = "";
1889
- var Loading = defineComponent({
1890
- name: "DLoading",
1891
- inheritAttrs: false,
1892
- props: loadingProps,
1893
- setup(props) {
1894
- const style = {
1895
- top: props.view.top,
1896
- left: props.view.left,
1897
- zIndex: props.zIndex
1898
- };
1899
- if (!props.message) {
1900
- style.background = "none";
1901
- }
1902
- const isShow = ref(false);
1903
- const open = () => {
1904
- isShow.value = true;
1905
- };
1906
- const close = () => {
1907
- isShow.value = false;
1908
- };
1909
- return {
1910
- style,
1911
- isShow,
1912
- open,
1913
- close
1914
- };
1915
- },
1916
- render() {
1917
- var _a;
1918
- const {
1919
- isShow,
1920
- isFull,
1921
- backdrop,
1922
- style,
1923
- message,
1924
- $slots
1925
- } = this;
1926
- return isShow && createVNode("div", {
1927
- "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
1928
- }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
1929
- "class": "devui-loading-wrapper"
1930
- }, [backdrop ? createVNode("div", {
1931
- "class": "devui-loading-mask"
1932
- }, null) : null, createVNode("div", {
1933
- "style": style,
1934
- "class": "devui-loading-area"
1935
- }, [createVNode("div", {
1936
- "class": "devui-busy-default-spinner"
1937
- }, [createVNode("div", {
1938
- "class": "devui-loading-bar1"
1939
- }, null), createVNode("div", {
1940
- "class": "devui-loading-bar2"
1941
- }, null), createVNode("div", {
1942
- "class": "devui-loading-bar3"
1943
- }, null), createVNode("div", {
1944
- "class": "devui-loading-bar4"
1945
- }, null)]), message ? createVNode("span", {
1946
- "class": "devui-loading-text"
1947
- }, [message]) : null])])]);
1948
- }
1949
- });
1950
- const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1951
- function createComponent(component, props, children = null) {
1952
- const vnode = h(component, __spreadValues({}, props), children);
1953
- const container = document.createElement("div");
1954
- vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1955
- render(vnode, container);
1956
- return vnode.component;
1957
- }
1958
- function unmountComponent(ComponnetInstance) {
1959
- render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1960
- }
1961
- const loadingConstructor = defineComponent(Loading);
1962
- const cacheInstance = /* @__PURE__ */ new WeakSet();
1963
- const isEmpty = (val) => {
1964
- if (!val) {
1965
- return true;
1966
- }
1967
- if (Array.isArray(val)) {
1968
- return val.length === 0;
1969
- }
1970
- if (val instanceof Set || val instanceof Map) {
1971
- return val.size === 0;
1972
- }
1973
- if (val instanceof Promise) {
1974
- return false;
1975
- }
1976
- if (typeof val === "object") {
1977
- try {
1978
- return Object.keys(val).length === 0;
1979
- } catch (e) {
1980
- return false;
1981
- }
1982
- }
1983
- return false;
1984
- };
1985
- const getType = (vari) => {
1986
- return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1987
- };
1988
- const isPromise = (value) => {
1989
- const type = getType(value);
1990
- switch (type) {
1991
- case "promise":
1992
- return [value];
1993
- case "array":
1994
- if (value.some((val) => getType(val) !== "promise")) {
1995
- console.error(new TypeError("Binding values should all be of type Promise"));
1996
- return "error";
1997
- }
1998
- return value;
1999
- default:
2000
- return false;
2001
- }
2002
- };
2003
- const unmount = (el) => {
2004
- cacheInstance.delete(el);
2005
- el.instance.proxy.close();
2006
- unmountComponent(el.instance);
2007
- };
2008
- const toggleLoading = (el, binding) => {
2009
- var _a, _b, _c;
2010
- if (binding.value) {
2011
- const vals = isPromise(binding.value);
2012
- if (vals === "error") {
2013
- return;
2014
- }
2015
- (_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
2016
- el.appendChild(el.mask);
2017
- cacheInstance.add(el);
2018
- if (vals) {
2019
- Promise.all(vals).catch((err) => {
2020
- console.error(new Error("Promise handling errors"), err);
2021
- }).finally(() => {
2022
- unmount(el);
2023
- });
2024
- }
2025
- } else {
2026
- unmount(el);
2027
- }
2028
- };
2029
- const removeAttribute = (el) => {
2030
- el.removeAttribute("zindex");
2031
- el.removeAttribute("positiontype");
2032
- el.removeAttribute("backdrop");
2033
- el.removeAttribute("message");
2034
- el.removeAttribute("view");
2035
- el.removeAttribute("loadingtemplateref");
2036
- };
2037
- const handleProps = (el, vprops) => {
2038
- var _a;
2039
- const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
2040
- const loadingTemplateRef = props.loadingTemplateRef;
2041
- const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
2042
- el.style.position = props.positionType;
2043
- el.options = props;
2044
- el.instance = loadingInstance;
2045
- el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
2046
- };
2047
- const loadingDirective = {
2048
- mounted: function(el, binding, vnode) {
2049
- handleProps(el, vnode.props);
2050
- removeAttribute(el);
2051
- !isEmpty(binding.value) && toggleLoading(el, binding);
2052
- },
2053
- updated: function(el, binding, vnode) {
2054
- if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
2055
- return;
2056
- }
2057
- !cacheInstance.has(el) && handleProps(el, vnode.props);
2058
- removeAttribute(el);
2059
- toggleLoading(el, binding);
2060
- }
2061
- };
2062
2345
  defineComponent(Loading);
2063
2346
  var table = "";
2064
2347
  let tableIdInit = 1;
@@ -2157,7 +2440,7 @@ const tableColumnProps = {
2157
2440
  },
2158
2441
  filterMultiple: {
2159
2442
  type: Boolean,
2160
- default: false
2443
+ default: true
2161
2444
  },
2162
2445
  filterList: {
2163
2446
  type: Array,
@@ -2310,6 +2593,7 @@ let columnIdInit = 1;
2310
2593
  var Column = defineComponent({
2311
2594
  name: "DColumn",
2312
2595
  props: tableColumnProps,
2596
+ emits: ["filter-change"],
2313
2597
  setup(props, ctx) {
2314
2598
  const instance = getCurrentInstance();
2315
2599
  const column = createColumn(toRefs(props), ctx.slots);
@@ -2322,6 +2606,7 @@ var Column = defineComponent({
2322
2606
  } = useRender();
2323
2607
  const parent = columnOrTableParent.value;
2324
2608
  columnId = `${parent.tableId || parent.columnId}_column_${columnIdInit++}`;
2609
+ column.ctx = ctx;
2325
2610
  onBeforeMount(() => {
2326
2611
  isSubColumn.value = owner !== parent;
2327
2612
  column.id = columnId;