"use strict";
((typeof self !== 'undefined' ? self : this)["webpackChunklib"] = (typeof self !== 'undefined' ? self : this)["webpackChunklib"] || []).push([[992],{

/***/ 1462:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7658);
/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _utils_eventbus__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6587);
/* harmony import */ var _utils_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7623);
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3288);
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(ramda__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8180);





const baseMixin = {
  data() {
    return {
      updateValue: 0,
      widgetId: "widget-" + Math.random().toString(15).slice(2, 15)
    };
  },
  mixins: [_utils_common__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z],
  props: {
    field: {
      type: Object,
      default: () => ({})
    },
    schema: {
      type: Object,
      default: () => ({})
    },
    values: {
      type: Object,
      default: () => ({})
    },
    colors: {
      type: Object,
      default: () => ({})
    },
    fieldErrors: {
      type: Object,
      default: () => ({})
    },
    hideFields: {
      type: Object,
      default: () => ({})
    },
    isDark: {
      type: Boolean,
      default: false
    },
    form: {
      type: Object,
      default: () => ({})
    }
  },
  inject: ["formId", "dependencies", "regExpFields", "isDeepValues", "flatFields", "context"],
  computed: {
    value: {
      get() {
        this.updateValue++; // 强制更新
        let friendValue = {
          value: this.isDeepValues ? this.deepPick(this.field.name.split("."), this.values) : this.friendValue()
        };
        return friendValue.value;
      },
      set(value) {
        let emitValue = this.beforeChange(value);
        this.changeValue(emitValue);
      }
    }
  },
  created() {
    this.load();
  },
  methods: {
    actionEmit(type, arg) {
      if (arg) {
        let msg = {
          type,
          arg
        };
        _utils_eventbus__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.$emit(`${this.formId}:action`, msg);
      }
    },
    load() {
      this.setFieldAttr();
      this.pickHideFields();
      this.pickDependencies();
      this.pickRegExp();
      this.loadCompleteDispatch();
      this.pickFlatField();
    },
    pickFlatField() {
      if (!this.field.name) return;
      this.flatFields[this.field.name] = this.field;
    },
    loadCompleteDispatch() {
      // 隐藏字段需要立马派发，不然视觉体验不友好
      for (let key in this.hideFields) this.dispatchHide(key);
      // 等所有字段都渲染完成在派发options依赖
      if (this.context.loadDebounce) clearTimeout(this.context.loadDebounce);
      this.context.loadDebounce = setTimeout(() => {
        for (let key in this.dependencies) this.dispatchOptions(key);
        this.context.loadCompleted = true;
      }, 500);
    },
    setFieldAttr() {
      const defaultFieldAttr = this.defaultFieldAttr();
      let fieldAttr = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.mergeDeepRight)(defaultFieldAttr, this.field);
      for (const [key, value] of Object.entries(fieldAttr)) this.field[key] = value;
    },
    defaultFieldAttr() {
      return {};
    },
    beforeChange(value) {
      return this.schema.type == "number" ? parseFloat(value) ? parseFloat(value) : value : value;
    },
    changeValue(value) {
      this.updateValue++;
      this.$emit('changeValue', this.field.name, this.schema, value, this.field);
    },
    friendValue() {
      // 做一些友好值处理
      let friendValue = null;
      let value = this.values[this.field.name];
      try {
        switch (this.schema.type) {
          case "array":
            friendValue = Array.isArray(value) ? value : (0,_utils__WEBPACK_IMPORTED_MODULE_4__/* .strToObj */ .Vq)(value);
            break;
          case "number":
            friendValue = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(value) == "Number" ? value : parseFloat(value);
            break;
          case "datetime":
            friendValue = new Date(value);
            break;
          case "boolean":
            friendValue = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(value) == "Boolean" ? value : value ? Boolean(value) : false;
            break;
          case "integer":
            friendValue = (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(value) == "Number" ? value : value ? parseInt(value) : value;
            break;
        }
        if (friendValue) this.values[this.field.name] = friendValue; // 有友好值，需要更新
      } catch (e) {
        console.error(`转换友好值错了：${e}`);
      }
      return friendValue || value;
    },
    // 字段依赖隐藏
    pickHideFields() {
      const hideRely = this.field.hideRely;
      if (!hideRely) return; // 若不存在依赖，则无需收集
      const hideFields = Array.isArray(hideRely) ? hideRely : (0,ramda__WEBPACK_IMPORTED_MODULE_3__.type)(hideRely) == "String" ? [hideRely] : [];
      hideFields.map(hideItem => {
        let splitHideExp = hideItem.split("==");
        if (splitHideExp.length != 2) return;
        let relyKey = splitHideExp[0].trim();
        let relyValue = splitHideExp[1].trim();
        if (!this.hideFields[relyKey]) this.hideFields[relyKey] = [];
        // 必须全部遍历，以应对依赖先后关系
        for (let key in this.hideFields) {
          // 已存在则不需要重新收集
          let hasExit = this.hideFields[key].find(item => {
            if (item.key == relyKey && item.value == relyValue && item.name == this.field.name) {
              // 必须重新赋值，因为form的地址已经变了
              item.field = this.field;
              return true;
            }
          });
          if (hasExit) return;
        }
        this.hideFields[relyKey].push({
          name: this.field.name,
          key: relyKey,
          value: relyValue,
          field: this.field
        });
      });
    },
    // 收集依赖关系
    async pickDependencies() {
      if (!this.field.hasOwnProperty("dict") || this.field.length == 0) return;
      if (typeof this.field.dict == "string" && (0,_utils__WEBPACK_IMPORTED_MODULE_4__/* .isUrl */ .CB)(this.field.dict)) {
        // dict字段是url则直接获取数据，并赋值给options     
        const {
          method,
          respProp,
          params,
          pickValues
        } = this.field.dictConfig;
        pickValues.map(key => {
          if (this.values[key] != undefined) params[key] = this.values[key];
        });
        const response = await (0,_utils__WEBPACK_IMPORTED_MODULE_4__/* .axios */ .od)(this.field.dict, params, method);
        const options = this.deepPick(respProp.split("."), response);
        if (Array.isArray(options) && options.length > 0) this.field.options = options;
        if (this.field.defaultOption >= 0 && this.field.options.length > 0) {
          let option = options[this.field.defaultOption];
          this.values[this.field.name] = typeof option == "object" ? option[this.field.defaultProp.value] : option;
        }
      } else if (Object.keys(this.field.dict).length > 0) {
        for (let key in this.field.dict) {
          let dictItem = this.field.dict[key];
          let dictKeyVal = key.split("==");
          let relyKey = dictKeyVal[0].trim();
          let relyValue = dictKeyVal[1].trim();
          // 赋值初始值
          if (!this.dependencies[relyKey]) this.dependencies[relyKey] = [];
          // 已存在就无需重复添加
          let hasExit = this.dependencies[relyKey].find(item => {
            if (item.keyValue == relyValue && item.name == this.field.name) {
              // 必须重新赋值，因为form的地址已经变了
              item.field = this.field;
              return true;
            }
          });
          if (!hasExit) {
            this.dependencies[relyKey].push({
              name: this.field.name,
              beRelyKey: relyKey,
              keyValue: relyValue,
              dictValue: dictItem,
              field: this.field,
              type: this.schema.type,
              options: JSON.parse(JSON.stringify(this.field.options))
            });
          }
        }
      }
    },
    // 收集表达式依赖
    pickRegExp() {
      const regExp = this.field.regExp;
      if (!regExp) return;
      regExp.map(regItem => {
        const {
          relyName
        } = regItem;
        if (!this.regExpFields[relyName]) this.regExpFields[relyName] = [];
        if (this.regExpFields[relyName].find(item => item.childrenName == this.field.name && item.relyName == regItem.relyName)) return; // 确保只收取一个表达式，
        // 正式收集
        this.regExpFields[relyName].push({
          ...regItem,
          childrenName: this.field.name,
          field: this.field
        });
      });
    }
  }
};
/* harmony default export */ __webpack_exports__.Z = (baseMixin);

/***/ }),

/***/ 6992:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": function() { return /* binding */ inputnumber; }
});

// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(748);
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-86.use[2]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[4]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Richform/src/widgets/inputnumber.vue?vue&type=template&id=0464beac&ts=true

const _hoisted_1 = ["id"];
function render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_ElInputNumber = (0,external_vue_.resolveComponent)("ElInputNumber");
  return (0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", {
    class: "inputnumber-widget",
    id: _ctx.widgetId
  }, [(0,external_vue_.createVNode)(_component_ElInputNumber, {
    modelValue: _ctx.value,
    "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.value = $event),
    ref: _ctx.field.name,
    style: {
      "width": "100%"
    },
    disabled: _ctx.field.disabled,
    step: _ctx.field.step,
    min: _ctx.field.min,
    max: _ctx.field.max,
    size: _ctx.field.size,
    "step-strictly": _ctx.field.stepStrictly,
    precision: _ctx.field.precision,
    "controls-position": _ctx.field.controlsPosition
  }, null, 8, ["modelValue", "disabled", "step", "min", "max", "size", "step-strictly", "precision", "controls-position"])], 8, _hoisted_1);
}
;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/inputnumber.vue?vue&type=template&id=0464beac&ts=true

// EXTERNAL MODULE: ./src/components/Richform/src/widgets/baseMixin.ts
var baseMixin = __webpack_require__(1462);
// EXTERNAL MODULE: external "element-plus"
var external_element_plus_ = __webpack_require__(5224);
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-86.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Richform/src/widgets/inputnumber.vue?vue&type=script&lang=ts


/* harmony default export */ var inputnumbervue_type_script_lang_ts = ({
  mixins: [baseMixin/* default */.Z],
  mounted() {
    if (this.value == null) this.value = this.field.initValue;
    if (this.$refs[this.field.name]) {
      this.field.ref = this.$refs[this.field.name];
    }
  },
  components: {
    ElInputNumber: external_element_plus_.ElInputNumber
  },
  methods: {
    defaultFieldAttr() {
      return {
        ref: null,
        disabled: false,
        step: 1,
        min: 0,
        max: 10000,
        initValue: 0,
        stepStrictly: false,
        precision: undefined,
        controlsPosition: "",
        size: "default"
      };
    }
  }
});
;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/inputnumber.vue?vue&type=script&lang=ts
 
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-67.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-67.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-67.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-67.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/Richform/src/widgets/inputnumber.vue?vue&type=style&index=0&id=0464beac&lang=scss
// extracted by mini-css-extract-plugin

;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/inputnumber.vue?vue&type=style&index=0&id=0464beac&lang=scss

// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
var exportHelper = __webpack_require__(3744);
;// CONCATENATED MODULE: ./src/components/Richform/src/widgets/inputnumber.vue




;


const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(inputnumbervue_type_script_lang_ts, [['render',render]])

/* harmony default export */ var inputnumber = (__exports__);

/***/ })

}]);