'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../../utils/index.cjs');
require('../../../../hooks/index.cjs');
var dateUtil = require('../utils/dateUtil.cjs');
var index = require('../../../../hooks/use-memo/index.cjs');
var shallowEqual = require('../../../../utils/lang/shallowEqual.cjs');

function useValueTexts(value, { formatList, generateConfig, locale }) {
  const texts = index.useMemo(
    () => {
      if (!value.value)
        return [[""], ""];
      let firstValueText2 = "";
      const fullValueTexts2 = [];
      for (let i = 0; i < formatList.value.length; i += 1) {
        const format = formatList.value[i];
        const formatStr = dateUtil.formatValue(value.value, {
          generateConfig: generateConfig.value,
          locale: locale.value,
          format
        });
        fullValueTexts2.push(formatStr);
        if (i === 0)
          firstValueText2 = formatStr;
      }
      return [fullValueTexts2, firstValueText2];
    },
    [value, formatList],
    (next, prev) => prev[0] !== next[0] || !shallowEqual.shallowEqual(prev[1], next[1])
  );
  const fullValueTexts = vue.computed(() => texts.value[0]);
  const firstValueText = vue.computed(() => texts.value[1]);
  return [fullValueTexts, firstValueText];
}

exports.default = useValueTexts;
//# sourceMappingURL=useValueTexts.cjs.map
