@nextcloud/vue
Version:
Nextcloud vue components
131 lines (130 loc) • 3.5 kB
JavaScript
require('../assets/NcSettingsInputText-Bsp_6DjJ.css');
;
const _l10n = require("./_l10n-CjO_W5Dt.cjs");
const GenRandomId = require("./GenRandomId-BQDud3d4.cjs");
const useModelMigration = require("./useModelMigration-D5zhrNXr.cjs");
const _pluginVue2_normalizer = require("./_plugin-vue2_normalizer-V0q-tHlQ.cjs");
_l10n.register(_l10n.t45);
const _sfc_main = {
name: "NcSettingsInputText",
model: {
prop: "value",
event: "update:value"
},
props: {
/**
* label of the select group element
*/
label: {
type: String,
required: true
},
/**
* hint of the select group input
*/
hint: {
type: String,
default: ""
},
/**
* Removed in v9 - use `modelValue` (`v-model`) instead
* @deprecated
*/
value: {
type: String,
default: void 0
},
/**
* value of the select group input
*/
modelValue: {
type: String,
default: ""
},
/**
* disabled state of the settings select group input
*/
disabled: {
type: Boolean,
default: false
},
/**
* id attribute of the select group element
*/
id: {
type: String,
default: () => "settings-input-text-" + GenRandomId.GenRandomId(),
validator: (id) => id.trim() !== ""
}
},
emits: [
/**
* Removed in v9 - use `update:modelValue` (`v-model`) instead
* @deprecated
*/
"update:value",
/**
* Emitted when the inputs value changes
*
* @type {string}
*/
"update:modelValue",
/* Same as update:modelValue for Vue 2 compatibility */
"update:model-value",
"input",
"submit",
"change"
],
setup() {
const model = useModelMigration.useModelMigration("value", "update:value");
return {
model
};
},
data() {
return {
submitTranslated: _l10n.t("Submit")
};
},
computed: {
/**
* @return {string}
*/
idSubmit() {
return this.id + "-submit";
}
},
methods: {
onInput(event) {
this.$emit("input", event);
this.model = event.target.value;
},
onSubmit(event) {
if (!this.disabled) {
this.$emit("submit", event);
}
},
onChange(event) {
this.$emit("change", event);
}
}
};
var _sfc_render = function render() {
var _vm = this, _c = _vm._self._c;
return _c("form", { ref: "form", attrs: { "disabled": _vm.disabled }, on: { "submit": function($event) {
$event.preventDefault();
$event.stopPropagation();
return _vm.onSubmit.apply(null, arguments);
} } }, [_c("div", { staticClass: "input-wrapper" }, [_c("label", { staticClass: "action-input__label", attrs: { "for": _vm.id } }, [_vm._v(_vm._s(_vm.label))]), _c("input", { attrs: { "id": _vm.id, "type": "text", "disabled": _vm.disabled }, domProps: { "value": _vm.model }, on: { "input": _vm.onInput, "change": _vm.onChange } }), _c("input", { staticClass: "action-input__submit", attrs: { "id": _vm.idSubmit, "type": "submit" }, domProps: { "value": _vm.submitTranslated } }), _vm.hint ? _c("p", { staticClass: "hint" }, [_vm._v(" " + _vm._s(_vm.hint) + " ")]) : _vm._e()])]);
};
var _sfc_staticRenderFns = [];
var __component__ = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns,
false,
null,
"0907eb0a"
);
const NcSettingsInputText = __component__.exports;
exports.NcSettingsInputText = NcSettingsInputText;