quasar-ui-danx 0.4.23 → 0.4.26
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/dist/danx.es.js +825 -822
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +32 -32
- package/dist/danx.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/Form/Fields/SingleFileField.vue +14 -16
- package/src/helpers/formats.ts +5 -2
package/package.json
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
@drop.prevent="onDrop"
|
7
7
|
>
|
8
8
|
<FieldLabel
|
9
|
-
|
9
|
+
v-if="label || (name || showName)"
|
10
|
+
:label="label"
|
11
|
+
:name="name"
|
10
12
|
:show-name="showName"
|
11
13
|
class="text-sm font-semibold"
|
12
14
|
/>
|
@@ -35,7 +37,7 @@
|
|
35
37
|
v-if="!readonly || uploadedFile"
|
36
38
|
class="w-32 cursor-pointer mt-2"
|
37
39
|
:class="{'border border-dashed border-blue-600': !uploadedFile, 'mx-auto': !readonly}"
|
38
|
-
:file="uploadedFile"
|
40
|
+
:file="uploadedFile || undefined"
|
39
41
|
downloadable
|
40
42
|
@click="!disable && $refs.file.click()"
|
41
43
|
/>
|
@@ -48,26 +50,22 @@
|
|
48
50
|
</div>
|
49
51
|
</template>
|
50
52
|
|
51
|
-
<script setup>
|
53
|
+
<script setup lang="ts">
|
52
54
|
import { onMounted } from "vue";
|
53
55
|
import { useSingleFileUpload } from "../../../../helpers";
|
56
|
+
import { UploadedFile } from "../../../../types";
|
54
57
|
import { FilePreview } from "../../../Utility";
|
55
58
|
import FieldLabel from "./FieldLabel";
|
56
59
|
|
57
60
|
const emit = defineEmits(["update:model-value"]);
|
58
|
-
const props = defineProps
|
59
|
-
modelValue
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
},
|
67
|
-
showName: Boolean,
|
68
|
-
disable: Boolean,
|
69
|
-
readonly: Boolean
|
70
|
-
});
|
61
|
+
const props = defineProps<{
|
62
|
+
modelValue?: UploadedFile;
|
63
|
+
label?: string;
|
64
|
+
name?: string;
|
65
|
+
showName?: boolean;
|
66
|
+
disable?: boolean;
|
67
|
+
readonly?: boolean;
|
68
|
+
}>();
|
71
69
|
const { onComplete, onDrop, onFileSelected, uploadedFile, clearUploadedFile } = useSingleFileUpload();
|
72
70
|
onComplete(() => emit("update:model-value", uploadedFile.value));
|
73
71
|
|
package/src/helpers/formats.ts
CHANGED
@@ -376,7 +376,7 @@ export function parseMarkdownYAML(string: string): object | null | false {
|
|
376
376
|
* Parse a markdown formatted string and return the code block content
|
377
377
|
*/
|
378
378
|
export function parseMarkdownCode(string: string): string {
|
379
|
-
return string.replace(/^```[a-z0-9]{
|
379
|
+
return string.replace(/^```[a-z0-9]{0,6}\s/, "").replace(/```$/, "");
|
380
380
|
}
|
381
381
|
|
382
382
|
/**
|
@@ -384,6 +384,7 @@ export function parseMarkdownCode(string: string): string {
|
|
384
384
|
* ie: a valid JSON string with a ```json prefix and ``` postfix
|
385
385
|
*/
|
386
386
|
export function fMarkdownCode(type: string, string: string | object): string {
|
387
|
+
console.log("formatting", type, string);
|
387
388
|
if (typeof string === "object" || isJSON(string)) {
|
388
389
|
switch (type) {
|
389
390
|
case "yaml":
|
@@ -396,7 +397,9 @@ export function fMarkdownCode(type: string, string: string | object): string {
|
|
396
397
|
}
|
397
398
|
|
398
399
|
const regex = new RegExp(`\`\`\`${type}`, "g");
|
399
|
-
|
400
|
+
string = (string || "") as string;
|
401
|
+
if (!string.match(regex)) {
|
402
|
+
string = parseMarkdownCode(string as string);
|
400
403
|
return `\`\`\`${type}\n${string}\n\`\`\``;
|
401
404
|
}
|
402
405
|
|