paas-component-library 0.9.97 → 0.9.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/paas-ui.js CHANGED
@@ -30320,8 +30320,8 @@ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30320
30320
  },
30321
30321
  change(r) {
30322
30322
  this.value = Array.isArray(r) ? r : [r], this.selected = this.value;
30323
- const e = this.multiple ? this.value : this.value[0];
30324
- this.$emit("update:modelValue", e), this.$emit("change", e);
30323
+ let e = this.multiple ? this.value : this.value[0];
30324
+ e instanceof Array && (e = e.join(",")), console.log(e), this.$emit("update:modelValue", e), this.$emit("change", e);
30325
30325
  },
30326
30326
  loadData() {
30327
30327
  if (this.loading) return;
@@ -30430,7 +30430,7 @@ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30430
30430
  }, 8, ["span"]);
30431
30431
  };
30432
30432
  }
30433
- }), Vce = /* @__PURE__ */ qt(Fce, [["__scopeId", "data-v-11fe74aa"]]), Dce = {
30433
+ }), Vce = /* @__PURE__ */ qt(Fce, [["__scopeId", "data-v-90b25971"]]), Dce = {
30434
30434
  name: "FormSelect",
30435
30435
  inject: {
30436
30436
  labelWidth: {
@@ -30439,51 +30439,27 @@ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30439
30439
  }
30440
30440
  },
30441
30441
  props: {
30442
- placeholder: {
30443
- type: String,
30444
- default: ""
30445
- },
30446
- size: {
30447
- type: Number,
30448
- default: 2
30449
- },
30450
- textWidth: {
30451
- type: String,
30452
- default: ""
30453
- },
30454
- data: {
30455
- type: Array,
30456
- default: () => []
30457
- },
30458
- multiple: {
30459
- type: Boolean,
30460
- default: !1
30461
- },
30442
+ placeholder: { type: String, default: "" },
30443
+ size: { type: Number, default: 2 },
30444
+ textWidth: { type: String, default: "" },
30445
+ data: { type: Array, default: () => [] },
30446
+ multiple: { type: Boolean, default: !1 },
30462
30447
  modelValue: {
30463
- type: [
30464
- String,
30465
- Number,
30466
- Object,
30467
- Array
30468
- ],
30448
+ type: [String, Number, Object, Array],
30469
30449
  default: null
30470
30450
  },
30471
- params: {
30472
- type: String,
30473
- default: ""
30474
- },
30475
- label: {
30476
- type: String,
30477
- default: ""
30478
- },
30479
- name: {
30480
- type: String,
30481
- default: ""
30482
- },
30483
- disabled: {
30484
- type: Boolean,
30485
- default: !1
30486
- }
30451
+ params: { type: String, default: "" },
30452
+ label: { type: String, default: "" },
30453
+ name: { type: String, default: "" },
30454
+ disabled: { type: Boolean, default: !1 }
30455
+ },
30456
+ data() {
30457
+ return {
30458
+ value: this.multiple ? [] : "",
30459
+ // 绑定给 paas-select 的值,统一字符串或字符串数组
30460
+ datas: []
30461
+ // 处理后的 data,保证 options.value 都是字符串
30462
+ };
30487
30463
  },
30488
30464
  computed: {
30489
30465
  see() {
@@ -30491,28 +30467,39 @@ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
30491
30467
  }
30492
30468
  },
30493
30469
  watch: {
30494
- modelValue(r) {
30495
- r == null && (r = "");
30496
- let e = new Array();
30497
- Array.isArray(r) ? (r.forEach((t) => {
30498
- t != "" && e.push(String(t));
30499
- }), this.value = e) : r instanceof String && (r != null && r.includes(",")) ? (r.spit(",").forEach((t) => {
30500
- t != "" && e.push(String(t));
30501
- }), this.value = e) : this.multiple && r ? this.value = [String(r)] : this.value = String(r);
30470
+ modelValue: {
30471
+ immediate: !0,
30472
+ handler(r) {
30473
+ this.syncValue(r);
30474
+ }
30475
+ },
30476
+ data: {
30477
+ immediate: !0,
30478
+ handler(r) {
30479
+ this.datas = (r || []).map((e) => ({
30480
+ ...e,
30481
+ value: e.value != null ? String(e.value) : e.value
30482
+ }));
30483
+ }
30502
30484
  }
30503
30485
  },
30504
- mounted() {
30505
- this.modelValue ? typeof this.modelValue == "string" && this.modelValue.includes(",") ? this.value = this.modelValue.split(",") : this.value = Array.isArray(this.modelValue) ? this.modelValue : [this.modelValue] : this.value = this.modelValue;
30506
- },
30507
- data() {
30508
- return {
30509
- value: null
30510
- };
30511
- },
30512
30486
  methods: {
30487
+ syncValue(r) {
30488
+ if (console.log("syncValue", r), r == null || r === "") {
30489
+ this.value = this.multiple ? [] : "";
30490
+ return;
30491
+ }
30492
+ this.multiple ? Array.isArray(r) ? this.value = r.filter((e) => e != null).map((e) => String(e)) : typeof r == "string" && r.includes(",") ? this.value = r.split(",").map((e) => e.trim()).filter((e) => e !== "") : this.value = [String(r)] : Array.isArray(r) && r.length > 0 ? this.value = String(r[0]) : typeof r == "string" || typeof r == "number" ? this.value = String(r) : this.value = "";
30493
+ },
30513
30494
  handleChange(r) {
30514
- this.$emit("update:modelValue", r), this.$emit("change", r);
30495
+ this.multiple ? (this.$emit("update:modelValue", r), this.$emit("change", r)) : (this.$emit("update:modelValue", r), this.$emit("change", r));
30515
30496
  }
30497
+ },
30498
+ mounted() {
30499
+ this.syncValue(this.modelValue), this.datas = (this.data || []).map((r) => ({
30500
+ ...r,
30501
+ value: r.value != null ? String(r.value) : r.value
30502
+ }));
30516
30503
  }
30517
30504
  };
30518
30505
  function Nce(r, e, t, n, a, f) {
@@ -30524,12 +30511,12 @@ function Nce(r, e, t, n, a, f) {
30524
30511
  O(m, {
30525
30512
  label: t.label,
30526
30513
  name: t.name,
30527
- "label-col": { style: { width: t.textWidth ? t.textWidth : f.labelWidth } },
30514
+ "label-col": { style: { width: t.textWidth || f.labelWidth } },
30528
30515
  "wrapper-col": { style: { flex: 1 } }
30529
30516
  }, {
30530
30517
  default: Fe(() => [
30531
30518
  O(h, {
30532
- data: t.data,
30519
+ data: a.datas,
30533
30520
  value: a.value,
30534
30521
  disabled: f.see || t.disabled,
30535
30522
  mode: t.multiple ? "multiple" : void 0,