@vrx-arco/pro-components
Version:
<p align="center"> <img src="https://vrx-arco.github.io/arco-design-pro/favicon.svg" width="200" height="250"> </p>
97 lines (96 loc) • 3.58 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vue = require("vue");
const props = require("../FormGrid/props.js");
const context = require("./context.js");
const FormGridItem = require("../FormGrid/FormGridItem.js");
const SearchBarItem = /* @__PURE__ */ vue.defineComponent({
name: "vrx-arco-search-bar-item",
props: __spreadProps(__spreadValues({}, props.formGridItemProps()), {
gridProps: Object,
/**
* 对 `search-bar` autoUpdate 属性进行覆盖,或指定 v-model:arg arg的值
*/
autoUpdate: [Boolean, String]
}),
setup: (props2, {
slots
}) => {
const {
gridProps,
model,
autoUpdate: pAutoUpdate
} = context.injectSearchBar();
return () => {
const _a = props2, {
autoUpdate
} = _a, otherProps = __objRest(_a, [
"autoUpdate"
]);
const renderDefaultSlot = () => {
var _a2;
const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
const {
field
} = props2;
const isAutoUpdate = autoUpdate || pAutoUpdate.value;
const firstDefaultSlotProps = defaultSlot == null ? void 0 : defaultSlot[0];
if (!firstDefaultSlotProps) {
return defaultSlot;
}
if (isAutoUpdate && field) {
firstDefaultSlotProps.props || (firstDefaultSlotProps.props = {});
firstDefaultSlotProps.dynamicProps || (firstDefaultSlotProps.dynamicProps = []);
const modelKey = autoUpdate === true || !autoUpdate ? "modelValue" : autoUpdate;
firstDefaultSlotProps.dynamicProps.push(modelKey);
firstDefaultSlotProps.patchFlag = 1 << 3;
firstDefaultSlotProps.props[modelKey] = model.value[field];
firstDefaultSlotProps.props[`onUpdate:${modelKey}`] = (value) => {
model.value[field] = value;
};
}
return defaultSlot;
};
return vue.createVNode(FormGridItem.FormGridItem, vue.mergeProps(otherProps, {
"gridProps": otherProps.gridProps || gridProps.value
}), {
default: () => [renderDefaultSlot()],
label: slots.label,
help: slots.help,
extra: slots.extra
});
};
}
});
exports.SearchBarItem = SearchBarItem;