knt-shared 1.5.7 → 1.5.8

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 +1 @@
1
- {"version":3,"file":"BasicReadonlyField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ReadonlyField/BasicReadonlyField.vue"],"names":[],"mappings":"AAKA;AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,SAAS,CAAC;;;;;;;;;;;AAmOhE,wBAMG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"BasicReadonlyField.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ReadonlyField/BasicReadonlyField.vue"],"names":[],"mappings":"AAKA;AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,SAAS,CAAC;;;;;;;;;;;AA2NhE,wBAMG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -10,13 +10,9 @@ export declare function renderText(value: any, config: RenderConfig): VNodeChild
10
10
  */
11
11
  export declare function renderInputNumber(value: any, config: RenderConfig): VNodeChild;
12
12
  /**
13
- * 渲染 Select
13
+ * 渲染 Select(智能判断单选/多选)
14
14
  */
15
15
  export declare function renderSelect(value: any, config: RenderConfig): VNodeChild;
16
- /**
17
- * 渲染 Select(多选)
18
- */
19
- export declare function renderSelectMultiple(value: any, config: RenderConfig): VNodeChild;
20
16
  /**
21
17
  * 渲染 TreeSelect
22
18
  * 支持单选和多选两种模式
@@ -1 +1 @@
1
- {"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../../src/components/ReadonlyField/renderers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAiBtD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAWvE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,GACnB,UAAU,CAQZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAoBzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,GACnB,UAAU,CA0BZ;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,GACnB,UAAU,CAyCZ;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CA4D3E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,GACnB,UAAU,CASZ;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,YAAY,GACnB,UAAU,CAqBZ;AAED;;GAEG;AACH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ExE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAQvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAqBzE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAiEzE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CAgB3E;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAiChD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAE,MAAgB,GAAG,QAAQ,CAEjE"}
package/dist/index.cjs.js CHANGED
@@ -3616,42 +3616,36 @@ function renderInputNumber(value, config) {
3616
3616
  return vue.h("div", { class: "readonly-field-number" }, String(value));
3617
3617
  }
3618
3618
  function renderSelect(value, config) {
3619
- var _a;
3619
+ var _a, _b;
3620
3620
  const emptyText = config.emptyText || "-";
3621
3621
  if (value === null || value === void 0 || value === "") {
3622
3622
  return vue.h("div", { class: "readonly-field-empty" }, emptyText);
3623
3623
  }
3624
+ if (Array.isArray(value)) {
3625
+ if (value.length === 0) {
3626
+ return vue.h("div", { class: "readonly-field-empty" }, emptyText);
3627
+ }
3628
+ const options2 = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
3629
+ const labels = getLabelsFromOptions(value, options2, {
3630
+ labelKey: config.labelKey,
3631
+ valueKey: config.valueKey
3632
+ });
3633
+ return vue.h(
3634
+ "div",
3635
+ { class: "readonly-field-select-multiple" },
3636
+ labels.join(", ")
3637
+ );
3638
+ }
3624
3639
  if (config.labelMap && value in config.labelMap) {
3625
3640
  return vue.h("div", { class: "readonly-field-select" }, config.labelMap[value]);
3626
3641
  }
3627
- const options = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
3642
+ const options = ((_b = config.componentProps) == null ? void 0 : _b.options) || [];
3628
3643
  const label = getLabelFromOptions(value, options, {
3629
3644
  labelKey: config.labelKey,
3630
3645
  valueKey: config.valueKey
3631
3646
  });
3632
3647
  return vue.h("div", { class: "readonly-field-select" }, label);
3633
3648
  }
3634
- function renderSelectMultiple(value, config) {
3635
- var _a;
3636
- const emptyText = config.emptyText || "-";
3637
- if (!value) {
3638
- return vue.h("div", { class: "readonly-field-empty" }, emptyText);
3639
- }
3640
- const values = Array.isArray(value) ? value : [value];
3641
- if (values.length === 0) {
3642
- return vue.h("div", { class: "readonly-field-empty" }, emptyText);
3643
- }
3644
- const options = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
3645
- const labels = getLabelsFromOptions(values, options, {
3646
- labelKey: config.labelKey,
3647
- valueKey: config.valueKey
3648
- });
3649
- return vue.h(
3650
- "div",
3651
- { class: "readonly-field-select-multiple" },
3652
- labels.join(", ")
3653
- );
3654
- }
3655
3649
  function renderTreeSelect(value, config) {
3656
3650
  var _a;
3657
3651
  const emptyText = config.emptyText || "-";
@@ -3778,7 +3772,7 @@ function renderCheckbox(value, config) {
3778
3772
  return renderSwitch(value, config);
3779
3773
  }
3780
3774
  function renderCheckboxGroup(value, config) {
3781
- return renderSelectMultiple(value, config);
3775
+ return renderSelect(value, config);
3782
3776
  }
3783
3777
  function renderRadio(value, config) {
3784
3778
  return renderSelect(value, config);
@@ -4006,11 +4000,6 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
4006
4000
  (newValue, oldValue) => {
4007
4001
  }
4008
4002
  );
4009
- vue.onMounted(() => {
4010
- if (props.fetchOptions && cachedOptions.value.length === 0) {
4011
- fetchOptionsAsync();
4012
- }
4013
- });
4014
4003
  return (_ctx, _cache) => {
4015
4004
  return vue.openBlock(), vue.createElementBlock("div", {
4016
4005
  class: vue.normalizeClass(wrapperClass.value),
@@ -4021,7 +4010,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
4021
4010
  };
4022
4011
  }
4023
4012
  });
4024
- const BasicReadonlyField = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-1428cd76"]]);
4013
+ const BasicReadonlyField = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-055a0eb6"]]);
4025
4014
  function useReadonlyField(options) {
4026
4015
  const defaultEmptyText = (options == null ? void 0 : options.defaultEmptyText) || "-";
4027
4016
  const globalLabelMap = (options == null ? void 0 : options.globalLabelMap) || {};