qidian-vue-ui 2.0.0-beta.0 → 2.0.0-beta.2
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/config-renderer/index.vue.mjs +2 -20
- package/dist/components/config-renderer/types.d.ts +0 -2
- package/dist/components/config-renderer/utils.mjs +1 -7
- package/dist/components/service/table/edit-cell.d.ts +11 -3
- package/dist/components/service/table/edit-cell.mjs +73 -36
- package/dist/components/service/table/index.css +17 -14
- package/dist/components/service/table/index.vue.mjs +1 -1
- package/dist/components/service/table/index.vue2.mjs +23 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSlice.mjs +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnset.mjs +12 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_parent.mjs +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/last.mjs +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/unset.mjs +7 -0
- package/package.json +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/assign.mjs +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, computed, h, resolveComponent, watch,
|
|
1
|
+
import { defineComponent, computed, h, resolveComponent, watch, createBlock, createCommentVNode, openBlock, resolveDynamicComponent, mergeProps, createSlots, renderList, withCtx } from "vue";
|
|
2
2
|
import { isEmpty } from "qidian-shared";
|
|
3
3
|
import { qdUseComputeValue } from "./compute.mjs";
|
|
4
|
-
import { wrapFunctionalRenderer,
|
|
4
|
+
import { wrapFunctionalRenderer, createVModelBinding } from "./utils.mjs";
|
|
5
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
6
|
...{
|
|
7
7
|
name: "QdConfigRenderer"
|
|
@@ -10,8 +10,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10
10
|
props: {
|
|
11
11
|
config: {},
|
|
12
12
|
context: {},
|
|
13
|
-
syncVModelContext: {},
|
|
14
|
-
onVModelUpdate: {},
|
|
15
13
|
fnInjectCtx: { type: Boolean },
|
|
16
14
|
crudMode: {}
|
|
17
15
|
},
|
|
@@ -20,7 +18,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20
18
|
const props = __props;
|
|
21
19
|
const emit = __emit;
|
|
22
20
|
let initialized = false;
|
|
23
|
-
const pendingDefaultEmits = [];
|
|
24
21
|
const currentContext = computed(() => props.config.context || props.context || {});
|
|
25
22
|
const reIfRender = computed(() => {
|
|
26
23
|
const ifRender = props.config.ifRender;
|
|
@@ -62,23 +59,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
62
59
|
const propName = key.slice(6);
|
|
63
60
|
const defaultKey = "default" + (key === "vModel" ? "ModelValue" : propName.charAt(0).toUpperCase() + key.slice(7));
|
|
64
61
|
const defaultValue = config[defaultKey];
|
|
65
|
-
const wasEmpty = getValueByPath(currentContext.value, value) === void 0;
|
|
66
62
|
const vModelBinding = createVModelBinding(
|
|
67
63
|
currentContext.value,
|
|
68
64
|
value,
|
|
69
65
|
initialized ? void 0 : defaultValue
|
|
70
66
|
);
|
|
71
|
-
const syncVModelBinding = props.syncVModelContext ? createVModelBinding(props.syncVModelContext, value) : void 0;
|
|
72
|
-
const updateModelValue = vModelBinding["onUpdate:modelValue"];
|
|
73
|
-
vModelBinding["onUpdate:modelValue"] = (modelValue) => {
|
|
74
|
-
updateModelValue?.(modelValue);
|
|
75
|
-
syncVModelBinding?.["onUpdate:modelValue"]?.(modelValue);
|
|
76
|
-
props.onVModelUpdate?.(key, modelValue);
|
|
77
|
-
};
|
|
78
|
-
const update = vModelBinding["onUpdate:modelValue"];
|
|
79
|
-
if (!initialized && key === "vModel" && defaultValue !== void 0 && wasEmpty && update) {
|
|
80
|
-
pendingDefaultEmits.push(() => update(defaultValue));
|
|
81
|
-
}
|
|
82
67
|
if (key === "vModel") {
|
|
83
68
|
componentProps2.modelValue = vModelBinding.modelValue;
|
|
84
69
|
componentProps2["onUpdate:modelValue"] = vModelBinding["onUpdate:modelValue"];
|
|
@@ -134,9 +119,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
134
119
|
},
|
|
135
120
|
{ immediate: true }
|
|
136
121
|
);
|
|
137
|
-
onMounted(() => {
|
|
138
|
-
while (pendingDefaultEmits.length) pendingDefaultEmits.shift()?.();
|
|
139
|
-
});
|
|
140
122
|
return (_ctx, _cache) => {
|
|
141
123
|
return reIfRender.value !== false ? (openBlock(), createBlock(resolveDynamicComponent(resolvedComponent.value), mergeProps({
|
|
142
124
|
key: 0,
|
|
@@ -36,7 +36,5 @@ export interface QdComponentConfig {
|
|
|
36
36
|
export interface QdConfigRendererProps extends Pick<QdFormProps, 'crudMode'> {
|
|
37
37
|
config: QdComponentConfig;
|
|
38
38
|
context?: Record<string, unknown>;
|
|
39
|
-
syncVModelContext?: Record<string, unknown>;
|
|
40
|
-
onVModelUpdate?: (key: string, value: unknown) => void;
|
|
41
39
|
fnInjectCtx?: boolean;
|
|
42
40
|
}
|
|
@@ -40,13 +40,7 @@ function resolveVModelBinding(context, vModel, defaultValue) {
|
|
|
40
40
|
}
|
|
41
41
|
return bindings;
|
|
42
42
|
}
|
|
43
|
-
const RENDERER_INTERNAL_KEYS = /* @__PURE__ */ new Set([
|
|
44
|
-
"context",
|
|
45
|
-
"config",
|
|
46
|
-
"crudMode",
|
|
47
|
-
"syncVModelContext",
|
|
48
|
-
"fnInjectCtx"
|
|
49
|
-
]);
|
|
43
|
+
const RENDERER_INTERNAL_KEYS = /* @__PURE__ */ new Set(["context", "config", "crudMode", "fnInjectCtx"]);
|
|
50
44
|
function wrapFunctionalRenderer(fn) {
|
|
51
45
|
return defineComponent({
|
|
52
46
|
name: "QdFunctionalRenderer",
|
|
@@ -12,6 +12,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
12
12
|
type: PropType<TableRowValue>;
|
|
13
13
|
required: true;
|
|
14
14
|
};
|
|
15
|
+
colKey: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
15
19
|
formItem: {
|
|
16
20
|
type: PropType<QdServiceTableFormItem>;
|
|
17
21
|
required: true;
|
|
@@ -35,7 +39,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
35
39
|
type: PropType<TableEditableCellPropsParams<TableRowData>["updateEditedCellValue"]>;
|
|
36
40
|
required: true;
|
|
37
41
|
};
|
|
38
|
-
|
|
42
|
+
sourceRow: {
|
|
39
43
|
type: PropType<TableRowData>;
|
|
40
44
|
default: undefined;
|
|
41
45
|
};
|
|
@@ -48,6 +52,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
48
52
|
type: PropType<TableRowValue>;
|
|
49
53
|
required: true;
|
|
50
54
|
};
|
|
55
|
+
colKey: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
51
59
|
formItem: {
|
|
52
60
|
type: PropType<QdServiceTableFormItem>;
|
|
53
61
|
required: true;
|
|
@@ -71,13 +79,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
71
79
|
type: PropType<TableEditableCellPropsParams<TableRowData>["updateEditedCellValue"]>;
|
|
72
80
|
required: true;
|
|
73
81
|
};
|
|
74
|
-
|
|
82
|
+
sourceRow: {
|
|
75
83
|
type: PropType<TableRowData>;
|
|
76
84
|
default: undefined;
|
|
77
85
|
};
|
|
78
86
|
}>> & Readonly<{}>, {
|
|
79
87
|
lazy: boolean;
|
|
80
|
-
syncVModelContext: TableRowData;
|
|
81
88
|
active: boolean;
|
|
89
|
+
sourceRow: TableRowData;
|
|
82
90
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
83
91
|
export default _default;
|
|
@@ -5,7 +5,68 @@ import { qdUseComputeValue } from "../../config-renderer/compute.mjs";
|
|
|
5
5
|
import { resolveQdFormItemOptions } from "../../form/utils.mjs";
|
|
6
6
|
import { PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE } from "../../form/config.mjs";
|
|
7
7
|
import _sfc_main from "../../config-renderer/index.vue.mjs";
|
|
8
|
-
import
|
|
8
|
+
import unset from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/unset.mjs";
|
|
9
|
+
import set from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.mjs";
|
|
10
|
+
function isProxyable(value) {
|
|
11
|
+
if (!value || typeof value !== "object") return false;
|
|
12
|
+
if (Array.isArray(value)) return true;
|
|
13
|
+
const prototype = Object.getPrototypeOf(value);
|
|
14
|
+
return prototype === Object.prototype || prototype === null;
|
|
15
|
+
}
|
|
16
|
+
function createRowEditContext(sourceRow, getEditedRow, colKey, updateEditedCellValue, onChange) {
|
|
17
|
+
const proxies = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
function syncValue(path, value) {
|
|
19
|
+
const editedRow = getEditedRow();
|
|
20
|
+
if (editedRow !== sourceRow) set(editedRow, path, value);
|
|
21
|
+
updateEditedCellValue({
|
|
22
|
+
isUpdateCurrentRow: true,
|
|
23
|
+
[path]: value
|
|
24
|
+
});
|
|
25
|
+
if (path === colKey) {
|
|
26
|
+
updateEditedCellValue(value);
|
|
27
|
+
queueMicrotask(() => {
|
|
28
|
+
onChange?.(value);
|
|
29
|
+
set(sourceRow, path, value);
|
|
30
|
+
if (editedRow !== sourceRow) set(editedRow, path, value);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function wrap(target, parentPath = "") {
|
|
35
|
+
const cachedByPath = proxies.get(target) ?? /* @__PURE__ */ new Map();
|
|
36
|
+
const cached = cachedByPath.get(parentPath);
|
|
37
|
+
if (cached) return cached;
|
|
38
|
+
const proxy = new Proxy(target, {
|
|
39
|
+
get(currentTarget, key, receiver) {
|
|
40
|
+
const value = Reflect.get(currentTarget, key, receiver);
|
|
41
|
+
if (typeof key !== "string" || !isProxyable(value)) return value;
|
|
42
|
+
return wrap(value, parentPath ? `${parentPath}.${key}` : key);
|
|
43
|
+
},
|
|
44
|
+
set(currentTarget, key, value, receiver) {
|
|
45
|
+
const result = Reflect.set(currentTarget, key, value, receiver);
|
|
46
|
+
if (!result || typeof key !== "string") return result;
|
|
47
|
+
syncValue(parentPath ? `${parentPath}.${key}` : key, value);
|
|
48
|
+
return result;
|
|
49
|
+
},
|
|
50
|
+
deleteProperty(currentTarget, key) {
|
|
51
|
+
const result = Reflect.deleteProperty(currentTarget, key);
|
|
52
|
+
if (!result || typeof key !== "string") return result;
|
|
53
|
+
const path = parentPath ? `${parentPath}.${key}` : key;
|
|
54
|
+
const editedRow = getEditedRow();
|
|
55
|
+
if (editedRow !== sourceRow) unset(editedRow, path);
|
|
56
|
+
updateEditedCellValue({
|
|
57
|
+
isUpdateCurrentRow: true,
|
|
58
|
+
[path]: void 0
|
|
59
|
+
});
|
|
60
|
+
if (path === colKey) updateEditedCellValue(void 0);
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
cachedByPath.set(parentPath, proxy);
|
|
65
|
+
proxies.set(target, cachedByPath);
|
|
66
|
+
return proxy;
|
|
67
|
+
}
|
|
68
|
+
return wrap(sourceRow);
|
|
69
|
+
}
|
|
9
70
|
const QdServiceTableEditCell = /* @__PURE__ */ defineComponent({
|
|
10
71
|
name: "QdServiceTableEditCell",
|
|
11
72
|
inheritAttrs: false,
|
|
@@ -18,6 +79,10 @@ const QdServiceTableEditCell = /* @__PURE__ */ defineComponent({
|
|
|
18
79
|
type: [String, Number],
|
|
19
80
|
required: true
|
|
20
81
|
},
|
|
82
|
+
colKey: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: true
|
|
85
|
+
},
|
|
21
86
|
formItem: {
|
|
22
87
|
type: Object,
|
|
23
88
|
required: true
|
|
@@ -41,7 +106,7 @@ const QdServiceTableEditCell = /* @__PURE__ */ defineComponent({
|
|
|
41
106
|
type: Function,
|
|
42
107
|
required: true
|
|
43
108
|
},
|
|
44
|
-
|
|
109
|
+
sourceRow: {
|
|
45
110
|
type: Object,
|
|
46
111
|
default: void 0
|
|
47
112
|
}
|
|
@@ -49,7 +114,9 @@ const QdServiceTableEditCell = /* @__PURE__ */ defineComponent({
|
|
|
49
114
|
setup(props, {
|
|
50
115
|
attrs
|
|
51
116
|
}) {
|
|
52
|
-
const currentContext = computed(() => props.
|
|
117
|
+
const currentContext = computed(() => createRowEditContext(props.sourceRow ?? props.row, () => props.row, props.colKey, props.updateEditedCellValue, (value) => {
|
|
118
|
+
if (typeof attrs.onChange === "function") attrs.onChange(value);
|
|
119
|
+
}));
|
|
53
120
|
const {
|
|
54
121
|
t
|
|
55
122
|
} = useConfig("form");
|
|
@@ -67,7 +134,7 @@ const QdServiceTableEditCell = /* @__PURE__ */ defineComponent({
|
|
|
67
134
|
const component = computed(() => {
|
|
68
135
|
const resolved = resolveQdFormItemOptions({
|
|
69
136
|
formItem: props.formItem,
|
|
70
|
-
context:
|
|
137
|
+
context: currentContext.value,
|
|
71
138
|
label: props.label,
|
|
72
139
|
t
|
|
73
140
|
}).component;
|
|
@@ -98,42 +165,12 @@ const QdServiceTableEditCell = /* @__PURE__ */ defineComponent({
|
|
|
98
165
|
delete rendererAttrs.value;
|
|
99
166
|
delete rendererAttrs.status;
|
|
100
167
|
delete rendererAttrs.tips;
|
|
101
|
-
|
|
102
|
-
if (typeof rendererAttrs.onChange === "function") {
|
|
103
|
-
const onChange = rendererAttrs.onChange;
|
|
104
|
-
delete rendererAttrs.onChange;
|
|
105
|
-
const prevUpdate = rendererAttrs["onUpdate:modelValue"];
|
|
106
|
-
rendererAttrs.onVModelUpdate = (key, value) => {
|
|
107
|
-
if (key === "vModel") {
|
|
108
|
-
if (props.syncVModelContext && props.row !== props.syncVModelContext) {
|
|
109
|
-
assign(props.row, props.syncVModelContext);
|
|
110
|
-
}
|
|
111
|
-
if (typeof prevUpdate === "function") prevUpdate(value);
|
|
112
|
-
onChange(value);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (!hasSecondaryVModel) return;
|
|
116
|
-
const path = component.value[key];
|
|
117
|
-
if (typeof path !== "string") return;
|
|
118
|
-
props.updateEditedCellValue({
|
|
119
|
-
isUpdateCurrentRow: true,
|
|
120
|
-
[path]: value
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
rendererAttrs["onUpdate:modelValue"] = (value) => {
|
|
124
|
-
if (props.syncVModelContext && props.row !== props.syncVModelContext) {
|
|
125
|
-
assign(props.row, props.syncVModelContext);
|
|
126
|
-
}
|
|
127
|
-
if (typeof prevUpdate === "function") prevUpdate(value);
|
|
128
|
-
onChange(value);
|
|
129
|
-
};
|
|
130
|
-
}
|
|
168
|
+
delete rendererAttrs.onChange;
|
|
131
169
|
return h(_sfc_main, {
|
|
132
170
|
...rendererAttrs,
|
|
133
|
-
syncVModelContext: props.syncVModelContext,
|
|
134
171
|
class: "qd-service-table__cell-editor",
|
|
135
172
|
config: component.value,
|
|
136
|
-
context:
|
|
173
|
+
context: currentContext.value,
|
|
137
174
|
crudMode: props.formItem.crudMode,
|
|
138
175
|
onFocusin: props.activate
|
|
139
176
|
});
|
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
.qd-service-table[data-v-
|
|
1
|
+
.qd-service-table[data-v-c56c6716] {
|
|
2
2
|
height: 100%;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
}
|
|
6
|
-
.qd-service-table[data-v-
|
|
6
|
+
.qd-service-table[data-v-c56c6716] > .t-table__content {
|
|
7
7
|
flex: 1;
|
|
8
8
|
}
|
|
9
|
-
.qd-service-table[data-v-
|
|
9
|
+
.qd-service-table[data-v-c56c6716] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
|
|
10
10
|
margin-left: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
|
|
11
11
|
}
|
|
12
|
-
.qd-service-table[data-v-
|
|
12
|
+
.qd-service-table[data-v-c56c6716] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
|
|
13
13
|
width: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
|
|
14
14
|
}
|
|
15
|
-
.qd-service-table[data-v-
|
|
16
|
-
.qd-service-table[data-v-
|
|
17
|
-
transform: var(--
|
|
15
|
+
.qd-service-table[data-v-c56c6716] .t-affix > .t-table__affixed-header-elm-wrap,
|
|
16
|
+
.qd-service-table[data-v-c56c6716] .t-affix > .t-table__scrollbar--obvious {
|
|
17
|
+
transform: var(--v05eb2f2a);
|
|
18
18
|
}
|
|
19
|
-
.qd-service-table--horizontal-bar-static[data-v-
|
|
19
|
+
.qd-service-table--horizontal-bar-static[data-v-c56c6716] .t-table__scrollbar--obvious {
|
|
20
20
|
visibility: hidden;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
}
|
|
23
|
-
.qd-service-table[data-v-
|
|
23
|
+
.qd-service-table[data-v-c56c6716] .t-table__affixed-header-elm-wrap {
|
|
24
24
|
height: auto !important;
|
|
25
25
|
}
|
|
26
|
-
.qd-service-table[data-v-
|
|
26
|
+
.qd-service-table[data-v-c56c6716] .t-table__affixed-header-elm {
|
|
27
27
|
position: relative;
|
|
28
28
|
scrollbar-width: none;
|
|
29
29
|
}
|
|
30
|
-
.qd-service-table[data-v-
|
|
30
|
+
.qd-service-table[data-v-c56c6716] .t-table__affixed-header-elm::-webkit-scrollbar {
|
|
31
31
|
display: none;
|
|
32
32
|
width: 0;
|
|
33
33
|
height: 0;
|
|
34
34
|
}
|
|
35
|
-
.qd-service-table[data-v-
|
|
35
|
+
.qd-service-table[data-v-c56c6716] .t-table__virtual-scroll-cursor + table {
|
|
36
36
|
border-collapse: separate;
|
|
37
37
|
}
|
|
38
|
-
.qd-service-table[data-v-
|
|
38
|
+
.qd-service-table[data-v-c56c6716] .t-table__cell-wrap > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
|
|
39
39
|
width: 100%;
|
|
40
40
|
}
|
|
41
|
-
.qd-service-table
|
|
41
|
+
.qd-service-table[data-v-c56c6716] .qd-service-table__non-editable-col {
|
|
42
|
+
background-color: color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent);
|
|
43
|
+
}
|
|
44
|
+
.qd-service-table--disable-horizontal-scroll[data-v-c56c6716] colgroup > col {
|
|
42
45
|
width: auto !important;
|
|
43
46
|
}
|
|
@@ -2,7 +2,7 @@ import './index.css'
|
|
|
2
2
|
import _sfc_main from "./index.vue2.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
-
const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c56c6716"]]);
|
|
6
6
|
export {
|
|
7
7
|
QdServiceTable as default
|
|
8
8
|
};
|
|
@@ -318,7 +318,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
318
318
|
emit: __emit
|
|
319
319
|
}) {
|
|
320
320
|
useCssVars((_ctx) => ({
|
|
321
|
-
"
|
|
321
|
+
"v05eb2f2a": affixedHeaderTransform.value
|
|
322
322
|
}));
|
|
323
323
|
const props = __props;
|
|
324
324
|
const emit = __emit;
|
|
@@ -934,9 +934,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
934
934
|
const formItem = column.formItem;
|
|
935
935
|
if (!formItem) return false;
|
|
936
936
|
if (formItem.lazy !== void 0) return formItem.lazy;
|
|
937
|
-
if (getQdFormComponentName(formItem.component)
|
|
937
|
+
if (/upload|switch|radio|checkbox/.test(getQdFormComponentName(formItem.component))) {
|
|
938
|
+
return false;
|
|
939
|
+
}
|
|
938
940
|
return props.lazyForm;
|
|
939
941
|
}
|
|
942
|
+
function resolveFormItemIfRender(column, row) {
|
|
943
|
+
const formItem = column.formItem;
|
|
944
|
+
const ifRender = formItem?.ifRender;
|
|
945
|
+
if (!formItem || isEmpty(ifRender)) return true;
|
|
946
|
+
if (typeof ifRender === "function" && ifRender.__qdCompute) {
|
|
947
|
+
return ifRender(row, formItem.crudMode);
|
|
948
|
+
}
|
|
949
|
+
return ifRender !== false;
|
|
950
|
+
}
|
|
940
951
|
function resolveFormItemVirtualRender(column) {
|
|
941
952
|
const formItem = column.formItem;
|
|
942
953
|
if (!formItem) return false;
|
|
@@ -1437,7 +1448,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1437
1448
|
children: wrapFormItemColumns(children)
|
|
1438
1449
|
} : {}
|
|
1439
1450
|
};
|
|
1440
|
-
|
|
1451
|
+
const columnClassName = reColumn.className === void 0 ? [] : Array.isArray(reColumn.className) ? reColumn.className : [reColumn.className];
|
|
1452
|
+
if (!formItem) {
|
|
1453
|
+
if (!children && formItemColumns.value.length) {
|
|
1454
|
+
reColumn.className = [...columnClassName, (context) => context.type === "td" ? "qd-service-table__non-editable-col" : ""];
|
|
1455
|
+
}
|
|
1456
|
+
return reColumn;
|
|
1457
|
+
}
|
|
1441
1458
|
const columnAttrs = column.attrs;
|
|
1442
1459
|
reColumn.attrs = (context) => {
|
|
1443
1460
|
const attrs = typeof columnAttrs === "function" ? columnAttrs(context) : columnAttrs;
|
|
@@ -1454,7 +1471,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1454
1471
|
}
|
|
1455
1472
|
};
|
|
1456
1473
|
};
|
|
1457
|
-
reColumn.className =
|
|
1474
|
+
reColumn.className = [...columnClassName, "qd-service-table__form-item-col", (context) => context.type === "td" && !resolveFormItemIfRender(column, context.row) ? "qd-service-table__non-editable-col" : ""];
|
|
1458
1475
|
const generatedEdit = {
|
|
1459
1476
|
component: QdServiceTableEditCell,
|
|
1460
1477
|
showEditIcon: false,
|
|
@@ -1476,9 +1493,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1476
1493
|
return {
|
|
1477
1494
|
row,
|
|
1478
1495
|
rowValue,
|
|
1496
|
+
colKey: String(colKey),
|
|
1479
1497
|
formItem,
|
|
1480
1498
|
label: column.title,
|
|
1481
|
-
|
|
1499
|
+
sourceRow: props.data?.find((item) => getRowValue(item) === rowValue) ?? data.value.find((item) => getRowValue(item) === rowValue) ?? row,
|
|
1482
1500
|
updateEditedCellValue: context.updateEditedCellValue,
|
|
1483
1501
|
lazy: resolveFormItemLazy(column),
|
|
1484
1502
|
active: !!activeEditingCell.value && isSameEditingCell(activeEditingCell.value, {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function baseSlice(array, start, end) {
|
|
2
|
+
var index = -1, length = array.length;
|
|
3
|
+
if (start < 0) {
|
|
4
|
+
start = -start > length ? 0 : length + start;
|
|
5
|
+
}
|
|
6
|
+
end = end > length ? length : end;
|
|
7
|
+
if (end < 0) {
|
|
8
|
+
end += length;
|
|
9
|
+
}
|
|
10
|
+
length = start > end ? 0 : end - start >>> 0;
|
|
11
|
+
start >>>= 0;
|
|
12
|
+
var result = Array(length);
|
|
13
|
+
while (++index < length) {
|
|
14
|
+
result[index] = array[index + start];
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
baseSlice as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import castPath from "./_castPath.mjs";
|
|
2
|
+
import last from "./last.mjs";
|
|
3
|
+
import parent from "./_parent.mjs";
|
|
4
|
+
import toKey from "./_toKey.mjs";
|
|
5
|
+
function baseUnset(object, path) {
|
|
6
|
+
path = castPath(path, object);
|
|
7
|
+
object = parent(object, path);
|
|
8
|
+
return object == null || delete object[toKey(last(path))];
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
baseUnset as default
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import assignValue from "./_assignValue.mjs";
|
|
2
|
-
import copyObject from "./_copyObject.mjs";
|
|
3
|
-
import createAssigner from "./_createAssigner.mjs";
|
|
4
|
-
import isArrayLike from "./isArrayLike.mjs";
|
|
5
|
-
import isPrototype from "./_isPrototype.mjs";
|
|
6
|
-
import keys from "./keys.mjs";
|
|
7
|
-
var objectProto = Object.prototype;
|
|
8
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
9
|
-
var assign = createAssigner(function(object, source) {
|
|
10
|
-
if (isPrototype(source) || isArrayLike(source)) {
|
|
11
|
-
copyObject(source, keys(source), object);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
for (var key in source) {
|
|
15
|
-
if (hasOwnProperty.call(source, key)) {
|
|
16
|
-
assignValue(object, key, source[key]);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
export {
|
|
21
|
-
assign as default
|
|
22
|
-
};
|