@rulab/adminjs-components 0.0.13 → 0.1.0-alpha.1
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/LICENSE +21 -21
- package/dist/index.cjs +97 -299
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -21
- package/dist/index.d.ts +10 -21
- package/dist/index.js +84 -288
- package/dist/index.js.map +1 -0
- package/package.json +12 -8
- package/src/components/ColorStatus/ColorStatusEdit.tsx +94 -94
- package/src/components/ColorStatus/ColorStatusList.tsx +20 -20
- package/src/components/ColorStatus/ColorStatusShow.tsx +23 -23
- package/src/components/ColorStatus/index.ts +3 -3
- package/src/components/ColorStatus/styles.ts +30 -30
- package/src/components/ColorStatus/types.ts +5 -5
- package/src/components/Editor/Editor.jsx +49 -49
- package/src/components/Editor/EditorList.jsx +22 -22
- package/src/components/Editor/EditorShow.jsx +24 -24
- package/src/components/Editor/config.ts +35 -35
- package/src/components/Editor/index.ts +3 -3
- package/src/components/Editor/styles.ts +151 -151
- package/src/components/{CustomSlug/CustomSlug.tsx → Slug/SlugEdit.tsx} +68 -68
- package/src/components/Slug/SlugFeature.ts +30 -0
- package/src/components/Slug/index.ts +1 -0
- package/src/components/{CustomSlug → Slug}/styles.ts +24 -24
- package/src/components/StringList/SortableList/SortableList.tsx +98 -98
- package/src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx +20 -20
- package/src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx +59 -59
- package/src/components/StringList/SortableList/components/SortableItem/styles.ts +22 -22
- package/src/components/StringList/SortableList/components/SortableItem/types.ts +7 -7
- package/src/components/StringList/SortableList/components/index.ts +2 -2
- package/src/components/StringList/SortableList/index.ts +1 -1
- package/src/components/StringList/SortableList/styles.ts +9 -9
- package/src/components/StringList/StringList.tsx +136 -136
- package/src/components/StringList/StringListShow.tsx +37 -37
- package/src/components/StringList/constants.ts +1 -1
- package/src/components/StringList/index.ts +2 -2
- package/src/components/StringList/styles.ts +41 -41
- package/src/components/index.ts +10 -9
- package/dist/bundle.js +0 -8
- package/dist/components/CustomSlug/CustomSlug.jsx +0 -29
- package/dist/components/CustomSlug/index.js +0 -1
- package/dist/components/CustomSlug/styles.js +0 -15
- package/dist/components/Editor/config.js +0 -11
- package/dist/components/Editor/index.js +0 -1
- package/dist/components/Editor/styles.js +0 -64
- package/dist/components/StringList/SortableList/SortableList.jsx +0 -43
- package/dist/components/StringList/SortableList/components/SortableItem/DragHandle.jsx +0 -10
- package/dist/components/StringList/SortableList/components/SortableItem/SortableItem.jsx +0 -32
- package/dist/components/StringList/SortableList/components/SortableItem/styles.js +0 -20
- package/dist/components/StringList/SortableList/components/SortableItem/types.js +0 -1
- package/dist/components/StringList/SortableList/components/index.js +0 -2
- package/dist/components/StringList/SortableList/index.js +0 -1
- package/dist/components/StringList/SortableList/styles.js +0 -8
- package/dist/components/StringList/StringList.jsx +0 -67
- package/dist/components/StringList/index.js +0 -1
- package/dist/components/StringList/styles.js +0 -16
- package/dist/components/index.js +0 -3
- package/dist/editorFeature.js +0 -16
- package/dist/index.d.mts +0 -8
- package/dist/index.mjs +0 -37
- package/dist/utils/index.js +0 -1
- package/dist/utils/slugifyImport.js +0 -3
- package/dist/utils/slugifyTitle.js +0 -10
- package/src/components/CustomSlug/index.ts +0 -1
- package/src/index.ts +0 -2
- package/src/types.d.ts +0 -3
- package/src/utils/index.ts +0 -3
- package/src/utils/parseHtml.ts +0 -56
- package/src/utils/slugifyImport.ts +0 -4
- package/src/utils/slugifyTitle.ts +0 -11
- package/tsconfig.json +0 -17
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Roman Daud
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Roman Daud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -28,20 +28,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
ColorStatusEdit: () => ColorStatusEdit_default,
|
|
34
34
|
ColorStatusList: () => ColorStatusList_default,
|
|
35
35
|
ColorStatusShow: () => ColorStatusShow_default,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
EditorList: () => EditorList_default,
|
|
39
|
-
EditorShow: () => EditorShow_default,
|
|
36
|
+
SlugEdit: () => SlugEdit_default,
|
|
37
|
+
SlugFeature: () => SlugFeature_default,
|
|
40
38
|
StringList: () => StringList_default,
|
|
41
39
|
StringListShow: () => StringListShow_default,
|
|
42
40
|
parseHtml: () => parseHtml
|
|
43
41
|
});
|
|
44
|
-
module.exports = __toCommonJS(
|
|
42
|
+
module.exports = __toCommonJS(index_exports);
|
|
43
|
+
|
|
44
|
+
// node_modules/.pnpm/tsup@8.3.5_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
|
|
45
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
46
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
45
47
|
|
|
46
48
|
// src/components/ColorStatus/ColorStatusEdit.tsx
|
|
47
49
|
var import_react = __toESM(require("react"), 1);
|
|
@@ -155,7 +157,7 @@ var ColorStatusList = ({ property, record }) => {
|
|
|
155
157
|
};
|
|
156
158
|
var ColorStatusList_default = ColorStatusList;
|
|
157
159
|
|
|
158
|
-
// src/components/
|
|
160
|
+
// src/components/Slug/SlugEdit.tsx
|
|
159
161
|
var import_react4 = __toESM(require("react"), 1);
|
|
160
162
|
var import_styled_components3 = require("styled-components");
|
|
161
163
|
var import_design_system2 = require("@adminjs/design-system");
|
|
@@ -211,7 +213,7 @@ var slugifyTitle = (title) => {
|
|
|
211
213
|
});
|
|
212
214
|
};
|
|
213
215
|
|
|
214
|
-
// src/components/
|
|
216
|
+
// src/components/Slug/styles.ts
|
|
215
217
|
var import_styled_components2 = require("@adminjs/design-system/styled-components");
|
|
216
218
|
var import_design_system = require("@adminjs/design-system");
|
|
217
219
|
var StyledInputWrapper = (0, import_styled_components2.styled)(import_design_system.Box)`
|
|
@@ -231,8 +233,8 @@ var StyledLabel = import_styled_components2.styled.div`
|
|
|
231
233
|
text-transform: capitalize;
|
|
232
234
|
`;
|
|
233
235
|
|
|
234
|
-
// src/components/
|
|
235
|
-
var
|
|
236
|
+
// src/components/Slug/SlugEdit.tsx
|
|
237
|
+
var SlugEdit = ({
|
|
236
238
|
property,
|
|
237
239
|
record,
|
|
238
240
|
resource,
|
|
@@ -262,301 +264,64 @@ var CustomSlug = ({
|
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
};
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
// src/components/Editor/Editor.jsx
|
|
268
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
269
|
-
var import_styled_components5 = require("styled-components");
|
|
270
|
-
var import_editorjs = __toESM(require("@editorjs/editorjs"), 1);
|
|
271
|
-
var import_design_system4 = require("@adminjs/design-system");
|
|
272
|
-
|
|
273
|
-
// src/components/Editor/styles.ts
|
|
274
|
-
var import_design_system3 = require("@adminjs/design-system");
|
|
275
|
-
var import_styled_components4 = require("@adminjs/design-system/styled-components");
|
|
276
|
-
var StyledLabel2 = import_styled_components4.styled.div`
|
|
277
|
-
font-size: 12px;
|
|
278
|
-
margin-bottom: 8px;
|
|
279
|
-
text-transform: capitalize;
|
|
280
|
-
`;
|
|
281
|
-
var StyledShowLabel = (0, import_styled_components4.styled)(StyledLabel2)`
|
|
282
|
-
color: rgb(137, 138, 154);
|
|
283
|
-
font-weight: 300;
|
|
284
|
-
`;
|
|
285
|
-
var StyledEditorWrapper = (0, import_styled_components4.styled)(import_design_system3.Box)`
|
|
286
|
-
padding: 12px;
|
|
287
|
-
margin-bottom: 24px;
|
|
288
|
-
border: 1px solid rgb(187, 195, 203);
|
|
289
|
-
`;
|
|
290
|
-
var StyledEditorViewWrapper = (0, import_styled_components4.styled)(import_design_system3.Box)`
|
|
291
|
-
h1,
|
|
292
|
-
h2,
|
|
293
|
-
h3 {
|
|
294
|
-
margin-bottom: 5px;
|
|
295
|
-
font-weight: bold;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
h1 {
|
|
299
|
-
font-size: 18px;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
h2 {
|
|
303
|
-
font-size: 16px;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
h3 {
|
|
307
|
-
font-size: 14px;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
p {
|
|
311
|
-
margin-bottom: 8px;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
ol,
|
|
315
|
-
ul {
|
|
316
|
-
margin-left: 20px;
|
|
317
|
-
margin-bottom: 8px;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
ol {
|
|
321
|
-
list-style: auto;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
ul {
|
|
325
|
-
list-style: inherit;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
table,
|
|
329
|
-
audio {
|
|
330
|
-
margin: 16px 0;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
table,
|
|
334
|
-
th,
|
|
335
|
-
td {
|
|
336
|
-
border: 1px solid;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
th {
|
|
340
|
-
font-weight: bold;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
th,
|
|
344
|
-
td {
|
|
345
|
-
padding: 4px;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
blockquote {
|
|
349
|
-
display: block;
|
|
350
|
-
padding: 5px 8px;
|
|
351
|
-
width: fit-content;
|
|
352
|
-
border-radius: 4px;
|
|
353
|
-
background-color: #e6e6e6;
|
|
354
|
-
}
|
|
355
|
-
`;
|
|
356
|
-
var StyledEditorShowWrapper = (0, import_styled_components4.styled)(StyledEditorViewWrapper)`
|
|
357
|
-
margin-bottom: 24px;
|
|
358
|
-
`;
|
|
359
|
-
var StyledEditor = import_styled_components4.styled.div`
|
|
360
|
-
audio,
|
|
361
|
-
.cdx-block,
|
|
362
|
-
.ce-header {
|
|
363
|
-
padding-left: 58px;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
input {
|
|
367
|
-
margin-left: 58px;
|
|
368
|
-
width: auto;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
.cdx-list {
|
|
372
|
-
padding-left: 85px;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
.ce-block__content {
|
|
376
|
-
width: 100%;
|
|
377
|
-
max-width: none;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
.ce-toolbar__content {
|
|
381
|
-
max-width: none;
|
|
382
|
-
left: 0;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.ce-toolbar__actions {
|
|
386
|
-
left: 0;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
h1.ce-header {
|
|
390
|
-
font-size: 22px;
|
|
391
|
-
font-weight: bold;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
h2.ce-header {
|
|
395
|
-
font-size: 20px;
|
|
396
|
-
font-weight: bold;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
h3.ce-header {
|
|
400
|
-
font-size: 18px;
|
|
401
|
-
font-weight: bold;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
h4.ce-header {
|
|
405
|
-
font-size: 16px;
|
|
406
|
-
font-weight: bold;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
h5.ce-header {
|
|
410
|
-
font-size: 15px;
|
|
411
|
-
font-weight: bold;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
h6.ce-header {
|
|
415
|
-
font-size: 14px;
|
|
416
|
-
font-weight: bold;
|
|
417
|
-
}
|
|
418
|
-
`;
|
|
419
|
-
|
|
420
|
-
// src/components/Editor/config.ts
|
|
421
|
-
var import_header = __toESM(require("@editorjs/header"), 1);
|
|
422
|
-
var import_list = __toESM(require("@editorjs/list"), 1);
|
|
423
|
-
var import_paragraph = __toESM(require("@editorjs/paragraph"), 1);
|
|
424
|
-
var import_quote = __toESM(require("@editorjs/quote"), 1);
|
|
425
|
-
var import_table = __toESM(require("@editorjs/table"), 1);
|
|
426
|
-
var import_editorjs_audio_player = __toESM(require("editorjs-audio-player"), 1);
|
|
427
|
-
var EDITOR_TOOLS = {
|
|
428
|
-
paragraph: {
|
|
429
|
-
class: import_paragraph.default,
|
|
430
|
-
inlineToolbar: true
|
|
431
|
-
},
|
|
432
|
-
list: {
|
|
433
|
-
class: import_list.default,
|
|
434
|
-
inlineToolbar: true
|
|
435
|
-
},
|
|
436
|
-
header: {
|
|
437
|
-
class: import_header.default,
|
|
438
|
-
config: {
|
|
439
|
-
placeholder: "Enter a header",
|
|
440
|
-
levels: [2, 3, 4],
|
|
441
|
-
defaultLevel: 2
|
|
442
|
-
}
|
|
443
|
-
},
|
|
444
|
-
table: {
|
|
445
|
-
class: import_table.default,
|
|
446
|
-
inlineToolbar: true
|
|
447
|
-
},
|
|
448
|
-
quote: {
|
|
449
|
-
class: import_quote.default,
|
|
450
|
-
inlineToolbar: true
|
|
451
|
-
},
|
|
452
|
-
audioPlayer: import_editorjs_audio_player.default
|
|
453
|
-
};
|
|
267
|
+
var SlugEdit_default = SlugEdit;
|
|
454
268
|
|
|
455
|
-
// src/components/
|
|
456
|
-
var Editor = ({ property, record, onChangeAdmin, editorId }) => {
|
|
457
|
-
const [jsonData, setJsonData] = (0, import_react5.useState)();
|
|
458
|
-
const isSavedData = Boolean(record.params[property.path]);
|
|
459
|
-
const ref = (0, import_react5.useRef)();
|
|
460
|
-
(0, import_react5.useEffect)(() => {
|
|
461
|
-
onChangeAdmin(property.path, jsonData);
|
|
462
|
-
}, [jsonData]);
|
|
463
|
-
(0, import_react5.useEffect)(() => {
|
|
464
|
-
if (!ref.current) {
|
|
465
|
-
const editor = new import_editorjs.default({
|
|
466
|
-
holder: editorId,
|
|
467
|
-
tools: EDITOR_TOOLS,
|
|
468
|
-
data: isSavedData ? JSON.parse(record.params[property.path]) : "",
|
|
469
|
-
async onChange(api, event) {
|
|
470
|
-
const data = await api.saver.save();
|
|
471
|
-
setJsonData(JSON.stringify(data));
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
ref.current = editor;
|
|
475
|
-
}
|
|
476
|
-
return () => {
|
|
477
|
-
ref?.current?.destroy?.();
|
|
478
|
-
};
|
|
479
|
-
}, []);
|
|
480
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_styled_components5.ThemeProvider, { theme: import_design_system4.theme }, /* @__PURE__ */ import_react5.default.createElement(StyledLabel2, null, property.path), /* @__PURE__ */ import_react5.default.createElement(StyledEditorWrapper, null, /* @__PURE__ */ import_react5.default.createElement(StyledEditor, { id: editorId })));
|
|
481
|
-
};
|
|
482
|
-
var Editor_default = Editor;
|
|
483
|
-
|
|
484
|
-
// src/components/Editor/EditorList.jsx
|
|
485
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
269
|
+
// src/components/StringList/StringList.tsx
|
|
486
270
|
var import_design_system5 = require("@adminjs/design-system");
|
|
487
|
-
var
|
|
488
|
-
var EditorList = ({ property, record }) => {
|
|
489
|
-
const htmlContent = parseHtml(record.params[property.path]);
|
|
490
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_styled_components6.ThemeProvider, { theme: import_design_system5.theme }, /* @__PURE__ */ import_react6.default.createElement(StyledEditorViewWrapper, null, htmlContent && /* @__PURE__ */ import_react6.default.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
|
|
491
|
-
};
|
|
492
|
-
var EditorList_default = EditorList;
|
|
493
|
-
|
|
494
|
-
// src/components/Editor/EditorShow.jsx
|
|
495
|
-
var import_react7 = __toESM(require("react"), 1);
|
|
271
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
496
272
|
var import_styled_components7 = require("styled-components");
|
|
497
|
-
var import_design_system6 = require("@adminjs/design-system");
|
|
498
|
-
var EditorShow = ({ property, record }) => {
|
|
499
|
-
const htmlContent = parseHtml(record.params[property.path]);
|
|
500
|
-
return /* @__PURE__ */ import_react7.default.createElement(import_styled_components7.ThemeProvider, { theme: import_design_system6.theme }, /* @__PURE__ */ import_react7.default.createElement(StyledEditorShowWrapper, null, /* @__PURE__ */ import_react7.default.createElement(StyledShowLabel, null, property.path), htmlContent && /* @__PURE__ */ import_react7.default.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
|
|
501
|
-
};
|
|
502
|
-
var EditorShow_default = EditorShow;
|
|
503
|
-
|
|
504
|
-
// src/components/StringList/StringList.tsx
|
|
505
|
-
var import_design_system9 = require("@adminjs/design-system");
|
|
506
|
-
var import_react11 = __toESM(require("react"), 1);
|
|
507
|
-
var import_styled_components11 = require("styled-components");
|
|
508
273
|
|
|
509
274
|
// src/components/StringList/styles.ts
|
|
510
|
-
var
|
|
511
|
-
var
|
|
512
|
-
var StyledWrapper = (0,
|
|
275
|
+
var import_design_system3 = require("@adminjs/design-system");
|
|
276
|
+
var import_styled_components4 = require("@adminjs/design-system/styled-components");
|
|
277
|
+
var StyledWrapper = (0, import_styled_components4.styled)(import_design_system3.Box)`
|
|
513
278
|
display: flex;
|
|
514
279
|
flex-direction: column;
|
|
515
280
|
margin-bottom: 45px;
|
|
516
281
|
`;
|
|
517
|
-
var StyledCustomInput2 = (0,
|
|
282
|
+
var StyledCustomInput2 = (0, import_styled_components4.styled)(import_design_system3.Input)`
|
|
518
283
|
width: 100%;
|
|
519
284
|
margin-right: 10px;
|
|
520
285
|
`;
|
|
521
|
-
var StyledInputWrapper2 = (0,
|
|
286
|
+
var StyledInputWrapper2 = (0, import_styled_components4.styled)(import_design_system3.Box)`
|
|
522
287
|
display: flex;
|
|
523
288
|
`;
|
|
524
|
-
var StyledListWrapper = (0,
|
|
289
|
+
var StyledListWrapper = (0, import_styled_components4.styled)(import_design_system3.Box)`
|
|
525
290
|
margin-bottom: 15px;
|
|
526
291
|
`;
|
|
527
|
-
var
|
|
292
|
+
var StyledLabel2 = import_styled_components4.styled.div`
|
|
528
293
|
font-size: 12px;
|
|
529
294
|
margin-bottom: 8px;
|
|
530
295
|
text-transform: capitalize;
|
|
531
296
|
`;
|
|
532
|
-
var
|
|
297
|
+
var StyledShowLabel = (0, import_styled_components4.styled)(StyledLabel2)`
|
|
533
298
|
line-height: 16px;
|
|
534
299
|
color: rgb(137, 138, 154);
|
|
535
300
|
font-weight: 300;
|
|
536
301
|
`;
|
|
537
|
-
var StyledShowWrapper = (0,
|
|
302
|
+
var StyledShowWrapper = (0, import_styled_components4.styled)(import_design_system3.Box)`
|
|
538
303
|
margin-bottom: 35px;
|
|
539
304
|
`;
|
|
540
|
-
var StyledListItem =
|
|
305
|
+
var StyledListItem = import_styled_components4.styled.li`
|
|
541
306
|
margin-bottom: 5px;
|
|
542
307
|
`;
|
|
543
308
|
|
|
544
309
|
// src/components/StringList/SortableList/SortableList.tsx
|
|
545
|
-
var
|
|
310
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
546
311
|
var import_core = require("@dnd-kit/core");
|
|
547
312
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
548
313
|
|
|
549
314
|
// src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx
|
|
550
|
-
var
|
|
315
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
551
316
|
var import_sortable = require("@dnd-kit/sortable");
|
|
552
|
-
var
|
|
317
|
+
var import_design_system4 = require("@adminjs/design-system");
|
|
553
318
|
|
|
554
319
|
// src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx
|
|
555
|
-
var
|
|
320
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
556
321
|
|
|
557
322
|
// src/components/StringList/SortableList/components/SortableItem/styles.ts
|
|
558
|
-
var
|
|
559
|
-
var StyledListItem2 =
|
|
323
|
+
var import_styled_components5 = require("@adminjs/design-system/styled-components");
|
|
324
|
+
var StyledListItem2 = import_styled_components5.styled.li`
|
|
560
325
|
display: flex;
|
|
561
326
|
justify-content: space-between;
|
|
562
327
|
align-items: center;
|
|
@@ -568,7 +333,7 @@ var StyledListItem2 = import_styled_components9.styled.li`
|
|
|
568
333
|
border-radius: 5px;
|
|
569
334
|
list-style: none;
|
|
570
335
|
`;
|
|
571
|
-
var StyledDragButton =
|
|
336
|
+
var StyledDragButton = import_styled_components5.styled.button`
|
|
572
337
|
padding: 3px;
|
|
573
338
|
margin-right: 15px;
|
|
574
339
|
cursor: move;
|
|
@@ -578,12 +343,12 @@ var StyledDragButton = import_styled_components9.styled.button`
|
|
|
578
343
|
|
|
579
344
|
// src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx
|
|
580
345
|
var DragHandle = ({ context }) => {
|
|
581
|
-
const { attributes, listeners, ref } = (0,
|
|
582
|
-
return /* @__PURE__ */
|
|
346
|
+
const { attributes, listeners, ref } = (0, import_react5.useContext)(context);
|
|
347
|
+
return /* @__PURE__ */ import_react5.default.createElement(StyledDragButton, { ...attributes, ...listeners, ref }, /* @__PURE__ */ import_react5.default.createElement("svg", { viewBox: "0 0 20 20", width: "13" }, /* @__PURE__ */ import_react5.default.createElement("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" })));
|
|
583
348
|
};
|
|
584
349
|
|
|
585
350
|
// src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx
|
|
586
|
-
var SortableItemContext = (0,
|
|
351
|
+
var SortableItemContext = (0, import_react6.createContext)({
|
|
587
352
|
attributes: {},
|
|
588
353
|
listeners: void 0,
|
|
589
354
|
ref() {
|
|
@@ -595,7 +360,7 @@ function SortableItem({
|
|
|
595
360
|
onDelete
|
|
596
361
|
}) {
|
|
597
362
|
const { attributes, isDragging, listeners, setNodeRef, setActivatorNodeRef } = (0, import_sortable.useSortable)({ id });
|
|
598
|
-
const context = (0,
|
|
363
|
+
const context = (0, import_react6.useMemo)(
|
|
599
364
|
() => ({
|
|
600
365
|
attributes,
|
|
601
366
|
listeners,
|
|
@@ -606,21 +371,21 @@ function SortableItem({
|
|
|
606
371
|
const style = {
|
|
607
372
|
opacity: isDragging ? 0.4 : void 0
|
|
608
373
|
};
|
|
609
|
-
return /* @__PURE__ */
|
|
610
|
-
|
|
374
|
+
return /* @__PURE__ */ import_react6.default.createElement(SortableItemContext.Provider, { value: context }, /* @__PURE__ */ import_react6.default.createElement(StyledListItem2, { ref: setNodeRef, style }, /* @__PURE__ */ import_react6.default.createElement("div", null, /* @__PURE__ */ import_react6.default.createElement(DragHandle, { context: SortableItemContext }), children), /* @__PURE__ */ import_react6.default.createElement(
|
|
375
|
+
import_design_system4.Button,
|
|
611
376
|
{
|
|
612
377
|
variant: "outlined",
|
|
613
378
|
color: "danger",
|
|
614
379
|
size: "icon",
|
|
615
380
|
onClick: (e) => onDelete(e, id)
|
|
616
381
|
},
|
|
617
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ import_react6.default.createElement(import_design_system4.Icon, { icon: "X", color: "red" })
|
|
618
383
|
)));
|
|
619
384
|
}
|
|
620
385
|
|
|
621
386
|
// src/components/StringList/SortableList/styles.ts
|
|
622
|
-
var
|
|
623
|
-
var StyledListWrapper2 =
|
|
387
|
+
var import_styled_components6 = require("@adminjs/design-system/styled-components");
|
|
388
|
+
var StyledListWrapper2 = import_styled_components6.styled.ul`
|
|
624
389
|
display: flex;
|
|
625
390
|
flex-direction: column;
|
|
626
391
|
gap: 12px;
|
|
@@ -643,8 +408,8 @@ function SortableList({
|
|
|
643
408
|
onChange,
|
|
644
409
|
renderItem
|
|
645
410
|
}) {
|
|
646
|
-
const [active, setActive] = (0,
|
|
647
|
-
const activeItem = (0,
|
|
411
|
+
const [active, setActive] = (0, import_react7.useState)(null);
|
|
412
|
+
const activeItem = (0, import_react7.useMemo)(
|
|
648
413
|
() => items.find((item) => item.id === active?.id),
|
|
649
414
|
[active, items]
|
|
650
415
|
);
|
|
@@ -654,7 +419,7 @@ function SortableList({
|
|
|
654
419
|
coordinateGetter: import_sortable2.sortableKeyboardCoordinates
|
|
655
420
|
})
|
|
656
421
|
);
|
|
657
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
658
423
|
import_core.DndContext,
|
|
659
424
|
{
|
|
660
425
|
sensors,
|
|
@@ -673,8 +438,8 @@ function SortableList({
|
|
|
673
438
|
setActive(null);
|
|
674
439
|
}
|
|
675
440
|
},
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ import_react7.default.createElement(import_sortable2.SortableContext, { items, strategy: import_sortable2.verticalListSortingStrategy }, /* @__PURE__ */ import_react7.default.createElement(StyledListWrapper2, { role: "application" }, items.map((item, index) => /* @__PURE__ */ import_react7.default.createElement(import_react7.Fragment, { key: index }, renderItem(item))))),
|
|
442
|
+
/* @__PURE__ */ import_react7.default.createElement(import_core.DragOverlay, { dropAnimation: dropAnimationConfig }, activeItem ? renderItem(activeItem) : null)
|
|
678
443
|
);
|
|
679
444
|
}
|
|
680
445
|
SortableList.Item = SortableItem;
|
|
@@ -691,28 +456,28 @@ var StringList = ({
|
|
|
691
456
|
}) => {
|
|
692
457
|
const stringListValue = record.params?.[property.path] ?? property.props.value ?? "";
|
|
693
458
|
const initialList = stringListValue ? prepareDataForList(stringListValue) : [];
|
|
694
|
-
const [inputValue, setInputValue] = (0,
|
|
695
|
-
const [list, setList] = (0,
|
|
459
|
+
const [inputValue, setInputValue] = (0, import_react8.useState)("");
|
|
460
|
+
const [list, setList] = (0, import_react8.useState)(initialList);
|
|
696
461
|
const serializedData = prepareDataForDatabase(list);
|
|
697
|
-
(0,
|
|
462
|
+
(0, import_react8.useEffect)(() => {
|
|
698
463
|
onChange(property.path, serializedData);
|
|
699
464
|
}, [serializedData]);
|
|
700
|
-
return /* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_styled_components7.ThemeProvider, { theme: import_design_system5.theme }, /* @__PURE__ */ import_react8.default.createElement(StyledLabel2, { htmlFor: "custom" }, property.path), /* @__PURE__ */ import_react8.default.createElement(StyledWrapper, null, /* @__PURE__ */ import_react8.default.createElement(StyledListWrapper, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
701
466
|
SortableList,
|
|
702
467
|
{
|
|
703
468
|
items: list,
|
|
704
469
|
onChange: setList,
|
|
705
|
-
renderItem: (item) => /* @__PURE__ */
|
|
470
|
+
renderItem: (item) => /* @__PURE__ */ import_react8.default.createElement(SortableList.Item, { id: item.id, onDelete: handleDeleteButton }, item.value)
|
|
706
471
|
}
|
|
707
|
-
)), /* @__PURE__ */
|
|
708
|
-
|
|
472
|
+
)), /* @__PURE__ */ import_react8.default.createElement(StyledInputWrapper2, null, /* @__PURE__ */ import_react8.default.createElement(
|
|
473
|
+
import_design_system5.Input,
|
|
709
474
|
{
|
|
710
475
|
id: "stringList",
|
|
711
476
|
name: property.path,
|
|
712
477
|
value: serializedData,
|
|
713
478
|
hidden: true
|
|
714
479
|
}
|
|
715
|
-
), /* @__PURE__ */
|
|
480
|
+
), /* @__PURE__ */ import_react8.default.createElement(
|
|
716
481
|
StyledCustomInput2,
|
|
717
482
|
{
|
|
718
483
|
id: "custom",
|
|
@@ -721,7 +486,7 @@ var StringList = ({
|
|
|
721
486
|
onChange: handleInput,
|
|
722
487
|
onKeyPress: handleEnterPress
|
|
723
488
|
}
|
|
724
|
-
), /* @__PURE__ */
|
|
489
|
+
), /* @__PURE__ */ import_react8.default.createElement(import_design_system5.Button, { variant: "outlined", onClick: handleAddButton }, "Add"))));
|
|
725
490
|
function handleInput(e) {
|
|
726
491
|
setInputValue(e.target.value);
|
|
727
492
|
}
|
|
@@ -758,27 +523,60 @@ var StringList = ({
|
|
|
758
523
|
var StringList_default = StringList;
|
|
759
524
|
|
|
760
525
|
// src/components/StringList/StringListShow.tsx
|
|
761
|
-
var
|
|
762
|
-
var
|
|
763
|
-
var
|
|
526
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
527
|
+
var import_styled_components8 = require("styled-components");
|
|
528
|
+
var import_design_system6 = require("@adminjs/design-system");
|
|
764
529
|
var StringListShow = ({
|
|
765
530
|
property,
|
|
766
531
|
record,
|
|
767
532
|
stringListSeparator = separator
|
|
768
533
|
}) => {
|
|
769
|
-
return /* @__PURE__ */
|
|
534
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_styled_components8.ThemeProvider, { theme: import_design_system6.theme }, /* @__PURE__ */ import_react9.default.createElement(StyledShowWrapper, null, /* @__PURE__ */ import_react9.default.createElement(StyledShowLabel, null, property.path), record.params.facts && /* @__PURE__ */ import_react9.default.createElement("ul", null, record.params.facts.split(stringListSeparator).map((item, index) => /* @__PURE__ */ import_react9.default.createElement(StyledListItem, { key: index }, `- ${item}`)))));
|
|
770
535
|
};
|
|
771
536
|
var StringListShow_default = StringListShow;
|
|
537
|
+
|
|
538
|
+
// src/components/Slug/SlugFeature.ts
|
|
539
|
+
var import_adminjs = require("adminjs");
|
|
540
|
+
|
|
541
|
+
// src/utils/bundle-component.ts
|
|
542
|
+
var import_path = __toESM(require("path"), 1);
|
|
543
|
+
var url = __toESM(require("url"), 1);
|
|
544
|
+
var dirname = url.fileURLToPath(new URL(".", importMetaUrl));
|
|
545
|
+
var bundleComponent = (loader, componentName, componentFile) => {
|
|
546
|
+
const componentPath = import_path.default.join(dirname, "../src/components", componentName, componentFile);
|
|
547
|
+
console.log("[bundleComponent] Registering:", componentPath);
|
|
548
|
+
return loader.add(componentName, componentPath);
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/components/Slug/SlugFeature.ts
|
|
552
|
+
var COMPONENT_NAME = "Slug";
|
|
553
|
+
var SlugFeature = (config) => {
|
|
554
|
+
const { componentLoader, key } = config;
|
|
555
|
+
const uploadFeature = () => {
|
|
556
|
+
const editComponent = bundleComponent(componentLoader, COMPONENT_NAME, "SlugEdit.tsx");
|
|
557
|
+
return (0, import_adminjs.buildFeature)({
|
|
558
|
+
properties: {
|
|
559
|
+
[key]: {
|
|
560
|
+
isVisible: { show: false, edit: true, list: false, filter: false },
|
|
561
|
+
components: {
|
|
562
|
+
edit: editComponent
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
return uploadFeature();
|
|
569
|
+
};
|
|
570
|
+
var SlugFeature_default = SlugFeature;
|
|
772
571
|
// Annotate the CommonJS export names for ESM import in node:
|
|
773
572
|
0 && (module.exports = {
|
|
774
573
|
ColorStatusEdit,
|
|
775
574
|
ColorStatusList,
|
|
776
575
|
ColorStatusShow,
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
EditorList,
|
|
780
|
-
EditorShow,
|
|
576
|
+
SlugEdit,
|
|
577
|
+
SlugFeature,
|
|
781
578
|
StringList,
|
|
782
579
|
StringListShow,
|
|
783
580
|
parseHtml
|
|
784
581
|
});
|
|
582
|
+
//# sourceMappingURL=index.cjs.map
|