dishui 0.0.67 → 0.0.68
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/calendar.js +5 -0
- package/dist/components/Demo/index.js +76 -80
- package/dist/components/Demo/index.js.map +1 -1
- package/dist/components/pro/Calendar/Calendar.js +576 -0
- package/dist/components/pro/Calendar/Calendar.js.map +1 -0
- package/dist/components/pro/Calendar/hooks/useCalendarDrag.js +104 -0
- package/dist/components/pro/Calendar/hooks/useCalendarDrag.js.map +1 -0
- package/dist/components/pro/Calendar/hooks/useCalendarState.js +187 -0
- package/dist/components/pro/Calendar/hooks/useCalendarState.js.map +1 -0
- package/dist/components/pro/Calendar/utils.js +193 -0
- package/dist/components/pro/Calendar/utils.js.map +1 -0
- package/dist/components/pro/Gantt/Gantt.js +868 -0
- package/dist/components/pro/Gantt/Gantt.js.map +1 -0
- package/dist/components/pro/Gantt/hooks/useGanttDrag.js +99 -0
- package/dist/components/pro/Gantt/hooks/useGanttDrag.js.map +1 -0
- package/dist/components/pro/Gantt/hooks/useGanttState.js +95 -0
- package/dist/components/pro/Gantt/hooks/useGanttState.js.map +1 -0
- package/dist/components/pro/Gantt/utils.js +236 -0
- package/dist/components/pro/Gantt/utils.js.map +1 -0
- package/dist/dishui.css +1 -1
- package/dist/gantt.js +5 -0
- package/dist/hooks/useCopyToClipboard.d.ts +2 -1
- package/dist/hooks/useCopyToClipboard.js +17 -9
- package/dist/hooks/useCopyToClipboard.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -1
- package/dist/utils/i18n.js +40 -0
- package/dist/utils/i18n.js.map +1 -1
- package/package.json +12 -1
- package/dist/pages/components/Gantt/index.d.ts +0 -3
- package/dist/pages/components/Gantt/index.en.d.ts +0 -3
- package/dist/pages/components/Gantt/index.zh.d.ts +0 -3
package/dist/calendar.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DEFAULT_COLOR_OPTIONS as e, LABELS_EN as t, LABELS_ZH as n, SLOT_HEIGHT as r, TIME_GRID_HEIGHT as i, TIME_SLOTS as a, addDays as o, clamp as s, formatDate as c, formatTime as l, generateId as u, generateTimeSlots as d, getDaysInMonth as f, getFirstDayOfMonth as p, getHolidayEntry as m, getMonthDates as h, getWeekDates as g, isHoliday as _, isNonWorkingDay as v, isSameDay as y, isToday as b, isWeekend as x, minutesToTime as S, parseDate as C, parseTime as w, timeToMinutes as T, todayStr as E } from "./components/pro/Calendar/utils.js";
|
|
2
|
+
import { useCalendarState as D } from "./components/pro/Calendar/hooks/useCalendarState.js";
|
|
3
|
+
import { useCalendarDrag as O } from "./components/pro/Calendar/hooks/useCalendarDrag.js";
|
|
4
|
+
import k from "./components/pro/Calendar/Calendar.js";
|
|
5
|
+
export { k as Calendar, e as DEFAULT_COLOR_OPTIONS, t as LABELS_EN, n as LABELS_ZH, r as SLOT_HEIGHT, i as TIME_GRID_HEIGHT, a as TIME_SLOTS, o as addDays, s as clamp, c as formatDate, l as formatTime, u as generateId, d as generateTimeSlots, f as getDaysInMonth, p as getFirstDayOfMonth, m as getHolidayEntry, h as getMonthDates, g as getWeekDates, _ as isHoliday, v as isNonWorkingDay, y as isSameDay, b as isToday, x as isWeekend, S as minutesToTime, C as parseDate, w as parseTime, T as timeToMinutes, E as todayStr, O as useCalendarDrag, D as useCalendarState };
|
|
@@ -1,103 +1,99 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Prism as o } from "react-syntax-highlighter";
|
|
7
|
-
import { coldarkDark as s } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
1
|
+
import { useCopyToClipboard as e } from "../../hooks/useCopyToClipboard.js";
|
|
2
|
+
import { useId as t, useState as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { Prism as a } from "react-syntax-highlighter";
|
|
5
|
+
import { coldarkDark as o } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
8
6
|
//#region src/components/Demo/index.tsx
|
|
9
|
-
var
|
|
10
|
-
let { copied: c, copy: l } =
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
className: "
|
|
13
|
-
children: [/* @__PURE__ */ i(
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
var s = ({ children: t, language: n = "jsx" }) => {
|
|
8
|
+
let { copied: s, error: c, copy: l } = e();
|
|
9
|
+
return /* @__PURE__ */ i("div", {
|
|
10
|
+
className: "min-w-0 overflow-hidden rounded-lg border border-base-300",
|
|
11
|
+
children: [/* @__PURE__ */ i("div", {
|
|
12
|
+
className: "flex items-center justify-between gap-3 bg-base-200 px-4 py-2",
|
|
13
|
+
children: [/* @__PURE__ */ r("span", {
|
|
14
|
+
className: "font-mono text-xs opacity-70",
|
|
15
|
+
children: n
|
|
16
|
+
}), /* @__PURE__ */ i("div", {
|
|
17
|
+
className: "flex items-center gap-2",
|
|
18
|
+
children: [/* @__PURE__ */ r("span", {
|
|
19
|
+
role: "status",
|
|
20
|
+
className: "text-xs",
|
|
21
|
+
children: c ? "Copy failed / 复制失败,请手动复制" : s ? "Copied / 已复制" : ""
|
|
22
|
+
}), /* @__PURE__ */ r("button", {
|
|
23
|
+
type: "button",
|
|
24
|
+
className: "btn btn-ghost btn-xs",
|
|
25
|
+
onClick: () => void l(t),
|
|
26
|
+
"aria-label": "Copy source code / 复制源代码",
|
|
27
|
+
children: "Copy / 复制"
|
|
28
|
+
})]
|
|
29
|
+
})]
|
|
30
|
+
}), /* @__PURE__ */ r(a, {
|
|
31
|
+
language: n,
|
|
32
|
+
style: o,
|
|
33
|
+
tabIndex: 0,
|
|
34
|
+
"aria-label": "Source code / 源代码",
|
|
16
35
|
customStyle: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
margin: 0,
|
|
37
|
+
borderRadius: 0,
|
|
38
|
+
fontSize: "0.8125rem",
|
|
39
|
+
lineHeight: 1.7,
|
|
40
|
+
padding: "1rem",
|
|
41
|
+
maxHeight: "32rem",
|
|
42
|
+
overflow: "auto"
|
|
20
43
|
},
|
|
21
44
|
children: t
|
|
22
|
-
}), /* @__PURE__ */ i(e, {
|
|
23
|
-
variant: "ghost",
|
|
24
|
-
size: "xs",
|
|
25
|
-
className: "absolute top-2 right-2",
|
|
26
|
-
onClick: () => l(t),
|
|
27
|
-
children: c ? /* @__PURE__ */ i("svg", {
|
|
28
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
-
className: "h-4 w-4",
|
|
30
|
-
fill: "none",
|
|
31
|
-
viewBox: "0 0 24 24",
|
|
32
|
-
stroke: "currentColor",
|
|
33
|
-
children: /* @__PURE__ */ i("path", {
|
|
34
|
-
strokeLinecap: "round",
|
|
35
|
-
strokeLinejoin: "round",
|
|
36
|
-
strokeWidth: "2",
|
|
37
|
-
d: "M5 13l4 4L19 7"
|
|
38
|
-
})
|
|
39
|
-
}) : /* @__PURE__ */ i("svg", {
|
|
40
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
-
className: "h-4 w-4",
|
|
42
|
-
fill: "none",
|
|
43
|
-
viewBox: "0 0 24 24",
|
|
44
|
-
stroke: "currentColor",
|
|
45
|
-
children: /* @__PURE__ */ i("path", {
|
|
46
|
-
strokeLinecap: "round",
|
|
47
|
-
strokeLinejoin: "round",
|
|
48
|
-
strokeWidth: "2",
|
|
49
|
-
d: "M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
45
|
})]
|
|
53
46
|
});
|
|
54
|
-
},
|
|
55
|
-
let [
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
|
|
47
|
+
}, c = ({ title: e, description: a, children: o, code: c, language: l = "jsx" }) => {
|
|
48
|
+
let [u, d] = n(!1), f = t(), p = `${f}-title`, m = `${f}-code`;
|
|
49
|
+
return /* @__PURE__ */ i("section", {
|
|
50
|
+
"aria-labelledby": p,
|
|
51
|
+
className: "mb-8 min-w-0 rounded-xl border border-base-300 bg-base-100 shadow-sm",
|
|
58
52
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
className: "
|
|
61
|
-
children: [/* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
/* @__PURE__ */ i("div", {
|
|
54
|
+
className: "border-b border-base-300 px-5 py-4",
|
|
55
|
+
children: [/* @__PURE__ */ r("h3", {
|
|
56
|
+
id: p,
|
|
57
|
+
className: "text-lg font-semibold",
|
|
58
|
+
children: e
|
|
59
|
+
}), a && /* @__PURE__ */ r("p", {
|
|
60
|
+
className: "mt-1 text-sm leading-relaxed opacity-70",
|
|
61
|
+
children: a
|
|
67
62
|
})]
|
|
68
63
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
className: "
|
|
71
|
-
children:
|
|
64
|
+
/* @__PURE__ */ r("div", {
|
|
65
|
+
className: "flex min-w-0 flex-wrap items-center gap-4 px-5 py-6",
|
|
66
|
+
children: o
|
|
72
67
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ i("div", {
|
|
74
69
|
className: "border-t border-base-300",
|
|
75
|
-
children: [/* @__PURE__ */
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}), /* @__PURE__ */ i("svg", {
|
|
70
|
+
children: [/* @__PURE__ */ i("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
className: "btn btn-ghost flex w-full items-center justify-between rounded-none rounded-b-xl px-5 text-sm font-medium",
|
|
73
|
+
"aria-expanded": u,
|
|
74
|
+
"aria-controls": m,
|
|
75
|
+
onClick: () => d((e) => !e),
|
|
76
|
+
children: [/* @__PURE__ */ r("span", { children: "Source Code / 源代码" }), /* @__PURE__ */ r("svg", {
|
|
77
|
+
"aria-hidden": "true",
|
|
84
78
|
xmlns: "http://www.w3.org/2000/svg",
|
|
85
|
-
className: `h-4 w-4 transition-transform ${
|
|
79
|
+
className: `h-4 w-4 transition-transform motion-reduce:transition-none ${u ? "rotate-180" : ""}`,
|
|
86
80
|
fill: "none",
|
|
87
81
|
viewBox: "0 0 24 24",
|
|
88
82
|
stroke: "currentColor",
|
|
89
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ r("path", {
|
|
90
84
|
strokeLinecap: "round",
|
|
91
85
|
strokeLinejoin: "round",
|
|
92
86
|
strokeWidth: "2",
|
|
93
87
|
d: "M19 9l-7 7-7-7"
|
|
94
88
|
})
|
|
95
89
|
})]
|
|
96
|
-
}),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
}), /* @__PURE__ */ r("div", {
|
|
91
|
+
id: m,
|
|
92
|
+
hidden: !u,
|
|
93
|
+
className: "min-w-0 border-t border-base-300 p-4",
|
|
94
|
+
children: u && /* @__PURE__ */ r(s, {
|
|
95
|
+
language: l,
|
|
96
|
+
children: c
|
|
101
97
|
})
|
|
102
98
|
})]
|
|
103
99
|
})
|
|
@@ -105,6 +101,6 @@ var c = ({ children: t, language: r = "jsx" }) => {
|
|
|
105
101
|
});
|
|
106
102
|
};
|
|
107
103
|
//#endregion
|
|
108
|
-
export {
|
|
104
|
+
export { c as default };
|
|
109
105
|
|
|
110
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Demo/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Demo/index.tsx"],"sourcesContent":["import React, { useId, useState } from 'react';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport { useCopyToClipboard } from '../../hooks/useCopyToClipboard';\n\nexport interface CodeBlockProps {\n children: string;\n language?: string;\n}\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({ children, language = 'jsx' }) => {\n const { copied, error, copy } = useCopyToClipboard();\n\n return (\n <div className=\"min-w-0 overflow-hidden rounded-lg border border-base-300\">\n <div className=\"flex items-center justify-between gap-3 bg-base-200 px-4 py-2\">\n <span className=\"font-mono text-xs opacity-70\">{language}</span>\n <div className=\"flex items-center gap-2\">\n <span role=\"status\" className=\"text-xs\">\n {error ? 'Copy failed / 复制失败,请手动复制' : copied ? 'Copied / 已复制' : ''}\n </span>\n <button\n type=\"button\"\n className=\"btn btn-ghost btn-xs\"\n onClick={() => void copy(children)}\n aria-label=\"Copy source code / 复制源代码\"\n >\n Copy / 复制\n </button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n style={coldarkDark}\n tabIndex={0}\n aria-label=\"Source code / 源代码\"\n customStyle={{\n margin: 0,\n borderRadius: 0,\n fontSize: '0.8125rem',\n lineHeight: 1.7,\n padding: '1rem',\n maxHeight: '32rem',\n overflow: 'auto',\n }}\n >\n {children}\n </SyntaxHighlighter>\n </div>\n );\n};\n\nexport interface DemoProps {\n title: string;\n description?: string;\n children: React.ReactNode;\n code: string;\n language?: string;\n}\n\nconst Demo: React.FC<DemoProps> = ({\n title,\n description,\n children,\n code,\n language = 'jsx',\n}) => {\n const [showCode, setShowCode] = useState(false);\n const id = useId();\n const titleId = `${id}-title`;\n const codeId = `${id}-code`;\n\n return (\n <section aria-labelledby={titleId} className=\"mb-8 min-w-0 rounded-xl border border-base-300 bg-base-100 shadow-sm\">\n <div className=\"border-b border-base-300 px-5 py-4\">\n <h3 id={titleId} className=\"text-lg font-semibold\">{title}</h3>\n {description && <p className=\"mt-1 text-sm leading-relaxed opacity-70\">{description}</p>}\n </div>\n\n <div className=\"flex min-w-0 flex-wrap items-center gap-4 px-5 py-6\">\n {children}\n </div>\n\n <div className=\"border-t border-base-300\">\n <button\n type=\"button\"\n className=\"btn btn-ghost flex w-full items-center justify-between rounded-none rounded-b-xl px-5 text-sm font-medium\"\n aria-expanded={showCode}\n aria-controls={codeId}\n onClick={() => setShowCode(value => !value)}\n >\n <span>Source Code / 源代码</span>\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={`h-4 w-4 transition-transform motion-reduce:transition-none ${showCode ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n </button>\n <div id={codeId} hidden={!showCode} className=\"min-w-0 border-t border-base-300 p-4\">\n {showCode && <CodeBlock language={language}>{code}</CodeBlock>}\n </div>\n </div>\n </section>\n );\n};\n\nexport default Demo;\n"],"mappings":";;;;;;AAUA,IAAM,KAAuC,EAAE,aAAU,cAAW,YAAY;CAC9E,IAAM,EAAE,WAAQ,UAAO,YAAS,EAAmB;CAEnD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,QAAD;IAAM,WAAU;IAAgC,UAAA;GAAe,CAAA,GAC/D,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,QAAD;KAAM,MAAK;KAAS,WAAU;KAC3B,UAAA,IAAQ,6BAA6B,IAAS,iBAAiB;IAC5D,CAAA,GACN,kBAAC,UAAD;KACE,MAAK;KACL,WAAU;KACV,eAAe,KAAK,EAAK,CAAQ;KACjC,cAAW;KACZ,UAAA;IAEO,CAAA,C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