How to use the xe-utils.get function in xe-utils

To help you get started, we’ve selected a few xe-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xuliangzhan / vxe-table / packages / table / src / table.js View on Github external
this.visibleColumn.forEach(column => {
        if (column.property && !XEUtils.has(recordItem, column.property)) {
          XEUtils.set(recordItem, column.property, null)
        }
        // 如果设置了 Key 就必须要唯一,可以自行设置;如果为空,则默认生成一个随机数
        if (rowKey && !XEUtils.get(recordItem, rowKey)) {
          XEUtils.set(recordItem, rowKey, ++rowUniqueId + Date.now())
        }
      })
      return recordItem
github xuliangzhan / vxe-table / src / plugins / element.js View on Github external
render: function (h, editRender, params) {
        var $table = params.$table
        var row = params.row
        var column = params.column
        var props = editRender.props || {}
        var optionProps = props.optionProps || {}
        var labelProp = optionProps.label || 'label'
        var valueProp = optionProps.value || 'value'
        if ($table.size) {
          props = XEUtils.assign({ size: $table.size }, props)
        }
        return [
          h('el-select', {
            props,
            model: {
              value: XEUtils.get(row, column.property),
              callback (value) {
                XEUtils.set(row, column.property, value)
              }
            }
          }, XEUtils.map(editRender.options, function (item, index) {
            return h('el-option', {
              props: {
                value: item[valueProp],
                label: item[labelProp]
              },
              key: index
            })
          }))
        ]
      },
      formatLabel: Handles.formatSelectLabel
github xuliangzhan / vue-element-extends / packages / editable / src / editable.vue View on Github external
_validCellRules (type, row, column) {
      let property = column.property
      let editRules = this.editRules
      let validPromise = Promise.resolve()
      if (property && !XEUtils.isEmpty(editRules)) {
        let rules = XEUtils.get(editRules, property)
        let value = XEUtils.get(row.data, property)
        if (rules) {
          for (let rIndex = 0; rIndex < rules.length; rIndex++) {
            validPromise = validPromise.then(rest => new Promise((resolve, reject) => {
              let rule = rules[rIndex]
              let isRequired = rule.required === true
              if ((type === 'all' || !rule.trigger || type === rule.trigger) && (isRequired || value || rule.validator)) {
                if (XEUtils.isFunction(rule.validator)) {
                  rule.validator(rule, value, e => {
                    if (XEUtils.isError(e)) {
                      let cusRule = { type: 'custom', message: e.message, rule }
                      return reject(cusRule)
                    }
                    return resolve(rule)
                  }, { rules, row, column })
                } else {
                  let restVal
github xuliangzhan / vxe-table / packages / table / src / table.js View on Github external
              let selectItems = matchObj.items.filter(item => XEUtils.get(item, property))
              return this.triggerCheckRowEvent(evnt, { row: matchObj.parent }, selectItems.length === matchObj.items.length ? true : (selectItems.length || value === -1 ? -1 : false))
github Spdino / vbt-table / src / components / body / body-render.js View on Github external
class={["vbt-body--column", column.id]}
            key={columnKey || columnIndex}
            on={tdOns}
            style={{height:'41px'}}
          >
            <div style="{{" class="{[">
              {column.renderCell({
                row,
                rowIndex,
                column,
                columnIndex,
                fixed: fixedType,
                level: rowLevel,
                isHidden: fixedHiddenColumn
              })}</div>
github xuliangzhan / vxe-table / packages / table / src / table.js View on Github external
hasRowChange (row, prop) {
      let { tableSourceData, treeConfig } = this
      let rowKey = UtilTools.getRowKey(this)
      let oRow
      if (rowKey || treeConfig) {
        let rowId = XEUtils.get(row, rowKey)
        if (treeConfig) {
          let children = treeConfig.children
          let matchObj = XEUtils.findTree(tableSourceData, row => rowId === XEUtils.get(row, rowKey), treeConfig)
          row = Object.assign({}, row, { [children]: null })
          if (matchObj) {
            oRow = Object.assign({}, matchObj.item, { [children]: null })
          }
        } else {
          oRow = tableSourceData.find(row => rowId === XEUtils.get(row, rowKey))
        }
      } else {
        let oRowIndex = this.getRowMapIndex(row)
        oRow = tableSourceData[oRowIndex]
      }
      if (arguments.length > 1) {
        return oRow && !XEUtils.isEqual(XEUtils.get(oRow, prop), XEUtils.get(row, prop))
github xuliangzhan / vxe-table / packages / table / src / table.js View on Github external
rows.forEach(row => {
          let rowIndex = tableFullData.indexOf(row)
          let oRow = tableSourceData[rowIndex]
          if (oRow && row) {
            if (prop) {
              XEUtils.set(row, prop, XEUtils.get(oRow, prop))
            } else {
              XEUtils.destructuring(row, oRow)
            }
          }
        })
        return this.$nextTick()
github xuliangzhan / vxe-table / packages / table / src / table.js View on Github external
validCellRules (type, row, column, cellValue) {
      let { editRules } = this
      let { property } = column
      let errorRules = []
      let validPromise = Promise.resolve()
      if (property &amp;&amp; !XEUtils.isEmpty(editRules)) {
        let rules = XEUtils.get(editRules, property)
        let value = XEUtils.isUndefined(cellValue) ? XEUtils.get(row, property) : cellValue
        if (rules) {
          for (let rIndex = 0; rIndex &lt; rules.length; rIndex++) {
            validPromise = validPromise.then(() =&gt; new Promise(resolve =&gt; {
              let rule = rules[rIndex]
              let isRequired = rule.required === true
              if (type === 'all' || !rule.trigger || type === rule.trigger) {
                if (XEUtils.isFunction(rule.validator)) {
                  rule.validator(rule, value, e =&gt; {
                    if (XEUtils.isError(e)) {
                      let cusRule = { type: 'custom', trigger: rule.trigger, message: e.message, rule }
                      errorRules.push(cusRule)
                    }
                    return resolve()
                  }, { rules, row, column, rowIndex: this.getRowMapIndex(row), columnIndex: this.getColumnMapIndex(column) })
                } else {
                  let len
github xuliangzhan / vue-element-extends / packages / editable / src / tool.js View on Github external
content += columns.map(column => {
          if (column.type === 'index') {
            return `"${column.index ? column.index(rowIndex) : rowIndex + 1}"`
          }
          return `"${XEUtils.get(record, column.property) || ''}"`
        }).join(',') + '\n'
      } else {