plain-design 1.0.0-beta.81 → 1.0.0-beta.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.81",
3
+ "version": "1.0.0-beta.83",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -34,7 +34,7 @@
34
34
  "color": "4.2.3",
35
35
  "dayjs": "1.11.10",
36
36
  "plain-icons": "0.0.7",
37
- "plain-utils": "^0.1.62",
37
+ "plain-utils": "^0.1.63",
38
38
  "react-flip-move": "3.0.5",
39
39
  "react-transition-group": "4.4.5"
40
40
  },
@@ -147,7 +147,7 @@ export const SearchList = designComponent({
147
147
  return (
148
148
  <div className="search-service-option-item-default" data-service-item-type={item.type}>
149
149
  {item.type == 'group' ? (
150
- <div className="search-service-option-item-default-title">{item.title}</div>
150
+ <div className="search-service-option-item-default-title">{i18n.$intl(item.title || '').d(item.title || '')}</div>
151
151
  ) : (
152
152
  <div className="search-service-option-item-default-box" onClick={() => methods.selectItem(item)}>
153
153
  {isLastSubHeader != null && SearchTreeIcon[isLastSubHeader ? 'last' : 'normal']()}
@@ -0,0 +1,46 @@
1
+ import {designComponent, getComponentCls, PropType, useClasses} from "plain-design-composition";
2
+ import './paragraph.scss';
3
+ import {ParagraphItem} from "../ParagraphItem";
4
+ import {i18n} from "../i18n";
5
+
6
+ export const Paragraph = designComponent({
7
+ name: 'paragraph',
8
+ props: {
9
+ order: { type: Boolean },
10
+ list: { type: [String, Array] as PropType<string | string[]> },
11
+ },
12
+ slots: ['default'],
13
+ setup({ props, slots }) {
14
+
15
+ const classes = useClasses(() => [
16
+ getComponentCls('paragraph')
17
+ ]);
18
+
19
+ return () => {
20
+ const Type = props.order ? 'ol' : 'ul';
21
+ return (
22
+ <Type className={classes.value}>
23
+ {slots.default()}
24
+ {!!props.list?.length && (() => {
25
+ let arr: string[] = [];
26
+ if (typeof props.list === "string") {
27
+ const i18nResult = i18n.$intl(props.list).d(props.list);
28
+ if (Array.isArray(i18nResult)) {
29
+ arr.push(...i18nResult);
30
+ } else {
31
+ arr.push(i18nResult);
32
+ }
33
+ } else {
34
+ arr.push(...props.list);
35
+ }
36
+ return arr.map((item, index) => (
37
+ <ParagraphItem key={index}>{item}</ParagraphItem>
38
+ ));
39
+ })()}
40
+ </Type>
41
+ );
42
+ };
43
+ },
44
+ });
45
+
46
+ export default Paragraph;
@@ -0,0 +1,12 @@
1
+ @include comp(paragraph) {
2
+
3
+ margin: 0;
4
+ padding-inline-start: 2em;
5
+
6
+ @include comp(paragraph-item) {
7
+
8
+ & + .#{componentName(paragraph-item)} {
9
+ margin-top: 1em;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,20 @@
1
+ import {designComponent, getComponentCls, useClasses} from "plain-design-composition";
2
+
3
+ export const ParagraphItem = designComponent({
4
+ props: {},
5
+ slots: ['default'],
6
+ setup({ props, slots }) {
7
+
8
+ const classes = useClasses(() => [
9
+ getComponentCls('paragraph-item')
10
+ ]);
11
+
12
+ return () => (
13
+ <li className={classes.value}>
14
+ {slots.default()}
15
+ </li>
16
+ );
17
+ },
18
+ });
19
+
20
+ export default ParagraphItem
@@ -121,6 +121,8 @@ export {PageCard} from './components/PageCard';
121
121
  export {PageCardTitle} from './components/PageCardTitle';
122
122
  export {PageCardContent} from './components/PageCardContent';
123
123
  export {RollingNumber} from './components/RollingNumber';
124
+ export {Paragraph} from './components/Paragraph';
125
+ export {ParagraphItem} from './components/ParagraphItem';
124
126
 
125
127
  export {VirtualTable} from './components/VirtualTable';
126
128
  export {Table} from './components/Table';