@daoyi/nmtl-ui 2.0.1-beta.127 → 2.0.1-beta.129

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.
@@ -1,7 +1,7 @@
1
1
  import React__default, { useEffect } from 'react';
2
2
  import { c as classNames } from './index-b76a85f4.js';
3
3
  import PropTypes from 'prop-types';
4
- import { g as constant$1, h as interpolateNumber, j as color, k as interpolateRgb, l as interpolateString, n as exponent, o as ordinal, p as initRange, r as map, s as slice$1, u as bisectRight, v as formatSpecifier, w as formatPrefix, x as format, d as d3Select } from './transform-3a04288b.js';
4
+ import { g as constant$1, h as interpolateNumber, j as color, k as interpolateRgb, l as interpolateString, n as exponent, o as ordinal, p as initRange, r as map, u as slice$1, v as bisectRight, w as formatSpecifier, x as formatPrefix, y as format, s as select } from './transform-849a452c.js';
5
5
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
6
6
 
7
7
  function sequence(start, stop, step) {
@@ -666,8 +666,8 @@ var BarChart = function BarChart(_ref) {
666
666
  maxValue = parseInt(item.count, 10);
667
667
  }
668
668
  });
669
- d3Select('div#barChart').html('');
670
- var svg = d3Select('#barChart').append('svg').attr('width', width + margin.left + margin.right).attr('height', height + margin.top + margin.bottom).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")"));
669
+ select('div#barChart').html('');
670
+ var svg = select('#barChart').append('svg').attr('width', width + margin.left + margin.right).attr('height', height + margin.top + margin.bottom).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")"));
671
671
  // X axis
672
672
  var x = band().range([0, width]).domain(data.map(function (d) {
673
673
  return d.year;
@@ -2753,6 +2753,12 @@ const downloadGephi = snaData => {
2753
2753
 
2754
2754
  /* 轉檔工具, 提供API轉下載tsv/xlsx */
2755
2755
 
2756
+ /* 欄名走套件自帶的 getIntl():zh-tw 語系表的值與原本寫死的欄名相同,子站(僅 zh-tw)輸出不變;
2757
+ 主站英文頁輸出英文欄名(nmtl-web i18n 盤點 D6) */
2758
+ const header = id => getIntl().formatMessage({
2759
+ id
2760
+ });
2761
+
2756
2762
  /* 大事年表 */
2757
2763
  const chronologyConvert = data => {
2758
2764
  const getText = function () {
@@ -2764,6 +2770,15 @@ const chronologyConvert = data => {
2764
2770
  };
2765
2771
  };
2766
2772
 
2773
+ /* 資料來源:主站把名稱包在 .tooltipsources 裡(「資料來源:」前綴隨語系變動,無法再靠中文字剝除);
2774
+ 子站的時間軸 HTML 沒有這一層,沿用原本剝除「註」「資料來源:」的寫法 */
2775
+ const getSources = function () {
2776
+ let after = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2777
+ const tagged = after.match(/<span class="tooltipsources">([\s\S]*?)<\/span>/);
2778
+ if (tagged) return tagged[1].replaceAll(/(<([^>]+)>)/gi, '').trim();
2779
+ return after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '');
2780
+ };
2781
+
2767
2782
  /* 做資料過濾 */
2768
2783
  const newData = (data || []).map(_ref => {
2769
2784
  let {
@@ -2779,11 +2794,11 @@ const chronologyConvert = data => {
2779
2794
  }
2780
2795
  } = _ref;
2781
2796
  return {
2782
- 日期: `${year || ''}/${month || ''}/${day || ''}`,
2783
- 名稱: (displayDate || '').replace('<span>', '').replace('</span>', ''),
2784
- 描述: (headline || '').replaceAll(/(<([^>]+)>)/gi, ''),
2785
- 類型: getText(text).before,
2786
- '註(資料集名稱)': getText(text).after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '')
2797
+ [header('export.chronology.date')]: `${year || ''}/${month || ''}/${day || ''}`,
2798
+ [header('export.chronology.name')]: (displayDate || '').replace('<span>', '').replace('</span>', ''),
2799
+ [header('export.chronology.description')]: (headline || '').replaceAll(/(<([^>]+)>)/gi, ''),
2800
+ [header('export.chronology.type')]: getText(text).before,
2801
+ [header('export.chronology.source')]: getSources(getText(text).after)
2787
2802
  };
2788
2803
  });
2789
2804
  return newData;
@@ -2800,12 +2815,12 @@ const mapConvert = data => (data || []).map(_ref2 => {
2800
2815
  posY
2801
2816
  } = _ref2;
2802
2817
  return {
2803
- '名稱(書名/文章名)': title || '',
2804
- 作者: author || '',
2805
- 出版者: publisher || '',
2806
- '地點(作品描述區域)': locations || '',
2807
- 經度: posX || '',
2808
- 緯度: posY || ''
2818
+ [header('export.works.title')]: title || '',
2819
+ [header('export.works.author')]: author || '',
2820
+ [header('export.map.publisher')]: publisher || '',
2821
+ [header('export.map.location')]: locations || '',
2822
+ [header('export.map.longitude')]: posX || '',
2823
+ [header('export.map.latitude')]: posY || ''
2809
2824
  };
2810
2825
  });
2811
2826
 
@@ -2821,13 +2836,13 @@ const mapLgConvert = data => (data || []).map(_ref3 => {
2821
2836
  activePosY
2822
2837
  } = _ref3;
2823
2838
  return {
2824
- 組織名稱: title || '',
2825
- 創立地點: locationOfFormation,
2826
- 創立地點經度: createPosX || '',
2827
- 創立地點緯度: createPosY || '',
2828
- 活動地點: workLocations || '',
2829
- 活動地點經度: activePosX || '',
2830
- 活動地點緯度: activePosY || ''
2839
+ [header('export.mapLg.orgName')]: title || '',
2840
+ [header('export.mapLg.foundingPlace')]: locationOfFormation,
2841
+ [header('export.mapLg.foundingLongitude')]: createPosX || '',
2842
+ [header('export.mapLg.foundingLatitude')]: createPosY || '',
2843
+ [header('export.mapLg.activityPlace')]: workLocations || '',
2844
+ [header('export.mapLg.activityLongitude')]: activePosX || '',
2845
+ [header('export.mapLg.activityLatitude')]: activePosY || ''
2831
2846
  };
2832
2847
  });
2833
2848
 
@@ -2842,16 +2857,16 @@ const worksBarChart = data => (data || []).map(_ref4 => {
2842
2857
  genreName
2843
2858
  } = _ref4;
2844
2859
  return {
2845
- '出版年/發表年': date || year || '',
2846
- '名稱(書名/文章名)': title || '',
2847
- 作者: (authors || []).map(_ref5 => {
2860
+ [header('export.works.publishYear')]: date || year || '',
2861
+ [header('export.works.title')]: title || '',
2862
+ [header('export.works.author')]: (authors || []).map(_ref5 => {
2848
2863
  let {
2849
2864
  author
2850
2865
  } = _ref5;
2851
2866
  return author;
2852
2867
  }).join(','),
2853
- 關鍵字: (keywords || '').replaceAll('\n', ''),
2854
- 文學分類: genreName || ''
2868
+ [header('export.works.keywords')]: (keywords || '').replaceAll('\n', ''),
2869
+ [header('export.works.genre')]: genreName || ''
2855
2870
  };
2856
2871
  });
2857
2872
 
@@ -2863,9 +2878,9 @@ const worksSlider = data => (data || []).map(_ref6 => {
2863
2878
  date
2864
2879
  } = _ref6;
2865
2880
  return {
2866
- '名稱(書名/文章名)': title || '',
2867
- 作者: author || '',
2868
- '出版日期/發表日期': date || ''
2881
+ [header('export.works.title')]: title || '',
2882
+ [header('export.works.author')]: author || '',
2883
+ [header('export.works.publishDate')]: date || ''
2869
2884
  // 文學分類: genreName || '',
2870
2885
  // 作品描述地: workDesc || '',
2871
2886
  // 作家出生地: locations,
@@ -3157,6 +3172,15 @@ styleInject(css_248z);
3157
3172
 
3158
3173
  /* eslint-disable prefer-destructuring */
3159
3174
 
3175
+ /* 元件內部字串:呼叫端有傳 intl(各站自己的 react-intl)就沿用;沒傳就走套件自帶的 getIntl(),
3176
+ 語系由各站在 IndexProvider 以 getIntl().setLocale() 設定。
3177
+ 原本沒傳時直接落在寫死的中文,英文頁的工具列整排都是中文(nmtl-web i18n 盤點 D1) */
3178
+ const translate = (intl, id) => intl ? intl.formatMessage({
3179
+ id
3180
+ }) : getIntl().formatMessage({
3181
+ id
3182
+ });
3183
+
3160
3184
  /* 視覺隱藏文字(供按鈕內容作為可及名稱, WCAG 4.1.2) */
3161
3185
  const hiddenTextStyle = {
3162
3186
  position: 'absolute',
@@ -3214,10 +3238,8 @@ const DownloadMenu = _ref2 => {
3214
3238
  /* react-data-export 的隱藏觸發器(見下方 xlsxTrigger 說明) */
3215
3239
  const xlsxTriggerRef = useRef(null);
3216
3240
  const hideButton = type => (exclude || []).filter(key => key === type).length > 0;
3217
- const t = (key, fallback) => intl ? intl.formatMessage({
3218
- id: key
3219
- }) : fallback;
3220
- const downloadLabel = t('knowledge.writersAndWorksSNA.download', '下載');
3241
+ const t = id => translate(intl, id);
3242
+ const downloadLabel = t('knowledge.writersAndWorksSNA.download');
3221
3243
 
3222
3244
  /* xlsx 需由 react-data-export 產生檔案,但它只會把傳入的 element 包一層 <span onClick>;
3223
3245
  若直接把 MenuItem 交給它,選單裡就會出現 <span><li role="menuitem"></span>——
@@ -3231,11 +3253,11 @@ const DownloadMenu = _ref2 => {
3231
3253
  id: domToImageId,
3232
3254
  fileName: `${exportFileName}_${exportDateSuffix()}`
3233
3255
  }),
3234
- label: t('knowledge.writersAndWorksSNA.download.img', '下載圖片')
3256
+ label: t('knowledge.writersAndWorksSNA.download.img')
3235
3257
  }, {
3236
3258
  key: 'downloadGephi',
3237
3259
  onClick: () => downloadGephi(data),
3238
- label: t('knowledge.writersAndWorksSNA.download.gephi', '下載Gephi')
3260
+ label: t('knowledge.writersAndWorksSNA.download.gephi')
3239
3261
  }, {
3240
3262
  key: 'downloadTsv',
3241
3263
  onClick: () => exportXlsx({
@@ -3244,11 +3266,11 @@ const DownloadMenu = _ref2 => {
3244
3266
  extType: 'tsv',
3245
3267
  fileName: exportFileName
3246
3268
  }),
3247
- label: t('knowledge.writersAndWorksSNA.download.tsv', '下載Tsv')
3269
+ label: t('knowledge.writersAndWorksSNA.download.tsv')
3248
3270
  }, {
3249
3271
  key: 'downloadXls',
3250
3272
  onClick: () => xlsxTriggerRef.current && xlsxTriggerRef.current.click(),
3251
- label: t('knowledge.writersAndWorksSNA.download.xls', '下載Excel'),
3273
+ label: t('knowledge.writersAndWorksSNA.download.xls'),
3252
3274
  requireExcel: true
3253
3275
  }];
3254
3276
  const menuItems = btns.filter(_ref3 => {
@@ -3360,17 +3382,13 @@ const FullscreenBtn = _ref5 => {
3360
3382
  return /*#__PURE__*/React__default.createElement("div", {
3361
3383
  className: classNames('extraTools__fullscreenBtn', className)
3362
3384
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
3363
- title: intl ? intl.formatMessage({
3364
- id: 'knowledge.writersAndWorksSNA.fullscreen'
3365
- }) : '全螢幕模式',
3385
+ title: translate(intl, 'knowledge.writersAndWorksSNA.fullscreen'),
3366
3386
  placement: "bottom"
3367
3387
  }, /*#__PURE__*/React__default.createElement("div", {
3368
3388
  className: "extraTools__fullscreenBtn-icon",
3369
3389
  role: "button",
3370
3390
  tabIndex: 0,
3371
- "aria-label": intl ? intl.formatMessage({
3372
- id: 'knowledge.writersAndWorksSNA.fullscreen'
3373
- }) : '全螢幕模式',
3391
+ "aria-label": translate(intl, 'knowledge.writersAndWorksSNA.fullscreen'),
3374
3392
  onClick: () => {
3375
3393
  if (screenfull.isEnabled && fullscreenDomId) screenfull.request(document.getElementById(fullscreenDomId));
3376
3394
  },
@@ -3420,12 +3438,9 @@ const FontSizeChanger = _ref6 => {
3420
3438
  if (el.getAttribute('tabindex') === '0') return;
3421
3439
  const isUp = el.classList.contains('font-size-up');
3422
3440
  const labelId = isUp ? 'knowledge.writersAndWorksSNA.big' : 'knowledge.writersAndWorksSNA.small';
3423
- const fallback = isUp ? '字級放大' : '字級縮小';
3424
3441
  el.setAttribute('tabindex', '0');
3425
3442
  el.setAttribute('role', 'button');
3426
- el.setAttribute('aria-label', intl ? intl.formatMessage({
3427
- id: labelId
3428
- }) : fallback);
3443
+ el.setAttribute('aria-label', translate(intl, labelId));
3429
3444
  el.addEventListener('keydown', event => {
3430
3445
  if (event.key === 'Enter' || event.key === ' ') {
3431
3446
  event.preventDefault();
@@ -3443,29 +3458,21 @@ const FontSizeChanger = _ref6 => {
3443
3458
  customButtons: {
3444
3459
  /* 外層按鈕由 react-font-size-changer 渲染,以 role="img" + aria-label 提供按鈕可及名稱(WCAG 4.1.2) */
3445
3460
  up: /*#__PURE__*/React__default.createElement(Tooltip, {
3446
- title: intl ? intl.formatMessage({
3447
- id: 'knowledge.writersAndWorksSNA.big'
3448
- }) : '字級放大',
3461
+ title: translate(intl, 'knowledge.writersAndWorksSNA.big'),
3449
3462
  placement: "bottom"
3450
3463
  }, /*#__PURE__*/React__default.createElement("span", {
3451
3464
  role: "img",
3452
- "aria-label": intl ? intl.formatMessage({
3453
- id: 'knowledge.writersAndWorksSNA.big'
3454
- }) : '字級放大'
3465
+ "aria-label": translate(intl, 'knowledge.writersAndWorksSNA.big')
3455
3466
  }, /*#__PURE__*/React__default.createElement(SVGComponent$2, {
3456
3467
  fill: iconColor,
3457
3468
  "aria-hidden": "true"
3458
3469
  }))),
3459
3470
  down: /*#__PURE__*/React__default.createElement(Tooltip, {
3460
- title: intl ? intl.formatMessage({
3461
- id: 'knowledge.writersAndWorksSNA.small'
3462
- }) : '字級縮小',
3471
+ title: translate(intl, 'knowledge.writersAndWorksSNA.small'),
3463
3472
  placement: "bottom"
3464
3473
  }, /*#__PURE__*/React__default.createElement("span", {
3465
3474
  role: "img",
3466
- "aria-label": intl ? intl.formatMessage({
3467
- id: 'knowledge.writersAndWorksSNA.small'
3468
- }) : '字級縮小'
3475
+ "aria-label": translate(intl, 'knowledge.writersAndWorksSNA.small')
3469
3476
  }, /*#__PURE__*/React__default.createElement(SVGComponent$1, {
3470
3477
  fill: iconColor,
3471
3478
  "aria-hidden": "true"
@@ -3514,14 +3521,10 @@ const SNAResetBtn = _ref7 => {
3514
3521
  }, /*#__PURE__*/React__default.createElement("div", {
3515
3522
  id: "resetBtn"
3516
3523
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
3517
- title: intl ? intl.formatMessage({
3518
- id: 'common.sna.reset'
3519
- }) : '回到原來位置與大小',
3524
+ title: translate(intl, 'common.sna.reset'),
3520
3525
  placement: "bottom"
3521
3526
  }, /*#__PURE__*/React__default.createElement(IconButton, {
3522
- "aria-label": intl ? intl.formatMessage({
3523
- id: 'common.sna.reset'
3524
- }) : '回到原來位置與大小',
3527
+ "aria-label": translate(intl, 'common.sna.reset'),
3525
3528
  onClick: () => renderSNA(),
3526
3529
  style: {
3527
3530
  padding: '0px'
@@ -1,4 +1,4 @@
1
- export { E as default } from './ExtraTools-11d483d5.js';
1
+ export { E as default } from './ExtraTools-2691c13e.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import './index-b76a85f4.js';
@@ -12,7 +12,19 @@ var css_248z = ".forwardLink {\n width: -moz-fit-content;\n width: fit-content
12
12
  styleInject(css_248z);
13
13
 
14
14
  var _excluded = ["className", "linkClassName", "title", "target", "disabled", "children", "tip", "onClick"];
15
- var locale = '/zh-tw'; // 20230318 暫時寫死,若套件納入語系控制,可將其置換
15
+
16
+ /*
17
+ * 導頁前綴沿用目前網址的語系段(/en/…、/zh-tw/…)。
18
+ * 原本寫死 '/zh-tw'(2023-03-18 暫時寫死),英文頁上的 ForwardLink 一律把使用者帶回中文站(nmtl-web i18n 盤點 D2)。
19
+ * history.location.pathname 不含 Router basename(各站 contextRoot),第一段就是語系;
20
+ * 只接受已知語系代碼,避免把 hr/lg/ra 這類兩個字母的子站代碼誤認成語系。
21
+ */
22
+ var KNOWN_LOCALES = ['zh-tw', 'zh-cn', 'en', 'en-us'];
23
+ var DEFAULT_LOCALE = 'zh-tw';
24
+ var getLocalePrefix = function getLocalePrefix(pathname) {
25
+ var firstSegment = (pathname || '').split('/').filter(Boolean)[0];
26
+ return "/".concat(firstSegment && KNOWN_LOCALES.includes(firstSegment.toLowerCase()) ? firstSegment : DEFAULT_LOCALE);
27
+ };
16
28
 
17
29
  /*
18
30
  * ⚠️ 本元件刻意「不輸出 href 屬性」,請勿改回 <a> 或 react-router <Link>。
@@ -69,7 +81,7 @@ var ForwardLink = function ForwardLink(_ref) {
69
81
  var go = useCallback(function () {
70
82
  if (onClick && onClick() === false) return;
71
83
  var to = {
72
- pathname: "".concat(locale).concat(pathname),
84
+ pathname: "".concat(getLocalePrefix(history.location.pathname)).concat(pathname),
73
85
  search: search
74
86
  };
75
87
  if (target === '_blank') {
@@ -1,4 +1,4 @@
1
- export { F as default } from './ForwardLink-fec856b3.js';
1
+ export { F as default } from './ForwardLink-5fbd2705.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
@@ -2,7 +2,7 @@ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import React__default, { useState, useRef, useEffect } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
- import { F as ForwardLink } from './ForwardLink-fec856b3.js';
5
+ import { F as ForwardLink } from './ForwardLink-5fbd2705.js';
6
6
  import { getIntl } from './globalConfig';
7
7
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
8
8
  import './index-b47819f3.js';
@@ -1,15 +1,19 @@
1
1
  import React__default, { useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { c as classNames } from './index-b76a85f4.js';
4
- import { e as event, d as d3Select, a as dispatch, c as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-3a04288b.js';
5
- import { E as ExtraTools } from './ExtraTools-11d483d5.js';
4
+ import { s as select, c as creator, e as event, d as dispatch, a as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-849a452c.js';
5
+ import { E as ExtraTools } from './ExtraTools-2691c13e.js';
6
+ import { getIntl } from './globalConfig';
6
7
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
8
  import './_rollupPluginBabelHelpers-a52356f6.js';
8
9
  import './_commonjsHelpers-70de2c37.js';
9
10
  import '@material-ui/core';
10
11
  import './Tooltip-6ebfa9c1.js';
11
12
  import './dataExport-a9e3fae1.js';
12
- import './globalConfig';
13
+
14
+ function d3Create(name) {
15
+ return select(creator(name).call(document.documentElement));
16
+ }
13
17
 
14
18
  function sourceEvent() {
15
19
  var current = event, source;
@@ -60,7 +64,7 @@ function noevent$1() {
60
64
 
61
65
  function dragDisable(view) {
62
66
  var root = view.document.documentElement,
63
- selection = d3Select(view).on("dragstart.drag", noevent$1, true);
67
+ selection = select(view).on("dragstart.drag", noevent$1, true);
64
68
  if ("onselectstart" in root) {
65
69
  selection.on("selectstart.drag", noevent$1, true);
66
70
  } else {
@@ -71,7 +75,7 @@ function dragDisable(view) {
71
75
 
72
76
  function yesdrag(view, noclick) {
73
77
  var root = view.document.documentElement,
74
- selection = d3Select(view).on("dragstart.drag", null);
78
+ selection = select(view).on("dragstart.drag", null);
75
79
  if (noclick) {
76
80
  selection.on("click.drag", noevent$1, true);
77
81
  setTimeout(function() { selection.on("click.drag", null); }, 0);
@@ -136,7 +140,7 @@ function drag() {
136
140
  if (touchending || !filter.apply(this, arguments)) return;
137
141
  var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
138
142
  if (!gesture) return;
139
- d3Select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
143
+ select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
140
144
  dragDisable(event.view);
141
145
  nopropagation$1();
142
146
  mousemoving = false;
@@ -155,7 +159,7 @@ function drag() {
155
159
  }
156
160
 
157
161
  function mouseupped() {
158
- d3Select(event.view).on("mousemove.drag mouseup.drag", null);
162
+ select(event.view).on("mousemove.drag mouseup.drag", null);
159
163
  yesdrag(event.view, mousemoving);
160
164
  noevent$1();
161
165
  gestures.mouse("end");
@@ -1228,7 +1232,7 @@ function zoom() {
1228
1232
  function mousedowned() {
1229
1233
  if (touchending || !filter.apply(this, arguments)) return;
1230
1234
  var g = gesture(this, arguments, true),
1231
- v = d3Select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
1235
+ v = select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
1232
1236
  p = mouse(this),
1233
1237
  x0 = event.clientX,
1234
1238
  y0 = event.clientY;
@@ -1265,8 +1269,8 @@ function zoom() {
1265
1269
  t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
1266
1270
 
1267
1271
  noevent();
1268
- if (duration > 0) d3Select(this).transition().duration(duration).call(schedule, t1, p0);
1269
- else d3Select(this).call(zoom.transform, t1);
1272
+ if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0);
1273
+ else select(this).call(zoom.transform, t1);
1270
1274
  }
1271
1275
 
1272
1276
  function touchstarted() {
@@ -1342,7 +1346,7 @@ function zoom() {
1342
1346
  g.end();
1343
1347
  // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.
1344
1348
  if (g.taps === 2) {
1345
- var p = d3Select(this).on("dblclick.zoom");
1349
+ var p = select(this).on("dblclick.zoom");
1346
1350
  if (p) p.apply(this, arguments);
1347
1351
  }
1348
1352
  }
@@ -1418,12 +1422,18 @@ var SNA = function SNA(props) {
1418
1422
  backgroundColor = props.backgroundColor,
1419
1423
  iconColor = props.iconColor;
1420
1424
  var g;
1425
+ /* 元件內部字串:有傳 intl 就沿用,沒傳就走套件自帶的 getIntl();原本沒傳時落在寫死的中文(nmtl-web i18n 盤點 D3) */
1426
+ var translateText = function translateText(id) {
1427
+ return intl ? intl.formatMessage({
1428
+ id: id
1429
+ }) : getIntl().formatMessage({
1430
+ id: id
1431
+ });
1432
+ };
1421
1433
  if (!SNAData || SNAData.nodes.length === 0) {
1422
1434
  return /*#__PURE__*/React__default.createElement("div", {
1423
1435
  className: "noData"
1424
- }, intl ? intl.formatMessage({
1425
- id: 'common.noData'
1426
- }) : '暫無資料');
1436
+ }, translateText('common.noData'));
1427
1437
  }
1428
1438
  var contentWidth = useMemo(function () {
1429
1439
  return screen.width > 1050 ? width : screen.width - 80;
@@ -1435,39 +1445,25 @@ var SNA = function SNA(props) {
1435
1445
  switch (type) {
1436
1446
  case 'mainNode':
1437
1447
  // 主要搜尋中心
1438
- return intl ? intl.formatMessage({
1439
- id: 'SNA.search.center'
1440
- }) : '主要搜尋中心';
1448
+ return translateText('SNA.search.center');
1441
1449
  case 'organization':
1442
1450
  // 組織
1443
- return intl ? intl.formatMessage({
1444
- id: 'SNA.organization'
1445
- }) : '組織';
1451
+ return translateText('SNA.organization');
1446
1452
  case 'person':
1447
1453
  // 作家
1448
- return intl ? intl.formatMessage({
1449
- id: 'SNA.author'
1450
- }) : '作家';
1454
+ return translateText('SNA.author');
1451
1455
  case 'publication':
1452
1456
  // 著作
1453
- return intl ? intl.formatMessage({
1454
- id: 'SNA.publication'
1455
- }) : '作家';
1457
+ return translateText('SNA.publication');
1456
1458
  case 'article':
1457
1459
  // 單篇作品
1458
- return intl ? intl.formatMessage({
1459
- id: 'SNA.article'
1460
- }) : '單篇作品';
1460
+ return translateText('SNA.article');
1461
1461
  case 'keyword':
1462
1462
  // 關鍵字
1463
- return intl ? intl.formatMessage({
1464
- id: 'SNA.keyword'
1465
- }) : '關鍵字';
1463
+ return translateText('SNA.keyword');
1466
1464
  case 'event':
1467
1465
  // 事件
1468
- return intl ? intl.formatMessage({
1469
- id: 'SNA.event'
1470
- }) : '事件';
1466
+ return translateText('SNA.event');
1471
1467
  default:
1472
1468
  return '';
1473
1469
  }
@@ -1528,7 +1524,13 @@ var SNA = function SNA(props) {
1528
1524
  }).distance(50)).force('charge', manyBody().strength(-200).distanceMax(1000)).force('center', center(contentWidth / 2, contentHeight / 2)).force('collide', collide().radius(function () {
1529
1525
  return nodeRadius + 5;
1530
1526
  }).strength(1).iterations(10)).force('x', x(contentWidth / 2)).force('y', y(contentHeight / 2)).force('radial', radial(100, contentWidth / 1.5, contentHeight / 1.5));
1531
- var svg = d3Select('#sna-graph').append('svg').attr('viewBox', [0, 0, contentWidth, contentHeight]).style('background-color', backgroundColor);
1527
+
1528
+ /* 效能:SVG 先建在未掛上文件的節點,全部節點/標籤/連線建好後才一次掛進 #sna-graph(見 init 結尾)。
1529
+ Adobe Fonts 動態子集 kit(abo/ada/hr/ra 的 index.html 載入)在 body 掛 MutationObserver,
1530
+ 每筆 mutation 都用 TreeWalker 重掃目標整棵子樹收集文字;d3 逐一 append 進 live DOM 時,
1531
+ 每加一個節點就產生一筆以父層 <g> 為目標的紀錄 → O(n²),ra 1,428 個節點首次載入主執行緒凍結 39–73 秒。
1532
+ 離線建好再掛上,kit 只收到一筆紀錄、只掃一次 */
1533
+ var svg = d3Create('svg').attr('viewBox', [0, 0, contentWidth, contentHeight]).style('background-color', backgroundColor);
1532
1534
  svg.append('defs').append('marker').attr('id', 'arrowhead').attr('viewBox', arrowViewBox).attr('refX', nodeRadius * 2 + nodeRadius * arrowPercent).attr('refY', 0).attr('orient', 'auto').attr('markerWidth', nodeRadius * (1 + arrowPercent)).attr('markerHeight', nodeRadius * (1 + arrowPercent)).attr('xoverflow', 'visible').append('svg:path').attr('d', arrowPath).attr('fill', '#999').style('stroke', 'none');
1533
1535
  // 增加一層g用來包住所有的物件,並對此g加入縮放功能
1534
1536
  g = svg.append('g');
@@ -1632,6 +1634,10 @@ var SNA = function SNA(props) {
1632
1634
  return getLineCurve(d.source, d.target, lineRaduis);
1633
1635
  });
1634
1636
  });
1637
+
1638
+ // 一次掛上(原因見上方建立 svg 處);simulation 的 tick 由 d3-timer 排在之後的 frame,掛上前不會跑
1639
+ var container = document.getElementById('sna-graph');
1640
+ if (container) container.appendChild(svg.node());
1635
1641
  };
1636
1642
  var renderSNA = function renderSNA() {
1637
1643
  if (SNAData && SNAData.nodes && SNAData.nodes.length > 0) {
@@ -96,7 +96,45 @@ var zhtw = {
96
96
  "aria.pagination.changed": "已切換至第 {page} 頁,結果已更新",
97
97
  "aria.keyword.groupLabel": "關鍵字,共 {count} 個,可用方向鍵瀏覽",
98
98
  "common.select.placeholder": "請選擇…",
99
- "common.share.facebook": "分享至 Facebook"
99
+ "common.share.facebook": "分享至 Facebook",
100
+ "knowledge.writersAndWorksSNA.download": "下載",
101
+ "knowledge.writersAndWorksSNA.download.img": "下載圖片",
102
+ "knowledge.writersAndWorksSNA.download.gephi": "下載Gephi",
103
+ "knowledge.writersAndWorksSNA.download.tsv": "下載Tsv",
104
+ "knowledge.writersAndWorksSNA.download.xls": "下載Excel",
105
+ "knowledge.writersAndWorksSNA.fullscreen": "全螢幕模式",
106
+ "knowledge.writersAndWorksSNA.big": "字級放大",
107
+ "knowledge.writersAndWorksSNA.small": "字級縮小",
108
+ "common.noData": "暫無資料",
109
+ "SNA.search.center": "主要搜尋中心",
110
+ "SNA.organization": "組織",
111
+ "SNA.author": "作家",
112
+ "SNA.publication": "著作",
113
+ "SNA.article": "單篇作品",
114
+ "SNA.keyword": "關鍵字",
115
+ "SNA.event": "事件",
116
+ "export.chronology.date": "日期",
117
+ "export.chronology.name": "名稱",
118
+ "export.chronology.description": "描述",
119
+ "export.chronology.type": "類型",
120
+ "export.chronology.source": "註(資料集名稱)",
121
+ "export.works.title": "名稱(書名/文章名)",
122
+ "export.works.author": "作者",
123
+ "export.works.publishYear": "出版年/發表年",
124
+ "export.works.keywords": "關鍵字",
125
+ "export.works.genre": "文學分類",
126
+ "export.works.publishDate": "出版日期/發表日期",
127
+ "export.map.publisher": "出版者",
128
+ "export.map.location": "地點(作品描述區域)",
129
+ "export.map.longitude": "經度",
130
+ "export.map.latitude": "緯度",
131
+ "export.mapLg.orgName": "組織名稱",
132
+ "export.mapLg.foundingPlace": "創立地點",
133
+ "export.mapLg.foundingLongitude": "創立地點經度",
134
+ "export.mapLg.foundingLatitude": "創立地點緯度",
135
+ "export.mapLg.activityPlace": "活動地點",
136
+ "export.mapLg.activityLongitude": "活動地點經度",
137
+ "export.mapLg.activityLatitude": "活動地點緯度"
100
138
  };
101
139
 
102
140
  var zhcn = {
@@ -181,7 +219,47 @@ var zhcn = {
181
219
  "aria.pagination.changed": "已切换至第 {page} 页,结果已更新",
182
220
  "aria.keyword.groupLabel": "关键字,共 {count} 个,可用方向键浏览",
183
221
  "common.select.placeholder": "请选择…",
184
- "common.share.facebook": "分享至 Facebook"
222
+ "common.share.facebook": "分享至 Facebook",
223
+ "common.form.code.check": "请输入验证码(点击图片可更换验证码)",
224
+ "common.sna.reset": "回到原来位置与大小",
225
+ "knowledge.writersAndWorksSNA.download": "下载",
226
+ "knowledge.writersAndWorksSNA.download.img": "下载图片",
227
+ "knowledge.writersAndWorksSNA.download.gephi": "下载Gephi",
228
+ "knowledge.writersAndWorksSNA.download.tsv": "下载Tsv",
229
+ "knowledge.writersAndWorksSNA.download.xls": "下载Excel",
230
+ "knowledge.writersAndWorksSNA.fullscreen": "全屏模式",
231
+ "knowledge.writersAndWorksSNA.big": "字号放大",
232
+ "knowledge.writersAndWorksSNA.small": "字号缩小",
233
+ "common.noData": "暂无资料",
234
+ "SNA.search.center": "主要搜寻中心",
235
+ "SNA.organization": "组织",
236
+ "SNA.author": "作家",
237
+ "SNA.publication": "著作",
238
+ "SNA.article": "单篇作品",
239
+ "SNA.keyword": "关键字",
240
+ "SNA.event": "事件",
241
+ "export.chronology.date": "日期",
242
+ "export.chronology.name": "名称",
243
+ "export.chronology.description": "描述",
244
+ "export.chronology.type": "类型",
245
+ "export.chronology.source": "注(资料集名称)",
246
+ "export.works.title": "名称(书名/文章名)",
247
+ "export.works.author": "作者",
248
+ "export.works.publishYear": "出版年/发表年",
249
+ "export.works.keywords": "关键字",
250
+ "export.works.genre": "文学分类",
251
+ "export.works.publishDate": "出版日期/发表日期",
252
+ "export.map.publisher": "出版者",
253
+ "export.map.location": "地点(作品描述区域)",
254
+ "export.map.longitude": "经度",
255
+ "export.map.latitude": "纬度",
256
+ "export.mapLg.orgName": "组织名称",
257
+ "export.mapLg.foundingPlace": "创立地点",
258
+ "export.mapLg.foundingLongitude": "创立地点经度",
259
+ "export.mapLg.foundingLatitude": "创立地点纬度",
260
+ "export.mapLg.activityPlace": "活动地点",
261
+ "export.mapLg.activityLongitude": "活动地点经度",
262
+ "export.mapLg.activityLatitude": "活动地点纬度"
185
263
  };
186
264
 
187
265
  var enus = {
@@ -266,7 +344,47 @@ var enus = {
266
344
  "aria.pagination.changed": "Moved to page {page}. Results updated",
267
345
  "aria.keyword.groupLabel": "Keywords, {count} items, use arrow keys to browse",
268
346
  "common.select.placeholder": "Please select...",
269
- "common.share.facebook": "Share on Facebook"
347
+ "common.share.facebook": "Share on Facebook",
348
+ "common.form.code.check": "Enter the verification code (click the image for a new one)",
349
+ "common.sna.reset": "Reset position and size",
350
+ "knowledge.writersAndWorksSNA.download": "Download",
351
+ "knowledge.writersAndWorksSNA.download.img": "Download image",
352
+ "knowledge.writersAndWorksSNA.download.gephi": "Download Gephi",
353
+ "knowledge.writersAndWorksSNA.download.tsv": "Download TSV",
354
+ "knowledge.writersAndWorksSNA.download.xls": "Download Excel",
355
+ "knowledge.writersAndWorksSNA.fullscreen": "Full screen",
356
+ "knowledge.writersAndWorksSNA.big": "Increase font size",
357
+ "knowledge.writersAndWorksSNA.small": "Decrease font size",
358
+ "common.noData": "No data",
359
+ "SNA.search.center": "Main node",
360
+ "SNA.organization": "Organization",
361
+ "SNA.author": "Author",
362
+ "SNA.publication": "Publication",
363
+ "SNA.article": "Article",
364
+ "SNA.keyword": "Keyword",
365
+ "SNA.event": "Event",
366
+ "export.chronology.date": "Date",
367
+ "export.chronology.name": "Name",
368
+ "export.chronology.description": "Description",
369
+ "export.chronology.type": "Type",
370
+ "export.chronology.source": "Note (dataset)",
371
+ "export.works.title": "Title (book/article)",
372
+ "export.works.author": "Author",
373
+ "export.works.publishYear": "Year of publication",
374
+ "export.works.keywords": "Keywords",
375
+ "export.works.genre": "Literary genre",
376
+ "export.works.publishDate": "Publication date",
377
+ "export.map.publisher": "Publisher",
378
+ "export.map.location": "Location (region described)",
379
+ "export.map.longitude": "Longitude",
380
+ "export.map.latitude": "Latitude",
381
+ "export.mapLg.orgName": "Organization name",
382
+ "export.mapLg.foundingPlace": "Place of founding",
383
+ "export.mapLg.foundingLongitude": "Founding place longitude",
384
+ "export.mapLg.foundingLatitude": "Founding place latitude",
385
+ "export.mapLg.activityPlace": "Place of activity",
386
+ "export.mapLg.activityLongitude": "Activity place longitude",
387
+ "export.mapLg.activityLatitude": "Activity place latitude"
270
388
  };
271
389
 
272
390
  var _languages;
@@ -988,7 +988,7 @@ Selection$1.prototype = selection.prototype = {
988
988
  dispatch: selection_dispatch
989
989
  };
990
990
 
991
- function d3Select(selector) {
991
+ function select(selector) {
992
992
  return typeof selector === "string"
993
993
  ? new Selection$1([[document.querySelector(selector)]], [document.documentElement])
994
994
  : new Selection$1([[selector]], root);
@@ -5472,4 +5472,4 @@ Transform.prototype = {
5472
5472
 
5473
5473
  var identity = new Transform(1, 0, 0);
5474
5474
 
5475
- export { DragEvent as D, Transform as T, dispatch as a, interrupt as b, customEvent as c, d3Select as d, event as e, category10 as f, constant as g, interpolateNumber as h, identity as i, color as j, interpolateRgb as k, interpolateString as l, map$2 as m, exponent as n, ordinal as o, initRange as p, quadtree as q, map as r, slice as s, timer as t, bisectRight as u, formatSpecifier as v, formatPrefix as w, format as x };
5475
+ export { DragEvent as D, Transform as T, customEvent as a, interrupt as b, creator as c, dispatch as d, event as e, category10 as f, constant as g, interpolateNumber as h, identity as i, color as j, interpolateRgb as k, interpolateString as l, map$2 as m, exponent as n, ordinal as o, initRange as p, quadtree as q, map as r, select as s, timer as t, slice as u, bisectRight as v, formatSpecifier as w, formatPrefix as x, format as y };
@@ -118,4 +118,4 @@ function _nonIterableRest() {
118
118
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
119
119
  }
120
120
 
121
- export { _toConsumableArray as _, _slicedToArray as a, _objectWithoutProperties as b, _objectSpread2 as c };
121
+ export { _toConsumableArray as _, _defineProperty as a, _slicedToArray as b, _objectWithoutProperties as c, _objectSpread2 as d };
@@ -1,4 +1,4 @@
1
- import { c as _objectSpread2 } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { d as _objectSpread2 } from './_rollupPluginBabelHelpers-9802e640.js';
2
2
 
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
 
@@ -1,4 +1,5 @@
1
- import { a as _slicedToArray } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { a as _defineProperty, b as _slicedToArray } from './_rollupPluginBabelHelpers-9802e640.js';
2
+ import { getIntl } from '../components/globalConfig';
2
3
 
3
4
  var fileDownload = function(data, filename, mime, bom) {
4
5
  var blobData = (typeof bom !== 'undefined') ? [bom, data] : [data];
@@ -78,7 +79,13 @@ var snaToExcel = function snaToExcel(data) {
78
79
  return [];
79
80
  };
80
81
 
81
- /* 轉檔工具, 提供API轉下載tsv/xlsx */
82
+ /* 欄名走套件自帶的 getIntl():zh-tw 語系表的值與原本寫死的欄名相同,子站(僅 zh-tw)輸出不變;
83
+ 主站英文頁輸出英文欄名(nmtl-web i18n 盤點 D6) */
84
+ var header = function header(id) {
85
+ return getIntl().formatMessage({
86
+ id: id
87
+ });
88
+ };
82
89
 
83
90
  /* 大事年表 */
84
91
  var chronologyConvert = function chronologyConvert(data) {
@@ -94,8 +101,18 @@ var chronologyConvert = function chronologyConvert(data) {
94
101
  };
95
102
  };
96
103
 
104
+ /* 資料來源:主站把名稱包在 .tooltipsources 裡(「資料來源:」前綴隨語系變動,無法再靠中文字剝除);
105
+ 子站的時間軸 HTML 沒有這一層,沿用原本剝除「註」「資料來源:」的寫法 */
106
+ var getSources = function getSources() {
107
+ var after = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
108
+ var tagged = after.match(/<span class="tooltipsources">([\s\S]*?)<\/span>/);
109
+ if (tagged) return tagged[1].replaceAll(/(<([^>]+)>)/gi, '').trim();
110
+ return after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '');
111
+ };
112
+
97
113
  /* 做資料過濾 */
98
114
  var newData = (data || []).map(function (_ref) {
115
+ var _ref2;
99
116
  var _ref$start_date = _ref.start_date,
100
117
  day = _ref$start_date.day,
101
118
  month = _ref$start_date.month,
@@ -104,96 +121,65 @@ var chronologyConvert = function chronologyConvert(data) {
104
121
  _ref$text = _ref.text,
105
122
  headline = _ref$text.headline,
106
123
  text = _ref$text.text;
107
- return {
108
- 日期: "".concat(year || '', "/").concat(month || '', "/").concat(day || ''),
109
- 名稱: (displayDate || '').replace('<span>', '').replace('</span>', ''),
110
- 描述: (headline || '').replaceAll(/(<([^>]+)>)/gi, ''),
111
- 類型: getText(text).before,
112
- '註(資料集名稱)': getText(text).after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '')
113
- };
124
+ return _ref2 = {}, _defineProperty(_ref2, header('export.chronology.date'), "".concat(year || '', "/").concat(month || '', "/").concat(day || '')), _defineProperty(_ref2, header('export.chronology.name'), (displayDate || '').replace('<span>', '').replace('</span>', '')), _defineProperty(_ref2, header('export.chronology.description'), (headline || '').replaceAll(/(<([^>]+)>)/gi, '')), _defineProperty(_ref2, header('export.chronology.type'), getText(text).before), _defineProperty(_ref2, header('export.chronology.source'), getSources(getText(text).after)), _ref2;
114
125
  });
115
126
  return newData;
116
127
  };
117
128
 
118
129
  /* 文學數據 - 地圖 */
119
130
  var mapConvert = function mapConvert(data) {
120
- return (data || []).map(function (_ref2) {
121
- var title = _ref2.title,
122
- author = _ref2.author,
123
- publisher = _ref2.publisher,
124
- locations = _ref2.locations,
125
- posX = _ref2.posX,
126
- posY = _ref2.posY;
127
- return {
128
- '名稱(書名/文章名)': title || '',
129
- 作者: author || '',
130
- 出版者: publisher || '',
131
- '地點(作品描述區域)': locations || '',
132
- 經度: posX || '',
133
- 緯度: posY || ''
134
- };
131
+ return (data || []).map(function (_ref3) {
132
+ var _ref4;
133
+ var title = _ref3.title,
134
+ author = _ref3.author,
135
+ publisher = _ref3.publisher,
136
+ locations = _ref3.locations,
137
+ posX = _ref3.posX,
138
+ posY = _ref3.posY;
139
+ return _ref4 = {}, _defineProperty(_ref4, header('export.works.title'), title || ''), _defineProperty(_ref4, header('export.works.author'), author || ''), _defineProperty(_ref4, header('export.map.publisher'), publisher || ''), _defineProperty(_ref4, header('export.map.location'), locations || ''), _defineProperty(_ref4, header('export.map.longitude'), posX || ''), _defineProperty(_ref4, header('export.map.latitude'), posY || ''), _ref4;
135
140
  });
136
141
  };
137
142
 
138
143
  /* 文學數據 - 地圖(文學聚落) */
139
144
  var mapLgConvert = function mapLgConvert(data) {
140
- return (data || []).map(function (_ref3) {
141
- var title = _ref3.title,
142
- locationOfFormation = _ref3.locationOfFormation,
143
- workLocations = _ref3.workLocations,
144
- createPosX = _ref3.createPosX,
145
- createPosY = _ref3.createPosY,
146
- activePosX = _ref3.activePosX,
147
- activePosY = _ref3.activePosY;
148
- return {
149
- 組織名稱: title || '',
150
- 創立地點: locationOfFormation,
151
- 創立地點經度: createPosX || '',
152
- 創立地點緯度: createPosY || '',
153
- 活動地點: workLocations || '',
154
- 活動地點經度: activePosX || '',
155
- 活動地點緯度: activePosY || ''
156
- };
145
+ return (data || []).map(function (_ref5) {
146
+ var _ref6;
147
+ var title = _ref5.title,
148
+ locationOfFormation = _ref5.locationOfFormation,
149
+ workLocations = _ref5.workLocations,
150
+ createPosX = _ref5.createPosX,
151
+ createPosY = _ref5.createPosY,
152
+ activePosX = _ref5.activePosX,
153
+ activePosY = _ref5.activePosY;
154
+ return _ref6 = {}, _defineProperty(_ref6, header('export.mapLg.orgName'), title || ''), _defineProperty(_ref6, header('export.mapLg.foundingPlace'), locationOfFormation), _defineProperty(_ref6, header('export.mapLg.foundingLongitude'), createPosX || ''), _defineProperty(_ref6, header('export.mapLg.foundingLatitude'), createPosY || ''), _defineProperty(_ref6, header('export.mapLg.activityPlace'), workLocations || ''), _defineProperty(_ref6, header('export.mapLg.activityLongitude'), activePosX || ''), _defineProperty(_ref6, header('export.mapLg.activityLatitude'), activePosY || ''), _ref6;
157
155
  });
158
156
  };
159
157
 
160
158
  /* 文學數據 - 年度聲量 */
161
159
  var worksBarChart = function worksBarChart(data) {
162
- return (data || []).map(function (_ref4) {
163
- var date = _ref4.date,
164
- year = _ref4.year,
165
- title = _ref4.title,
166
- keywords = _ref4.keywords,
167
- authors = _ref4.authors,
168
- genreName = _ref4.genreName;
169
- return {
170
- '出版年/發表年': date || year || '',
171
- '名稱(書名/文章名)': title || '',
172
- 作者: (authors || []).map(function (_ref5) {
173
- var author = _ref5.author;
174
- return author;
175
- }).join(','),
176
- 關鍵字: (keywords || '').replaceAll('\n', ''),
177
- 文學分類: genreName || ''
178
- };
160
+ return (data || []).map(function (_ref7) {
161
+ var _ref9;
162
+ var date = _ref7.date,
163
+ year = _ref7.year,
164
+ title = _ref7.title,
165
+ keywords = _ref7.keywords,
166
+ authors = _ref7.authors,
167
+ genreName = _ref7.genreName;
168
+ return _ref9 = {}, _defineProperty(_ref9, header('export.works.publishYear'), date || year || ''), _defineProperty(_ref9, header('export.works.title'), title || ''), _defineProperty(_ref9, header('export.works.author'), (authors || []).map(function (_ref8) {
169
+ var author = _ref8.author;
170
+ return author;
171
+ }).join(',')), _defineProperty(_ref9, header('export.works.keywords'), (keywords || '').replaceAll('\n', '')), _defineProperty(_ref9, header('export.works.genre'), genreName || ''), _ref9;
179
172
  });
180
173
  };
181
174
 
182
175
  /* 文學數據 - 文學自由搭配 */
183
176
  var worksSlider = function worksSlider(data) {
184
- return (data || []).map(function (_ref6) {
185
- var title = _ref6.title,
186
- author = _ref6.author,
187
- date = _ref6.date;
188
- return {
189
- '名稱(書名/文章名)': title || '',
190
- 作者: author || '',
191
- '出版日期/發表日期': date || ''
192
- // 文學分類: genreName || '',
193
- // 作品描述地: workDesc || '',
194
- // 作家出生地: locations,
195
- // 獲獎獎項: awards || '',
196
- };
177
+ return (data || []).map(function (_ref10) {
178
+ var _ref11;
179
+ var title = _ref10.title,
180
+ author = _ref10.author,
181
+ date = _ref10.date;
182
+ return _ref11 = {}, _defineProperty(_ref11, header('export.works.title'), title || ''), _defineProperty(_ref11, header('export.works.author'), author || ''), _defineProperty(_ref11, header('export.works.publishDate'), date || ''), _ref11;
197
183
  });
198
184
  };
199
185
 
@@ -1,4 +1,4 @@
1
- import { b as _objectWithoutProperties, c as _objectSpread2 } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { c as _objectWithoutProperties, d as _objectSpread2 } from './_rollupPluginBabelHelpers-9802e640.js';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  var queryString = {};
@@ -1,4 +1,4 @@
1
- import { _ as _toConsumableArray } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { _ as _toConsumableArray } from './_rollupPluginBabelHelpers-9802e640.js';
2
2
  import { s as snaDefine } from './snaDefine-6a2bcd94.js';
3
3
 
4
4
  var snaPreProcess = function snaPreProcess(_ref) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@daoyi/nmtl-ui",
3
3
  "packageManager": "pnpm@10.34.5",
4
- "version": "2.0.1-beta.127",
4
+ "version": "2.0.1-beta.129",
5
5
  "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
6
6
  "author": "daoyi",
7
7
  "main": "lib/index.js",