bm-admin-ui 1.0.37-alpha → 1.0.38-alpha

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.
@@ -1,5 +1,5 @@
1
1
  import { withInstall } from 'bm-admin-ui/es/utils/with-install';
2
- import { defineComponent, getCurrentInstance, reactive, ref, watch, resolveComponent, openBlock, createBlock, unref, mergeProps, isRef, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, h } from 'vue';
2
+ import { defineComponent, getCurrentInstance, reactive, ref, watch, resolveComponent, openBlock, createBlock, unref, mergeProps, isRef, withCtx, createElementVNode, withModifiers, createVNode, createTextVNode, toDisplayString, h } from 'vue';
3
3
  import ASelect from 'ant-design-vue/lib/select';
4
4
 
5
5
  var _export_sfc = (sfc, props) => {
@@ -12,9 +12,11 @@ var _export_sfc = (sfc, props) => {
12
12
 
13
13
  const _hoisted_1 = { class: "bm-select-header" };
14
14
  const _hoisted_2 = { class: "bm-select-header-btn" };
15
- const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", { class: "checkbox-label" }, "\u5168\u9009", -1);
16
- const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "checkbox-label" }, "\u53CD\u9009", -1);
17
- const _hoisted_5 = { class: "blue" };
15
+ const _hoisted_3 = ["onClick"];
16
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "checkbox-label" }, "\u5168\u9009", -1);
17
+ const _hoisted_5 = ["onClick"];
18
+ const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", { class: "checkbox-label" }, "\u53CD\u9009", -1);
19
+ const _hoisted_7 = { class: "blue" };
18
20
  const _sfc_main = /* @__PURE__ */ defineComponent({
19
21
  __name: "selectAll",
20
22
  props: {
@@ -45,7 +47,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
47
  immediate: true
46
48
  });
47
49
  const selectAll = (e) => {
48
- e.preventDefault();
49
50
  let key = "value";
50
51
  if (instance?.attrs.fieldNames || instance?.attrs["field-names"])
51
52
  key = (instance?.attrs).fieldNames?.value || (instance?.attrs)["field-names"].value;
@@ -66,15 +67,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
66
67
  });
67
68
  };
68
69
  const reverseAll = (e) => {
69
- e.preventDefault();
70
70
  let key = "value";
71
71
  if (instance?.attrs.fieldNames || instance?.attrs["field-names"])
72
72
  key = (instance?.attrs).fieldNames?.value || (instance?.attrs)["field-names"].value;
73
- state.search.checkedReverse = !state.search.checkedReverse;
74
- state.search.indeterminate = false;
75
- state.search.checkedAll = false;
76
73
  if (selectValue.value.length <= 0)
77
- return false;
74
+ return state.search.checkedReverse = false;
75
+ state.search.checkedReverse = !state.search.checkedReverse;
76
+ if (state.search.checkedReverse) {
77
+ state.search.indeterminate = false;
78
+ state.search.checkedAll = false;
79
+ } else {
80
+ state.search.indeterminate = !!selectValue.value.length && selectValue.value.length < (instance?.attrs.options).length;
81
+ state.search.checkedAll = selectValue.value.length === (instance?.attrs.options).length;
82
+ }
78
83
  selectValue.value = (instance?.attrs.options).filter((v) => !selectValue.value.some((ele) => ele === v[key])).map((x) => x[key]);
79
84
  emit("update:value", selectValue.value);
80
85
  emit("onSelectAll", {
@@ -99,41 +104,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
104
  const _component_a_checkbox = resolveComponent("a-checkbox");
100
105
  return openBlock(), createBlock(unref(ASelect), mergeProps({
101
106
  value: unref(selectValue),
102
- "onUpdate:value": _cache[2] || (_cache[2] = ($event) => isRef(selectValue) ? selectValue.value = $event : selectValue = $event),
103
- class: "follow"
107
+ "onUpdate:value": _cache[4] || (_cache[4] = ($event) => isRef(selectValue) ? selectValue.value = $event : selectValue = $event),
108
+ class: "bm-select"
104
109
  }, _ctx.$attrs, {
105
- onChange,
106
- mode: "multiple"
110
+ mode: "multiple",
111
+ placeholder: unref(instance)?.attrs.placeholder ? unref(instance)?.attrs.placeholder : "\u8BF7\u9009\u62E9",
112
+ "get-popup-container": (nodes) => nodes.parentNode,
113
+ onChange
107
114
  }), {
108
115
  dropdownRender: withCtx(({ menuNode: menu }) => [
109
116
  createElementVNode("div", _hoisted_1, [
110
117
  createElementVNode("div", _hoisted_2, [
111
- createElementVNode("div", { onClick: selectAll }, [
118
+ createElementVNode("div", {
119
+ onClick: withModifiers(selectAll, ["prevent"]),
120
+ onMousedown: _cache[1] || (_cache[1] = (e) => e.preventDefault())
121
+ }, [
112
122
  createVNode(_component_a_checkbox, {
113
123
  checked: state.search.checkedAll,
114
124
  "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => state.search.checkedAll = $event),
115
125
  indeterminate: state.search.indeterminate
116
126
  }, null, 8, ["checked", "indeterminate"]),
117
- _hoisted_3
118
- ]),
119
- createElementVNode("div", { onClick: reverseAll }, [
127
+ _hoisted_4
128
+ ], 40, _hoisted_3),
129
+ createElementVNode("div", {
130
+ onClick: withModifiers(reverseAll, ["prevent"]),
131
+ onMousedown: _cache[3] || (_cache[3] = (e) => e.preventDefault())
132
+ }, [
120
133
  createVNode(_component_a_checkbox, {
121
134
  checked: state.search.checkedReverse,
122
- "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => state.search.checkedReverse = $event)
135
+ "onUpdate:checked": _cache[2] || (_cache[2] = ($event) => state.search.checkedReverse = $event)
123
136
  }, null, 8, ["checked"]),
124
- _hoisted_4
125
- ])
137
+ _hoisted_6
138
+ ], 40, _hoisted_5)
126
139
  ]),
127
140
  createElementVNode("div", null, [
128
- createTextVNode("\u5DF2\u9009\u62E9 "),
129
- createElementVNode("span", _hoisted_5, toDisplayString(unref(selectValue).length), 1),
130
- createTextVNode(" \u9879")
141
+ createTextVNode(" \u5DF2\u9009\u62E9 "),
142
+ createElementVNode("span", _hoisted_7, toDisplayString(unref(selectValue).length), 1),
143
+ createTextVNode(" \u9879 ")
131
144
  ])
132
145
  ]),
133
146
  createVNode(VNodes, { vnodes: menu }, null, 8, ["vnodes"])
134
147
  ]),
135
148
  _: 1
136
- }, 16, ["value"]);
149
+ }, 16, ["value", "placeholder", "get-popup-container"]);
137
150
  };
138
151
  }
139
152
  });
@@ -1,4 +1,6 @@
1
- export declare function BmAdminUiResolver(options: any): {
1
+ export declare function BmAdminUiResolver(options?: {
2
+ importStyle: boolean;
3
+ }): {
2
4
  type: string;
3
5
  resolve: (name: string) => {
4
6
  name: string;
@@ -2,7 +2,7 @@ function kebabCase(key) {
2
2
  const result = key.replace(/([A-Z])/g, ' $1').trim();
3
3
  return result.split(' ').join('-').toLowerCase();
4
4
  }
5
- export function BmAdminUiResolver(options) {
5
+ export function BmAdminUiResolver(options = { importStyle: false }) {
6
6
  return [
7
7
  {
8
8
  type: 'component',