@daoyi/nmtl-ui 2.0.1-beta.14 → 2.0.1-beta.140

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 (112) hide show
  1. package/README.md +45 -45
  2. package/lib/components/Autocomplete-e40d7145.js +494 -0
  3. package/lib/components/Autocomplete.js +20 -1
  4. package/lib/components/Avatar.js +59 -1
  5. package/lib/components/BackTop.js +124 -1
  6. package/lib/components/BarChart.js +764 -1
  7. package/lib/components/Breadcrumbs.js +146 -1
  8. package/lib/components/Button-8cf35bc0.js +114 -0
  9. package/lib/components/Button.js +7 -1
  10. package/lib/components/Carousel.js +4654 -1
  11. package/lib/components/Checkbox.js +37 -1
  12. package/lib/components/CollapseContent.js +235 -1
  13. package/lib/components/ContactModal-af7fa280.js +12295 -0
  14. package/lib/components/ContactModal.js +24 -3
  15. package/lib/components/Drawer-b770014f.js +247 -0
  16. package/lib/components/Drawer.js +18 -1
  17. package/lib/components/Dropdown.js +134 -1
  18. package/lib/components/Empty-48685dd0.js +46 -0
  19. package/lib/components/Empty.js +5 -1
  20. package/lib/components/ExportButton.js +128 -1
  21. package/lib/components/ExtraTools-c46c1965.js +3676 -0
  22. package/lib/components/ExtraTools.js +11 -22
  23. package/lib/components/Filter.js +821 -12
  24. package/lib/components/Footer.js +317 -1
  25. package/lib/components/ForwardLink-2905563c.js +184 -0
  26. package/lib/components/ForwardLink.js +10 -0
  27. package/lib/components/Header.js +267 -1
  28. package/lib/components/Image.js +61 -1
  29. package/lib/components/Input.js +89 -1
  30. package/lib/components/InputMethod.js +33937 -10
  31. package/lib/components/KeywordSearch-4e621ded.js +156 -0
  32. package/lib/components/KeywordSearch.js +22 -1
  33. package/lib/components/KeywordTicker.js +224 -1
  34. package/lib/components/Keywords.js +383 -1
  35. package/lib/components/Loading.js +32 -1
  36. package/lib/components/MUITheme.js +2657 -1
  37. package/lib/components/Modal-aa77d4d8.js +171 -0
  38. package/lib/components/Modal.js +11 -1
  39. package/lib/components/MoreButton-0b5aaef3.js +148 -0
  40. package/lib/components/MoreButton.js +8 -1
  41. package/lib/components/Pagination.js +3702 -0
  42. package/lib/components/Radio.js +83 -1
  43. package/lib/components/SNA.js +1755 -22
  44. package/lib/components/SegmentedControl-804da0a6.js +113 -0
  45. package/lib/components/SegmentedControl.js +11 -0
  46. package/lib/components/Select-979f7e73.js +189 -0
  47. package/lib/components/Select.js +14 -1
  48. package/lib/components/Spin-07679812.js +79 -0
  49. package/lib/components/Spin.js +7 -1
  50. package/lib/components/Table.js +51 -1
  51. package/lib/components/Tooltip-bbbaa9c7.js +70 -0
  52. package/lib/components/Tooltip.js +7 -1
  53. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  54. package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
  55. package/lib/components/createSvgIcon-370e163a.js +576 -0
  56. package/lib/components/dataExport-a9e3fae1.js +91 -0
  57. package/lib/components/debounce-127da66c.js +355 -0
  58. package/lib/components/defaultTheme-c5dd0f64.js +1661 -0
  59. package/lib/components/globalConfig.js +471 -0
  60. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  61. package/lib/components/index-c33afcb5.js +61 -0
  62. package/lib/components/index-ff95f719.js +481 -0
  63. package/lib/components/isObjectLike-e111475d.js +190 -0
  64. package/lib/components/style-inject.es-1f59c1d0.js +28 -1
  65. package/lib/components/toConsumableArray-c268c112.js +19 -0
  66. package/lib/components/transform-849a452c.js +5475 -0
  67. package/lib/components/useTheme-98b6cf17.js +11 -0
  68. package/lib/components/withTheme-3486f38b.js +6 -0
  69. package/lib/configs/config.selector.js +151 -0
  70. package/lib/configs/index.d.ts +1 -0
  71. package/lib/configs/index.js +1 -0
  72. package/lib/index.d.ts +6 -1
  73. package/lib/index.js +6 -1
  74. package/lib/utils/_rollupPluginBabelHelpers-9802e640.js +121 -0
  75. package/lib/utils/arrayMerge.js +4953 -1
  76. package/lib/utils/chunkArray.js +15 -1
  77. package/lib/utils/convert2HtmlEntities.js +57 -1
  78. package/lib/utils/domToImage.js +802 -1
  79. package/lib/utils/downloadGephi.js +106 -1
  80. package/lib/utils/exportXlsx.js +221 -1
  81. package/lib/utils/historyAppendSearch.js +502 -1
  82. package/lib/utils/index.d.ts +2 -0
  83. package/lib/utils/index.js +2 -0
  84. package/lib/utils/isDevelopMode.js +5 -1
  85. package/lib/utils/newWindowHint-72ebfe3b.js +53 -0
  86. package/lib/utils/parseYMD.js +36 -1
  87. package/lib/utils/prepareTimelineData.js +70 -0
  88. package/lib/utils/removeDuplicateItem.js +11 -1
  89. package/lib/utils/sendEmail.js +39 -1
  90. package/lib/utils/snaDefine-6a2bcd94.js +5 -0
  91. package/lib/utils/snaDefine.js +1 -1
  92. package/lib/utils/snaPreProcess.js +84 -1
  93. package/lib/utils/syncTimelineA11y.js +293 -0
  94. package/package.json +141 -128
  95. package/lib/components/Empty-54b79907.js +0 -1
  96. package/lib/components/KeywordSearch-5a393f12.js +0 -1
  97. package/lib/components/Select-f2441b83.js +0 -1
  98. package/lib/components/_rollupPluginBabelHelpers-1b8c042f.js +0 -1
  99. package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
  100. package/lib/components/createSvgIcon-62b64929.js +0 -1
  101. package/lib/components/createSvgIcon-e24792d4.js +0 -1
  102. package/lib/components/createTheme-7fffa109.js +0 -1
  103. package/lib/components/dataExport-9fccd4f0.js +0 -1
  104. package/lib/components/debounce-c993109b.js +0 -1
  105. package/lib/components/hoist-non-react-statics.cjs-d6a9befd.js +0 -1
  106. package/lib/components/index-11391ca3.js +0 -7
  107. package/lib/components/index-b2745105.js +0 -7
  108. package/lib/components/isObjectLike-2f1983fe.js +0 -1
  109. package/lib/components/style-inject.es-c875d022.js +0 -1
  110. package/lib/components/transform-95ae0119.js +0 -1
  111. package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
  112. package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
@@ -1 +1,502 @@
1
- import{b as r,c as e}from"./_rollupPluginBabelHelpers-928a52ce.js";import t from"prop-types";import{c as o}from"./_commonjsHelpers-e2cda605.js";var n=new RegExp("%[a-f0-9]{2}","gi"),a=new RegExp("(%[a-f0-9]{2})+","gi");function s(r,e){try{return decodeURIComponent(r.join(""))}catch(r){}if(1===r.length)return r;e=e||1;var t=r.slice(0,e),o=r.slice(e);return Array.prototype.concat.call([],s(t),s(o))}function c(r){try{return decodeURIComponent(r)}catch(o){for(var e=r.match(n),t=1;t<e.length;t++)e=(r=s(e,t).join("")).match(n);return r}}var i=function(r){if("string"!=typeof r)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(e){return function(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=a.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(r){var o=c(t[0]);o!==t[0]&&(e[t[0]]=o)}t=a.exec(r)}e["%C2"]="�";for(var n=Object.keys(e),s=0;s<n.length;s++){var i=n[s];r=r.replace(new RegExp(i,"g"),e[i])}return r}(r)}},l=(r,e)=>{if("string"!=typeof r||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[r];const t=r.indexOf(e);return-1===t?[r]:[r.slice(0,t),r.slice(t+e.length)]},u=o((function(r,e){function t(r){if("string"!=typeof r||1!==r.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(r,e){return e.encode?e.strict?encodeURIComponent(r).replace(/[!'()*]/g,(r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`)):encodeURIComponent(r):r}function n(r,e){return e.decode?i(r):r}function a(r){return Array.isArray(r)?r.sort():"object"==typeof r?a(Object.keys(r)).sort(((r,e)=>Number(r)-Number(e))).map((e=>r[e])):r}function s(r){const e=r.indexOf("#");return-1!==e&&(r=r.slice(0,e)),r}function c(r){const e=(r=s(r)).indexOf("?");return-1===e?"":r.slice(e+1)}function u(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&"string"==typeof r&&""!==r.trim()?r=Number(r):!e.parseBooleans||null===r||"true"!==r.toLowerCase()&&"false"!==r.toLowerCase()||(r="true"===r.toLowerCase()),r}function p(r,e){t((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const o=function(r){let e;switch(r.arrayFormat){case"index":return(r,t,o)=>{e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),e?(void 0===o[r]&&(o[r]={}),o[r][e[1]]=t):o[r]=t};case"bracket":return(r,t,o)=>{e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),e?void 0!==o[r]?o[r]=[].concat(o[r],t):o[r]=[t]:o[r]=t};case"comma":case"separator":return(e,t,o)=>{const a="string"==typeof t&&t.split("").indexOf(r.arrayFormatSeparator)>-1?t.split(r.arrayFormatSeparator).map((e=>n(e,r))):null===t?t:n(t,r);o[e]=a};default:return(r,e,t)=>{void 0!==t[r]?t[r]=[].concat(t[r],e):t[r]=e}}}(e),s=Object.create(null);if("string"!=typeof r)return s;if(!(r=r.trim().replace(/^[?#&]/,"")))return s;for(const t of r.split("&")){let[r,a]=l(e.decode?t.replace(/\+/g," "):t,"=");a=void 0===a?null:["comma","separator"].includes(e.arrayFormat)?a:n(a,e),o(n(r,e),a,s)}for(const r of Object.keys(s)){const t=s[r];if("object"==typeof t&&null!==t)for(const r of Object.keys(t))t[r]=u(t[r],e);else s[r]=u(t,e)}return!1===e.sort?s:(!0===e.sort?Object.keys(s).sort():Object.keys(s).sort(e.sort)).reduce(((r,e)=>{const t=s[e];return Boolean(t)&&"object"==typeof t&&!Array.isArray(t)?r[e]=a(t):r[e]=t,r}),Object.create(null))}e.extract=c,e.parse=p,e.stringify=(r,e)=>{if(!r)return"";t((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const n=t=>e.skipNull&&null==r[t]||e.skipEmptyString&&""===r[t],a=function(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{const a=t.length;return void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?t:null===n?[...t,[o(e,r),"[",a,"]"].join("")]:[...t,[o(e,r),"[",o(a,r),"]=",o(n,r)].join("")]};case"bracket":return e=>(t,n)=>void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?t:null===n?[...t,[o(e,r),"[]"].join("")]:[...t,[o(e,r),"[]=",o(n,r)].join("")];case"comma":case"separator":return e=>(t,n)=>null==n||0===n.length?t:0===t.length?[[o(e,r),"=",o(n,r)].join("")]:[[t,o(n,r)].join(r.arrayFormatSeparator)];default:return e=>(t,n)=>void 0===n||r.skipNull&&null===n||r.skipEmptyString&&""===n?t:null===n?[...t,o(e,r)]:[...t,[o(e,r),"=",o(n,r)].join("")]}}(e),s={};for(const e of Object.keys(r))n(e)||(s[e]=r[e]);const c=Object.keys(s);return!1!==e.sort&&c.sort(e.sort),c.map((t=>{const n=r[t];return void 0===n?"":null===n?o(t,e):Array.isArray(n)?n.reduce(a(t),[]).join("&"):o(t,e)+"="+o(n,e)})).filter((r=>r.length>0)).join("&")},e.parseUrl=(r,e)=>({url:s(r).split("?")[0]||"",query:p(c(r),e)}),e.stringifyUrl=(r,t)=>{const o=s(r.url).split("?")[0]||"",n=e.extract(r.url),a=e.parse(n),c=function(r){let e="";const t=r.indexOf("#");return-1!==t&&(e=r.slice(t)),e}(r.url),i=Object.assign(a,r.query);let l=e.stringify(i,t);return l&&(l=`?${l}`),`${o}${l}${c}`}}));u.extract,u.parse,u.stringify,u.parseUrl,u.stringifyUrl;var p=["history"],f=function(t){var o=t.history,n=r(t,p);if(o){var a=o.location.search;o.replace({search:u.stringify(e(e({},u.parse(a)),n))})}else console.error("error","historyAppendSearch needs history")};f.propTypes={history:t.objectOf(t.any).isRequired};export{f as default};
1
+ import { c as _objectWithoutProperties, d as _objectSpread2 } from './_rollupPluginBabelHelpers-9802e640.js';
2
+ import PropTypes from 'prop-types';
3
+
4
+ var queryString = {};
5
+
6
+ var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
7
+
8
+ var token = '%[a-f0-9]{2}';
9
+ var singleMatcher = new RegExp(token, 'gi');
10
+ var multiMatcher = new RegExp('(' + token + ')+', 'gi');
11
+
12
+ function decodeComponents(components, split) {
13
+ try {
14
+ // Try to decode the entire string first
15
+ return decodeURIComponent(components.join(''));
16
+ } catch (err) {
17
+ // Do nothing
18
+ }
19
+
20
+ if (components.length === 1) {
21
+ return components;
22
+ }
23
+
24
+ split = split || 1;
25
+
26
+ // Split the array in 2 parts
27
+ var left = components.slice(0, split);
28
+ var right = components.slice(split);
29
+
30
+ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
31
+ }
32
+
33
+ function decode(input) {
34
+ try {
35
+ return decodeURIComponent(input);
36
+ } catch (err) {
37
+ var tokens = input.match(singleMatcher);
38
+
39
+ for (var i = 1; i < tokens.length; i++) {
40
+ input = decodeComponents(tokens, i).join('');
41
+
42
+ tokens = input.match(singleMatcher);
43
+ }
44
+
45
+ return input;
46
+ }
47
+ }
48
+
49
+ function customDecodeURIComponent(input) {
50
+ // Keep track of all the replacements and prefill the map with the `BOM`
51
+ var replaceMap = {
52
+ '%FE%FF': '\uFFFD\uFFFD',
53
+ '%FF%FE': '\uFFFD\uFFFD'
54
+ };
55
+
56
+ var match = multiMatcher.exec(input);
57
+ while (match) {
58
+ try {
59
+ // Decode as big chunks as possible
60
+ replaceMap[match[0]] = decodeURIComponent(match[0]);
61
+ } catch (err) {
62
+ var result = decode(match[0]);
63
+
64
+ if (result !== match[0]) {
65
+ replaceMap[match[0]] = result;
66
+ }
67
+ }
68
+
69
+ match = multiMatcher.exec(input);
70
+ }
71
+
72
+ // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
73
+ replaceMap['%C2'] = '\uFFFD';
74
+
75
+ var entries = Object.keys(replaceMap);
76
+
77
+ for (var i = 0; i < entries.length; i++) {
78
+ // Replace all decoded components
79
+ var key = entries[i];
80
+ input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
81
+ }
82
+
83
+ return input;
84
+ }
85
+
86
+ var decodeUriComponent = function (encodedURI) {
87
+ if (typeof encodedURI !== 'string') {
88
+ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
89
+ }
90
+
91
+ try {
92
+ encodedURI = encodedURI.replace(/\+/g, ' ');
93
+
94
+ // Try the built in decoder first
95
+ return decodeURIComponent(encodedURI);
96
+ } catch (err) {
97
+ // Fallback to a more advanced decoder
98
+ return customDecodeURIComponent(encodedURI);
99
+ }
100
+ };
101
+
102
+ var splitOnFirst = (string, separator) => {
103
+ if (!(typeof string === 'string' && typeof separator === 'string')) {
104
+ throw new TypeError('Expected the arguments to be of type `string`');
105
+ }
106
+
107
+ if (separator === '') {
108
+ return [string];
109
+ }
110
+
111
+ const separatorIndex = string.indexOf(separator);
112
+
113
+ if (separatorIndex === -1) {
114
+ return [string];
115
+ }
116
+
117
+ return [
118
+ string.slice(0, separatorIndex),
119
+ string.slice(separatorIndex + separator.length)
120
+ ];
121
+ };
122
+
123
+ (function (exports) {
124
+ const strictUriEncode$1 = strictUriEncode;
125
+ const decodeComponent = decodeUriComponent;
126
+ const splitOnFirst$1 = splitOnFirst;
127
+
128
+ const isNullOrUndefined = value => value === null || value === undefined;
129
+
130
+ function encoderForArrayFormat(options) {
131
+ switch (options.arrayFormat) {
132
+ case 'index':
133
+ return key => (result, value) => {
134
+ const index = result.length;
135
+
136
+ if (
137
+ value === undefined ||
138
+ (options.skipNull && value === null) ||
139
+ (options.skipEmptyString && value === '')
140
+ ) {
141
+ return result;
142
+ }
143
+
144
+ if (value === null) {
145
+ return [...result, [encode(key, options), '[', index, ']'].join('')];
146
+ }
147
+
148
+ return [
149
+ ...result,
150
+ [encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
151
+ ];
152
+ };
153
+
154
+ case 'bracket':
155
+ return key => (result, value) => {
156
+ if (
157
+ value === undefined ||
158
+ (options.skipNull && value === null) ||
159
+ (options.skipEmptyString && value === '')
160
+ ) {
161
+ return result;
162
+ }
163
+
164
+ if (value === null) {
165
+ return [...result, [encode(key, options), '[]'].join('')];
166
+ }
167
+
168
+ return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
169
+ };
170
+
171
+ case 'comma':
172
+ case 'separator':
173
+ return key => (result, value) => {
174
+ if (value === null || value === undefined || value.length === 0) {
175
+ return result;
176
+ }
177
+
178
+ if (result.length === 0) {
179
+ return [[encode(key, options), '=', encode(value, options)].join('')];
180
+ }
181
+
182
+ return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
183
+ };
184
+
185
+ default:
186
+ return key => (result, value) => {
187
+ if (
188
+ value === undefined ||
189
+ (options.skipNull && value === null) ||
190
+ (options.skipEmptyString && value === '')
191
+ ) {
192
+ return result;
193
+ }
194
+
195
+ if (value === null) {
196
+ return [...result, encode(key, options)];
197
+ }
198
+
199
+ return [...result, [encode(key, options), '=', encode(value, options)].join('')];
200
+ };
201
+ }
202
+ }
203
+
204
+ function parserForArrayFormat(options) {
205
+ let result;
206
+
207
+ switch (options.arrayFormat) {
208
+ case 'index':
209
+ return (key, value, accumulator) => {
210
+ result = /\[(\d*)\]$/.exec(key);
211
+
212
+ key = key.replace(/\[\d*\]$/, '');
213
+
214
+ if (!result) {
215
+ accumulator[key] = value;
216
+ return;
217
+ }
218
+
219
+ if (accumulator[key] === undefined) {
220
+ accumulator[key] = {};
221
+ }
222
+
223
+ accumulator[key][result[1]] = value;
224
+ };
225
+
226
+ case 'bracket':
227
+ return (key, value, accumulator) => {
228
+ result = /(\[\])$/.exec(key);
229
+ key = key.replace(/\[\]$/, '');
230
+
231
+ if (!result) {
232
+ accumulator[key] = value;
233
+ return;
234
+ }
235
+
236
+ if (accumulator[key] === undefined) {
237
+ accumulator[key] = [value];
238
+ return;
239
+ }
240
+
241
+ accumulator[key] = [].concat(accumulator[key], value);
242
+ };
243
+
244
+ case 'comma':
245
+ case 'separator':
246
+ return (key, value, accumulator) => {
247
+ const isArray = typeof value === 'string' && value.split('').indexOf(options.arrayFormatSeparator) > -1;
248
+ const newValue = isArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
249
+ accumulator[key] = newValue;
250
+ };
251
+
252
+ default:
253
+ return (key, value, accumulator) => {
254
+ if (accumulator[key] === undefined) {
255
+ accumulator[key] = value;
256
+ return;
257
+ }
258
+
259
+ accumulator[key] = [].concat(accumulator[key], value);
260
+ };
261
+ }
262
+ }
263
+
264
+ function validateArrayFormatSeparator(value) {
265
+ if (typeof value !== 'string' || value.length !== 1) {
266
+ throw new TypeError('arrayFormatSeparator must be single character string');
267
+ }
268
+ }
269
+
270
+ function encode(value, options) {
271
+ if (options.encode) {
272
+ return options.strict ? strictUriEncode$1(value) : encodeURIComponent(value);
273
+ }
274
+
275
+ return value;
276
+ }
277
+
278
+ function decode(value, options) {
279
+ if (options.decode) {
280
+ return decodeComponent(value);
281
+ }
282
+
283
+ return value;
284
+ }
285
+
286
+ function keysSorter(input) {
287
+ if (Array.isArray(input)) {
288
+ return input.sort();
289
+ }
290
+
291
+ if (typeof input === 'object') {
292
+ return keysSorter(Object.keys(input))
293
+ .sort((a, b) => Number(a) - Number(b))
294
+ .map(key => input[key]);
295
+ }
296
+
297
+ return input;
298
+ }
299
+
300
+ function removeHash(input) {
301
+ const hashStart = input.indexOf('#');
302
+ if (hashStart !== -1) {
303
+ input = input.slice(0, hashStart);
304
+ }
305
+
306
+ return input;
307
+ }
308
+
309
+ function getHash(url) {
310
+ let hash = '';
311
+ const hashStart = url.indexOf('#');
312
+ if (hashStart !== -1) {
313
+ hash = url.slice(hashStart);
314
+ }
315
+
316
+ return hash;
317
+ }
318
+
319
+ function extract(input) {
320
+ input = removeHash(input);
321
+ const queryStart = input.indexOf('?');
322
+ if (queryStart === -1) {
323
+ return '';
324
+ }
325
+
326
+ return input.slice(queryStart + 1);
327
+ }
328
+
329
+ function parseValue(value, options) {
330
+ if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
331
+ value = Number(value);
332
+ } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
333
+ value = value.toLowerCase() === 'true';
334
+ }
335
+
336
+ return value;
337
+ }
338
+
339
+ function parse(input, options) {
340
+ options = Object.assign({
341
+ decode: true,
342
+ sort: true,
343
+ arrayFormat: 'none',
344
+ arrayFormatSeparator: ',',
345
+ parseNumbers: false,
346
+ parseBooleans: false
347
+ }, options);
348
+
349
+ validateArrayFormatSeparator(options.arrayFormatSeparator);
350
+
351
+ const formatter = parserForArrayFormat(options);
352
+
353
+ // Create an object with no prototype
354
+ const ret = Object.create(null);
355
+
356
+ if (typeof input !== 'string') {
357
+ return ret;
358
+ }
359
+
360
+ input = input.trim().replace(/^[?#&]/, '');
361
+
362
+ if (!input) {
363
+ return ret;
364
+ }
365
+
366
+ for (const param of input.split('&')) {
367
+ let [key, value] = splitOnFirst$1(options.decode ? param.replace(/\+/g, ' ') : param, '=');
368
+
369
+ // Missing `=` should be `null`:
370
+ // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
371
+ value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
372
+ formatter(decode(key, options), value, ret);
373
+ }
374
+
375
+ for (const key of Object.keys(ret)) {
376
+ const value = ret[key];
377
+ if (typeof value === 'object' && value !== null) {
378
+ for (const k of Object.keys(value)) {
379
+ value[k] = parseValue(value[k], options);
380
+ }
381
+ } else {
382
+ ret[key] = parseValue(value, options);
383
+ }
384
+ }
385
+
386
+ if (options.sort === false) {
387
+ return ret;
388
+ }
389
+
390
+ return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
391
+ const value = ret[key];
392
+ if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
393
+ // Sort object keys, not values
394
+ result[key] = keysSorter(value);
395
+ } else {
396
+ result[key] = value;
397
+ }
398
+
399
+ return result;
400
+ }, Object.create(null));
401
+ }
402
+
403
+ exports.extract = extract;
404
+ exports.parse = parse;
405
+
406
+ exports.stringify = (object, options) => {
407
+ if (!object) {
408
+ return '';
409
+ }
410
+
411
+ options = Object.assign({
412
+ encode: true,
413
+ strict: true,
414
+ arrayFormat: 'none',
415
+ arrayFormatSeparator: ','
416
+ }, options);
417
+
418
+ validateArrayFormatSeparator(options.arrayFormatSeparator);
419
+
420
+ const shouldFilter = key => (
421
+ (options.skipNull && isNullOrUndefined(object[key])) ||
422
+ (options.skipEmptyString && object[key] === '')
423
+ );
424
+
425
+ const formatter = encoderForArrayFormat(options);
426
+
427
+ const objectCopy = {};
428
+
429
+ for (const key of Object.keys(object)) {
430
+ if (!shouldFilter(key)) {
431
+ objectCopy[key] = object[key];
432
+ }
433
+ }
434
+
435
+ const keys = Object.keys(objectCopy);
436
+
437
+ if (options.sort !== false) {
438
+ keys.sort(options.sort);
439
+ }
440
+
441
+ return keys.map(key => {
442
+ const value = object[key];
443
+
444
+ if (value === undefined) {
445
+ return '';
446
+ }
447
+
448
+ if (value === null) {
449
+ return encode(key, options);
450
+ }
451
+
452
+ if (Array.isArray(value)) {
453
+ return value
454
+ .reduce(formatter(key), [])
455
+ .join('&');
456
+ }
457
+
458
+ return encode(key, options) + '=' + encode(value, options);
459
+ }).filter(x => x.length > 0).join('&');
460
+ };
461
+
462
+ exports.parseUrl = (input, options) => {
463
+ return {
464
+ url: removeHash(input).split('?')[0] || '',
465
+ query: parse(extract(input), options)
466
+ };
467
+ };
468
+
469
+ exports.stringifyUrl = (input, options) => {
470
+ const url = removeHash(input.url).split('?')[0] || '';
471
+ const queryFromUrl = exports.extract(input.url);
472
+ const parsedQueryFromUrl = exports.parse(queryFromUrl);
473
+ const hash = getHash(input.url);
474
+ const query = Object.assign(parsedQueryFromUrl, input.query);
475
+ let queryString = exports.stringify(query, options);
476
+ if (queryString) {
477
+ queryString = `?${queryString}`;
478
+ }
479
+
480
+ return `${url}${queryString}${hash}`;
481
+ };
482
+ } (queryString));
483
+
484
+ var _excluded = ["history"];
485
+ var historyAppendSearch = function historyAppendSearch(_ref) {
486
+ var history = _ref.history,
487
+ rest = _objectWithoutProperties(_ref, _excluded);
488
+ if (history) {
489
+ var search = history.location.search;
490
+ history.replace({
491
+ search: queryString.stringify(_objectSpread2(_objectSpread2({}, queryString.parse(search)), rest))
492
+ });
493
+ } else {
494
+ console.error('error', 'historyAppendSearch needs history');
495
+ }
496
+ };
497
+ historyAppendSearch.propTypes = {
498
+ /** react-router-dom 的 history */
499
+ history: PropTypes.objectOf(PropTypes.any).isRequired
500
+ };
501
+
502
+ export { historyAppendSearch as default };
@@ -11,3 +11,5 @@ export { default as historyAppendSearch } from './historyAppendSearch';
11
11
  export { default as sendEmail } from './sendEmail';
12
12
  export { default as chunkArray } from './chunkArray';
13
13
  export { default as arrayMerge } from './arrayMerge';
14
+ export { default as prepareTimelineData } from './prepareTimelineData';
15
+ export { default as syncTimelineA11y } from './syncTimelineA11y';
@@ -11,3 +11,5 @@ export { default as historyAppendSearch } from './historyAppendSearch';
11
11
  export { default as sendEmail } from './sendEmail';
12
12
  export { default as chunkArray } from './chunkArray';
13
13
  export { default as arrayMerge } from './arrayMerge';
14
+ export { default as prepareTimelineData } from './prepareTimelineData';
15
+ export { default as syncTimelineA11y } from './syncTimelineA11y';
@@ -1 +1,5 @@
1
- var o=function(){return"localhost"===window.location||!1};export{o as default};
1
+ var isDevelopMode = function isDevelopMode() {
2
+ return window.location === 'localhost' || "production" === 'development';
3
+ };
4
+
5
+ export { isDevelopMode as default };
@@ -0,0 +1,53 @@
1
+ import { getIntl } from '../components/globalConfig';
2
+
3
+ /*
4
+ * 在 HTML 字串裡另開新視窗的連結文字後面補「(另開新視窗)」
5
+ * (數位部人工檢測 HM1240404E,2026-10-07:要直接寫在連結文字上,不能只放 title)。
6
+ * convert2HtmlEntities 與時間軸資料處理共用;不對外匯出。
7
+ */
8
+ var HINT_CLASS = 'newwindow-hint';
9
+ var hasHint = function hasHint(text) {
10
+ return /另開新視窗|另开新窗口|new window/i.test(text);
11
+ };
12
+ var newWindowHintText = function newWindowHintText() {
13
+ return getIntl().formatMessage({
14
+ id: 'aria.newWindow'
15
+ });
16
+ };
17
+
18
+ /**
19
+ * @param {string} html
20
+ * @param {object} [options]
21
+ * @param {boolean} [options.treatMissingTargetAsBlank] 沒寫 target 的連結也當成另開新視窗
22
+ * (@daoyi/timeline 的 DOMPurify 會把它們強制改成 _blank)
23
+ * @param {string} [options.className] 提示 span 的 class
24
+ */
25
+ var addNewWindowHint = function addNewWindowHint(html) {
26
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
27
+ _ref$treatMissingTarg = _ref.treatMissingTargetAsBlank,
28
+ treatMissingTargetAsBlank = _ref$treatMissingTarg === void 0 ? false : _ref$treatMissingTarg,
29
+ _ref$className = _ref.className,
30
+ className = _ref$className === void 0 ? HINT_CLASS : _ref$className;
31
+ var hasLinks = typeof html === 'string' && (html.indexOf('<a') !== -1 || html.indexOf('data-goto') !== -1);
32
+ if (!hasLinks || typeof DOMParser === 'undefined') return html;
33
+ var doc = new DOMParser().parseFromString("<body>".concat(html, "</body>"), 'text/html');
34
+ var hint = newWindowHintText();
35
+ var changed = false;
36
+ /* 時間軸的站內明細連結是不輸出 href 的 span role="link" data-goto(各站 Chronology 以 window.open 另開分頁),
37
+ 同樣要提示(2026-10-08 人工測試回饋) */
38
+ var selector = treatMissingTargetAsBlank ? 'a[href], [data-goto]' : 'a[href]';
39
+ doc.body.querySelectorAll(selector).forEach(function (a) {
40
+ var target = a.hasAttribute('data-goto') ? '_blank' : (a.getAttribute('target') || (treatMissingTargetAsBlank ? '_blank' : '')).toLowerCase();
41
+ if (target !== '_blank') return;
42
+ if (a.tagName === 'A' && !a.getAttribute('rel')) a.setAttribute('rel', 'noopener noreferrer');
43
+ if (hasHint(a.textContent)) return;
44
+ var span = doc.createElement('span');
45
+ span.className = className;
46
+ span.textContent = hint;
47
+ a.appendChild(span);
48
+ changed = true;
49
+ });
50
+ return changed ? doc.body.innerHTML : html;
51
+ };
52
+
53
+ export { addNewWindowHint as a, newWindowHintText as n };
@@ -1 +1,36 @@
1
- var t=function(t){var a="",n=t.split("-"),r=parseInt(n[0],10);r<=0?r=1911:a=r.toString();var o=parseInt(n[1],10);o<=0||o>12?o=1:a="".concat(a,"-").concat(o.toString());var c=parseInt(n[2],10);return c<=0||c>31?c=1:a="".concat(a,"-").concat(c.toString()),{year:r,month:o,day:c,displayDate:a}};export{t as default};
1
+ var parseYMD = function parseYMD(date) {
2
+ var displayDate = '';
3
+ var ymd = date.split('-');
4
+
5
+ // year
6
+ var year = parseInt(ymd[0], 10);
7
+ if (year <= 0) {
8
+ year = 1911;
9
+ } else {
10
+ displayDate = year.toString();
11
+ }
12
+
13
+ // month
14
+ var month = parseInt(ymd[1], 10);
15
+ if (month <= 0 || month > 12) {
16
+ month = 1;
17
+ } else {
18
+ displayDate = "".concat(displayDate, "-").concat(month.toString());
19
+ }
20
+
21
+ // day
22
+ var day = parseInt(ymd[2], 10);
23
+ if (day <= 0 || day > 31) {
24
+ day = 1;
25
+ } else {
26
+ displayDate = "".concat(displayDate, "-").concat(day.toString());
27
+ }
28
+ return {
29
+ year: year,
30
+ month: month,
31
+ day: day,
32
+ displayDate: displayDate
33
+ };
34
+ };
35
+
36
+ export { parseYMD as default };
@@ -0,0 +1,70 @@
1
+ import { d as _objectSpread2, b as _slicedToArray } from './_rollupPluginBabelHelpers-9802e640.js';
2
+ import { getIntl } from '../components/globalConfig';
3
+ import { a as addNewWindowHint, n as newWindowHintText } from './newWindowHint-72ebfe3b.js';
4
+
5
+ var TIMELINE_HINT_CLASS = 'tl-newwindow-hint';
6
+
7
+ /* https://drive.google.com/file/d/{id}/preview(或 /view) */
8
+ var DRIVE_FILE = /^https?:\/\/drive\.google\.com\/file\/d\/([\w-]+)/i;
9
+ /* 套件只認得分享網址(…/view?usp=sharing)為 Google Doc 類型、嵌入 /preview 的 iframe;資料裡也有 /preview 等寫法,統一 */
10
+ var driveShare = function driveShare(id) {
11
+ return "https://drive.google.com/file/d/".concat(id, "/view?usp=sharing");
12
+ };
13
+ /* 時間刻度標記的小縮圖;# 之後不送伺服器,.jpg 讓套件當圖片處理 */
14
+ var driveThumbnail = function driveThumbnail(id) {
15
+ return "https://drive.google.com/thumbnail?id=".concat(id, "&sz=w400#.jpg");
16
+ };
17
+ var driveView = function driveView(id) {
18
+ return "https://drive.google.com/file/d/".concat(id, "/view");
19
+ };
20
+ var hint = function hint(html) {
21
+ return addNewWindowHint(html, {
22
+ treatMissingTargetAsBlank: true,
23
+ className: TIMELINE_HINT_CLASS
24
+ });
25
+ };
26
+ var prepareMedia = function prepareMedia(media) {
27
+ if (!media || typeof media.url !== 'string') return media;
28
+ var match = DRIVE_FILE.exec(media.url);
29
+ if (!match) return _objectSpread2(_objectSpread2({}, media), {}, {
30
+ caption: hint(media.caption)
31
+ });
32
+ var _match = _slicedToArray(match, 2),
33
+ id = _match[1];
34
+ var _getIntl = getIntl(),
35
+ formatMessage = _getIntl.formatMessage;
36
+ var open = "<a href=\"".concat(driveView(id), "\" target=\"_blank\" rel=\"noopener noreferrer\">").concat(formatMessage({
37
+ id: 'chronology.openDriveFile'
38
+ }), "<span class=\"").concat(TIMELINE_HINT_CLASS, "\">").concat(newWindowHintText(), "</span></a>");
39
+ return _objectSpread2(_objectSpread2({}, media), {}, {
40
+ url: driveShare(id),
41
+ thumbnail: driveThumbnail(id),
42
+ /* 預覽器對鍵盤與報讀軟體隱藏,圖說的連結是它們的替代入口 */
43
+ caption: [open, hint(media.caption)].filter(Boolean).join('<br />'),
44
+ link: undefined
45
+ });
46
+ };
47
+ var prepareSlide = function prepareSlide(slide) {
48
+ if (!slide) return slide;
49
+ var text = slide.text ? _objectSpread2(_objectSpread2({}, slide.text), {}, {
50
+ headline: hint(slide.text.headline),
51
+ text: hint(slide.text.text)
52
+ }) : slide.text;
53
+ return _objectSpread2(_objectSpread2({}, slide), {}, {
54
+ text: text,
55
+ media: prepareMedia(slide.media)
56
+ });
57
+ };
58
+
59
+ /**
60
+ * @param {object} data TimelineJS 的資料({ title?, events[] })
61
+ */
62
+ var prepareTimelineData = function prepareTimelineData(data) {
63
+ if (!data || !Array.isArray(data.events)) return data;
64
+ return _objectSpread2(_objectSpread2({}, data), {}, {
65
+ title: data.title ? prepareSlide(data.title) : data.title,
66
+ events: data.events.map(prepareSlide)
67
+ });
68
+ };
69
+
70
+ export { TIMELINE_HINT_CLASS, prepareTimelineData as default };