@farris/ui-vue 1.7.0-beta.2 → 1.7.1-beta.0

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.
Files changed (34) hide show
  1. package/components/button-group/index.esm.js +62 -62
  2. package/components/button-group/index.umd.cjs +1 -1
  3. package/components/combo-list/index.esm.js +96 -92
  4. package/components/combo-list/index.umd.cjs +1 -1
  5. package/components/data-view/index.esm.js +823 -823
  6. package/components/data-view/index.umd.cjs +1 -1
  7. package/components/expression-editor/index.esm.js +7 -3
  8. package/components/expression-editor/index.umd.cjs +4 -4
  9. package/components/filter-condition-editor/index.esm.js +434 -430
  10. package/components/filter-condition-editor/index.umd.cjs +5 -5
  11. package/components/order/index.esm.js +7 -3
  12. package/components/order/index.umd.cjs +1 -1
  13. package/components/pagination/index.esm.js +70 -70
  14. package/components/pagination/index.umd.cjs +2 -2
  15. package/components/response-layout-editor/index.esm.js +8 -0
  16. package/components/response-layout-editor/index.umd.cjs +1 -1
  17. package/components/schema-selector/index.esm.js +460 -460
  18. package/components/schema-selector/index.umd.cjs +1 -1
  19. package/components/sort-condition-editor/index.esm.js +571 -567
  20. package/components/sort-condition-editor/index.umd.cjs +5 -5
  21. package/components/switch/index.esm.js +19 -15
  22. package/components/switch/index.umd.cjs +2 -2
  23. package/designer/checkbox-group/index.esm.js +48 -44
  24. package/designer/checkbox-group/index.umd.cjs +1 -1
  25. package/designer/data-grid/index.esm.js +14 -14
  26. package/designer/data-grid/index.umd.cjs +2 -2
  27. package/designer/data-view/index.esm.js +4 -3
  28. package/designer/data-view/index.umd.cjs +2 -2
  29. package/designer/farris-designer.all.esm.js +3 -3
  30. package/designer/farris-designer.all.umd.cjs +1 -1
  31. package/farris.all.esm.js +34 -24
  32. package/farris.all.umd.cjs +25 -25
  33. package/package.json +1 -1
  34. package/types/components.d.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { defineComponent as E, ref as v, computed as T, watch as P, onMounted as A, createVNode as I, inject as M } from "vue";
1
+ import { defineComponent as E, ref as v, computed as V, watch as P, onMounted as A, createVNode as I, inject as M } from "vue";
2
2
  import { useI18n as $ } from "vue-i18n";
3
3
  import Y from "../button-edit/index.esm.js";
4
4
  import { resolveAppearance as Z, createPropsResolver as _ } from "../dynamic-resolver/index.esm.js";
@@ -208,6 +208,10 @@ const oe = /* @__PURE__ */ new Map([
208
208
  description: "清空事件",
209
209
  type: "string",
210
210
  default: ""
211
+ },
212
+ "onUpdate:modelValue": {
213
+ description: "",
214
+ type: "object"
211
215
  }
212
216
  }, me = [
213
217
  "type"
@@ -436,7 +440,7 @@ const R = {
436
440
  props: Ce,
437
441
  emits: ["selectionChange"],
438
442
  setup(e, t) {
439
- const l = v(), o = v(e.dataSource), n = v([]), d = v(e.separator), s = v(e.width), f = v(e.maxHeight), r = v(String(e.selectedValues).split(d.value)), S = T(() => e.multiSelect), p = T(() => ({
443
+ const l = v(), o = v(e.dataSource), n = v([]), d = v(e.separator), f = v(e.width), r = v(e.maxHeight), u = v(String(e.selectedValues).split(d.value)), S = V(() => e.multiSelect), p = V(() => ({
440
444
  enableSelectRow: !0,
441
445
  multiSelect: e.multiSelect,
442
446
  multiSelectMode: "OnCheckAndClick",
@@ -446,40 +450,40 @@ const R = {
446
450
  }));
447
451
  P(e.dataSource, () => {
448
452
  o.value = e.dataSource;
449
- }), T(() => e.enableSearch ? "SearchBar" : "ContentHeader");
450
- const x = T(() => {
451
- const u = {};
452
- return s.value !== void 0 && (u.width = `${s.value}px`), f.value !== void 0 && f.value > 0 && (u.maxHeight = `${f.value}px`), u;
453
+ }), V(() => e.enableSearch ? "SearchBar" : "ContentHeader");
454
+ const x = V(() => {
455
+ const c = {};
456
+ return f.value !== void 0 && (c.width = `${f.value}px`), r.value !== void 0 && r.value > 0 && (c.maxHeight = `${r.value}px`), c;
453
457
  });
454
- function i(u) {
455
- l.value.search(u);
458
+ function i(c) {
459
+ l.value.search(c);
456
460
  }
457
- function a(u) {
458
- n.value = u.map((h) => Object.assign({}, h)), r.value = u.map((h) => h[e.idField]), t.emit("selectionChange", n.value);
461
+ function a(c) {
462
+ n.value = c.map((h) => Object.assign({}, h)), u.value = c.map((h) => h[e.idField]), t.emit("selectionChange", n.value);
459
463
  }
460
- function b(u) {
464
+ function b(c) {
461
465
  if (e.enableHighlightSearch)
462
466
  return;
463
467
  let h = [];
464
468
  const {
465
- searchOption: c
469
+ searchOption: s
466
470
  } = e;
467
- typeof c == "function" ? h = o.value.filter((F) => c(u, F)) : h = o.value.filter((F) => F[e.valueField].indexOf(u) > -1 || F[e.textField].indexOf(u) > -1), l.value.updateDataSource(h);
471
+ typeof s == "function" ? h = o.value.filter((F) => s(c, F)) : h = o.value.filter((F) => F[e.valueField].indexOf(c) > -1 || F[e.textField].indexOf(c) > -1), l.value.updateDataSource(h);
468
472
  }
469
- P([() => e.selectedValues], ([u]) => {
470
- e.multiSelect ? r.value = u.split(d.value) : r.value = [u];
473
+ P([() => e.selectedValues], ([c]) => {
474
+ e.multiSelect ? u.value = c.split(d.value) : u.value = [c];
471
475
  });
472
- function C(u) {
473
- l.value.activeRowById(u);
476
+ function C(c) {
477
+ l.value.activeRowById(c);
474
478
  }
475
479
  return A(() => {
476
- var u, h;
480
+ var c, h;
477
481
  if (!e.multiSelect) {
478
- const c = (u = r.value) == null ? void 0 : u[0];
479
- let F = c;
480
- if (!D(c)) {
481
- const w = typeof c, V = typeof ((h = o.value[0]) == null ? void 0 : h[e.valueField || e.idField]);
482
- V === "number" && w !== V && (F = Number(c)), V === "boolean" && w !== V && (F = c === "true" ? !0 : c === "false" ? !1 : c), C(F);
482
+ const s = (c = u.value) == null ? void 0 : c[0];
483
+ let F = s;
484
+ if (!D(s)) {
485
+ const w = typeof s, T = typeof ((h = o.value[0]) == null ? void 0 : h[e.valueField || e.idField]);
486
+ T === "number" && w !== T && (F = Number(s)), T === "boolean" && w !== T && (F = s === "true" ? !0 : s === "false" ? !1 : s), C(F);
483
487
  }
484
488
  }
485
489
  }), t.expose({
@@ -502,7 +506,7 @@ const R = {
502
506
  multiSelect: e.multiSelect,
503
507
  selection: p.value,
504
508
  enableHighlightSearch: e.enableHighlightSearch,
505
- selectionValues: r.value,
509
+ selectionValues: u.value,
506
510
  onSelectionUpdate: a,
507
511
  onAfterSearch: b
508
512
  }, null)]);
@@ -510,18 +514,18 @@ const R = {
510
514
  });
511
515
  function xe(e) {
512
516
  const { t } = $(), l = v(""), o = v(e.modelValue), n = v(e.data || []), d = v(e.editable);
513
- function s(i) {
517
+ function f(i) {
514
518
  const a = e.multiSelect ? String(i).split(e.separator) : [String(i)], b = a.map((h) => [h, !0]), C = new Map(b);
515
- return n.value.filter((h) => C.has(String(h[e.valueField]))).sort((h, c) => {
516
- const F = a.indexOf(h[e.valueField]), w = a.indexOf(c[e.valueField]);
519
+ return n.value.filter((h) => C.has(String(h[e.valueField]))).sort((h, s) => {
520
+ const F = a.indexOf(h[e.valueField]), w = a.indexOf(s[e.valueField]);
517
521
  return F - w;
518
522
  });
519
523
  }
520
- function f(i) {
521
- const a = s(i).map((b) => b[e.textField]).join(e.separator);
524
+ function r(i) {
525
+ const a = f(i).map((b) => b[e.textField]).join(e.separator);
522
526
  l.value = d.value ? a || i : a;
523
527
  }
524
- function r(i) {
528
+ function u(i) {
525
529
  if (e.multiSelect) {
526
530
  const a = i.split(e.separator).map((C) => [C, !0]), b = new Map(a);
527
531
  return n.value.filter((C) => b.has(C[e.textField]));
@@ -533,7 +537,7 @@ function xe(e) {
533
537
  return a[e.idField] = i, a[e.textField] = i, [a];
534
538
  }
535
539
  function p(i) {
536
- let a = r(i);
540
+ let a = u(i);
537
541
  const b = a && a.length > 0;
538
542
  return d.value && !b && (a = S(i)), a;
539
543
  }
@@ -541,17 +545,17 @@ function xe(e) {
541
545
  const { url: i, method: a = "GET", headers: b = { "Content-Type": "application/json;charset=utf-8;" }, body: C = null } = e.remote;
542
546
  if (!i)
543
547
  return;
544
- const u = a.toLowerCase() === "get" ? { method: a, headers: b } : { method: a, headers: b, body: C };
548
+ const c = a.toLowerCase() === "get" ? { method: a, headers: b } : { method: a, headers: b, body: C };
545
549
  let h = !1;
546
- fetch(new Request(i, u)).then((c) => {
547
- var w, V;
548
- if (c.status === 200)
549
- return h = !!((V = (w = c.headers) == null ? void 0 : w.get("content-type")) != null && V.includes("application/json")), h ? c.text() : c.json();
550
- throw c.status === 405 ? new Error(t("comboList.remoteError")) : new Error(c.statusText);
551
- }).then((c) => {
552
- c.length && (n.value = h ? JSON.parse(c) : c);
553
- }).catch((c) => {
554
- console.warn(c);
550
+ fetch(new Request(i, c)).then((s) => {
551
+ var w, T;
552
+ if (s.status === 200)
553
+ return h = !!((T = (w = s.headers) == null ? void 0 : w.get("content-type")) != null && T.includes("application/json")), h ? s.text() : s.json();
554
+ throw s.status === 405 ? new Error(t("comboList.remoteError")) : new Error(s.statusText);
555
+ }).then((s) => {
556
+ s.length && (n.value = h ? JSON.parse(s) : s);
557
+ }).catch((s) => {
558
+ console.warn(s);
555
559
  });
556
560
  }
557
561
  return e.remote && (e.load ? e.load().then((i) => {
@@ -566,8 +570,8 @@ function xe(e) {
566
570
  a && (l.value = a[e.textField]);
567
571
  }
568
572
  }), P(() => e.modelValue, (i) => {
569
- o.value = i, f(i);
570
- }), f(e.modelValue), { dataSource: n, displayText: l, editable: d, modelValue: o, getItemsByDisplayText: r, getItemsByValue: s, getSelectedItemsByDisplayText: p };
573
+ o.value = i, r(i);
574
+ }), r(e.modelValue), { dataSource: n, displayText: l, editable: d, modelValue: o, getItemsByDisplayText: u, getItemsByValue: f, getSelectedItemsByDisplayText: p };
571
575
  }
572
576
  const L = /* @__PURE__ */ E({
573
577
  name: "FComboList",
@@ -576,7 +580,7 @@ const L = /* @__PURE__ */ E({
576
580
  setup(e, t) {
577
581
  const {
578
582
  t: l
579
- } = $(), o = v(), n = v(), d = v(e.disabled || e.readonly), s = v(e.enableClear), f = v(e.enableSearch), r = v(e.readonly), {
583
+ } = $(), o = v(), n = v(), d = v(e.disabled || e.readonly), f = v(e.enableClear), r = v(e.enableSearch), u = v(e.readonly), {
580
584
  dataSource: S,
581
585
  displayText: p,
582
586
  editable: x,
@@ -584,9 +588,9 @@ const L = /* @__PURE__ */ E({
584
588
  getSelectedItemsByDisplayText: a,
585
589
  getItemsByDisplayText: b,
586
590
  getItemsByValue: C
587
- } = xe(e), u = v(e.dropDownIcon);
588
- u.value === '<span class="f-icon f-icon-arrow-chevron-down"></span>' && (u.value = '<span id="' + e.id + '-icon-dropdown" class="f-icon f-icon-arrow-chevron-down"></span>');
589
- const h = T(() => e.multiSelect), c = T(() => n.value ? n.value.elementRef.getBoundingClientRect().width : 0);
591
+ } = xe(e), c = v(e.dropDownIcon);
592
+ c.value === '<span class="f-icon f-icon-arrow-chevron-down"></span>' && (c.value = '<span id="' + e.id + '-icon-dropdown" class="f-icon f-icon-arrow-chevron-down"></span>');
593
+ const h = V(() => e.multiSelect), s = V(() => n.value ? n.value.elementRef.getBoundingClientRect().width : 0);
590
594
  function F() {
591
595
  !h.value && n.value && n.value.hidePopup();
592
596
  }
@@ -595,35 +599,35 @@ const L = /* @__PURE__ */ E({
595
599
  let g = "";
596
600
  m.length === 1 ? g = m[0][e.valueField] : g = m.map((y) => y[e.valueField]).join(e.separator), i.value !== g && (i.value = g, t.emit("update:modelValue", i.value), t.emit("change", m, i.value));
597
601
  }
598
- function V() {
602
+ function T() {
599
603
  const m = C(i.value);
600
604
  w(m);
601
605
  }
602
- function q() {
603
- r.value || p.value;
606
+ function U() {
607
+ u.value || p.value;
604
608
  }
605
- function G(m) {
609
+ function j(m) {
606
610
  var g;
607
611
  i.value = "", (g = o.value) == null || g.activeRowById(""), t.emit("update:modelValue", ""), t.emit("change", [], ""), t.emit("clear");
608
612
  }
609
- function U(m) {
613
+ function q(m) {
610
614
  var g, y;
611
615
  e.enableSearch && e.enableHighlightSearch && ((g = o.value) == null || g.search(m)), (y = o.value) == null || y.activeRowById(m), t.emit("change", [i.value], i.value);
612
616
  }
613
- function W(m) {
617
+ function G(m) {
614
618
  if (e.multiSelect) {
615
619
  const g = C(i.value), B = g.map((O) => O[e.idField || e.valueField]).join(e.separator);
616
620
  i.value !== B && (i.value = B, t.emit("update:modelValue", i.value), t.emit("change", g, i.value));
617
621
  }
618
622
  }
619
- function j() {
623
+ function W() {
620
624
  return p.value;
621
625
  }
622
626
  function J(m) {
623
627
  const {
624
628
  value: g
625
629
  } = m.target;
626
- U(g), t.emit("input", g);
630
+ q(g), t.emit("input", g);
627
631
  }
628
632
  function z() {
629
633
  n.value.hidePopup();
@@ -635,7 +639,7 @@ const L = /* @__PURE__ */ E({
635
639
  return S.value;
636
640
  }
637
641
  const k = {
638
- getDisplayText: j,
642
+ getDisplayText: W,
639
643
  hidePopup: z,
640
644
  updateDataSource: K,
641
645
  getData: Q
@@ -648,17 +652,17 @@ const L = /* @__PURE__ */ E({
648
652
  })).then((y) => typeof (y == null ? void 0 : y.canOpen) == "boolean" ? y == null ? void 0 : y.canOpen : !0);
649
653
  }
650
654
  return P([() => e.disabled, () => e.editable, () => e.enableClear, () => e.enableSearch, () => e.readonly], ([m, g, y, B, O]) => {
651
- d.value = m, x.value = g, s.value = y, f.value = B, r.value = O;
655
+ d.value = m, x.value = g, f.value = y, r.value = B, u.value = O;
652
656
  }), () => I(Y, {
653
657
  ref: n,
654
658
  id: e.id,
655
659
  disable: d.value,
656
- readonly: r.value,
660
+ readonly: u.value,
657
661
  forcePlaceholder: e.forcePlaceholder,
658
662
  editable: x.value,
659
- buttonContent: u.value,
663
+ buttonContent: c.value,
660
664
  placeholder: e.placeholder === "请选择" ? l("comboList.placeholder") : e.placeholder,
661
- enableClear: s.value,
665
+ enableClear: f.value,
662
666
  maxLength: e.maxLength,
663
667
  tabIndex: e.tabIndex,
664
668
  enableTitle: e.enableTitle,
@@ -668,10 +672,10 @@ const L = /* @__PURE__ */ E({
668
672
  "onUpdate:modelValue": (m) => p.value = m,
669
673
  focusOnCreated: e.focusOnCreated,
670
674
  selectOnCreated: e.selectOnCreated,
671
- onClear: G,
672
- onClick: q,
673
- onChange: W,
674
- onBlur: V,
675
+ onClear: j,
676
+ onClick: U,
677
+ onChange: G,
678
+ onBlur: T,
675
679
  onInput: J,
676
680
  beforeOpen: X,
677
681
  placement: e.placement,
@@ -690,10 +694,10 @@ const L = /* @__PURE__ */ E({
690
694
  selectedValues: i.value,
691
695
  separator: e.separator,
692
696
  multiSelect: e.multiSelect,
693
- enableSearch: f.value,
697
+ enableSearch: r.value,
694
698
  maxHeight: e.maxHeight,
695
699
  enableHighlightSearch: e.enableHighlightSearch,
696
- width: e.fitEditor ? c.value : void 0,
700
+ width: e.fitEditor ? s.value : void 0,
697
701
  onSelectionChange: (m) => {
698
702
  w(m), F();
699
703
  }
@@ -711,7 +715,7 @@ class we extends ae {
711
715
  super(t, l);
712
716
  }
713
717
  getCommonEditorProperties(t) {
714
- var l, o, n, d, s;
718
+ var l, o, n, d, f, r;
715
719
  return {
716
720
  viewType: {
717
721
  visible: !!((l = t.editor) != null && l.multiSelect),
@@ -745,10 +749,10 @@ class we extends ae {
745
749
  title: "允许编辑",
746
750
  type: "boolean",
747
751
  refreshPanelAfterChanged: !0,
748
- readonly: !!((d = t.editor) != null && d.multiSelect)
752
+ readonly: !!((d = t.editor) != null && d.multiSelect) && (((f = t.editor) == null ? void 0 : f.viewType) === "tag" || !t.editor.viewType)
749
753
  },
750
754
  enableHighlightSearch: {
751
- visible: !!((s = t.editor) != null && s.editable),
755
+ visible: !!((r = t.editor) != null && r.editable),
752
756
  description: "编辑状态下启用高亮搜索",
753
757
  title: "启用高亮搜索",
754
758
  type: "boolean"
@@ -756,12 +760,12 @@ class we extends ae {
756
760
  };
757
761
  }
758
762
  getEditorProperties(t) {
759
- var d, s;
763
+ var d, f;
760
764
  const l = this;
761
765
  let o = "";
762
766
  if (((d = t == null ? void 0 : t.binding) == null ? void 0 : d.type) === "Form") {
763
- const f = this.schemaService.getFieldByIDAndVMID(t.binding.field, this.viewModelId);
764
- (s = f == null ? void 0 : f.schemaField) != null && s.type && (o = f.schemaField.type.$type);
767
+ const r = this.schemaService.getFieldByIDAndVMID(t.binding.field, this.viewModelId);
768
+ (f = r == null ? void 0 : r.schemaField) != null && f.type && (o = r.schemaField.type.$type);
765
769
  }
766
770
  return l.getComponentConfig(t, { type: "combo-list" }, {
767
771
  // enableSearch: {
@@ -855,31 +859,31 @@ class we extends ae {
855
859
  }
856
860
  },
857
861
  ...this.getCommonEditorProperties(t)
858
- }, (f, r) => {
859
- if (!f || !r.editor)
862
+ }, (r, u) => {
863
+ if (!r || !u.editor)
860
864
  return;
861
865
  const S = this;
862
- switch (f.propertyID) {
866
+ switch (r.propertyID) {
863
867
  case "dataSourceType": {
864
- f.propertyValue === "static" ? (r.editor.valueField = "value", r.editor.textField = "name", r.editor.remote = null) : f.propertyValue === "dynamic" && (r.editor.remote = { method: "GET" }, r.editor.valueField = "value", r.editor.textField = "name");
868
+ r.propertyValue === "static" ? (u.editor.valueField = "value", u.editor.textField = "name", u.editor.remote = null) : r.propertyValue === "dynamic" && (u.editor.remote = { method: "GET" }, u.editor.valueField = "value", u.editor.textField = "name");
865
869
  break;
866
870
  }
867
871
  case "data": {
868
- !S.checkEnumDataReadonly(r) && r.formatter && (r.formatter.data = [...f.propertyValue]);
872
+ !S.checkEnumDataReadonly(u) && u.formatter && (u.formatter.data = [...r.propertyValue]);
869
873
  break;
870
874
  }
871
875
  case "viewType":
872
- f.propertyValue === "tag" && (r.editor.editable = !1);
876
+ r.propertyValue === "tag" && (u.editor.editable = !1);
873
877
  }
874
878
  });
875
879
  }
876
880
  getGridFieldEdtiorProperties(t, l) {
877
- var s, f, r, S, p, x;
881
+ var f, r, u, S, p, x;
878
882
  const o = this;
879
883
  let n = "";
880
- if (((s = t == null ? void 0 : t.binding) == null ? void 0 : s.type) === "Form") {
884
+ if (((f = t == null ? void 0 : t.binding) == null ? void 0 : f.type) === "Form") {
881
885
  const i = this.schemaService.getFieldByIDAndVMID(t.binding.field, this.viewModelId);
882
- (f = i == null ? void 0 : i.schemaField) != null && f.type && (n = i.schemaField.type.$type);
886
+ (r = i == null ? void 0 : i.schemaField) != null && r.type && (n = i.schemaField.type.$type);
883
887
  }
884
888
  return o.getComponentConfig(t, { type: "combo-list" }, {
885
889
  // editable: {
@@ -910,7 +914,7 @@ class we extends ae {
910
914
  description: "",
911
915
  title: "数据",
912
916
  type: "array",
913
- visible: !((r = t.editor) != null && r.dataSourceType) || ((S = t.editor) == null ? void 0 : S.dataSourceType) === "static",
917
+ visible: !((u = t.editor) != null && u.dataSourceType) || ((S = t.editor) == null ? void 0 : S.dataSourceType) === "static",
914
918
  ...o.getItemCollectionEditor(t, (p = t.editor) == null ? void 0 : p.valueField, (x = t.editor) == null ? void 0 : x.textField),
915
919
  // 这个属性,标记当属性变更得时候触发重新更新属性
916
920
  refreshPanelAfterChanged: !0
@@ -994,7 +998,7 @@ class we extends ae {
994
998
  */
995
999
  getEventPropertyConfig(t, l = "card", o, n) {
996
1000
  const d = this;
997
- let s = [
1001
+ let f = [
998
1002
  {
999
1003
  label: "onChange",
1000
1004
  name: "值变化事件"
@@ -1008,12 +1012,12 @@ class we extends ae {
1008
1012
  name: "打开下拉面板前"
1009
1013
  }
1010
1014
  ];
1011
- o && (s = s.concat(o)), this.appendFieldValueChangeEvents(t, s);
1012
- const f = d.eventsEditorUtils.formProperties(t, d.viewModelId, s);
1015
+ o && (f = f.concat(o)), this.appendFieldValueChangeEvents(t, f);
1016
+ const r = d.eventsEditorUtils.formProperties(t, d.viewModelId, f);
1013
1017
  return {
1014
1018
  title: "事件",
1015
1019
  hideTitle: !0,
1016
- properties: d.createBaseEventProperty(f),
1020
+ properties: d.createBaseEventProperty(r),
1017
1021
  tabId: "commands",
1018
1022
  tabName: "交互",
1019
1023
  setPropertyRelates(p, x) {
@@ -1025,7 +1029,7 @@ class we extends ae {
1025
1029
  };
1026
1030
  }
1027
1031
  }
1028
- function Ve(e, t) {
1032
+ function Te(e, t) {
1029
1033
  const l = e.schema;
1030
1034
  function o(n, d) {
1031
1035
  return new we(n, t).getPropertyConfig(l, d);
@@ -1034,15 +1038,15 @@ function Ve(e, t) {
1034
1038
  getPropsConfig: o
1035
1039
  };
1036
1040
  }
1037
- const Te = /* @__PURE__ */ E({
1041
+ const Ve = /* @__PURE__ */ E({
1038
1042
  name: "FComboListDesign",
1039
1043
  props: pe,
1040
1044
  emits: ["clear", "update:modelValue", "change"],
1041
1045
  setup(e, t) {
1042
- const l = v(), o = M("designer-host-service"), n = M("design-item-context"), d = Ve(n, o), s = ie(l, n, d);
1046
+ const l = v(), o = M("designer-host-service"), n = M("design-item-context"), d = Te(n, o), f = ie(l, n, d);
1043
1047
  return A(() => {
1044
- l.value.componentInstance = s;
1045
- }), t.expose(s.value), () => I(te, {
1048
+ l.value.componentInstance = f;
1049
+ }), t.expose(f.value), () => I(te, {
1046
1050
  ref: l,
1047
1051
  buttonContent: e.dropDownIcon,
1048
1052
  readonly: !0,
@@ -1057,7 +1061,7 @@ L.register = (e, t, l, o) => {
1057
1061
  e["combo-list"] = L, t["combo-list"] = N, o["combo-list"] = { callbackResolver: Se };
1058
1062
  };
1059
1063
  L.registerDesigner = (e, t, l) => {
1060
- e["combo-list"] = Te, t["combo-list"] = N;
1064
+ e["combo-list"] = Ve, t["combo-list"] = N;
1061
1065
  };
1062
1066
  const Ae = ne(L);
1063
1067
  export {
@@ -1 +1 @@
1
- (function(g,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("vue-i18n"),require("../button-edit/index.umd.js"),require("../dynamic-resolver/index.umd.js"),require("lodash-es"),require("../list-view/index.umd.js"),require("../../designer/button-edit/index.umd.js"),require("../designer-canvas/index.umd.js"),require("../common/index.umd.js"),require("../property-panel/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","../button-edit/index.umd.js","../dynamic-resolver/index.umd.js","lodash-es","../list-view/index.umd.js","../../designer/button-edit/index.umd.js","../designer-canvas/index.umd.js","../common/index.umd.js","../property-panel/index.umd.js"],n):(g=typeof globalThis<"u"?globalThis:g||self,n(g["combo-list"]={},g.Vue,g.vueI18n,g.FButtonEdit,g.dynamicResolver,g.LodashES,g.FListView,g.FButtonEditDesign,g.designerCanvas,g.common,g.propertyPanel))})(this,function(g,n,R,$,E,N,G,U,W,M,J){"use strict";const _=new Map([["appearance",E.resolveAppearance]]),z={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/combo-list.schema.json",title:"combo-list",description:"A Farris Input Component",type:"object",properties:{id:{description:"The unique identifier for a combo list",type:"string"},type:{description:"The type string of number combo list component",type:"string",default:"combo-list"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{description:"",type:"boolean",default:!1},enableClear:{description:"",type:"boolean",default:!1},editable:{description:"",type:"boolean",default:!1},enableLinkLabel:{description:"",type:"boolean",default:!1},label:{description:"",type:"string",default:""},lableWidth:{description:"",type:"number"},placeholder:{description:"",type:"string",default:"请选择"},idField:{description:"",type:"string",default:"id"},valueField:{description:"",type:"string",default:"id"},titleField:{description:"",type:"string",default:"name"},textField:{description:"",type:"string",default:"name"},dataSourceType:{description:"",type:"string",default:"static"},data:{description:"",type:"array"},remote:{description:"",type:"string"},readonly:{description:"",type:"boolean",default:!1},required:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},textAlign:{description:"",type:"string",enum:["left","middle","right"],default:"left"},multiSelect:{description:"",type:"boolean",default:!1},maxLength:{description:"",type:"number",default:null},visible:{description:"",type:"boolean",default:!0},onBlur:{description:"",type:"string",default:""},onClickLinkLabel:{description:"",type:"sting",default:""},maxHeight:{description:"",type:"number",default:350},minPanelWidth:{description:"",type:"number",default:160},popupOnClick:{description:"",type:"boolean",default:!0},separator:{description:"",type:"string",default:","},viewType:{description:"",type:"string",default:"tag"},enableSearch:{description:"启用搜索",type:"boolean",default:!0},enableHighlightSearch:{description:"启用高亮搜索",type:"boolean",default:!1},beforeOpen:{description:"打卡面板前回调",type:"string"},onChange:{description:"值变化事件",type:"string",default:""},onInput:{description:"输入事件",type:"string",default:""},onClear:{description:"清空事件",type:"string",default:""}},required:["type"],ignore:["id","appearance","binding","visible"]};function K(e,t,l){return t}function Q(){function e(t,l,d){const a={};return a.beforeOpen=r=>l.call("beforeOpen",t,[r,t],d),a}return{resolve:e}}var k=(e=>(e.top="top",e.bottom="bottom",e.auto="auto",e))(k||{});const I={id:{type:String},data:{type:Array,default:[]},disabled:{default:!1,type:Boolean},dropDownIcon:{type:String,default:'<span class="f-icon f-icon-arrow-chevron-down"></span>'},editable:{default:!1,type:Boolean},enableClear:{default:!0,type:Boolean},enableSearch:{type:Boolean,default:!1},enableTitle:{default:!0,type:Boolean},fitEditor:{default:!1,type:Boolean},forcePlaceholder:{default:!1,type:Boolean},hidePanelOnClear:{default:!0,type:Boolean},idField:{default:"id",type:String},mapFields:{type:Object},maxHeight:{default:350,type:Number},maxLength:{type:Number},multiSelect:{type:Boolean,default:!1},modelValue:{},placeholder:{type:String,default:"请选择"},placement:{type:String,default:"auto"},readonly:{default:!1,type:Boolean},remote:{default:null,type:Object},remoteSearch:{default:!1,type:Boolean},separator:{default:",",type:String},tabIndex:{type:Number,default:-1},textField:{default:"name",type:String},titleField:{default:"name",type:String},valueField:{default:"id",type:String},viewType:{default:"tag",type:String},change:{type:Function,default:()=>{}},focusOnCreated:{type:Boolean,default:!1},selectOnCreated:{type:Boolean,default:!1},autoHeight:{type:Boolean,default:!0},beforeOpen:{type:Function,default:null},load:{type:Function},searchOption:{type:[Boolean,Function],default:!1},enableHighlightSearch:{type:Boolean,default:!0},minPanelWidth:{type:Number,default:160},popupOnClick:{type:Boolean,default:!0}},H=Object.assign({},I,{readonly:{}}),L=E.createPropsResolver(I,z,_,K),A=Q(),X={dataSource:{type:Array,default:[]},enableSearch:{type:Boolean,default:!1},idField:{type:String,default:"id"},multiSelect:{type:Boolean,default:!1},selectedValues:{type:String,default:""},separator:{type:String,default:","},textField:{type:String,default:"name"},titleField:{type:String,default:"name"},width:{type:Number},maxHeight:{type:Number},valueField:{type:String,default:"id"},onSelectionChange:{type:Function,default:()=>{}},searchOption:{type:[Boolean,Function],default:!1},enableHighlightSearch:{type:Boolean,default:!0}},Y=n.defineComponent({name:"FComboListContainer",props:X,emits:["selectionChange"],setup(e,t){const l=n.ref(),d=n.ref(e.dataSource),a=n.ref([]),r=n.ref(e.separator),f=n.ref(e.width),m=n.ref(e.maxHeight),u=n.ref(String(e.selectedValues).split(r.value)),C=n.computed(()=>e.multiSelect),S=n.computed(()=>({enableSelectRow:!0,multiSelect:e.multiSelect,multiSelectMode:"OnCheckAndClick",showCheckbox:C.value,showSelectAll:!1,showSelection:!0}));n.watch(e.dataSource,()=>{d.value=e.dataSource}),n.computed(()=>e.enableSearch?"SearchBar":"ContentHeader");const w=n.computed(()=>{const s={};return f.value!==void 0&&(s.width=`${f.value}px`),m.value!==void 0&&m.value>0&&(s.maxHeight=`${m.value}px`),s});function i(s){l.value.search(s)}function o(s){a.value=s.map(y=>Object.assign({},y)),u.value=s.map(y=>y[e.idField]),t.emit("selectionChange",a.value)}function v(s){if(e.enableHighlightSearch)return;let y=[];const{searchOption:c}=e;typeof c=="function"?y=d.value.filter(x=>c(s,x)):y=d.value.filter(x=>x[e.valueField].indexOf(s)>-1||x[e.textField].indexOf(s)>-1),l.value.updateDataSource(y)}n.watch([()=>e.selectedValues],([s])=>{e.multiSelect?u.value=s.split(r.value):u.value=[s]});function F(s){l.value.activeRowById(s)}return n.onMounted(()=>{var s,y;if(!e.multiSelect){const c=(s=u.value)==null?void 0:s[0];let x=c;if(!N.isUndefined(c)){const V=typeof c,T=typeof((y=d.value[0])==null?void 0:y[e.valueField||e.idField]);T==="number"&&V!==T&&(x=Number(c)),T==="boolean"&&V!==T&&(x=c==="true"?!0:c==="false"?!1:c),F(x)}}}),t.expose({search:i,activeRowById:F}),()=>n.createVNode("div",{class:"f-combo-list-container",style:w.value},[n.createVNode(G,{ref:l,size:"small",itemClass:"f-combo-list-item",itemContentClass:"text-truncate",header:"ContentHeader",headerClass:"f-combo-list-search-box",data:d.value,idField:e.idField,textField:e.textField,titleField:e.titleField,multiSelect:e.multiSelect,selection:S.value,enableHighlightSearch:e.enableHighlightSearch,selectionValues:u.value,onSelectionUpdate:o,onAfterSearch:v},null)])}});function Z(e){const{t}=R.useI18n(),l=n.ref(""),d=n.ref(e.modelValue),a=n.ref(e.data||[]),r=n.ref(e.editable);function f(i){const o=e.multiSelect?String(i).split(e.separator):[String(i)],v=o.map(y=>[y,!0]),F=new Map(v);return a.value.filter(y=>F.has(String(y[e.valueField]))).sort((y,c)=>{const x=o.indexOf(y[e.valueField]),V=o.indexOf(c[e.valueField]);return x-V})}function m(i){const o=f(i).map(v=>v[e.textField]).join(e.separator);l.value=r.value?o||i:o}function u(i){if(e.multiSelect){const o=i.split(e.separator).map(F=>[F,!0]),v=new Map(o);return a.value.filter(F=>v.has(F[e.textField]))}return a.value.filter(o=>""+o[e.textField]===i)}function C(i){const o={};return o[e.idField]=i,o[e.textField]=i,[o]}function S(i){let o=u(i);const v=o&&o.length>0;return r.value&&!v&&(o=C(i)),o}function w(){const{url:i,method:o="GET",headers:v={"Content-Type":"application/json;charset=utf-8;"},body:F=null}=e.remote;if(!i)return;const s=o.toLowerCase()==="get"?{method:o,headers:v}:{method:o,headers:v,body:F};let y=!1;fetch(new Request(i,s)).then(c=>{var V,T;if(c.status===200)return y=!!((T=(V=c.headers)==null?void 0:V.get("content-type"))!=null&&T.includes("application/json")),y?c.text():c.json();throw c.status===405?new Error(t("comboList.remoteError")):new Error(c.statusText)}).then(c=>{c.length&&(a.value=y?JSON.parse(c):c)}).catch(c=>{console.warn(c)})}return e.remote&&(e.load?e.load().then(i=>{a.value=i}).catch(i=>{console.log(i)}):w()),n.watch(()=>e.data,()=>{a.value=e.data}),n.watch([a],([i])=>{if(e.modelValue!=null){const o=i.find(v=>v[e.valueField]===e.modelValue);o&&(l.value=o[e.textField])}}),n.watch(()=>e.modelValue,i=>{d.value=i,m(i)}),m(e.modelValue),{dataSource:a,displayText:l,editable:r,modelValue:d,getItemsByDisplayText:u,getItemsByValue:f,getSelectedItemsByDisplayText:S}}const P=n.defineComponent({name:"FComboList",props:I,emits:["clear","update:modelValue","change","input"],setup(e,t){const{t:l}=R.useI18n(),d=n.ref(),a=n.ref(),r=n.ref(e.disabled||e.readonly),f=n.ref(e.enableClear),m=n.ref(e.enableSearch),u=n.ref(e.readonly),{dataSource:C,displayText:S,editable:w,modelValue:i,getSelectedItemsByDisplayText:o,getItemsByDisplayText:v,getItemsByValue:F}=Z(e),s=n.ref(e.dropDownIcon);s.value==='<span class="f-icon f-icon-arrow-chevron-down"></span>'&&(s.value='<span id="'+e.id+'-icon-dropdown" class="f-icon f-icon-arrow-chevron-down"></span>');const y=n.computed(()=>e.multiSelect),c=n.computed(()=>a.value?a.value.elementRef.getBoundingClientRect().width:0);function x(){!y.value&&a.value&&a.value.hidePopup()}function V(h){S.value=h.map(p=>p[e.textField]).join(e.separator);let b="";h.length===1?b=h[0][e.valueField]:b=h.map(p=>p[e.valueField]).join(e.separator),i.value!==b&&(i.value=b,t.emit("update:modelValue",i.value),t.emit("change",h,i.value))}function T(){const h=F(i.value);V(h)}function ne(){u.value||S.value}function le(h){var b;i.value="",(b=d.value)==null||b.activeRowById(""),t.emit("update:modelValue",""),t.emit("change",[],""),t.emit("clear")}function ae(h){var b,p;e.enableSearch&&e.enableHighlightSearch&&((b=d.value)==null||b.search(h)),(p=d.value)==null||p.activeRowById(h),t.emit("change",[i.value],i.value)}function oe(h){if(e.multiSelect){const b=F(i.value),B=b.map(O=>O[e.idField||e.valueField]).join(e.separator);i.value!==B&&(i.value=B,t.emit("update:modelValue",i.value),t.emit("change",b,i.value))}}function de(){return S.value}function re(h){const{value:b}=h.target;ae(b),t.emit("input",b)}function ue(){a.value.hidePopup()}function se(h){C.value=h}function ce(){return C.value}const q={getDisplayText:de,hidePopup:ue,updateDataSource:se,getData:ce};t.expose(q);function fe(h){const b=typeof e.beforeOpen=="function";return!e.beforeOpen||!b?Promise.resolve(!0):Promise.resolve().then(()=>e.beforeOpen({instance:q})).then(p=>typeof(p==null?void 0:p.canOpen)=="boolean"?p==null?void 0:p.canOpen:!0)}return n.watch([()=>e.disabled,()=>e.editable,()=>e.enableClear,()=>e.enableSearch,()=>e.readonly],([h,b,p,B,O])=>{r.value=h,w.value=b,f.value=p,m.value=B,u.value=O}),()=>n.createVNode($,{ref:a,id:e.id,disable:r.value,readonly:u.value,forcePlaceholder:e.forcePlaceholder,editable:w.value,buttonContent:s.value,placeholder:e.placeholder==="请选择"?l("comboList.placeholder"):e.placeholder,enableClear:f.value,maxLength:e.maxLength,tabIndex:e.tabIndex,enableTitle:e.enableTitle,multiSelect:e.multiSelect,inputType:e.multiSelect?e.viewType:"text",modelValue:S.value,"onUpdate:modelValue":h=>S.value=h,focusOnCreated:e.focusOnCreated,selectOnCreated:e.selectOnCreated,onClear:le,onClick:ne,onChange:oe,onBlur:T,onInput:re,beforeOpen:fe,placement:e.placement,popupMinWidth:e.minPanelWidth,popupClass:"f-combo-list-wrapper",popupOnClick:e.popupOnClick,limitContentBySpace:!0},{default:()=>[n.createVNode(Y,{ref:d,idField:e.idField,valueField:e.valueField,textField:e.textField,titleField:e.titleField,dataSource:C.value,selectedValues:i.value,separator:e.separator,multiSelect:e.multiSelect,enableSearch:m.value,maxHeight:e.maxHeight,enableHighlightSearch:e.enableHighlightSearch,width:e.fitEditor?c.value:void 0,onSelectionChange:h=>{V(h),x()}},null)]})}}),j={convertFrom:(e,t)=>(e.editor.remote||{})[t],convertTo:(e,t,l)=>{e.editor.remote=e.editor.remote||{},e.editor.remote[t]=l}};class D extends J.InputBaseProperty{constructor(t,l){super(t,l)}getCommonEditorProperties(t){var l,d,a,r,f;return{viewType:{visible:!!((l=t.editor)!=null&&l.multiSelect),description:"数据展示类型,有标签和文本两种方式",title:"数据展示类型",type:"enum",editor:{data:[{id:"tag",name:"标签"},{id:"text",name:"文本"}]},refreshPanelAfterChanged:!0},separator:{visible:!!((d=t.editor)!=null&&d.multiSelect)&&((a=t.editor)==null?void 0:a.viewType)==="text",description:"下拉列表启用多选且数据展示类型为文本时的分隔符",title:"分隔符",type:"enum",editor:{data:[{id:",",name:"逗号(,)"},{id:"#",name:"井号(#)"},{id:".",name:"句号(.)"},{id:"|",name:"竖线(|)"}]}},editable:{description:"",title:"允许编辑",type:"boolean",refreshPanelAfterChanged:!0,readonly:!!((r=t.editor)!=null&&r.multiSelect)},enableHighlightSearch:{visible:!!((f=t.editor)!=null&&f.editable),description:"编辑状态下启用高亮搜索",title:"启用高亮搜索",type:"boolean"}}}getEditorProperties(t){var r,f;const l=this;let d="";if(((r=t==null?void 0:t.binding)==null?void 0:r.type)==="Form"){const m=this.schemaService.getFieldByIDAndVMID(t.binding.field,this.viewModelId);(f=m==null?void 0:m.schemaField)!=null&&f.type&&(d=m.schemaField.type.$type)}return l.getComponentConfig(t,{type:"combo-list"},{enableClear:{description:"",title:"启用清空",type:"boolean"},dataSourceType:{description:"",title:"数据源类型",type:"enum",editor:{default:"static",data:[{id:"static",name:"静态"},{id:"dynamic",name:"动态"}]},refreshPanelAfterChanged:!0},data:{description:"",title:"数据",type:"array",visible:!t.editor.dataSourceType||t.editor.dataSourceType==="static",...l.getItemCollectionEditor(t,t.editor.valueField,t.editor.textField),refreshPanelAfterChanged:!0},url:{visible:t.editor.dataSourceType==="dynamic",$converter:j,description:"",title:"服务端API",type:"string"},body:{visible:t.editor.dataSourceType==="dynamic",$converter:j,description:"",title:"服务端API参数",type:"string"},textField:{description:"",title:"数据源显示字段",type:"string",readonly:t.editor.dataSourceType!=="dynamic"},valueField:{description:"",title:"数据源值字段",type:"string",readonly:t.editor.dataSourceType!=="dynamic"},multiSelect:{description:"",title:"启用多选",visible:!d||d==="StringType",type:"boolean",refreshPanelAfterChanged:!0},maxLength:{description:"",title:"最大输入长度",type:"number",editor:{nullable:!0,min:0,useThousands:!1}},...this.getCommonEditorProperties(t)},(m,u)=>{if(!m||!u.editor)return;const C=this;switch(m.propertyID){case"dataSourceType":{m.propertyValue==="static"?(u.editor.valueField="value",u.editor.textField="name",u.editor.remote=null):m.propertyValue==="dynamic"&&(u.editor.remote={method:"GET"},u.editor.valueField="value",u.editor.textField="name");break}case"data":{!C.checkEnumDataReadonly(u)&&u.formatter&&(u.formatter.data=[...m.propertyValue]);break}case"viewType":m.propertyValue==="tag"&&(u.editor.editable=!1)}})}getGridFieldEdtiorProperties(t,l){var f,m,u,C,S,w;const d=this;let a="";if(((f=t==null?void 0:t.binding)==null?void 0:f.type)==="Form"){const i=this.schemaService.getFieldByIDAndVMID(t.binding.field,this.viewModelId);(m=i==null?void 0:i.schemaField)!=null&&m.type&&(a=i.schemaField.type.$type)}return d.getComponentConfig(t,{type:"combo-list"},{enableClear:{description:"",title:"启用清空",type:"boolean"},dataSourceType:{description:"",title:"数据源类型",type:"enum",editor:{default:"static",data:[{id:"static",name:"静态"},{id:"dynamic",name:"动态"}]},refreshPanelAfterChanged:!0},data:{description:"",title:"数据",type:"array",visible:!((u=t.editor)!=null&&u.dataSourceType)||((C=t.editor)==null?void 0:C.dataSourceType)==="static",...d.getItemCollectionEditor(t,(S=t.editor)==null?void 0:S.valueField,(w=t.editor)==null?void 0:w.textField),refreshPanelAfterChanged:!0},textField:{description:"",title:"数据源显示字段",type:"string",readonly:!0},valueField:{description:"",title:"数据源值字段",type:"string",readonly:!0},multiSelect:{description:"",title:"启用多选",visible:a==="StringType",type:"boolean",refreshPanelAfterChanged:!0},maxLength:{description:"",title:"最大输入长度",type:"number",editor:{nullable:!0,min:0,useThousands:!1}},...this.getCommonEditorProperties(t)},(i,o)=>{if(!i||!o.editor)return;const v=this;switch(i.propertyID){case"dataSourceType":{i.propertyValue==="static"?(o.editor.valueField="value",o.editor.textField="name",o.editor.remote=null):i.propertyValue==="dynamic"&&(o.editor.remote={method:"GET"},o.editor.valueField="value",o.editor.textField="name");break}case"data":{!v.checkEnumDataReadonly(o)&&o.formatter&&(o.formatter.data=[...i.propertyValue]);break}}})}setEditorPropertyRelates(t,l,d){if(!t||!l.editor)return;const a=this;switch(t.propertyID){case"dataSourceType":{t.propertyValue==="static"&&(l.editor.valueField="value",l.editor.textField="name",l.editor.remote={});break}case"data":{!a.checkEnumDataReadonly(l)&&l.formatter&&(l.formatter.data=[...t.propertyValue]);break}}}changeBindingField(t,l,d){var r;super.changeBindingField(t,l);const a=d;t.editor&&((r=a==null?void 0:a.type)==null?void 0:r.$type)===M.FormSchemaEntityFieldType$Type.EnumType&&(t.editor.data=a.type.enumValues||[])}getEventPropertyConfig(t,l="card",d,a){const r=this;let f=[{label:"onChange",name:"值变化事件"},{label:"onClear",name:"清空事件"},{label:"beforeOpen",name:"打开下拉面板前"}];d&&(f=f.concat(d)),this.appendFieldValueChangeEvents(t,f);const m=r.eventsEditorUtils.formProperties(t,r.viewModelId,f);return{title:"事件",hideTitle:!0,properties:r.createBaseEventProperty(m),tabId:"commands",tabName:"交互",setPropertyRelates(S,w){const i=S.propertyValue;delete t[r.viewModelId],i&&(i.setPropertyRelates=this.setPropertyRelates,r.eventsEditorUtils.saveRelatedParameters(t,r.viewModelId,i.events,i)),a&&a(S,w,i);const o=r.designViewModelUtils.getDgViewModel(r.viewModelId);o&&r.designViewModelField&&o.changeField(r.designViewModelField.id,{valueChanging:t.fieldValueChanging,valueChanged:t.fieldValueChanged}),t.editor.beforeOpen!==t.beforeOpen&&(t.editor.beforeOpen=t.beforeOpen),t.editor.onChange!==t.onChange&&(t.editor.onChange=t.onChange),t.editor.onClear!==t.onClear&&(t.editor.onClear=t.onClear)}}}}function ee(e,t){const l=e.schema;function d(a,r){return new D(a,t).getPropertyConfig(l,r)}return{getPropsConfig:d}}const te=n.defineComponent({name:"FComboListDesign",props:H,emits:["clear","update:modelValue","change"],setup(e,t){const l=n.ref(),d=n.inject("designer-host-service"),a=n.inject("design-item-context"),r=ee(a,d),f=W.useDesignerComponent(l,a,r);return n.onMounted(()=>{l.value.componentInstance=f}),t.expose(f.value),()=>n.createVNode(U,{ref:l,buttonContent:e.dropDownIcon,readonly:!0,editable:!1,forcePlaceholder:!0,placeholder:e.placeholder,enableClear:!0},null)}});P.register=(e,t,l,d)=>{e["combo-list"]=P,t["combo-list"]=L,d["combo-list"]={callbackResolver:A}},P.registerDesigner=(e,t,l)=>{e["combo-list"]=te,t["combo-list"]=L};const ie=M.withInstall(P);g.FComboList=P,g.Placement=k,g.callbackResolver=A,g.comboListDesignProps=H,g.comboListProps=I,g.default=ie,g.propsResolver=L,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(g,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("vue-i18n"),require("../button-edit/index.umd.js"),require("../dynamic-resolver/index.umd.js"),require("lodash-es"),require("../list-view/index.umd.js"),require("../../designer/button-edit/index.umd.js"),require("../designer-canvas/index.umd.js"),require("../common/index.umd.js"),require("../property-panel/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","../button-edit/index.umd.js","../dynamic-resolver/index.umd.js","lodash-es","../list-view/index.umd.js","../../designer/button-edit/index.umd.js","../designer-canvas/index.umd.js","../common/index.umd.js","../property-panel/index.umd.js"],n):(g=typeof globalThis<"u"?globalThis:g||self,n(g["combo-list"]={},g.Vue,g.vueI18n,g.FButtonEdit,g.dynamicResolver,g.LodashES,g.FListView,g.FButtonEditDesign,g.designerCanvas,g.common,g.propertyPanel))})(this,function(g,n,R,$,E,N,U,G,W,M,J){"use strict";const _=new Map([["appearance",E.resolveAppearance]]),z={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/combo-list.schema.json",title:"combo-list",description:"A Farris Input Component",type:"object",properties:{id:{description:"The unique identifier for a combo list",type:"string"},type:{description:"The type string of number combo list component",type:"string",default:"combo-list"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{description:"",type:"boolean",default:!1},enableClear:{description:"",type:"boolean",default:!1},editable:{description:"",type:"boolean",default:!1},enableLinkLabel:{description:"",type:"boolean",default:!1},label:{description:"",type:"string",default:""},lableWidth:{description:"",type:"number"},placeholder:{description:"",type:"string",default:"请选择"},idField:{description:"",type:"string",default:"id"},valueField:{description:"",type:"string",default:"id"},titleField:{description:"",type:"string",default:"name"},textField:{description:"",type:"string",default:"name"},dataSourceType:{description:"",type:"string",default:"static"},data:{description:"",type:"array"},remote:{description:"",type:"string"},readonly:{description:"",type:"boolean",default:!1},required:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},textAlign:{description:"",type:"string",enum:["left","middle","right"],default:"left"},multiSelect:{description:"",type:"boolean",default:!1},maxLength:{description:"",type:"number",default:null},visible:{description:"",type:"boolean",default:!0},onBlur:{description:"",type:"string",default:""},onClickLinkLabel:{description:"",type:"sting",default:""},maxHeight:{description:"",type:"number",default:350},minPanelWidth:{description:"",type:"number",default:160},popupOnClick:{description:"",type:"boolean",default:!0},separator:{description:"",type:"string",default:","},viewType:{description:"",type:"string",default:"tag"},enableSearch:{description:"启用搜索",type:"boolean",default:!0},enableHighlightSearch:{description:"启用高亮搜索",type:"boolean",default:!1},beforeOpen:{description:"打卡面板前回调",type:"string"},onChange:{description:"值变化事件",type:"string",default:""},onInput:{description:"输入事件",type:"string",default:""},onClear:{description:"清空事件",type:"string",default:""},"onUpdate:modelValue":{description:"",type:"object"}},required:["type"],ignore:["id","appearance","binding","visible"]};function K(e,t,l){return t}function Q(){function e(t,l,d){const a={};return a.beforeOpen=r=>l.call("beforeOpen",t,[r,t],d),a}return{resolve:e}}var k=(e=>(e.top="top",e.bottom="bottom",e.auto="auto",e))(k||{});const I={id:{type:String},data:{type:Array,default:[]},disabled:{default:!1,type:Boolean},dropDownIcon:{type:String,default:'<span class="f-icon f-icon-arrow-chevron-down"></span>'},editable:{default:!1,type:Boolean},enableClear:{default:!0,type:Boolean},enableSearch:{type:Boolean,default:!1},enableTitle:{default:!0,type:Boolean},fitEditor:{default:!1,type:Boolean},forcePlaceholder:{default:!1,type:Boolean},hidePanelOnClear:{default:!0,type:Boolean},idField:{default:"id",type:String},mapFields:{type:Object},maxHeight:{default:350,type:Number},maxLength:{type:Number},multiSelect:{type:Boolean,default:!1},modelValue:{},placeholder:{type:String,default:"请选择"},placement:{type:String,default:"auto"},readonly:{default:!1,type:Boolean},remote:{default:null,type:Object},remoteSearch:{default:!1,type:Boolean},separator:{default:",",type:String},tabIndex:{type:Number,default:-1},textField:{default:"name",type:String},titleField:{default:"name",type:String},valueField:{default:"id",type:String},viewType:{default:"tag",type:String},change:{type:Function,default:()=>{}},focusOnCreated:{type:Boolean,default:!1},selectOnCreated:{type:Boolean,default:!1},autoHeight:{type:Boolean,default:!0},beforeOpen:{type:Function,default:null},load:{type:Function},searchOption:{type:[Boolean,Function],default:!1},enableHighlightSearch:{type:Boolean,default:!0},minPanelWidth:{type:Number,default:160},popupOnClick:{type:Boolean,default:!0}},H=Object.assign({},I,{readonly:{}}),L=E.createPropsResolver(I,z,_,K),j=Q(),X={dataSource:{type:Array,default:[]},enableSearch:{type:Boolean,default:!1},idField:{type:String,default:"id"},multiSelect:{type:Boolean,default:!1},selectedValues:{type:String,default:""},separator:{type:String,default:","},textField:{type:String,default:"name"},titleField:{type:String,default:"name"},width:{type:Number},maxHeight:{type:Number},valueField:{type:String,default:"id"},onSelectionChange:{type:Function,default:()=>{}},searchOption:{type:[Boolean,Function],default:!1},enableHighlightSearch:{type:Boolean,default:!0}},Y=n.defineComponent({name:"FComboListContainer",props:X,emits:["selectionChange"],setup(e,t){const l=n.ref(),d=n.ref(e.dataSource),a=n.ref([]),r=n.ref(e.separator),m=n.ref(e.width),u=n.ref(e.maxHeight),s=n.ref(String(e.selectedValues).split(r.value)),C=n.computed(()=>e.multiSelect),S=n.computed(()=>({enableSelectRow:!0,multiSelect:e.multiSelect,multiSelectMode:"OnCheckAndClick",showCheckbox:C.value,showSelectAll:!1,showSelection:!0}));n.watch(e.dataSource,()=>{d.value=e.dataSource}),n.computed(()=>e.enableSearch?"SearchBar":"ContentHeader");const w=n.computed(()=>{const c={};return m.value!==void 0&&(c.width=`${m.value}px`),u.value!==void 0&&u.value>0&&(c.maxHeight=`${u.value}px`),c});function i(c){l.value.search(c)}function o(c){a.value=c.map(y=>Object.assign({},y)),s.value=c.map(y=>y[e.idField]),t.emit("selectionChange",a.value)}function v(c){if(e.enableHighlightSearch)return;let y=[];const{searchOption:f}=e;typeof f=="function"?y=d.value.filter(x=>f(c,x)):y=d.value.filter(x=>x[e.valueField].indexOf(c)>-1||x[e.textField].indexOf(c)>-1),l.value.updateDataSource(y)}n.watch([()=>e.selectedValues],([c])=>{e.multiSelect?s.value=c.split(r.value):s.value=[c]});function F(c){l.value.activeRowById(c)}return n.onMounted(()=>{var c,y;if(!e.multiSelect){const f=(c=s.value)==null?void 0:c[0];let x=f;if(!N.isUndefined(f)){const V=typeof f,T=typeof((y=d.value[0])==null?void 0:y[e.valueField||e.idField]);T==="number"&&V!==T&&(x=Number(f)),T==="boolean"&&V!==T&&(x=f==="true"?!0:f==="false"?!1:f),F(x)}}}),t.expose({search:i,activeRowById:F}),()=>n.createVNode("div",{class:"f-combo-list-container",style:w.value},[n.createVNode(U,{ref:l,size:"small",itemClass:"f-combo-list-item",itemContentClass:"text-truncate",header:"ContentHeader",headerClass:"f-combo-list-search-box",data:d.value,idField:e.idField,textField:e.textField,titleField:e.titleField,multiSelect:e.multiSelect,selection:S.value,enableHighlightSearch:e.enableHighlightSearch,selectionValues:s.value,onSelectionUpdate:o,onAfterSearch:v},null)])}});function Z(e){const{t}=R.useI18n(),l=n.ref(""),d=n.ref(e.modelValue),a=n.ref(e.data||[]),r=n.ref(e.editable);function m(i){const o=e.multiSelect?String(i).split(e.separator):[String(i)],v=o.map(y=>[y,!0]),F=new Map(v);return a.value.filter(y=>F.has(String(y[e.valueField]))).sort((y,f)=>{const x=o.indexOf(y[e.valueField]),V=o.indexOf(f[e.valueField]);return x-V})}function u(i){const o=m(i).map(v=>v[e.textField]).join(e.separator);l.value=r.value?o||i:o}function s(i){if(e.multiSelect){const o=i.split(e.separator).map(F=>[F,!0]),v=new Map(o);return a.value.filter(F=>v.has(F[e.textField]))}return a.value.filter(o=>""+o[e.textField]===i)}function C(i){const o={};return o[e.idField]=i,o[e.textField]=i,[o]}function S(i){let o=s(i);const v=o&&o.length>0;return r.value&&!v&&(o=C(i)),o}function w(){const{url:i,method:o="GET",headers:v={"Content-Type":"application/json;charset=utf-8;"},body:F=null}=e.remote;if(!i)return;const c=o.toLowerCase()==="get"?{method:o,headers:v}:{method:o,headers:v,body:F};let y=!1;fetch(new Request(i,c)).then(f=>{var V,T;if(f.status===200)return y=!!((T=(V=f.headers)==null?void 0:V.get("content-type"))!=null&&T.includes("application/json")),y?f.text():f.json();throw f.status===405?new Error(t("comboList.remoteError")):new Error(f.statusText)}).then(f=>{f.length&&(a.value=y?JSON.parse(f):f)}).catch(f=>{console.warn(f)})}return e.remote&&(e.load?e.load().then(i=>{a.value=i}).catch(i=>{console.log(i)}):w()),n.watch(()=>e.data,()=>{a.value=e.data}),n.watch([a],([i])=>{if(e.modelValue!=null){const o=i.find(v=>v[e.valueField]===e.modelValue);o&&(l.value=o[e.textField])}}),n.watch(()=>e.modelValue,i=>{d.value=i,u(i)}),u(e.modelValue),{dataSource:a,displayText:l,editable:r,modelValue:d,getItemsByDisplayText:s,getItemsByValue:m,getSelectedItemsByDisplayText:S}}const P=n.defineComponent({name:"FComboList",props:I,emits:["clear","update:modelValue","change","input"],setup(e,t){const{t:l}=R.useI18n(),d=n.ref(),a=n.ref(),r=n.ref(e.disabled||e.readonly),m=n.ref(e.enableClear),u=n.ref(e.enableSearch),s=n.ref(e.readonly),{dataSource:C,displayText:S,editable:w,modelValue:i,getSelectedItemsByDisplayText:o,getItemsByDisplayText:v,getItemsByValue:F}=Z(e),c=n.ref(e.dropDownIcon);c.value==='<span class="f-icon f-icon-arrow-chevron-down"></span>'&&(c.value='<span id="'+e.id+'-icon-dropdown" class="f-icon f-icon-arrow-chevron-down"></span>');const y=n.computed(()=>e.multiSelect),f=n.computed(()=>a.value?a.value.elementRef.getBoundingClientRect().width:0);function x(){!y.value&&a.value&&a.value.hidePopup()}function V(h){S.value=h.map(p=>p[e.textField]).join(e.separator);let b="";h.length===1?b=h[0][e.valueField]:b=h.map(p=>p[e.valueField]).join(e.separator),i.value!==b&&(i.value=b,t.emit("update:modelValue",i.value),t.emit("change",h,i.value))}function T(){const h=F(i.value);V(h)}function ne(){s.value||S.value}function le(h){var b;i.value="",(b=d.value)==null||b.activeRowById(""),t.emit("update:modelValue",""),t.emit("change",[],""),t.emit("clear")}function ae(h){var b,p;e.enableSearch&&e.enableHighlightSearch&&((b=d.value)==null||b.search(h)),(p=d.value)==null||p.activeRowById(h),t.emit("change",[i.value],i.value)}function oe(h){if(e.multiSelect){const b=F(i.value),B=b.map(O=>O[e.idField||e.valueField]).join(e.separator);i.value!==B&&(i.value=B,t.emit("update:modelValue",i.value),t.emit("change",b,i.value))}}function de(){return S.value}function re(h){const{value:b}=h.target;ae(b),t.emit("input",b)}function ue(){a.value.hidePopup()}function se(h){C.value=h}function ce(){return C.value}const q={getDisplayText:de,hidePopup:ue,updateDataSource:se,getData:ce};t.expose(q);function fe(h){const b=typeof e.beforeOpen=="function";return!e.beforeOpen||!b?Promise.resolve(!0):Promise.resolve().then(()=>e.beforeOpen({instance:q})).then(p=>typeof(p==null?void 0:p.canOpen)=="boolean"?p==null?void 0:p.canOpen:!0)}return n.watch([()=>e.disabled,()=>e.editable,()=>e.enableClear,()=>e.enableSearch,()=>e.readonly],([h,b,p,B,O])=>{r.value=h,w.value=b,m.value=p,u.value=B,s.value=O}),()=>n.createVNode($,{ref:a,id:e.id,disable:r.value,readonly:s.value,forcePlaceholder:e.forcePlaceholder,editable:w.value,buttonContent:c.value,placeholder:e.placeholder==="请选择"?l("comboList.placeholder"):e.placeholder,enableClear:m.value,maxLength:e.maxLength,tabIndex:e.tabIndex,enableTitle:e.enableTitle,multiSelect:e.multiSelect,inputType:e.multiSelect?e.viewType:"text",modelValue:S.value,"onUpdate:modelValue":h=>S.value=h,focusOnCreated:e.focusOnCreated,selectOnCreated:e.selectOnCreated,onClear:le,onClick:ne,onChange:oe,onBlur:T,onInput:re,beforeOpen:fe,placement:e.placement,popupMinWidth:e.minPanelWidth,popupClass:"f-combo-list-wrapper",popupOnClick:e.popupOnClick,limitContentBySpace:!0},{default:()=>[n.createVNode(Y,{ref:d,idField:e.idField,valueField:e.valueField,textField:e.textField,titleField:e.titleField,dataSource:C.value,selectedValues:i.value,separator:e.separator,multiSelect:e.multiSelect,enableSearch:u.value,maxHeight:e.maxHeight,enableHighlightSearch:e.enableHighlightSearch,width:e.fitEditor?f.value:void 0,onSelectionChange:h=>{V(h),x()}},null)]})}}),A={convertFrom:(e,t)=>(e.editor.remote||{})[t],convertTo:(e,t,l)=>{e.editor.remote=e.editor.remote||{},e.editor.remote[t]=l}};class D extends J.InputBaseProperty{constructor(t,l){super(t,l)}getCommonEditorProperties(t){var l,d,a,r,m,u;return{viewType:{visible:!!((l=t.editor)!=null&&l.multiSelect),description:"数据展示类型,有标签和文本两种方式",title:"数据展示类型",type:"enum",editor:{data:[{id:"tag",name:"标签"},{id:"text",name:"文本"}]},refreshPanelAfterChanged:!0},separator:{visible:!!((d=t.editor)!=null&&d.multiSelect)&&((a=t.editor)==null?void 0:a.viewType)==="text",description:"下拉列表启用多选且数据展示类型为文本时的分隔符",title:"分隔符",type:"enum",editor:{data:[{id:",",name:"逗号(,)"},{id:"#",name:"井号(#)"},{id:".",name:"句号(.)"},{id:"|",name:"竖线(|)"}]}},editable:{description:"",title:"允许编辑",type:"boolean",refreshPanelAfterChanged:!0,readonly:!!((r=t.editor)!=null&&r.multiSelect)&&(((m=t.editor)==null?void 0:m.viewType)==="tag"||!t.editor.viewType)},enableHighlightSearch:{visible:!!((u=t.editor)!=null&&u.editable),description:"编辑状态下启用高亮搜索",title:"启用高亮搜索",type:"boolean"}}}getEditorProperties(t){var r,m;const l=this;let d="";if(((r=t==null?void 0:t.binding)==null?void 0:r.type)==="Form"){const u=this.schemaService.getFieldByIDAndVMID(t.binding.field,this.viewModelId);(m=u==null?void 0:u.schemaField)!=null&&m.type&&(d=u.schemaField.type.$type)}return l.getComponentConfig(t,{type:"combo-list"},{enableClear:{description:"",title:"启用清空",type:"boolean"},dataSourceType:{description:"",title:"数据源类型",type:"enum",editor:{default:"static",data:[{id:"static",name:"静态"},{id:"dynamic",name:"动态"}]},refreshPanelAfterChanged:!0},data:{description:"",title:"数据",type:"array",visible:!t.editor.dataSourceType||t.editor.dataSourceType==="static",...l.getItemCollectionEditor(t,t.editor.valueField,t.editor.textField),refreshPanelAfterChanged:!0},url:{visible:t.editor.dataSourceType==="dynamic",$converter:A,description:"",title:"服务端API",type:"string"},body:{visible:t.editor.dataSourceType==="dynamic",$converter:A,description:"",title:"服务端API参数",type:"string"},textField:{description:"",title:"数据源显示字段",type:"string",readonly:t.editor.dataSourceType!=="dynamic"},valueField:{description:"",title:"数据源值字段",type:"string",readonly:t.editor.dataSourceType!=="dynamic"},multiSelect:{description:"",title:"启用多选",visible:!d||d==="StringType",type:"boolean",refreshPanelAfterChanged:!0},maxLength:{description:"",title:"最大输入长度",type:"number",editor:{nullable:!0,min:0,useThousands:!1}},...this.getCommonEditorProperties(t)},(u,s)=>{if(!u||!s.editor)return;const C=this;switch(u.propertyID){case"dataSourceType":{u.propertyValue==="static"?(s.editor.valueField="value",s.editor.textField="name",s.editor.remote=null):u.propertyValue==="dynamic"&&(s.editor.remote={method:"GET"},s.editor.valueField="value",s.editor.textField="name");break}case"data":{!C.checkEnumDataReadonly(s)&&s.formatter&&(s.formatter.data=[...u.propertyValue]);break}case"viewType":u.propertyValue==="tag"&&(s.editor.editable=!1)}})}getGridFieldEdtiorProperties(t,l){var m,u,s,C,S,w;const d=this;let a="";if(((m=t==null?void 0:t.binding)==null?void 0:m.type)==="Form"){const i=this.schemaService.getFieldByIDAndVMID(t.binding.field,this.viewModelId);(u=i==null?void 0:i.schemaField)!=null&&u.type&&(a=i.schemaField.type.$type)}return d.getComponentConfig(t,{type:"combo-list"},{enableClear:{description:"",title:"启用清空",type:"boolean"},dataSourceType:{description:"",title:"数据源类型",type:"enum",editor:{default:"static",data:[{id:"static",name:"静态"},{id:"dynamic",name:"动态"}]},refreshPanelAfterChanged:!0},data:{description:"",title:"数据",type:"array",visible:!((s=t.editor)!=null&&s.dataSourceType)||((C=t.editor)==null?void 0:C.dataSourceType)==="static",...d.getItemCollectionEditor(t,(S=t.editor)==null?void 0:S.valueField,(w=t.editor)==null?void 0:w.textField),refreshPanelAfterChanged:!0},textField:{description:"",title:"数据源显示字段",type:"string",readonly:!0},valueField:{description:"",title:"数据源值字段",type:"string",readonly:!0},multiSelect:{description:"",title:"启用多选",visible:a==="StringType",type:"boolean",refreshPanelAfterChanged:!0},maxLength:{description:"",title:"最大输入长度",type:"number",editor:{nullable:!0,min:0,useThousands:!1}},...this.getCommonEditorProperties(t)},(i,o)=>{if(!i||!o.editor)return;const v=this;switch(i.propertyID){case"dataSourceType":{i.propertyValue==="static"?(o.editor.valueField="value",o.editor.textField="name",o.editor.remote=null):i.propertyValue==="dynamic"&&(o.editor.remote={method:"GET"},o.editor.valueField="value",o.editor.textField="name");break}case"data":{!v.checkEnumDataReadonly(o)&&o.formatter&&(o.formatter.data=[...i.propertyValue]);break}}})}setEditorPropertyRelates(t,l,d){if(!t||!l.editor)return;const a=this;switch(t.propertyID){case"dataSourceType":{t.propertyValue==="static"&&(l.editor.valueField="value",l.editor.textField="name",l.editor.remote={});break}case"data":{!a.checkEnumDataReadonly(l)&&l.formatter&&(l.formatter.data=[...t.propertyValue]);break}}}changeBindingField(t,l,d){var r;super.changeBindingField(t,l);const a=d;t.editor&&((r=a==null?void 0:a.type)==null?void 0:r.$type)===M.FormSchemaEntityFieldType$Type.EnumType&&(t.editor.data=a.type.enumValues||[])}getEventPropertyConfig(t,l="card",d,a){const r=this;let m=[{label:"onChange",name:"值变化事件"},{label:"onClear",name:"清空事件"},{label:"beforeOpen",name:"打开下拉面板前"}];d&&(m=m.concat(d)),this.appendFieldValueChangeEvents(t,m);const u=r.eventsEditorUtils.formProperties(t,r.viewModelId,m);return{title:"事件",hideTitle:!0,properties:r.createBaseEventProperty(u),tabId:"commands",tabName:"交互",setPropertyRelates(S,w){const i=S.propertyValue;delete t[r.viewModelId],i&&(i.setPropertyRelates=this.setPropertyRelates,r.eventsEditorUtils.saveRelatedParameters(t,r.viewModelId,i.events,i)),a&&a(S,w,i);const o=r.designViewModelUtils.getDgViewModel(r.viewModelId);o&&r.designViewModelField&&o.changeField(r.designViewModelField.id,{valueChanging:t.fieldValueChanging,valueChanged:t.fieldValueChanged}),t.editor.beforeOpen!==t.beforeOpen&&(t.editor.beforeOpen=t.beforeOpen),t.editor.onChange!==t.onChange&&(t.editor.onChange=t.onChange),t.editor.onClear!==t.onClear&&(t.editor.onClear=t.onClear)}}}}function ee(e,t){const l=e.schema;function d(a,r){return new D(a,t).getPropertyConfig(l,r)}return{getPropsConfig:d}}const te=n.defineComponent({name:"FComboListDesign",props:H,emits:["clear","update:modelValue","change"],setup(e,t){const l=n.ref(),d=n.inject("designer-host-service"),a=n.inject("design-item-context"),r=ee(a,d),m=W.useDesignerComponent(l,a,r);return n.onMounted(()=>{l.value.componentInstance=m}),t.expose(m.value),()=>n.createVNode(G,{ref:l,buttonContent:e.dropDownIcon,readonly:!0,editable:!1,forcePlaceholder:!0,placeholder:e.placeholder,enableClear:!0},null)}});P.register=(e,t,l,d)=>{e["combo-list"]=P,t["combo-list"]=L,d["combo-list"]={callbackResolver:j}},P.registerDesigner=(e,t,l)=>{e["combo-list"]=te,t["combo-list"]=L};const ie=M.withInstall(P);g.FComboList=P,g.Placement=k,g.callbackResolver=j,g.comboListDesignProps=H,g.comboListProps=I,g.default=ie,g.propsResolver=L,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});