bm-admin-ui 1.0.89-alpha → 1.0.91-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.
@@ -175,14 +175,19 @@ const _hoisted_3 = ["onClick"];
175
175
  const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "checkbox-label" }, "\u5168\u9009", -1);
176
176
  const _hoisted_5 = ["onClick"];
177
177
  const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", { class: "checkbox-label" }, "\u53CD\u9009", -1);
178
- const _hoisted_7 = { class: "blue" };
178
+ const _hoisted_7 = { key: 0 };
179
+ const _hoisted_8 = { class: "blue" };
179
180
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
180
181
  __name: "form-select-all",
181
182
  props: {
182
183
  modelValue: {
183
184
  type: Array || String || Number || void 0
184
185
  },
185
- disabled: Boolean
186
+ disabled: Boolean,
187
+ showSelectAll: {
188
+ type: Boolean,
189
+ default: true
190
+ }
186
191
  },
187
192
  emits: ["onSelectAll", "onChange", "update:modelValue"],
188
193
  setup(__props, { emit }) {
@@ -192,7 +197,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
192
197
  search: {
193
198
  indeterminate: false,
194
199
  checkedAll: false,
195
- checkedReverse: false
200
+ checkedReverse: false,
201
+ searchList: []
196
202
  }
197
203
  });
198
204
  let selectValue = ref([]);
@@ -204,7 +210,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
204
210
  state.search = {
205
211
  indeterminate: false,
206
212
  checkedAll: false,
207
- checkedReverse: false
213
+ checkedReverse: false,
214
+ searchList: []
208
215
  };
209
216
  }
210
217
  },
@@ -214,17 +221,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
214
221
  );
215
222
  const selectAll = (e) => {
216
223
  let key = "value";
224
+ let list = [];
217
225
  if (instance?.attrs.fieldNames || instance?.attrs["field-names"])
218
226
  key = (instance?.attrs).fieldNames?.value || (instance?.attrs)["field-names"].value;
219
227
  state.search.checkedAll = !state.search.checkedAll;
220
228
  state.search.indeterminate = false;
221
229
  state.search.checkedReverse = false;
230
+ if (state.search.searchList.length > 0)
231
+ list = state.search.searchList;
232
+ else
233
+ list = instance?.attrs.options;
222
234
  if (state.search.checkedAll) {
223
- selectValue.value = (instance?.attrs.options).map(
224
- (v) => {
225
- return v[key];
226
- }
227
- );
235
+ selectValue.value = list.map((v) => {
236
+ return v[key];
237
+ });
228
238
  } else {
229
239
  selectValue.value = [];
230
240
  }
@@ -267,6 +277,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
267
277
  option
268
278
  });
269
279
  };
280
+ const onSearch = (val) => {
281
+ if (val) {
282
+ const key = (instance?.attrs).optionFilterProp || (instance?.attrs)["option-filter-prop"] || "value";
283
+ const list = (instance?.attrs).options.filter((ele) => {
284
+ return String(ele[key]).indexOf(String(val)) > -1;
285
+ });
286
+ state.search.searchList = list;
287
+ }
288
+ };
270
289
  const VNodes = (_, { attrs }) => {
271
290
  return h(attrs.vnodes);
272
291
  };
@@ -279,10 +298,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
279
298
  class: "bm-select search"
280
299
  }, _ctx.$attrs, {
281
300
  mode: "multiple",
301
+ class: { w200: !props.showSelectAll },
282
302
  disabled: props.disabled,
283
303
  placeholder: unref(instance)?.attrs.placeholder ? unref(instance)?.attrs.placeholder : "\u8BF7\u9009\u62E9",
284
304
  "get-popup-container": (nodes) => nodes.parentNode,
285
- onChange
305
+ onChange,
306
+ onSearch
286
307
  }), {
287
308
  dropdownRender: withCtx(({ menuNode: menu }) => [
288
309
  createElementVNode("div", _hoisted_1, [
@@ -314,16 +335,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
314
335
  ]),
315
336
  _: 1
316
337
  }),
317
- createElementVNode("div", null, [
338
+ __props.showSelectAll ? (openBlock(), createElementBlock("div", _hoisted_7, [
318
339
  createTextVNode(" \u5DF2\u9009\u62E9 "),
319
- createElementVNode("span", _hoisted_7, toDisplayString(unref(selectValue)?.length || 0), 1),
340
+ createElementVNode("span", _hoisted_8, toDisplayString(unref(selectValue)?.length || 0), 1),
320
341
  createTextVNode(" \u9879 ")
321
- ])
342
+ ])) : createCommentVNode("v-if", true)
322
343
  ]),
323
344
  createVNode(VNodes, { vnodes: menu }, null, 8, ["vnodes"])
324
345
  ]),
325
346
  _: 1
326
- }, 16, ["value", "disabled", "placeholder", "get-popup-container"]);
347
+ }, 16, ["value", "class", "disabled", "placeholder", "get-popup-container"]);
327
348
  };
328
349
  }
329
350
  });
@@ -3,6 +3,10 @@ declare const _default: import("vue").DefineComponent<{
3
3
  type: ArrayConstructor;
4
4
  };
5
5
  disabled: BooleanConstructor;
6
+ showSelectAll: {
7
+ type: BooleanConstructor;
8
+ default: boolean;
9
+ };
6
10
  }, {
7
11
  instance: import("vue").ComponentInternalInstance | null;
8
12
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -10,6 +14,10 @@ declare const _default: import("vue").DefineComponent<{
10
14
  type: ArrayConstructor;
11
15
  };
12
16
  disabled: BooleanConstructor;
17
+ showSelectAll: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
13
21
  }>> & {
14
22
  onOnChange?: ((...args: any[]) => any) | undefined;
15
23
  onOnSelectAll?: ((...args: any[]) => any) | undefined;
@@ -20,6 +28,7 @@ declare const _default: import("vue").DefineComponent<{
20
28
  indeterminate: boolean;
21
29
  checkedAll: boolean;
22
30
  checkedReverse: boolean;
31
+ searchList: never[];
23
32
  };
24
33
  };
25
34
  emit: (event: "onChange" | "onSelectAll" | "update:modelValue", ...args: any[]) => void;
@@ -27,6 +36,7 @@ declare const _default: import("vue").DefineComponent<{
27
36
  selectAll: (e: any) => void;
28
37
  reverseAll: (e: any) => false | undefined;
29
38
  onChange: (value: any, option: any) => void;
39
+ onSearch: (val: string | number) => void;
30
40
  VNodes: (_: any, { attrs }: {
31
41
  attrs: any;
32
42
  }) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -731,11 +741,16 @@ declare const _default: import("vue").DefineComponent<{
731
741
  type: ArrayConstructor;
732
742
  };
733
743
  disabled: BooleanConstructor;
744
+ showSelectAll: {
745
+ type: BooleanConstructor;
746
+ default: boolean;
747
+ };
734
748
  }>> & {
735
749
  onOnChange?: ((...args: any[]) => any) | undefined;
736
750
  onOnSelectAll?: ((...args: any[]) => any) | undefined;
737
751
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
738
752
  }, {
739
753
  disabled: boolean;
754
+ showSelectAll: boolean;
740
755
  }>;
741
756
  export default _default;
@@ -121,6 +121,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
121
121
  const onSearch = (val) => {
122
122
  if (val) {
123
123
  const key = (instance?.attrs).optionFilterProp || (instance?.attrs)["option-filter-prop"] || "value";
124
+ console.log(key);
124
125
  const list = (instance?.attrs).options.filter((ele) => {
125
126
  return String(ele[key]).indexOf(String(val)) > -1;
126
127
  });
@@ -1,5 +1,5 @@
1
1
  let id = 0;
2
2
  export default function uniqueId() {
3
- return (Math.random().toString(36).substring(3, 6) +
4
- Number(`${Date.now()}${++id}`).toString(36));
3
+ return `bm${Math.random().toString(36).substring(3, 6) +
4
+ Number(`${Date.now()}${++id}`).toString(36)}`;
5
5
  }