@rulab/adminjs-components 0.0.13 → 0.1.0-alpha.10

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.
Files changed (180) hide show
  1. package/LICENSE +21 -21
  2. package/dist/components/ColorStatus/ColorStatusEdit.d.ts +5 -0
  3. package/dist/components/ColorStatus/ColorStatusEdit.js +58 -0
  4. package/dist/components/ColorStatus/ColorStatusList.d.ts +4 -0
  5. package/dist/components/ColorStatus/ColorStatusList.js +7 -0
  6. package/dist/components/ColorStatus/ColorStatusShow.d.ts +4 -0
  7. package/dist/components/ColorStatus/ColorStatusShow.js +9 -0
  8. package/dist/components/ColorStatus/index.d.ts +3 -0
  9. package/dist/components/ColorStatus/index.js +3 -0
  10. package/dist/components/ColorStatus/styles.d.ts +5 -0
  11. package/dist/components/ColorStatus/styles.js +25 -0
  12. package/dist/components/ColorStatus/types.d.ts +5 -0
  13. package/dist/components/ColorStatus/types.js +1 -0
  14. package/dist/components/Editor/Editor.d.ts +11 -0
  15. package/dist/components/Editor/Editor.js +33 -0
  16. package/dist/components/Editor/EditorList.d.ts +9 -0
  17. package/dist/components/Editor/EditorList.js +10 -0
  18. package/dist/components/Editor/EditorShow.d.ts +9 -0
  19. package/dist/components/Editor/EditorShow.js +10 -0
  20. package/dist/components/Editor/config.d.ts +29 -0
  21. package/dist/components/Editor/config.js +26 -3
  22. package/dist/components/Editor/index.d.ts +3 -0
  23. package/dist/components/Editor/index.js +3 -1
  24. package/dist/components/Editor/styles.d.ts +6 -0
  25. package/dist/components/Editor/styles.js +140 -59
  26. package/dist/components/Slug/SlugEdit.d.ts +5 -0
  27. package/dist/components/Slug/SlugEdit.js +27 -0
  28. package/dist/components/Slug/SlugFeature.d.ts +7 -0
  29. package/dist/components/Slug/SlugFeature.js +21 -0
  30. package/dist/components/Slug/index.d.ts +1 -0
  31. package/dist/components/Slug/index.js +1 -0
  32. package/dist/components/Slug/styles.d.ts +4 -0
  33. package/dist/components/{CustomSlug → Slug}/styles.js +14 -9
  34. package/dist/components/StringList/SortableList/SortableList.d.ts +18 -0
  35. package/dist/components/StringList/SortableList/{SortableList.jsx → SortableList.js} +13 -19
  36. package/dist/components/StringList/SortableList/components/SortableItem/DragHandle.d.ts +7 -0
  37. package/dist/components/StringList/SortableList/components/SortableItem/DragHandle.js +8 -0
  38. package/dist/components/StringList/SortableList/components/SortableItem/SortableItem.d.ts +8 -0
  39. package/dist/components/StringList/SortableList/components/SortableItem/{SortableItem.jsx → SortableItem.js} +7 -11
  40. package/dist/components/StringList/SortableList/components/SortableItem/styles.d.ts +2 -0
  41. package/dist/components/StringList/SortableList/components/SortableItem/styles.js +18 -18
  42. package/dist/components/StringList/SortableList/components/SortableItem/types.d.ts +6 -0
  43. package/dist/components/StringList/SortableList/components/index.d.ts +2 -0
  44. package/dist/components/StringList/SortableList/index.d.ts +1 -0
  45. package/dist/components/StringList/SortableList/styles.d.ts +1 -0
  46. package/dist/components/StringList/SortableList/styles.js +6 -6
  47. package/dist/components/StringList/StringList.d.ts +8 -0
  48. package/dist/components/StringList/StringList.js +60 -0
  49. package/dist/components/StringList/StringListShow.d.ts +7 -0
  50. package/dist/components/StringList/StringListShow.js +14 -0
  51. package/dist/components/StringList/constants.d.ts +1 -0
  52. package/dist/components/StringList/constants.js +1 -0
  53. package/dist/components/StringList/index.d.ts +2 -0
  54. package/dist/components/StringList/index.js +2 -1
  55. package/dist/components/StringList/styles.d.ts +8 -0
  56. package/dist/components/StringList/styles.js +28 -11
  57. package/dist/components/index.d.ts +7 -0
  58. package/dist/components/index.js +9 -2
  59. package/dist/index.d.ts +2 -44
  60. package/dist/index.js +2 -757
  61. package/dist/scripts/fix-import-extensions.d.ts +1 -0
  62. package/dist/scripts/fix-import-extensions.js +39 -0
  63. package/dist/utils/bundle-component.d.ts +2 -0
  64. package/dist/utils/bundle-component.js +8 -0
  65. package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -1
  66. package/dist/utils/index.js +1 -0
  67. package/dist/utils/parseHtml.d.ts +1 -0
  68. package/dist/utils/parseHtml.js +37 -0
  69. package/dist/utils/slugifyImport.d.ts +3 -0
  70. package/dist/utils/slugifyImport.js +1 -1
  71. package/dist/utils/slugifyTitle.d.ts +1 -0
  72. package/dist/utils/slugifyTitle.js +3 -3
  73. package/package.json +14 -8
  74. package/src/components/ColorStatus/ColorStatusEdit.d.ts +5 -0
  75. package/src/components/ColorStatus/ColorStatusEdit.js +58 -0
  76. package/src/components/ColorStatus/ColorStatusEdit.tsx +94 -94
  77. package/src/components/ColorStatus/ColorStatusList.d.ts +4 -0
  78. package/src/components/ColorStatus/ColorStatusList.js +7 -0
  79. package/src/components/ColorStatus/ColorStatusList.tsx +20 -20
  80. package/src/components/ColorStatus/ColorStatusShow.d.ts +4 -0
  81. package/src/components/ColorStatus/ColorStatusShow.js +9 -0
  82. package/src/components/ColorStatus/ColorStatusShow.tsx +23 -23
  83. package/src/components/ColorStatus/index.d.ts +3 -0
  84. package/src/components/ColorStatus/index.js +3 -0
  85. package/src/components/ColorStatus/index.ts +3 -3
  86. package/src/components/ColorStatus/styles.d.ts +5 -0
  87. package/src/components/ColorStatus/styles.js +25 -0
  88. package/src/components/ColorStatus/styles.ts +30 -30
  89. package/src/components/ColorStatus/types.d.ts +5 -0
  90. package/src/components/ColorStatus/types.js +1 -0
  91. package/src/components/ColorStatus/types.ts +5 -5
  92. package/src/components/Editor/Editor.d.ts +8 -0
  93. package/src/components/Editor/Editor.js +36 -0
  94. package/src/components/Editor/Editor.jsx +49 -49
  95. package/src/components/Editor/EditorList.d.ts +6 -0
  96. package/src/components/Editor/EditorList.js +11 -0
  97. package/src/components/Editor/EditorList.jsx +22 -22
  98. package/src/components/Editor/EditorShow.d.ts +6 -0
  99. package/src/components/Editor/EditorShow.js +13 -0
  100. package/src/components/Editor/EditorShow.jsx +24 -24
  101. package/src/components/Editor/config.d.ts +29 -0
  102. package/src/components/Editor/config.js +34 -0
  103. package/src/components/Editor/config.ts +35 -35
  104. package/src/components/Editor/index.d.ts +3 -0
  105. package/src/components/Editor/index.js +3 -0
  106. package/src/components/Editor/index.ts +3 -3
  107. package/src/components/Editor/styles.d.ts +6 -0
  108. package/src/components/Editor/styles.js +145 -0
  109. package/src/components/Editor/styles.ts +151 -151
  110. package/src/components/Slug/SlugEdit.d.ts +5 -0
  111. package/src/components/Slug/SlugEdit.js +27 -0
  112. package/src/components/{CustomSlug/CustomSlug.tsx → Slug/SlugEdit.tsx} +68 -68
  113. package/src/components/Slug/SlugFeature.d.ts +7 -0
  114. package/src/components/Slug/SlugFeature.js +21 -0
  115. package/src/components/Slug/SlugFeature.ts +30 -0
  116. package/src/components/Slug/index.d.ts +1 -0
  117. package/src/components/Slug/index.js +1 -0
  118. package/src/components/Slug/index.ts +1 -0
  119. package/src/components/Slug/styles.d.ts +4 -0
  120. package/src/components/Slug/styles.js +20 -0
  121. package/src/components/{CustomSlug → Slug}/styles.ts +24 -24
  122. package/src/components/StringList/SortableList/SortableList.d.ts +18 -0
  123. package/src/components/StringList/SortableList/SortableList.js +37 -0
  124. package/src/components/StringList/SortableList/SortableList.tsx +98 -98
  125. package/src/components/StringList/SortableList/components/SortableItem/DragHandle.d.ts +7 -0
  126. package/src/components/StringList/SortableList/components/SortableItem/DragHandle.js +8 -0
  127. package/src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx +20 -20
  128. package/src/components/StringList/SortableList/components/SortableItem/SortableItem.d.ts +8 -0
  129. package/src/components/StringList/SortableList/components/SortableItem/SortableItem.js +28 -0
  130. package/src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx +59 -59
  131. package/src/components/StringList/SortableList/components/SortableItem/styles.d.ts +2 -0
  132. package/src/components/StringList/SortableList/components/SortableItem/styles.js +20 -0
  133. package/src/components/StringList/SortableList/components/SortableItem/styles.ts +22 -22
  134. package/src/components/StringList/SortableList/components/SortableItem/types.d.ts +6 -0
  135. package/src/components/StringList/SortableList/components/SortableItem/types.js +1 -0
  136. package/src/components/StringList/SortableList/components/SortableItem/types.ts +7 -7
  137. package/src/components/StringList/SortableList/components/index.d.ts +2 -0
  138. package/src/components/StringList/SortableList/components/index.js +2 -0
  139. package/src/components/StringList/SortableList/components/index.ts +2 -2
  140. package/src/components/StringList/SortableList/index.d.ts +1 -0
  141. package/src/components/StringList/SortableList/index.js +1 -0
  142. package/src/components/StringList/SortableList/index.ts +1 -1
  143. package/src/components/StringList/SortableList/styles.d.ts +1 -0
  144. package/src/components/StringList/SortableList/styles.js +8 -0
  145. package/src/components/StringList/SortableList/styles.ts +9 -9
  146. package/src/components/StringList/StringList.d.ts +8 -0
  147. package/src/components/StringList/StringList.js +60 -0
  148. package/src/components/StringList/StringList.tsx +136 -136
  149. package/src/components/StringList/StringListShow.d.ts +7 -0
  150. package/src/components/StringList/StringListShow.js +14 -0
  151. package/src/components/StringList/StringListShow.tsx +37 -37
  152. package/src/components/StringList/constants.d.ts +1 -0
  153. package/src/components/StringList/constants.js +1 -0
  154. package/src/components/StringList/constants.ts +1 -1
  155. package/src/components/StringList/index.d.ts +2 -0
  156. package/src/components/StringList/index.js +2 -0
  157. package/src/components/StringList/index.ts +2 -2
  158. package/src/components/StringList/styles.d.ts +8 -0
  159. package/src/components/StringList/styles.js +33 -0
  160. package/src/components/StringList/styles.ts +41 -41
  161. package/src/components/index.d.ts +7 -0
  162. package/src/components/index.js +10 -0
  163. package/src/components/index.ts +10 -9
  164. package/dist/bundle.js +0 -8
  165. package/dist/components/CustomSlug/CustomSlug.jsx +0 -29
  166. package/dist/components/CustomSlug/index.js +0 -1
  167. package/dist/components/StringList/SortableList/components/SortableItem/DragHandle.jsx +0 -10
  168. package/dist/components/StringList/StringList.jsx +0 -67
  169. package/dist/editorFeature.js +0 -16
  170. package/dist/index.cjs +0 -784
  171. package/dist/index.d.cts +0 -44
  172. package/dist/index.d.mts +0 -8
  173. package/dist/index.mjs +0 -37
  174. package/src/components/CustomSlug/index.ts +0 -1
  175. package/src/index.ts +0 -2
  176. package/src/types.d.ts +0 -3
  177. package/src/utils/parseHtml.ts +0 -56
  178. package/src/utils/slugifyImport.ts +0 -4
  179. package/src/utils/slugifyTitle.ts +0 -11
  180. package/tsconfig.json +0 -17
package/dist/index.d.cts DELETED
@@ -1,44 +0,0 @@
1
- import React, { FC } from 'react';
2
- import { EditPropertyProps, ShowPropertyProps } from 'adminjs';
3
-
4
- type ColorStatusTypes = Omit<EditPropertyProps, "where" | "resource">;
5
- declare const ColorStatus: FC<ColorStatusTypes>;
6
-
7
- declare const ColorStatusShow: FC<ShowPropertyProps>;
8
-
9
- declare const ColorStatusList: FC<ShowPropertyProps>;
10
-
11
- type CustomSlugTypes = Omit<EditPropertyProps, "where">;
12
- declare const CustomSlug: FC<CustomSlugTypes>;
13
-
14
- declare function Editor({ property, record, onChangeAdmin, editorId }: {
15
- property: any;
16
- record: any;
17
- onChangeAdmin: any;
18
- editorId: any;
19
- }): React.JSX.Element;
20
-
21
- declare function EditorList({ property, record }: {
22
- property: any;
23
- record: any;
24
- }): React.JSX.Element;
25
-
26
- declare function EditorShow({ property, record }: {
27
- property: any;
28
- record: any;
29
- }): React.JSX.Element;
30
-
31
- type StringListTypes = Omit<EditPropertyProps, "where" | "resource">;
32
- interface StringListShowPropsType$1 extends StringListTypes {
33
- stringListSeparator?: string;
34
- }
35
- declare const StringList: FC<StringListShowPropsType$1>;
36
-
37
- interface StringListShowPropsType extends ShowPropertyProps {
38
- stringListSeparator?: string;
39
- }
40
- declare const StringListShow: FC<StringListShowPropsType>;
41
-
42
- declare const parseHtml: (jsonData: string) => string | undefined;
43
-
44
- export { ColorStatus as ColorStatusEdit, ColorStatusList, ColorStatusShow, CustomSlug, Editor, EditorList, EditorShow, StringList, StringListShow, parseHtml };
package/dist/index.d.mts DELETED
@@ -1,8 +0,0 @@
1
- import { FeatureType, ComponentLoader } from 'adminjs';
2
-
3
- type EditorOptions = {
4
- componentLoader: ComponentLoader;
5
- };
6
- declare const editorFeature: (options: EditorOptions) => FeatureType;
7
-
8
- export { editorFeature as default, editorFeature };
package/dist/index.mjs DELETED
@@ -1,37 +0,0 @@
1
- // src/features/editorFeature.ts
2
- import {
3
- buildFeature
4
- } from "adminjs";
5
-
6
- // src/bundle.ts
7
- import path from "path";
8
- import * as url from "url";
9
- var __dirname = url.fileURLToPath(new URL(".", import.meta.url));
10
- var bundle = (loader, componentName) => {
11
- const componentPath = path.join(__dirname, `./components/${componentName}`);
12
- return loader.add(componentName, componentPath);
13
- };
14
- var bundle_default = bundle;
15
-
16
- // src/features/editorFeature.ts
17
- var editorFeature = (options) => {
18
- const { componentLoader } = options;
19
- const editComponent = bundle_default(componentLoader, "Editor");
20
- return buildFeature({
21
- properties: {
22
- editor: {
23
- components: {
24
- edit: editComponent
25
- }
26
- }
27
- }
28
- });
29
- };
30
- var editorFeature_default = editorFeature;
31
-
32
- // src/index.ts
33
- var src_default = editorFeature_default;
34
- export {
35
- src_default as default,
36
- editorFeature_default as editorFeature
37
- };
@@ -1 +0,0 @@
1
- export { default } from "./CustomSlug.js";
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./components/index.js";
2
- export { parseHtml } from "./utils/parseHtml.js";
package/src/types.d.ts DELETED
@@ -1,3 +0,0 @@
1
- declare module "@editorjs/header";
2
- declare module "@editorjs/paragraph";
3
- declare module "@editorjs/list";
@@ -1,56 +0,0 @@
1
- import edjsHTML from "editorjs-html";
2
-
3
- type TableBlockType = {
4
- type: "table";
5
- data: {
6
- content: string[][];
7
- withHeadings: boolean;
8
- };
9
- };
10
-
11
- type AudioPlayerBlockType = {
12
- type: "audioPlayer";
13
- data: {
14
- src: string;
15
- };
16
- };
17
-
18
- const tableParser = (block: TableBlockType) => {
19
- const rows = block.data.content.map((row, index) => {
20
- const tableHtml = [];
21
- if (block.data.withHeadings && index === 0) {
22
- tableHtml.push(`<tr>${row.map((cell) => `<th>${cell}</th>`)}</tr>`);
23
- } else {
24
- tableHtml.push(`<tr>${row.map((cell) => `<td>${cell}</td>`)}</tr>`);
25
- }
26
-
27
- return tableHtml;
28
- });
29
-
30
- if (block.data.withHeadings) {
31
- const heading = rows[0] as string[];
32
- const [, ...content] = rows;
33
-
34
- return `<table><thead>${heading.join("")}</thead><tbody>${content.join("")}</tbody></table>`;
35
- } else {
36
- return `<table><tbody>${rows.join("")}</tbody></table>`;
37
- }
38
- };
39
-
40
- const audioPlayerParser = (block: AudioPlayerBlockType) => {
41
- return `<audio controls src={${block.data.src}} />`;
42
- };
43
-
44
- export const parseHtml = (jsonData: string) => {
45
- const edjsParser = edjsHTML({
46
- table: tableParser,
47
- audioPlayer: audioPlayerParser,
48
- });
49
-
50
- try {
51
- const data = edjsParser.parse(JSON.parse(jsonData));
52
- return String(data).replace(/>,</g, "><");
53
- } catch (e) {
54
- console.log("error", e);
55
- }
56
- };
@@ -1,4 +0,0 @@
1
- // This is a fix of typescript module import error
2
- import slugify from "slugify";
3
-
4
- export default slugify as unknown as typeof slugify.default;
@@ -1,11 +0,0 @@
1
- import slugify from "./slugifyImport.js";
2
-
3
- export const slugifyTitle = (title: string) => {
4
- return slugify(title, {
5
- replacement: "-",
6
- remove: /[*+~.()'"!:@]/g,
7
- lower: true,
8
- locale: "vi",
9
- trim: true,
10
- });
11
- };
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "esModuleInterop": true,
4
- "skipLibCheck": true,
5
- "target": "es2022",
6
- "allowJs": true,
7
- "resolveJsonModule": true,
8
- "moduleDetection": "force",
9
- "strict": true,
10
- "noUncheckedIndexedAccess": true,
11
- "moduleResolution": "Bundler",
12
- "module": "ESNext",
13
- "lib": ["es2022", "dom", "dom.iterable"],
14
- "jsx": "react",
15
- "noEmit": true
16
- }
17
- }