Typography.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
  2. import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
  3. import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
  4. var _excluded = ["prefixCls", "class", "direction", "component"];
  5. import { createVNode as _createVNode } from "vue";
  6. import { defineComponent } from 'vue';
  7. import useConfigInject from '../_util/hooks/useConfigInject';
  8. import classNames from '../_util/classNames';
  9. export var typographyProps = function typographyProps() {
  10. return {
  11. prefixCls: String,
  12. direction: String,
  13. // Form Internal use
  14. component: String
  15. };
  16. };
  17. var Typography = defineComponent({
  18. name: 'ATypography',
  19. inheritAttrs: false,
  20. props: typographyProps(),
  21. setup: function setup(props, _ref) {
  22. var slots = _ref.slots,
  23. attrs = _ref.attrs;
  24. var _useConfigInject = useConfigInject('typography', props),
  25. prefixCls = _useConfigInject.prefixCls,
  26. direction = _useConfigInject.direction;
  27. return function () {
  28. var _slots$default;
  29. var _props$attrs = _objectSpread(_objectSpread({}, props), attrs),
  30. _prefixCls = _props$attrs.prefixCls,
  31. _className = _props$attrs.class,
  32. _direction = _props$attrs.direction,
  33. _props$attrs$componen = _props$attrs.component,
  34. Component = _props$attrs$componen === void 0 ? 'article' : _props$attrs$componen,
  35. restProps = _objectWithoutProperties(_props$attrs, _excluded);
  36. return _createVNode(Component, _objectSpread({
  37. "class": classNames(prefixCls.value, _defineProperty({}, "".concat(prefixCls.value, "-rtl"), direction.value === 'rtl'), attrs.class)
  38. }, restProps), {
  39. default: function _default() {
  40. return [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
  41. }
  42. });
  43. };
  44. }
  45. });
  46. export default Typography;