knt-shared 1.8.3 → 1.8.4
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/components/Description/BasicDescription.vue.d.ts +8 -5
- package/dist/components/Description/BasicDescription.vue.d.ts.map +1 -1
- package/dist/components/Description/types.d.ts +17 -5
- package/dist/components/Description/types.d.ts.map +1 -1
- package/dist/components/Form/componentMap.d.ts +15 -15
- package/dist/components/Image/BasicImage.vue.d.ts +1 -1
- package/dist/components/ReadonlyField/BasicReadonlyField.vue.d.ts +1 -1
- package/dist/components/Table/components/componentMap.d.ts +15 -15
- package/dist/components/Upload/BasicUpload.vue.d.ts +1 -1
- package/dist/index.cjs.js +59 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +59 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +7 -7
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9313,7 +9313,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9313
9313
|
schema: {},
|
|
9314
9314
|
data: {},
|
|
9315
9315
|
helpMessageOptions: {},
|
|
9316
|
-
labelAlign: {
|
|
9316
|
+
labelAlign: {},
|
|
9317
9317
|
size: { default: "medium" },
|
|
9318
9318
|
bordered: { type: Boolean, default: true },
|
|
9319
9319
|
layout: { default: "horizontal" },
|
|
@@ -9324,7 +9324,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9324
9324
|
extra: {},
|
|
9325
9325
|
tableLayout: {},
|
|
9326
9326
|
labelStyle: {},
|
|
9327
|
-
valueStyle: {}
|
|
9327
|
+
valueStyle: {},
|
|
9328
|
+
showEmptyText: { type: Boolean, default: false },
|
|
9329
|
+
emptyText: { default: "-" }
|
|
9328
9330
|
},
|
|
9329
9331
|
emits: ["register"],
|
|
9330
9332
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -9344,21 +9346,59 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9344
9346
|
data: {
|
|
9345
9347
|
type: Object,
|
|
9346
9348
|
default: () => ({})
|
|
9349
|
+
},
|
|
9350
|
+
showEmptyText: {
|
|
9351
|
+
type: Boolean,
|
|
9352
|
+
default: false
|
|
9353
|
+
},
|
|
9354
|
+
emptyText: {
|
|
9355
|
+
type: String,
|
|
9356
|
+
default: "-"
|
|
9347
9357
|
}
|
|
9348
9358
|
},
|
|
9349
9359
|
setup(props2) {
|
|
9350
9360
|
return () => {
|
|
9351
9361
|
const result = props2.render(props2.value, props2.data);
|
|
9352
|
-
if (
|
|
9353
|
-
return h("span",
|
|
9362
|
+
if (isEmptyValue(result)) {
|
|
9363
|
+
return props2.showEmptyText ? h("span", props2.emptyText) : null;
|
|
9364
|
+
}
|
|
9365
|
+
if (typeof result === "string" || typeof result === "number" || typeof result === "boolean") {
|
|
9366
|
+
return h("span", String(result));
|
|
9354
9367
|
}
|
|
9355
9368
|
return result;
|
|
9356
9369
|
};
|
|
9357
9370
|
}
|
|
9358
9371
|
});
|
|
9372
|
+
const isEmptyValue = (value) => {
|
|
9373
|
+
return value === "" || value === null || value === void 0;
|
|
9374
|
+
};
|
|
9359
9375
|
const getProps = computed(() => {
|
|
9360
9376
|
return { ...props, ...unref(propsRef) };
|
|
9361
9377
|
});
|
|
9378
|
+
const getDisplayValue = (value) => {
|
|
9379
|
+
const propsData = unref(getProps);
|
|
9380
|
+
if (isEmptyValue(value)) {
|
|
9381
|
+
return propsData.showEmptyText ? propsData.emptyText ?? "-" : "";
|
|
9382
|
+
}
|
|
9383
|
+
return value;
|
|
9384
|
+
};
|
|
9385
|
+
const getResolvedAlign = computed(() => {
|
|
9386
|
+
const propsData = unref(getProps);
|
|
9387
|
+
const { align, labelAlign } = propsData;
|
|
9388
|
+
if (!labelAlign) {
|
|
9389
|
+
return align;
|
|
9390
|
+
}
|
|
9391
|
+
if (align && typeof align === "object") {
|
|
9392
|
+
return {
|
|
9393
|
+
...align,
|
|
9394
|
+
label: labelAlign
|
|
9395
|
+
};
|
|
9396
|
+
}
|
|
9397
|
+
return {
|
|
9398
|
+
label: labelAlign,
|
|
9399
|
+
value: align
|
|
9400
|
+
};
|
|
9401
|
+
});
|
|
9362
9402
|
const getBindValue = computed(() => {
|
|
9363
9403
|
const propsData = unref(getProps);
|
|
9364
9404
|
return {
|
|
@@ -9366,9 +9406,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9366
9406
|
size: propsData.size,
|
|
9367
9407
|
bordered: propsData.bordered,
|
|
9368
9408
|
layout: propsData.layout,
|
|
9369
|
-
|
|
9370
|
-
align: propsData.align,
|
|
9371
|
-
colon: propsData.colon,
|
|
9409
|
+
align: unref(getResolvedAlign),
|
|
9372
9410
|
style: propsData.style,
|
|
9373
9411
|
class: propsData.class,
|
|
9374
9412
|
tableLayout: propsData.tableLayout,
|
|
@@ -9397,6 +9435,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9397
9435
|
}
|
|
9398
9436
|
return data[field];
|
|
9399
9437
|
};
|
|
9438
|
+
const getLabelText = (label) => {
|
|
9439
|
+
const propsData = unref(getProps);
|
|
9440
|
+
if (!propsData.colon || /[::]\s*$/.test(label)) {
|
|
9441
|
+
return label;
|
|
9442
|
+
}
|
|
9443
|
+
return `${label}:`;
|
|
9444
|
+
};
|
|
9400
9445
|
const getLabelStyle = (item) => {
|
|
9401
9446
|
const style = { ...item.labelStyle };
|
|
9402
9447
|
if (item.labelMinWidth) {
|
|
@@ -9478,7 +9523,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9478
9523
|
label: withCtx(() => [
|
|
9479
9524
|
createElementVNode("div", {
|
|
9480
9525
|
style: normalizeStyle(getLabelStyle(item))
|
|
9481
|
-
}, toDisplayString(item.label), 5)
|
|
9526
|
+
}, toDisplayString(getLabelText(item.label)), 5)
|
|
9482
9527
|
]),
|
|
9483
9528
|
default: withCtx(() => [
|
|
9484
9529
|
createElementVNode("div", {
|
|
@@ -9488,9 +9533,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9488
9533
|
key: 0,
|
|
9489
9534
|
render: item.render,
|
|
9490
9535
|
value: getFieldValue(item.field),
|
|
9491
|
-
data: getProps.value.data || {}
|
|
9492
|
-
|
|
9493
|
-
|
|
9536
|
+
data: getProps.value.data || {},
|
|
9537
|
+
"show-empty-text": getProps.value.showEmptyText,
|
|
9538
|
+
"empty-text": getProps.value.emptyText || "-"
|
|
9539
|
+
}, null, 8, ["render", "value", "data", "show-empty-text", "empty-text"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
9540
|
+
createTextVNode(toDisplayString(getDisplayValue(getFieldValue(item.field))), 1)
|
|
9494
9541
|
], 64))
|
|
9495
9542
|
], 4)
|
|
9496
9543
|
]),
|
|
@@ -9504,7 +9551,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9504
9551
|
};
|
|
9505
9552
|
}
|
|
9506
9553
|
});
|
|
9507
|
-
const BasicDescription = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
9554
|
+
const BasicDescription = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-93ccbd39"]]);
|
|
9508
9555
|
function useDescription(props) {
|
|
9509
9556
|
const descriptionRef = ref(null);
|
|
9510
9557
|
const loadedRef = ref(false);
|